Avoid creating un-representable DateTime for transition point (#16753)
[mono-project.git] / support / map.c
blobd073160c91661c4a314db316445dbf62812758c4
1 /*
2 * This file was automatically generated by create-native-map from ../mcs/class/lib/net_4_x/Mono.Posix.dll.
4 * DO NOT MODIFY.
5 */
6 #ifdef HAVE_CONFIG_H
7 #include <config.h>
8 #endif /* ndef HAVE_CONFIG_H */
10 #include <stdlib.h>
11 #include <string.h>
14 * Implementation Macros
16 #ifndef _GNU_SOURCE
17 #define _GNU_SOURCE
18 #endif /* ndef _GNU_SOURCE */
20 #ifndef _XOPEN_SOURCE
21 #define _XOPEN_SOURCE
22 #endif /* ndef _XOPEN_SOURCE */
26 * Implementation Includes
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #ifdef HAVE_NETINET_IN_H
31 #include <netinet/in.h>
32 #endif /* ndef HAVE_NETINET_IN_H */
33 #ifdef HAVE_SYS_TIME_H
34 #include <sys/time.h>
35 #endif /* ndef HAVE_SYS_TIME_H */
36 #ifdef HAVE_SYS_POLL_H
37 #include <sys/poll.h>
38 #endif /* ndef HAVE_SYS_POLL_H */
39 #ifdef HAVE_SYS_WAIT_H
40 #include <sys/wait.h>
41 #endif /* ndef HAVE_SYS_WAIT_H */
42 #ifdef HAVE_SYS_STATVFS_H
43 #include <sys/statvfs.h>
44 #endif /* ndef HAVE_SYS_STATVFS_H */
45 #ifdef HAVE_SYS_XATTR_H
46 #include <sys/xattr.h>
47 #endif /* ndef HAVE_SYS_XATTR_H */
48 #ifdef HAVE_SYS_MMAN_H
49 #include <sys/mman.h>
50 #endif /* ndef HAVE_SYS_MMAN_H */
51 #ifdef HAVE_SYS_SOCKET_H
52 #include <sys/socket.h>
53 #endif /* ndef HAVE_SYS_SOCKET_H */
54 #ifdef HAVE_SYS_UIO_H
55 #include <sys/uio.h>
56 #endif /* ndef HAVE_SYS_UIO_H */
57 #ifdef HAVE_UNISTD_H
58 #include <unistd.h>
59 #endif /* ndef HAVE_UNISTD_H */
60 #include <fcntl.h>
61 #include <signal.h>
62 #ifdef HAVE_POLL_H
63 #include <poll.h>
64 #endif /* ndef HAVE_POLL_H */
65 #ifdef HAVE_GRP_H
66 #include <grp.h>
67 #endif /* ndef HAVE_GRP_H */
68 #include <errno.h>
69 #ifdef HAVE_SYSLOG_H
70 #include <syslog.h>
71 #endif /* ndef HAVE_SYSLOG_H */
72 #ifdef HAVE_DIRENT_H
73 #include <dirent.h>
74 #endif /* ndef HAVE_DIRENT_H */
75 #ifdef HAVE_UTIME_H
76 #include <utime.h>
77 #endif /* ndef HAVE_UTIME_H */
78 #include <time.h>
79 #include "mph.h"
81 #include "map.h"
83 #include <errno.h> /* errno, EOVERFLOW */
84 #include <glib.h> /* g* types, g_assert_not_reached() */
86 #if defined (G_MININT8)
87 #define CNM_MININT8 G_MININT8
88 #else
89 #define CNM_MININT8 (-128)
90 #endif
92 #if defined (G_MAXINT8)
93 #define CNM_MAXINT8 G_MAXINT8
94 #else
95 #define CNM_MAXINT8 (127)
96 #endif
98 #if defined (G_MAXUINT8)
99 #define CNM_MAXUINT8 G_MAXUINT8
100 #else
101 #define CNM_MAXUINT8 (255)
102 #endif
104 #if defined (G_MININT16)
105 #define CNM_MININT16 G_MININT16
106 #else
107 #define CNM_MININT16 (-32768)
108 #endif
110 #if defined (G_MAXINT16)
111 #define CNM_MAXINT16 G_MAXINT16
112 #else
113 #define CNM_MAXINT16 (32767)
114 #endif
116 #if defined (G_MAXUINT16)
117 #define CNM_MAXUINT16 G_MAXUINT16
118 #else
119 #define CNM_MAXUINT16 (65535)
120 #endif
122 #if defined (G_MININT32)
123 #define CNM_MININT32 G_MININT32
124 #else
125 #define CNM_MININT32 (-2147483648)
126 #endif
128 #if defined (G_MAXINT32)
129 #define CNM_MAXINT32 G_MAXINT32
130 #else
131 #define CNM_MAXINT32 (2147483647)
132 #endif
134 #if defined (G_MAXUINT32)
135 #define CNM_MAXUINT32 G_MAXUINT32
136 #else
137 #define CNM_MAXUINT32 (4294967295U)
138 #endif
140 #if defined (G_MININT64)
141 #define CNM_MININT64 G_MININT64
142 #else
143 #define CNM_MININT64 (-9223372036854775808LL)
144 #endif
146 #if defined (G_MAXINT64)
147 #define CNM_MAXINT64 G_MAXINT64
148 #else
149 #define CNM_MAXINT64 (9223372036854775807LL)
150 #endif
152 #if defined (G_MAXUINT64)
153 #define CNM_MAXUINT64 G_MAXUINT64
154 #else
155 #define CNM_MAXUINT64 (18446744073709551615ULL)
156 #endif
159 /* returns TRUE if @type is an unsigned type */
160 #define _cnm_integral_type_is_unsigned(type) \
161 (sizeof(type) == sizeof(gint8) \
162 ? (((type)-1) > CNM_MAXINT8) \
163 : sizeof(type) == sizeof(gint16) \
164 ? (((type)-1) > CNM_MAXINT16) \
165 : sizeof(type) == sizeof(gint32) \
166 ? (((type)-1) > CNM_MAXINT32) \
167 : sizeof(type) == sizeof(gint64) \
168 ? (((type)-1) > CNM_MAXINT64) \
169 : (g_assert_not_reached (), 0))
171 /* returns the minimum value of @type as a gint64 */
172 #define _cnm_integral_type_min(type) \
173 (_cnm_integral_type_is_unsigned (type) \
174 ? 0 \
175 : sizeof(type) == sizeof(gint8) \
176 ? CNM_MININT8 \
177 : sizeof(type) == sizeof(gint16) \
178 ? CNM_MININT16 \
179 : sizeof(type) == sizeof(gint32) \
180 ? CNM_MININT32 \
181 : sizeof(type) == sizeof(gint64) \
182 ? CNM_MININT64 \
183 : (g_assert_not_reached (), 0))
185 /* returns the maximum value of @type as a guint64 */
186 #define _cnm_integral_type_max(type) \
187 (_cnm_integral_type_is_unsigned (type) \
188 ? sizeof(type) == sizeof(gint8) \
189 ? CNM_MAXUINT8 \
190 : sizeof(type) == sizeof(gint16) \
191 ? CNM_MAXUINT16 \
192 : sizeof(type) == sizeof(gint32) \
193 ? CNM_MAXUINT32 \
194 : sizeof(type) == sizeof(gint64) \
195 ? CNM_MAXUINT64 \
196 : (g_assert_not_reached (), 0) \
197 : sizeof(type) == sizeof(gint8) \
198 ? CNM_MAXINT8 \
199 : sizeof(type) == sizeof(gint16) \
200 ? CNM_MAXINT16 \
201 : sizeof(type) == sizeof(gint32) \
202 ? CNM_MAXINT32 \
203 : sizeof(type) == sizeof(gint64) \
204 ? CNM_MAXINT64 \
205 : (g_assert_not_reached (), 0))
207 #ifdef _CNM_DUMP
208 #define _cnm_dump(to_t,from) \
209 printf ("# %s -> %s: uns=%i; min=%llx; max=%llx; value=%llx; lt=%i; l0=%i; gt=%i; e=%i\n", \
210 #from, #to_t, \
211 (int) _cnm_integral_type_is_unsigned (to_t), \
212 (gint64) (_cnm_integral_type_min (to_t)), \
213 (gint64) (_cnm_integral_type_max (to_t)), \
214 (gint64) (from), \
215 (((gint64) _cnm_integral_type_min (to_t)) <= (gint64) from), \
216 (from < 0), \
217 (((guint64) from) <= (guint64) _cnm_integral_type_max (to_t)), \
218 !((int) _cnm_integral_type_is_unsigned (to_t) \
219 ? ((0 <= from) && \
220 ((guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \
221 : ((gint64) _cnm_integral_type_min(to_t) <= (gint64) from && \
222 (guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \
224 #else /* ndef _CNM_DUMP */
225 #define _cnm_dump(to_t, from) do {} while (0)
226 #endif /* def _CNM_DUMP */
228 #ifdef DEBUG
229 #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \
230 int uns = _cnm_integral_type_is_unsigned (to_t); \
231 gint64 min = (gint64) _cnm_integral_type_min (to_t); \
232 guint64 max = (guint64) _cnm_integral_type_max (to_t); \
233 gint64 sf = (gint64) from; \
234 guint64 uf = (guint64) from; \
235 if (!(uns ? ((0 <= from) && (uf <= max)) \
236 : (min <= sf && (from < 0 || uf <= max)))) { \
237 _cnm_dump(to_t, from); \
238 errno = EOVERFLOW; \
239 return (val); \
241 } G_STMT_END
242 #else /* !def DEBUG */
243 /* don't do any overflow checking */
244 #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \
245 } G_STMT_END
246 #endif /* def DEBUG */
248 int Mono_Posix_FromAccessModes (int x, int *r)
250 *r = 0;
251 if ((x & Mono_Posix_AccessModes_F_OK) == Mono_Posix_AccessModes_F_OK)
252 #ifdef F_OK
253 *r |= F_OK;
254 #else /* def F_OK */
255 {errno = EINVAL; return -1;}
256 #endif /* ndef F_OK */
257 if ((x & Mono_Posix_AccessModes_R_OK) == Mono_Posix_AccessModes_R_OK)
258 #ifdef R_OK
259 *r |= R_OK;
260 #else /* def R_OK */
261 {errno = EINVAL; return -1;}
262 #endif /* ndef R_OK */
263 if ((x & Mono_Posix_AccessModes_W_OK) == Mono_Posix_AccessModes_W_OK)
264 #ifdef W_OK
265 *r |= W_OK;
266 #else /* def W_OK */
267 {errno = EINVAL; return -1;}
268 #endif /* ndef W_OK */
269 if ((x & Mono_Posix_AccessModes_X_OK) == Mono_Posix_AccessModes_X_OK)
270 #ifdef X_OK
271 *r |= X_OK;
272 #else /* def X_OK */
273 {errno = EINVAL; return -1;}
274 #endif /* ndef X_OK */
275 if (x == 0)
276 return 0;
277 return 0;
280 int Mono_Posix_ToAccessModes (int x, int *r)
282 *r = 0;
283 if (x == 0)
284 return 0;
285 #ifdef F_OK
286 if ((x & F_OK) == F_OK)
287 *r |= Mono_Posix_AccessModes_F_OK;
288 #endif /* ndef F_OK */
289 #ifdef R_OK
290 if ((x & R_OK) == R_OK)
291 *r |= Mono_Posix_AccessModes_R_OK;
292 #endif /* ndef R_OK */
293 #ifdef W_OK
294 if ((x & W_OK) == W_OK)
295 *r |= Mono_Posix_AccessModes_W_OK;
296 #endif /* ndef W_OK */
297 #ifdef X_OK
298 if ((x & X_OK) == X_OK)
299 *r |= Mono_Posix_AccessModes_X_OK;
300 #endif /* ndef X_OK */
301 return 0;
304 int Mono_Posix_FromAtFlags (int x, int *r)
306 *r = 0;
307 if ((x & Mono_Posix_AtFlags_AT_EMPTY_PATH) == Mono_Posix_AtFlags_AT_EMPTY_PATH)
308 #ifdef AT_EMPTY_PATH
309 *r |= AT_EMPTY_PATH;
310 #else /* def AT_EMPTY_PATH */
311 {errno = EINVAL; return -1;}
312 #endif /* ndef AT_EMPTY_PATH */
313 if ((x & Mono_Posix_AtFlags_AT_NO_AUTOMOUNT) == Mono_Posix_AtFlags_AT_NO_AUTOMOUNT)
314 #ifdef AT_NO_AUTOMOUNT
315 *r |= AT_NO_AUTOMOUNT;
316 #else /* def AT_NO_AUTOMOUNT */
317 {errno = EINVAL; return -1;}
318 #endif /* ndef AT_NO_AUTOMOUNT */
319 if ((x & Mono_Posix_AtFlags_AT_REMOVEDIR) == Mono_Posix_AtFlags_AT_REMOVEDIR)
320 #ifdef AT_REMOVEDIR
321 *r |= AT_REMOVEDIR;
322 #else /* def AT_REMOVEDIR */
323 {errno = EINVAL; return -1;}
324 #endif /* ndef AT_REMOVEDIR */
325 if ((x & Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW)
326 #ifdef AT_SYMLINK_FOLLOW
327 *r |= AT_SYMLINK_FOLLOW;
328 #else /* def AT_SYMLINK_FOLLOW */
329 {errno = EINVAL; return -1;}
330 #endif /* ndef AT_SYMLINK_FOLLOW */
331 if ((x & Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW)
332 #ifdef AT_SYMLINK_NOFOLLOW
333 *r |= AT_SYMLINK_NOFOLLOW;
334 #else /* def AT_SYMLINK_NOFOLLOW */
335 {errno = EINVAL; return -1;}
336 #endif /* ndef AT_SYMLINK_NOFOLLOW */
337 if (x == 0)
338 return 0;
339 return 0;
342 int Mono_Posix_ToAtFlags (int x, int *r)
344 *r = 0;
345 if (x == 0)
346 return 0;
347 #ifdef AT_EMPTY_PATH
348 if ((x & AT_EMPTY_PATH) == AT_EMPTY_PATH)
349 *r |= Mono_Posix_AtFlags_AT_EMPTY_PATH;
350 #endif /* ndef AT_EMPTY_PATH */
351 #ifdef AT_NO_AUTOMOUNT
352 if ((x & AT_NO_AUTOMOUNT) == AT_NO_AUTOMOUNT)
353 *r |= Mono_Posix_AtFlags_AT_NO_AUTOMOUNT;
354 #endif /* ndef AT_NO_AUTOMOUNT */
355 #ifdef AT_REMOVEDIR
356 if ((x & AT_REMOVEDIR) == AT_REMOVEDIR)
357 *r |= Mono_Posix_AtFlags_AT_REMOVEDIR;
358 #endif /* ndef AT_REMOVEDIR */
359 #ifdef AT_SYMLINK_FOLLOW
360 if ((x & AT_SYMLINK_FOLLOW) == AT_SYMLINK_FOLLOW)
361 *r |= Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW;
362 #endif /* ndef AT_SYMLINK_FOLLOW */
363 #ifdef AT_SYMLINK_NOFOLLOW
364 if ((x & AT_SYMLINK_NOFOLLOW) == AT_SYMLINK_NOFOLLOW)
365 *r |= Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW;
366 #endif /* ndef AT_SYMLINK_NOFOLLOW */
367 return 0;
370 #ifdef HAVE_STRUCT_CMSGHDR
372 Mono_Posix_FromCmsghdr (struct Mono_Posix_Cmsghdr *from, struct cmsghdr *to)
374 _cnm_return_val_if_overflow (gint64, from->cmsg_len, -1);
376 memset (to, 0, sizeof(*to));
378 to->cmsg_len = from->cmsg_len;
379 if (Mono_Posix_FromUnixSocketProtocol (from->cmsg_level, &to->cmsg_level) != 0) {
380 return -1;
382 if (Mono_Posix_FromUnixSocketControlMessage (from->cmsg_type, &to->cmsg_type) != 0) {
383 return -1;
386 return 0;
388 #endif /* ndef HAVE_STRUCT_CMSGHDR */
391 #ifdef HAVE_STRUCT_CMSGHDR
393 Mono_Posix_ToCmsghdr (struct cmsghdr *from, struct Mono_Posix_Cmsghdr *to)
395 _cnm_return_val_if_overflow (gint64, from->cmsg_len, -1);
397 memset (to, 0, sizeof(*to));
399 to->cmsg_len = from->cmsg_len;
400 if (Mono_Posix_ToUnixSocketProtocol (from->cmsg_level, &to->cmsg_level) != 0) {
401 return -1;
403 if (Mono_Posix_ToUnixSocketControlMessage (from->cmsg_type, &to->cmsg_type) != 0) {
404 return -1;
407 return 0;
409 #endif /* ndef HAVE_STRUCT_CMSGHDR */
412 int Mono_Posix_FromConfstrName (int x, int *r)
414 *r = 0;
415 if (x == Mono_Posix_ConfstrName__CS_GNU_LIBC_VERSION)
416 #ifdef _CS_GNU_LIBC_VERSION
417 {*r = _CS_GNU_LIBC_VERSION; return 0;}
418 #else /* def _CS_GNU_LIBC_VERSION */
419 {errno = EINVAL; return -1;}
420 #endif /* ndef _CS_GNU_LIBC_VERSION */
421 if (x == Mono_Posix_ConfstrName__CS_GNU_LIBPTHREAD_VERSION)
422 #ifdef _CS_GNU_LIBPTHREAD_VERSION
423 {*r = _CS_GNU_LIBPTHREAD_VERSION; return 0;}
424 #else /* def _CS_GNU_LIBPTHREAD_VERSION */
425 {errno = EINVAL; return -1;}
426 #endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
427 if (x == Mono_Posix_ConfstrName__CS_LFS64_CFLAGS)
428 #ifdef _CS_LFS64_CFLAGS
429 {*r = _CS_LFS64_CFLAGS; return 0;}
430 #else /* def _CS_LFS64_CFLAGS */
431 {errno = EINVAL; return -1;}
432 #endif /* ndef _CS_LFS64_CFLAGS */
433 if (x == Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS)
434 #ifdef _CS_LFS64_LDFLAGS
435 {*r = _CS_LFS64_LDFLAGS; return 0;}
436 #else /* def _CS_LFS64_LDFLAGS */
437 {errno = EINVAL; return -1;}
438 #endif /* ndef _CS_LFS64_LDFLAGS */
439 if (x == Mono_Posix_ConfstrName__CS_LFS64_LIBS)
440 #ifdef _CS_LFS64_LIBS
441 {*r = _CS_LFS64_LIBS; return 0;}
442 #else /* def _CS_LFS64_LIBS */
443 {errno = EINVAL; return -1;}
444 #endif /* ndef _CS_LFS64_LIBS */
445 if (x == Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS)
446 #ifdef _CS_LFS64_LINTFLAGS
447 {*r = _CS_LFS64_LINTFLAGS; return 0;}
448 #else /* def _CS_LFS64_LINTFLAGS */
449 {errno = EINVAL; return -1;}
450 #endif /* ndef _CS_LFS64_LINTFLAGS */
451 if (x == Mono_Posix_ConfstrName__CS_LFS_CFLAGS)
452 #ifdef _CS_LFS_CFLAGS
453 {*r = _CS_LFS_CFLAGS; return 0;}
454 #else /* def _CS_LFS_CFLAGS */
455 {errno = EINVAL; return -1;}
456 #endif /* ndef _CS_LFS_CFLAGS */
457 if (x == Mono_Posix_ConfstrName__CS_LFS_LDFLAGS)
458 #ifdef _CS_LFS_LDFLAGS
459 {*r = _CS_LFS_LDFLAGS; return 0;}
460 #else /* def _CS_LFS_LDFLAGS */
461 {errno = EINVAL; return -1;}
462 #endif /* ndef _CS_LFS_LDFLAGS */
463 if (x == Mono_Posix_ConfstrName__CS_LFS_LIBS)
464 #ifdef _CS_LFS_LIBS
465 {*r = _CS_LFS_LIBS; return 0;}
466 #else /* def _CS_LFS_LIBS */
467 {errno = EINVAL; return -1;}
468 #endif /* ndef _CS_LFS_LIBS */
469 if (x == Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS)
470 #ifdef _CS_LFS_LINTFLAGS
471 {*r = _CS_LFS_LINTFLAGS; return 0;}
472 #else /* def _CS_LFS_LINTFLAGS */
473 {errno = EINVAL; return -1;}
474 #endif /* ndef _CS_LFS_LINTFLAGS */
475 if (x == Mono_Posix_ConfstrName__CS_PATH)
476 #ifdef _CS_PATH
477 {*r = _CS_PATH; return 0;}
478 #else /* def _CS_PATH */
479 {errno = EINVAL; return -1;}
480 #endif /* ndef _CS_PATH */
481 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_CFLAGS)
482 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
483 {*r = _CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;}
484 #else /* def _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
485 {errno = EINVAL; return -1;}
486 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
487 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LDFLAGS)
488 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
489 {*r = _CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;}
490 #else /* def _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
491 {errno = EINVAL; return -1;}
492 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
493 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LIBS)
494 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
495 {*r = _CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;}
496 #else /* def _CS_POSIX_V6_ILP32_OFF32_LIBS */
497 {errno = EINVAL; return -1;}
498 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */
499 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
500 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
501 {*r = _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;}
502 #else /* def _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
503 {errno = EINVAL; return -1;}
504 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
505 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)
506 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
507 {*r = _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;}
508 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
509 {errno = EINVAL; return -1;}
510 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
511 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS)
512 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
513 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;}
514 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
515 {errno = EINVAL; return -1;}
516 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
517 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LIBS)
518 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
519 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;}
520 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
521 {errno = EINVAL; return -1;}
522 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
523 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
524 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
525 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;}
526 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
527 {errno = EINVAL; return -1;}
528 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
529 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_CFLAGS)
530 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
531 {*r = _CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;}
532 #else /* def _CS_POSIX_V6_LP64_OFF64_CFLAGS */
533 {errno = EINVAL; return -1;}
534 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */
535 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LDFLAGS)
536 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
537 {*r = _CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;}
538 #else /* def _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
539 {errno = EINVAL; return -1;}
540 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
541 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LIBS)
542 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
543 {*r = _CS_POSIX_V6_LP64_OFF64_LIBS; return 0;}
544 #else /* def _CS_POSIX_V6_LP64_OFF64_LIBS */
545 {errno = EINVAL; return -1;}
546 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */
547 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
548 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
549 {*r = _CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;}
550 #else /* def _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
551 {errno = EINVAL; return -1;}
552 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
553 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)
554 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
555 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;}
556 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
557 {errno = EINVAL; return -1;}
558 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
559 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS)
560 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
561 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;}
562 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
563 {errno = EINVAL; return -1;}
564 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
565 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LIBS)
566 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
567 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;}
568 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
569 {errno = EINVAL; return -1;}
570 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
571 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
572 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
573 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
574 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
575 {errno = EINVAL; return -1;}
576 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
577 if (x == Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS)
578 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
579 {*r = _CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
580 #else /* def _CS_V6_WIDTH_RESTRICTED_ENVS */
581 {errno = EINVAL; return -1;}
582 #endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
583 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_CFLAGS)
584 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
585 {*r = _CS_XBS5_ILP32_OFF32_CFLAGS; return 0;}
586 #else /* def _CS_XBS5_ILP32_OFF32_CFLAGS */
587 {errno = EINVAL; return -1;}
588 #endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */
589 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LDFLAGS)
590 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
591 {*r = _CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;}
592 #else /* def _CS_XBS5_ILP32_OFF32_LDFLAGS */
593 {errno = EINVAL; return -1;}
594 #endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */
595 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LIBS)
596 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
597 {*r = _CS_XBS5_ILP32_OFF32_LIBS; return 0;}
598 #else /* def _CS_XBS5_ILP32_OFF32_LIBS */
599 {errno = EINVAL; return -1;}
600 #endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */
601 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LINTFLAGS)
602 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
603 {*r = _CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;}
604 #else /* def _CS_XBS5_ILP32_OFF32_LINTFLAGS */
605 {errno = EINVAL; return -1;}
606 #endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */
607 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_CFLAGS)
608 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
609 {*r = _CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;}
610 #else /* def _CS_XBS5_ILP32_OFFBIG_CFLAGS */
611 {errno = EINVAL; return -1;}
612 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */
613 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LDFLAGS)
614 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
615 {*r = _CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;}
616 #else /* def _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
617 {errno = EINVAL; return -1;}
618 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
619 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LIBS)
620 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
621 {*r = _CS_XBS5_ILP32_OFFBIG_LIBS; return 0;}
622 #else /* def _CS_XBS5_ILP32_OFFBIG_LIBS */
623 {errno = EINVAL; return -1;}
624 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */
625 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LINTFLAGS)
626 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
627 {*r = _CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;}
628 #else /* def _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
629 {errno = EINVAL; return -1;}
630 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
631 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_CFLAGS)
632 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
633 {*r = _CS_XBS5_LP64_OFF64_CFLAGS; return 0;}
634 #else /* def _CS_XBS5_LP64_OFF64_CFLAGS */
635 {errno = EINVAL; return -1;}
636 #endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */
637 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LDFLAGS)
638 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
639 {*r = _CS_XBS5_LP64_OFF64_LDFLAGS; return 0;}
640 #else /* def _CS_XBS5_LP64_OFF64_LDFLAGS */
641 {errno = EINVAL; return -1;}
642 #endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */
643 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LIBS)
644 #ifdef _CS_XBS5_LP64_OFF64_LIBS
645 {*r = _CS_XBS5_LP64_OFF64_LIBS; return 0;}
646 #else /* def _CS_XBS5_LP64_OFF64_LIBS */
647 {errno = EINVAL; return -1;}
648 #endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */
649 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LINTFLAGS)
650 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
651 {*r = _CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;}
652 #else /* def _CS_XBS5_LP64_OFF64_LINTFLAGS */
653 {errno = EINVAL; return -1;}
654 #endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */
655 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_CFLAGS)
656 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
657 {*r = _CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;}
658 #else /* def _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
659 {errno = EINVAL; return -1;}
660 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
661 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LDFLAGS)
662 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
663 {*r = _CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;}
664 #else /* def _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
665 {errno = EINVAL; return -1;}
666 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
667 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LIBS)
668 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
669 {*r = _CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;}
670 #else /* def _CS_XBS5_LPBIG_OFFBIG_LIBS */
671 {errno = EINVAL; return -1;}
672 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */
673 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS)
674 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
675 {*r = _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
676 #else /* def _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
677 {errno = EINVAL; return -1;}
678 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
679 if (x == 0)
680 return 0;
681 errno = EINVAL; return -1;
684 int Mono_Posix_ToConfstrName (int x, int *r)
686 *r = 0;
687 if (x == 0)
688 return 0;
689 #ifdef _CS_GNU_LIBC_VERSION
690 if (x == _CS_GNU_LIBC_VERSION)
691 {*r = Mono_Posix_ConfstrName__CS_GNU_LIBC_VERSION; return 0;}
692 #endif /* ndef _CS_GNU_LIBC_VERSION */
693 #ifdef _CS_GNU_LIBPTHREAD_VERSION
694 if (x == _CS_GNU_LIBPTHREAD_VERSION)
695 {*r = Mono_Posix_ConfstrName__CS_GNU_LIBPTHREAD_VERSION; return 0;}
696 #endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
697 #ifdef _CS_LFS64_CFLAGS
698 if (x == _CS_LFS64_CFLAGS)
699 {*r = Mono_Posix_ConfstrName__CS_LFS64_CFLAGS; return 0;}
700 #endif /* ndef _CS_LFS64_CFLAGS */
701 #ifdef _CS_LFS64_LDFLAGS
702 if (x == _CS_LFS64_LDFLAGS)
703 {*r = Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS; return 0;}
704 #endif /* ndef _CS_LFS64_LDFLAGS */
705 #ifdef _CS_LFS64_LIBS
706 if (x == _CS_LFS64_LIBS)
707 {*r = Mono_Posix_ConfstrName__CS_LFS64_LIBS; return 0;}
708 #endif /* ndef _CS_LFS64_LIBS */
709 #ifdef _CS_LFS64_LINTFLAGS
710 if (x == _CS_LFS64_LINTFLAGS)
711 {*r = Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS; return 0;}
712 #endif /* ndef _CS_LFS64_LINTFLAGS */
713 #ifdef _CS_LFS_CFLAGS
714 if (x == _CS_LFS_CFLAGS)
715 {*r = Mono_Posix_ConfstrName__CS_LFS_CFLAGS; return 0;}
716 #endif /* ndef _CS_LFS_CFLAGS */
717 #ifdef _CS_LFS_LDFLAGS
718 if (x == _CS_LFS_LDFLAGS)
719 {*r = Mono_Posix_ConfstrName__CS_LFS_LDFLAGS; return 0;}
720 #endif /* ndef _CS_LFS_LDFLAGS */
721 #ifdef _CS_LFS_LIBS
722 if (x == _CS_LFS_LIBS)
723 {*r = Mono_Posix_ConfstrName__CS_LFS_LIBS; return 0;}
724 #endif /* ndef _CS_LFS_LIBS */
725 #ifdef _CS_LFS_LINTFLAGS
726 if (x == _CS_LFS_LINTFLAGS)
727 {*r = Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS; return 0;}
728 #endif /* ndef _CS_LFS_LINTFLAGS */
729 #ifdef _CS_PATH
730 if (x == _CS_PATH)
731 {*r = Mono_Posix_ConfstrName__CS_PATH; return 0;}
732 #endif /* ndef _CS_PATH */
733 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
734 if (x == _CS_POSIX_V6_ILP32_OFF32_CFLAGS)
735 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;}
736 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
737 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
738 if (x == _CS_POSIX_V6_ILP32_OFF32_LDFLAGS)
739 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;}
740 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
741 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
742 if (x == _CS_POSIX_V6_ILP32_OFF32_LIBS)
743 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;}
744 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */
745 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
746 if (x == _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
747 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;}
748 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
749 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
750 if (x == _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)
751 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;}
752 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
753 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
754 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS)
755 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;}
756 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
757 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
758 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LIBS)
759 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;}
760 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
761 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
762 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
763 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;}
764 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
765 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
766 if (x == _CS_POSIX_V6_LP64_OFF64_CFLAGS)
767 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;}
768 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */
769 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
770 if (x == _CS_POSIX_V6_LP64_OFF64_LDFLAGS)
771 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;}
772 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
773 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
774 if (x == _CS_POSIX_V6_LP64_OFF64_LIBS)
775 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LIBS; return 0;}
776 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */
777 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
778 if (x == _CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
779 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;}
780 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
781 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
782 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)
783 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;}
784 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
785 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
786 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS)
787 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;}
788 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
789 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
790 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LIBS)
791 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;}
792 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
793 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
794 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
795 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
796 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
797 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
798 if (x == _CS_V6_WIDTH_RESTRICTED_ENVS)
799 {*r = Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
800 #endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
801 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
802 if (x == _CS_XBS5_ILP32_OFF32_CFLAGS)
803 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_CFLAGS; return 0;}
804 #endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */
805 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
806 if (x == _CS_XBS5_ILP32_OFF32_LDFLAGS)
807 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;}
808 #endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */
809 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
810 if (x == _CS_XBS5_ILP32_OFF32_LIBS)
811 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LIBS; return 0;}
812 #endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */
813 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
814 if (x == _CS_XBS5_ILP32_OFF32_LINTFLAGS)
815 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;}
816 #endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */
817 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
818 if (x == _CS_XBS5_ILP32_OFFBIG_CFLAGS)
819 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;}
820 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */
821 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
822 if (x == _CS_XBS5_ILP32_OFFBIG_LDFLAGS)
823 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;}
824 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
825 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
826 if (x == _CS_XBS5_ILP32_OFFBIG_LIBS)
827 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LIBS; return 0;}
828 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */
829 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
830 if (x == _CS_XBS5_ILP32_OFFBIG_LINTFLAGS)
831 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;}
832 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
833 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
834 if (x == _CS_XBS5_LP64_OFF64_CFLAGS)
835 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_CFLAGS; return 0;}
836 #endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */
837 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
838 if (x == _CS_XBS5_LP64_OFF64_LDFLAGS)
839 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LDFLAGS; return 0;}
840 #endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */
841 #ifdef _CS_XBS5_LP64_OFF64_LIBS
842 if (x == _CS_XBS5_LP64_OFF64_LIBS)
843 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LIBS; return 0;}
844 #endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */
845 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
846 if (x == _CS_XBS5_LP64_OFF64_LINTFLAGS)
847 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;}
848 #endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */
849 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
850 if (x == _CS_XBS5_LPBIG_OFFBIG_CFLAGS)
851 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;}
852 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
853 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
854 if (x == _CS_XBS5_LPBIG_OFFBIG_LDFLAGS)
855 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;}
856 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
857 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
858 if (x == _CS_XBS5_LPBIG_OFFBIG_LIBS)
859 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;}
860 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */
861 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
862 if (x == _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS)
863 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
864 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
865 errno = EINVAL; return -1;
868 int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r)
870 *r = 0;
871 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) == Mono_Posix_DirectoryNotifyFlags_DN_ACCESS)
872 #ifdef DN_ACCESS
873 *r |= DN_ACCESS;
874 #else /* def DN_ACCESS */
875 {errno = EINVAL; return -1;}
876 #endif /* ndef DN_ACCESS */
877 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) == Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB)
878 #ifdef DN_ATTRIB
879 *r |= DN_ATTRIB;
880 #else /* def DN_ATTRIB */
881 {errno = EINVAL; return -1;}
882 #endif /* ndef DN_ATTRIB */
883 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_CREATE) == Mono_Posix_DirectoryNotifyFlags_DN_CREATE)
884 #ifdef DN_CREATE
885 *r |= DN_CREATE;
886 #else /* def DN_CREATE */
887 {errno = EINVAL; return -1;}
888 #endif /* ndef DN_CREATE */
889 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_DELETE) == Mono_Posix_DirectoryNotifyFlags_DN_DELETE)
890 #ifdef DN_DELETE
891 *r |= DN_DELETE;
892 #else /* def DN_DELETE */
893 {errno = EINVAL; return -1;}
894 #endif /* ndef DN_DELETE */
895 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY)
896 #ifdef DN_MODIFY
897 *r |= DN_MODIFY;
898 #else /* def DN_MODIFY */
899 {errno = EINVAL; return -1;}
900 #endif /* ndef DN_MODIFY */
901 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT)
902 #ifdef DN_MULTISHOT
903 *r |= DN_MULTISHOT;
904 #else /* def DN_MULTISHOT */
905 {errno = EINVAL; return -1;}
906 #endif /* ndef DN_MULTISHOT */
907 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME)
908 #ifdef DN_RENAME
909 *r |= DN_RENAME;
910 #else /* def DN_RENAME */
911 {errno = EINVAL; return -1;}
912 #endif /* ndef DN_RENAME */
913 if (x == 0)
914 return 0;
915 return 0;
918 int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r)
920 *r = 0;
921 if (x == 0)
922 return 0;
923 #ifdef DN_ACCESS
924 if ((x & DN_ACCESS) == DN_ACCESS)
925 *r |= Mono_Posix_DirectoryNotifyFlags_DN_ACCESS;
926 #endif /* ndef DN_ACCESS */
927 #ifdef DN_ATTRIB
928 if ((x & DN_ATTRIB) == DN_ATTRIB)
929 *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
930 #endif /* ndef DN_ATTRIB */
931 #ifdef DN_CREATE
932 if ((x & DN_CREATE) == DN_CREATE)
933 *r |= Mono_Posix_DirectoryNotifyFlags_DN_CREATE;
934 #endif /* ndef DN_CREATE */
935 #ifdef DN_DELETE
936 if ((x & DN_DELETE) == DN_DELETE)
937 *r |= Mono_Posix_DirectoryNotifyFlags_DN_DELETE;
938 #endif /* ndef DN_DELETE */
939 #ifdef DN_MODIFY
940 if ((x & DN_MODIFY) == DN_MODIFY)
941 *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
942 #endif /* ndef DN_MODIFY */
943 #ifdef DN_MULTISHOT
944 if ((x & DN_MULTISHOT) == DN_MULTISHOT)
945 *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
946 #endif /* ndef DN_MULTISHOT */
947 #ifdef DN_RENAME
948 if ((x & DN_RENAME) == DN_RENAME)
949 *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
950 #endif /* ndef DN_RENAME */
951 return 0;
954 int Mono_Posix_FromEpollEvents (unsigned int x, unsigned int *r)
956 *r = 0;
957 if ((x & Mono_Posix_EpollEvents_EPOLLERR) == Mono_Posix_EpollEvents_EPOLLERR)
958 #ifdef EPOLLERR
959 *r |= EPOLLERR;
960 #else /* def EPOLLERR */
961 {errno = EINVAL; return -1;}
962 #endif /* ndef EPOLLERR */
963 if ((x & Mono_Posix_EpollEvents_EPOLLET) == Mono_Posix_EpollEvents_EPOLLET)
964 #ifdef EPOLLET
965 *r |= EPOLLET;
966 #else /* def EPOLLET */
967 {errno = EINVAL; return -1;}
968 #endif /* ndef EPOLLET */
969 if ((x & Mono_Posix_EpollEvents_EPOLLHUP) == Mono_Posix_EpollEvents_EPOLLHUP)
970 #ifdef EPOLLHUP
971 *r |= EPOLLHUP;
972 #else /* def EPOLLHUP */
973 {errno = EINVAL; return -1;}
974 #endif /* ndef EPOLLHUP */
975 if ((x & Mono_Posix_EpollEvents_EPOLLIN) == Mono_Posix_EpollEvents_EPOLLIN)
976 #ifdef EPOLLIN
977 *r |= EPOLLIN;
978 #else /* def EPOLLIN */
979 {errno = EINVAL; return -1;}
980 #endif /* ndef EPOLLIN */
981 if ((x & Mono_Posix_EpollEvents_EPOLLMSG) == Mono_Posix_EpollEvents_EPOLLMSG)
982 #ifdef EPOLLMSG
983 *r |= EPOLLMSG;
984 #else /* def EPOLLMSG */
985 {errno = EINVAL; return -1;}
986 #endif /* ndef EPOLLMSG */
987 if ((x & Mono_Posix_EpollEvents_EPOLLONESHOT) == Mono_Posix_EpollEvents_EPOLLONESHOT)
988 #ifdef EPOLLONESHOT
989 *r |= EPOLLONESHOT;
990 #else /* def EPOLLONESHOT */
991 {errno = EINVAL; return -1;}
992 #endif /* ndef EPOLLONESHOT */
993 if ((x & Mono_Posix_EpollEvents_EPOLLOUT) == Mono_Posix_EpollEvents_EPOLLOUT)
994 #ifdef EPOLLOUT
995 *r |= EPOLLOUT;
996 #else /* def EPOLLOUT */
997 {errno = EINVAL; return -1;}
998 #endif /* ndef EPOLLOUT */
999 if ((x & Mono_Posix_EpollEvents_EPOLLPRI) == Mono_Posix_EpollEvents_EPOLLPRI)
1000 #ifdef EPOLLPRI
1001 *r |= EPOLLPRI;
1002 #else /* def EPOLLPRI */
1003 {errno = EINVAL; return -1;}
1004 #endif /* ndef EPOLLPRI */
1005 if ((x & Mono_Posix_EpollEvents_EPOLLRDBAND) == Mono_Posix_EpollEvents_EPOLLRDBAND)
1006 #ifdef EPOLLRDBAND
1007 *r |= EPOLLRDBAND;
1008 #else /* def EPOLLRDBAND */
1009 {errno = EINVAL; return -1;}
1010 #endif /* ndef EPOLLRDBAND */
1011 if ((x & Mono_Posix_EpollEvents_EPOLLRDHUP) == Mono_Posix_EpollEvents_EPOLLRDHUP)
1012 #ifdef EPOLLRDHUP
1013 *r |= EPOLLRDHUP;
1014 #else /* def EPOLLRDHUP */
1015 {errno = EINVAL; return -1;}
1016 #endif /* ndef EPOLLRDHUP */
1017 if ((x & Mono_Posix_EpollEvents_EPOLLRDNORM) == Mono_Posix_EpollEvents_EPOLLRDNORM)
1018 #ifdef EPOLLRDNORM
1019 *r |= EPOLLRDNORM;
1020 #else /* def EPOLLRDNORM */
1021 {errno = EINVAL; return -1;}
1022 #endif /* ndef EPOLLRDNORM */
1023 if ((x & Mono_Posix_EpollEvents_EPOLLWRBAND) == Mono_Posix_EpollEvents_EPOLLWRBAND)
1024 #ifdef EPOLLWRBAND
1025 *r |= EPOLLWRBAND;
1026 #else /* def EPOLLWRBAND */
1027 {errno = EINVAL; return -1;}
1028 #endif /* ndef EPOLLWRBAND */
1029 if ((x & Mono_Posix_EpollEvents_EPOLLWRNORM) == Mono_Posix_EpollEvents_EPOLLWRNORM)
1030 #ifdef EPOLLWRNORM
1031 *r |= EPOLLWRNORM;
1032 #else /* def EPOLLWRNORM */
1033 {errno = EINVAL; return -1;}
1034 #endif /* ndef EPOLLWRNORM */
1035 if (x == 0)
1036 return 0;
1037 return 0;
1040 int Mono_Posix_ToEpollEvents (unsigned int x, unsigned int *r)
1042 *r = 0;
1043 if (x == 0)
1044 return 0;
1045 #ifdef EPOLLERR
1046 if ((x & EPOLLERR) == EPOLLERR)
1047 *r |= Mono_Posix_EpollEvents_EPOLLERR;
1048 #endif /* ndef EPOLLERR */
1049 #ifdef EPOLLET
1050 if ((x & EPOLLET) == EPOLLET)
1051 *r |= Mono_Posix_EpollEvents_EPOLLET;
1052 #endif /* ndef EPOLLET */
1053 #ifdef EPOLLHUP
1054 if ((x & EPOLLHUP) == EPOLLHUP)
1055 *r |= Mono_Posix_EpollEvents_EPOLLHUP;
1056 #endif /* ndef EPOLLHUP */
1057 #ifdef EPOLLIN
1058 if ((x & EPOLLIN) == EPOLLIN)
1059 *r |= Mono_Posix_EpollEvents_EPOLLIN;
1060 #endif /* ndef EPOLLIN */
1061 #ifdef EPOLLMSG
1062 if ((x & EPOLLMSG) == EPOLLMSG)
1063 *r |= Mono_Posix_EpollEvents_EPOLLMSG;
1064 #endif /* ndef EPOLLMSG */
1065 #ifdef EPOLLONESHOT
1066 if ((x & EPOLLONESHOT) == EPOLLONESHOT)
1067 *r |= Mono_Posix_EpollEvents_EPOLLONESHOT;
1068 #endif /* ndef EPOLLONESHOT */
1069 #ifdef EPOLLOUT
1070 if ((x & EPOLLOUT) == EPOLLOUT)
1071 *r |= Mono_Posix_EpollEvents_EPOLLOUT;
1072 #endif /* ndef EPOLLOUT */
1073 #ifdef EPOLLPRI
1074 if ((x & EPOLLPRI) == EPOLLPRI)
1075 *r |= Mono_Posix_EpollEvents_EPOLLPRI;
1076 #endif /* ndef EPOLLPRI */
1077 #ifdef EPOLLRDBAND
1078 if ((x & EPOLLRDBAND) == EPOLLRDBAND)
1079 *r |= Mono_Posix_EpollEvents_EPOLLRDBAND;
1080 #endif /* ndef EPOLLRDBAND */
1081 #ifdef EPOLLRDHUP
1082 if ((x & EPOLLRDHUP) == EPOLLRDHUP)
1083 *r |= Mono_Posix_EpollEvents_EPOLLRDHUP;
1084 #endif /* ndef EPOLLRDHUP */
1085 #ifdef EPOLLRDNORM
1086 if ((x & EPOLLRDNORM) == EPOLLRDNORM)
1087 *r |= Mono_Posix_EpollEvents_EPOLLRDNORM;
1088 #endif /* ndef EPOLLRDNORM */
1089 #ifdef EPOLLWRBAND
1090 if ((x & EPOLLWRBAND) == EPOLLWRBAND)
1091 *r |= Mono_Posix_EpollEvents_EPOLLWRBAND;
1092 #endif /* ndef EPOLLWRBAND */
1093 #ifdef EPOLLWRNORM
1094 if ((x & EPOLLWRNORM) == EPOLLWRNORM)
1095 *r |= Mono_Posix_EpollEvents_EPOLLWRNORM;
1096 #endif /* ndef EPOLLWRNORM */
1097 return 0;
1100 int Mono_Posix_FromEpollFlags (int x, int *r)
1102 *r = 0;
1103 if ((x & Mono_Posix_EpollFlags_EPOLL_CLOEXEC) == Mono_Posix_EpollFlags_EPOLL_CLOEXEC)
1104 #ifdef EPOLL_CLOEXEC
1105 *r |= EPOLL_CLOEXEC;
1106 #else /* def EPOLL_CLOEXEC */
1107 {errno = EINVAL; return -1;}
1108 #endif /* ndef EPOLL_CLOEXEC */
1109 if ((x & Mono_Posix_EpollFlags_EPOLL_NONBLOCK) == Mono_Posix_EpollFlags_EPOLL_NONBLOCK)
1110 #ifdef EPOLL_NONBLOCK
1111 *r |= EPOLL_NONBLOCK;
1112 #else /* def EPOLL_NONBLOCK */
1113 {errno = EINVAL; return -1;}
1114 #endif /* ndef EPOLL_NONBLOCK */
1115 if (x == 0)
1116 return 0;
1117 return 0;
1120 int Mono_Posix_ToEpollFlags (int x, int *r)
1122 *r = 0;
1123 if (x == 0)
1124 return 0;
1125 #ifdef EPOLL_CLOEXEC
1126 if ((x & EPOLL_CLOEXEC) == EPOLL_CLOEXEC)
1127 *r |= Mono_Posix_EpollFlags_EPOLL_CLOEXEC;
1128 #endif /* ndef EPOLL_CLOEXEC */
1129 #ifdef EPOLL_NONBLOCK
1130 if ((x & EPOLL_NONBLOCK) == EPOLL_NONBLOCK)
1131 *r |= Mono_Posix_EpollFlags_EPOLL_NONBLOCK;
1132 #endif /* ndef EPOLL_NONBLOCK */
1133 return 0;
1136 int Mono_Posix_FromErrno (int x, int *r)
1138 *r = 0;
1139 if (x == Mono_Posix_Errno_E2BIG)
1140 #ifdef E2BIG
1141 {*r = E2BIG; return 0;}
1142 #else /* def E2BIG */
1143 {errno = EINVAL; return -1;}
1144 #endif /* ndef E2BIG */
1145 if (x == Mono_Posix_Errno_EACCES)
1146 #ifdef EACCES
1147 {*r = EACCES; return 0;}
1148 #else /* def EACCES */
1149 {errno = EINVAL; return -1;}
1150 #endif /* ndef EACCES */
1151 if (x == Mono_Posix_Errno_EADDRINUSE)
1152 #ifdef EADDRINUSE
1153 {*r = EADDRINUSE; return 0;}
1154 #else /* def EADDRINUSE */
1155 {errno = EINVAL; return -1;}
1156 #endif /* ndef EADDRINUSE */
1157 if (x == Mono_Posix_Errno_EADDRNOTAVAIL)
1158 #ifdef EADDRNOTAVAIL
1159 {*r = EADDRNOTAVAIL; return 0;}
1160 #else /* def EADDRNOTAVAIL */
1161 {errno = EINVAL; return -1;}
1162 #endif /* ndef EADDRNOTAVAIL */
1163 if (x == Mono_Posix_Errno_EADV)
1164 #ifdef EADV
1165 {*r = EADV; return 0;}
1166 #else /* def EADV */
1167 {errno = EINVAL; return -1;}
1168 #endif /* ndef EADV */
1169 if (x == Mono_Posix_Errno_EAFNOSUPPORT)
1170 #ifdef EAFNOSUPPORT
1171 {*r = EAFNOSUPPORT; return 0;}
1172 #else /* def EAFNOSUPPORT */
1173 {errno = EINVAL; return -1;}
1174 #endif /* ndef EAFNOSUPPORT */
1175 if (x == Mono_Posix_Errno_EAGAIN)
1176 #ifdef EAGAIN
1177 {*r = EAGAIN; return 0;}
1178 #else /* def EAGAIN */
1179 {errno = EINVAL; return -1;}
1180 #endif /* ndef EAGAIN */
1181 if (x == Mono_Posix_Errno_EALREADY)
1182 #ifdef EALREADY
1183 {*r = EALREADY; return 0;}
1184 #else /* def EALREADY */
1185 {errno = EINVAL; return -1;}
1186 #endif /* ndef EALREADY */
1187 if (x == Mono_Posix_Errno_EAUTH)
1188 #ifdef EAUTH
1189 {*r = EAUTH; return 0;}
1190 #else /* def EAUTH */
1191 {errno = EINVAL; return -1;}
1192 #endif /* ndef EAUTH */
1193 if (x == Mono_Posix_Errno_EBADARCH)
1194 #ifdef EBADARCH
1195 {*r = EBADARCH; return 0;}
1196 #else /* def EBADARCH */
1197 {errno = EINVAL; return -1;}
1198 #endif /* ndef EBADARCH */
1199 if (x == Mono_Posix_Errno_EBADE)
1200 #ifdef EBADE
1201 {*r = EBADE; return 0;}
1202 #else /* def EBADE */
1203 {errno = EINVAL; return -1;}
1204 #endif /* ndef EBADE */
1205 if (x == Mono_Posix_Errno_EBADEXEC)
1206 #ifdef EBADEXEC
1207 {*r = EBADEXEC; return 0;}
1208 #else /* def EBADEXEC */
1209 {errno = EINVAL; return -1;}
1210 #endif /* ndef EBADEXEC */
1211 if (x == Mono_Posix_Errno_EBADF)
1212 #ifdef EBADF
1213 {*r = EBADF; return 0;}
1214 #else /* def EBADF */
1215 {errno = EINVAL; return -1;}
1216 #endif /* ndef EBADF */
1217 if (x == Mono_Posix_Errno_EBADFD)
1218 #ifdef EBADFD
1219 {*r = EBADFD; return 0;}
1220 #else /* def EBADFD */
1221 {errno = EINVAL; return -1;}
1222 #endif /* ndef EBADFD */
1223 if (x == Mono_Posix_Errno_EBADMACHO)
1224 #ifdef EBADMACHO
1225 {*r = EBADMACHO; return 0;}
1226 #else /* def EBADMACHO */
1227 {errno = EINVAL; return -1;}
1228 #endif /* ndef EBADMACHO */
1229 if (x == Mono_Posix_Errno_EBADMSG)
1230 #ifdef EBADMSG
1231 {*r = EBADMSG; return 0;}
1232 #else /* def EBADMSG */
1233 {errno = EINVAL; return -1;}
1234 #endif /* ndef EBADMSG */
1235 if (x == Mono_Posix_Errno_EBADR)
1236 #ifdef EBADR
1237 {*r = EBADR; return 0;}
1238 #else /* def EBADR */
1239 {errno = EINVAL; return -1;}
1240 #endif /* ndef EBADR */
1241 if (x == Mono_Posix_Errno_EBADRPC)
1242 #ifdef EBADRPC
1243 {*r = EBADRPC; return 0;}
1244 #else /* def EBADRPC */
1245 {errno = EINVAL; return -1;}
1246 #endif /* ndef EBADRPC */
1247 if (x == Mono_Posix_Errno_EBADRQC)
1248 #ifdef EBADRQC
1249 {*r = EBADRQC; return 0;}
1250 #else /* def EBADRQC */
1251 {errno = EINVAL; return -1;}
1252 #endif /* ndef EBADRQC */
1253 if (x == Mono_Posix_Errno_EBADSLT)
1254 #ifdef EBADSLT
1255 {*r = EBADSLT; return 0;}
1256 #else /* def EBADSLT */
1257 {errno = EINVAL; return -1;}
1258 #endif /* ndef EBADSLT */
1259 if (x == Mono_Posix_Errno_EBFONT)
1260 #ifdef EBFONT
1261 {*r = EBFONT; return 0;}
1262 #else /* def EBFONT */
1263 {errno = EINVAL; return -1;}
1264 #endif /* ndef EBFONT */
1265 if (x == Mono_Posix_Errno_EBUSY)
1266 #ifdef EBUSY
1267 {*r = EBUSY; return 0;}
1268 #else /* def EBUSY */
1269 {errno = EINVAL; return -1;}
1270 #endif /* ndef EBUSY */
1271 if (x == Mono_Posix_Errno_ECANCELED)
1272 #ifdef ECANCELED
1273 {*r = ECANCELED; return 0;}
1274 #else /* def ECANCELED */
1275 {errno = EINVAL; return -1;}
1276 #endif /* ndef ECANCELED */
1277 if (x == Mono_Posix_Errno_ECHILD)
1278 #ifdef ECHILD
1279 {*r = ECHILD; return 0;}
1280 #else /* def ECHILD */
1281 {errno = EINVAL; return -1;}
1282 #endif /* ndef ECHILD */
1283 if (x == Mono_Posix_Errno_ECHRNG)
1284 #ifdef ECHRNG
1285 {*r = ECHRNG; return 0;}
1286 #else /* def ECHRNG */
1287 {errno = EINVAL; return -1;}
1288 #endif /* ndef ECHRNG */
1289 if (x == Mono_Posix_Errno_ECOMM)
1290 #ifdef ECOMM
1291 {*r = ECOMM; return 0;}
1292 #else /* def ECOMM */
1293 {errno = EINVAL; return -1;}
1294 #endif /* ndef ECOMM */
1295 if (x == Mono_Posix_Errno_ECONNABORTED)
1296 #ifdef ECONNABORTED
1297 {*r = ECONNABORTED; return 0;}
1298 #else /* def ECONNABORTED */
1299 {errno = EINVAL; return -1;}
1300 #endif /* ndef ECONNABORTED */
1301 if (x == Mono_Posix_Errno_ECONNREFUSED)
1302 #ifdef ECONNREFUSED
1303 {*r = ECONNREFUSED; return 0;}
1304 #else /* def ECONNREFUSED */
1305 {errno = EINVAL; return -1;}
1306 #endif /* ndef ECONNREFUSED */
1307 if (x == Mono_Posix_Errno_ECONNRESET)
1308 #ifdef ECONNRESET
1309 {*r = ECONNRESET; return 0;}
1310 #else /* def ECONNRESET */
1311 {errno = EINVAL; return -1;}
1312 #endif /* ndef ECONNRESET */
1313 if (x == Mono_Posix_Errno_EDEADLK)
1314 #ifdef EDEADLK
1315 {*r = EDEADLK; return 0;}
1316 #else /* def EDEADLK */
1317 {errno = EINVAL; return -1;}
1318 #endif /* ndef EDEADLK */
1319 if (x == Mono_Posix_Errno_EDEADLOCK)
1320 #ifdef EDEADLOCK
1321 {*r = EDEADLOCK; return 0;}
1322 #else /* def EDEADLOCK */
1323 {errno = EINVAL; return -1;}
1324 #endif /* ndef EDEADLOCK */
1325 if (x == Mono_Posix_Errno_EDESTADDRREQ)
1326 #ifdef EDESTADDRREQ
1327 {*r = EDESTADDRREQ; return 0;}
1328 #else /* def EDESTADDRREQ */
1329 {errno = EINVAL; return -1;}
1330 #endif /* ndef EDESTADDRREQ */
1331 if (x == Mono_Posix_Errno_EDEVERR)
1332 #ifdef EDEVERR
1333 {*r = EDEVERR; return 0;}
1334 #else /* def EDEVERR */
1335 {errno = EINVAL; return -1;}
1336 #endif /* ndef EDEVERR */
1337 if (x == Mono_Posix_Errno_EDOM)
1338 #ifdef EDOM
1339 {*r = EDOM; return 0;}
1340 #else /* def EDOM */
1341 {errno = EINVAL; return -1;}
1342 #endif /* ndef EDOM */
1343 if (x == Mono_Posix_Errno_EDOTDOT)
1344 #ifdef EDOTDOT
1345 {*r = EDOTDOT; return 0;}
1346 #else /* def EDOTDOT */
1347 {errno = EINVAL; return -1;}
1348 #endif /* ndef EDOTDOT */
1349 if (x == Mono_Posix_Errno_EDQUOT)
1350 #ifdef EDQUOT
1351 {*r = EDQUOT; return 0;}
1352 #else /* def EDQUOT */
1353 {errno = EINVAL; return -1;}
1354 #endif /* ndef EDQUOT */
1355 if (x == Mono_Posix_Errno_EEXIST)
1356 #ifdef EEXIST
1357 {*r = EEXIST; return 0;}
1358 #else /* def EEXIST */
1359 {errno = EINVAL; return -1;}
1360 #endif /* ndef EEXIST */
1361 if (x == Mono_Posix_Errno_EFAULT)
1362 #ifdef EFAULT
1363 {*r = EFAULT; return 0;}
1364 #else /* def EFAULT */
1365 {errno = EINVAL; return -1;}
1366 #endif /* ndef EFAULT */
1367 if (x == Mono_Posix_Errno_EFBIG)
1368 #ifdef EFBIG
1369 {*r = EFBIG; return 0;}
1370 #else /* def EFBIG */
1371 {errno = EINVAL; return -1;}
1372 #endif /* ndef EFBIG */
1373 if (x == Mono_Posix_Errno_EFTYPE)
1374 #ifdef EFTYPE
1375 {*r = EFTYPE; return 0;}
1376 #else /* def EFTYPE */
1377 {errno = EINVAL; return -1;}
1378 #endif /* ndef EFTYPE */
1379 if (x == Mono_Posix_Errno_EHOSTDOWN)
1380 #ifdef EHOSTDOWN
1381 {*r = EHOSTDOWN; return 0;}
1382 #else /* def EHOSTDOWN */
1383 {errno = EINVAL; return -1;}
1384 #endif /* ndef EHOSTDOWN */
1385 if (x == Mono_Posix_Errno_EHOSTUNREACH)
1386 #ifdef EHOSTUNREACH
1387 {*r = EHOSTUNREACH; return 0;}
1388 #else /* def EHOSTUNREACH */
1389 {errno = EINVAL; return -1;}
1390 #endif /* ndef EHOSTUNREACH */
1391 if (x == Mono_Posix_Errno_EIDRM)
1392 #ifdef EIDRM
1393 {*r = EIDRM; return 0;}
1394 #else /* def EIDRM */
1395 {errno = EINVAL; return -1;}
1396 #endif /* ndef EIDRM */
1397 if (x == Mono_Posix_Errno_EILSEQ)
1398 #ifdef EILSEQ
1399 {*r = EILSEQ; return 0;}
1400 #else /* def EILSEQ */
1401 {errno = EINVAL; return -1;}
1402 #endif /* ndef EILSEQ */
1403 if (x == Mono_Posix_Errno_EINPROGRESS)
1404 #ifdef EINPROGRESS
1405 {*r = EINPROGRESS; return 0;}
1406 #else /* def EINPROGRESS */
1407 {errno = EINVAL; return -1;}
1408 #endif /* ndef EINPROGRESS */
1409 if (x == Mono_Posix_Errno_EINTR)
1410 #ifdef EINTR
1411 {*r = EINTR; return 0;}
1412 #else /* def EINTR */
1413 {errno = EINVAL; return -1;}
1414 #endif /* ndef EINTR */
1415 if (x == Mono_Posix_Errno_EINVAL)
1416 #ifdef EINVAL
1417 {*r = EINVAL; return 0;}
1418 #else /* def EINVAL */
1419 {errno = EINVAL; return -1;}
1420 #endif /* ndef EINVAL */
1421 if (x == Mono_Posix_Errno_EIO)
1422 #ifdef EIO
1423 {*r = EIO; return 0;}
1424 #else /* def EIO */
1425 {errno = EINVAL; return -1;}
1426 #endif /* ndef EIO */
1427 if (x == Mono_Posix_Errno_EISCONN)
1428 #ifdef EISCONN
1429 {*r = EISCONN; return 0;}
1430 #else /* def EISCONN */
1431 {errno = EINVAL; return -1;}
1432 #endif /* ndef EISCONN */
1433 if (x == Mono_Posix_Errno_EISDIR)
1434 #ifdef EISDIR
1435 {*r = EISDIR; return 0;}
1436 #else /* def EISDIR */
1437 {errno = EINVAL; return -1;}
1438 #endif /* ndef EISDIR */
1439 if (x == Mono_Posix_Errno_EISNAM)
1440 #ifdef EISNAM
1441 {*r = EISNAM; return 0;}
1442 #else /* def EISNAM */
1443 {errno = EINVAL; return -1;}
1444 #endif /* ndef EISNAM */
1445 if (x == Mono_Posix_Errno_EKEYEXPIRED)
1446 #ifdef EKEYEXPIRED
1447 {*r = EKEYEXPIRED; return 0;}
1448 #else /* def EKEYEXPIRED */
1449 {errno = EINVAL; return -1;}
1450 #endif /* ndef EKEYEXPIRED */
1451 if (x == Mono_Posix_Errno_EKEYREJECTED)
1452 #ifdef EKEYREJECTED
1453 {*r = EKEYREJECTED; return 0;}
1454 #else /* def EKEYREJECTED */
1455 {errno = EINVAL; return -1;}
1456 #endif /* ndef EKEYREJECTED */
1457 if (x == Mono_Posix_Errno_EKEYREVOKED)
1458 #ifdef EKEYREVOKED
1459 {*r = EKEYREVOKED; return 0;}
1460 #else /* def EKEYREVOKED */
1461 {errno = EINVAL; return -1;}
1462 #endif /* ndef EKEYREVOKED */
1463 if (x == Mono_Posix_Errno_EL2HLT)
1464 #ifdef EL2HLT
1465 {*r = EL2HLT; return 0;}
1466 #else /* def EL2HLT */
1467 {errno = EINVAL; return -1;}
1468 #endif /* ndef EL2HLT */
1469 if (x == Mono_Posix_Errno_EL2NSYNC)
1470 #ifdef EL2NSYNC
1471 {*r = EL2NSYNC; return 0;}
1472 #else /* def EL2NSYNC */
1473 {errno = EINVAL; return -1;}
1474 #endif /* ndef EL2NSYNC */
1475 if (x == Mono_Posix_Errno_EL3HLT)
1476 #ifdef EL3HLT
1477 {*r = EL3HLT; return 0;}
1478 #else /* def EL3HLT */
1479 {errno = EINVAL; return -1;}
1480 #endif /* ndef EL3HLT */
1481 if (x == Mono_Posix_Errno_EL3RST)
1482 #ifdef EL3RST
1483 {*r = EL3RST; return 0;}
1484 #else /* def EL3RST */
1485 {errno = EINVAL; return -1;}
1486 #endif /* ndef EL3RST */
1487 if (x == Mono_Posix_Errno_ELIBACC)
1488 #ifdef ELIBACC
1489 {*r = ELIBACC; return 0;}
1490 #else /* def ELIBACC */
1491 {errno = EINVAL; return -1;}
1492 #endif /* ndef ELIBACC */
1493 if (x == Mono_Posix_Errno_ELIBBAD)
1494 #ifdef ELIBBAD
1495 {*r = ELIBBAD; return 0;}
1496 #else /* def ELIBBAD */
1497 {errno = EINVAL; return -1;}
1498 #endif /* ndef ELIBBAD */
1499 if (x == Mono_Posix_Errno_ELIBEXEC)
1500 #ifdef ELIBEXEC
1501 {*r = ELIBEXEC; return 0;}
1502 #else /* def ELIBEXEC */
1503 {errno = EINVAL; return -1;}
1504 #endif /* ndef ELIBEXEC */
1505 if (x == Mono_Posix_Errno_ELIBMAX)
1506 #ifdef ELIBMAX
1507 {*r = ELIBMAX; return 0;}
1508 #else /* def ELIBMAX */
1509 {errno = EINVAL; return -1;}
1510 #endif /* ndef ELIBMAX */
1511 if (x == Mono_Posix_Errno_ELIBSCN)
1512 #ifdef ELIBSCN
1513 {*r = ELIBSCN; return 0;}
1514 #else /* def ELIBSCN */
1515 {errno = EINVAL; return -1;}
1516 #endif /* ndef ELIBSCN */
1517 if (x == Mono_Posix_Errno_ELNRNG)
1518 #ifdef ELNRNG
1519 {*r = ELNRNG; return 0;}
1520 #else /* def ELNRNG */
1521 {errno = EINVAL; return -1;}
1522 #endif /* ndef ELNRNG */
1523 if (x == Mono_Posix_Errno_ELOOP)
1524 #ifdef ELOOP
1525 {*r = ELOOP; return 0;}
1526 #else /* def ELOOP */
1527 {errno = EINVAL; return -1;}
1528 #endif /* ndef ELOOP */
1529 if (x == Mono_Posix_Errno_EMEDIUMTYPE)
1530 #ifdef EMEDIUMTYPE
1531 {*r = EMEDIUMTYPE; return 0;}
1532 #else /* def EMEDIUMTYPE */
1533 {errno = EINVAL; return -1;}
1534 #endif /* ndef EMEDIUMTYPE */
1535 if (x == Mono_Posix_Errno_EMFILE)
1536 #ifdef EMFILE
1537 {*r = EMFILE; return 0;}
1538 #else /* def EMFILE */
1539 {errno = EINVAL; return -1;}
1540 #endif /* ndef EMFILE */
1541 if (x == Mono_Posix_Errno_EMLINK)
1542 #ifdef EMLINK
1543 {*r = EMLINK; return 0;}
1544 #else /* def EMLINK */
1545 {errno = EINVAL; return -1;}
1546 #endif /* ndef EMLINK */
1547 if (x == Mono_Posix_Errno_EMSGSIZE)
1548 #ifdef EMSGSIZE
1549 {*r = EMSGSIZE; return 0;}
1550 #else /* def EMSGSIZE */
1551 {errno = EINVAL; return -1;}
1552 #endif /* ndef EMSGSIZE */
1553 if (x == Mono_Posix_Errno_EMULTIHOP)
1554 #ifdef EMULTIHOP
1555 {*r = EMULTIHOP; return 0;}
1556 #else /* def EMULTIHOP */
1557 {errno = EINVAL; return -1;}
1558 #endif /* ndef EMULTIHOP */
1559 if (x == Mono_Posix_Errno_ENAMETOOLONG)
1560 #ifdef ENAMETOOLONG
1561 {*r = ENAMETOOLONG; return 0;}
1562 #else /* def ENAMETOOLONG */
1563 {errno = EINVAL; return -1;}
1564 #endif /* ndef ENAMETOOLONG */
1565 if (x == Mono_Posix_Errno_ENAVAIL)
1566 #ifdef ENAVAIL
1567 {*r = ENAVAIL; return 0;}
1568 #else /* def ENAVAIL */
1569 {errno = EINVAL; return -1;}
1570 #endif /* ndef ENAVAIL */
1571 if (x == Mono_Posix_Errno_ENEEDAUTH)
1572 #ifdef ENEEDAUTH
1573 {*r = ENEEDAUTH; return 0;}
1574 #else /* def ENEEDAUTH */
1575 {errno = EINVAL; return -1;}
1576 #endif /* ndef ENEEDAUTH */
1577 if (x == Mono_Posix_Errno_ENETDOWN)
1578 #ifdef ENETDOWN
1579 {*r = ENETDOWN; return 0;}
1580 #else /* def ENETDOWN */
1581 {errno = EINVAL; return -1;}
1582 #endif /* ndef ENETDOWN */
1583 if (x == Mono_Posix_Errno_ENETRESET)
1584 #ifdef ENETRESET
1585 {*r = ENETRESET; return 0;}
1586 #else /* def ENETRESET */
1587 {errno = EINVAL; return -1;}
1588 #endif /* ndef ENETRESET */
1589 if (x == Mono_Posix_Errno_ENETUNREACH)
1590 #ifdef ENETUNREACH
1591 {*r = ENETUNREACH; return 0;}
1592 #else /* def ENETUNREACH */
1593 {errno = EINVAL; return -1;}
1594 #endif /* ndef ENETUNREACH */
1595 if (x == Mono_Posix_Errno_ENFILE)
1596 #ifdef ENFILE
1597 {*r = ENFILE; return 0;}
1598 #else /* def ENFILE */
1599 {errno = EINVAL; return -1;}
1600 #endif /* ndef ENFILE */
1601 if (x == Mono_Posix_Errno_ENOANO)
1602 #ifdef ENOANO
1603 {*r = ENOANO; return 0;}
1604 #else /* def ENOANO */
1605 {errno = EINVAL; return -1;}
1606 #endif /* ndef ENOANO */
1607 if (x == Mono_Posix_Errno_ENOATTR)
1608 #ifdef ENOATTR
1609 {*r = ENOATTR; return 0;}
1610 #else /* def ENOATTR */
1611 {errno = EINVAL; return -1;}
1612 #endif /* ndef ENOATTR */
1613 if (x == Mono_Posix_Errno_ENOBUFS)
1614 #ifdef ENOBUFS
1615 {*r = ENOBUFS; return 0;}
1616 #else /* def ENOBUFS */
1617 {errno = EINVAL; return -1;}
1618 #endif /* ndef ENOBUFS */
1619 if (x == Mono_Posix_Errno_ENOCSI)
1620 #ifdef ENOCSI
1621 {*r = ENOCSI; return 0;}
1622 #else /* def ENOCSI */
1623 {errno = EINVAL; return -1;}
1624 #endif /* ndef ENOCSI */
1625 if (x == Mono_Posix_Errno_ENODATA)
1626 #ifdef ENODATA
1627 {*r = ENODATA; return 0;}
1628 #else /* def ENODATA */
1629 {errno = EINVAL; return -1;}
1630 #endif /* ndef ENODATA */
1631 if (x == Mono_Posix_Errno_ENODEV)
1632 #ifdef ENODEV
1633 {*r = ENODEV; return 0;}
1634 #else /* def ENODEV */
1635 {errno = EINVAL; return -1;}
1636 #endif /* ndef ENODEV */
1637 if (x == Mono_Posix_Errno_ENOENT)
1638 #ifdef ENOENT
1639 {*r = ENOENT; return 0;}
1640 #else /* def ENOENT */
1641 {errno = EINVAL; return -1;}
1642 #endif /* ndef ENOENT */
1643 if (x == Mono_Posix_Errno_ENOEXEC)
1644 #ifdef ENOEXEC
1645 {*r = ENOEXEC; return 0;}
1646 #else /* def ENOEXEC */
1647 {errno = EINVAL; return -1;}
1648 #endif /* ndef ENOEXEC */
1649 if (x == Mono_Posix_Errno_ENOKEY)
1650 #ifdef ENOKEY
1651 {*r = ENOKEY; return 0;}
1652 #else /* def ENOKEY */
1653 {errno = EINVAL; return -1;}
1654 #endif /* ndef ENOKEY */
1655 if (x == Mono_Posix_Errno_ENOLCK)
1656 #ifdef ENOLCK
1657 {*r = ENOLCK; return 0;}
1658 #else /* def ENOLCK */
1659 {errno = EINVAL; return -1;}
1660 #endif /* ndef ENOLCK */
1661 if (x == Mono_Posix_Errno_ENOLINK)
1662 #ifdef ENOLINK
1663 {*r = ENOLINK; return 0;}
1664 #else /* def ENOLINK */
1665 {errno = EINVAL; return -1;}
1666 #endif /* ndef ENOLINK */
1667 if (x == Mono_Posix_Errno_ENOMEDIUM)
1668 #ifdef ENOMEDIUM
1669 {*r = ENOMEDIUM; return 0;}
1670 #else /* def ENOMEDIUM */
1671 {errno = EINVAL; return -1;}
1672 #endif /* ndef ENOMEDIUM */
1673 if (x == Mono_Posix_Errno_ENOMEM)
1674 #ifdef ENOMEM
1675 {*r = ENOMEM; return 0;}
1676 #else /* def ENOMEM */
1677 {errno = EINVAL; return -1;}
1678 #endif /* ndef ENOMEM */
1679 if (x == Mono_Posix_Errno_ENOMSG)
1680 #ifdef ENOMSG
1681 {*r = ENOMSG; return 0;}
1682 #else /* def ENOMSG */
1683 {errno = EINVAL; return -1;}
1684 #endif /* ndef ENOMSG */
1685 if (x == Mono_Posix_Errno_ENONET)
1686 #ifdef ENONET
1687 {*r = ENONET; return 0;}
1688 #else /* def ENONET */
1689 {errno = EINVAL; return -1;}
1690 #endif /* ndef ENONET */
1691 if (x == Mono_Posix_Errno_ENOPKG)
1692 #ifdef ENOPKG
1693 {*r = ENOPKG; return 0;}
1694 #else /* def ENOPKG */
1695 {errno = EINVAL; return -1;}
1696 #endif /* ndef ENOPKG */
1697 if (x == Mono_Posix_Errno_ENOPOLICY)
1698 #ifdef ENOPOLICY
1699 {*r = ENOPOLICY; return 0;}
1700 #else /* def ENOPOLICY */
1701 {errno = EINVAL; return -1;}
1702 #endif /* ndef ENOPOLICY */
1703 if (x == Mono_Posix_Errno_ENOPROTOOPT)
1704 #ifdef ENOPROTOOPT
1705 {*r = ENOPROTOOPT; return 0;}
1706 #else /* def ENOPROTOOPT */
1707 {errno = EINVAL; return -1;}
1708 #endif /* ndef ENOPROTOOPT */
1709 if (x == Mono_Posix_Errno_ENOSPC)
1710 #ifdef ENOSPC
1711 {*r = ENOSPC; return 0;}
1712 #else /* def ENOSPC */
1713 {errno = EINVAL; return -1;}
1714 #endif /* ndef ENOSPC */
1715 if (x == Mono_Posix_Errno_ENOSR)
1716 #ifdef ENOSR
1717 {*r = ENOSR; return 0;}
1718 #else /* def ENOSR */
1719 {errno = EINVAL; return -1;}
1720 #endif /* ndef ENOSR */
1721 if (x == Mono_Posix_Errno_ENOSTR)
1722 #ifdef ENOSTR
1723 {*r = ENOSTR; return 0;}
1724 #else /* def ENOSTR */
1725 {errno = EINVAL; return -1;}
1726 #endif /* ndef ENOSTR */
1727 if (x == Mono_Posix_Errno_ENOSYS)
1728 #ifdef ENOSYS
1729 {*r = ENOSYS; return 0;}
1730 #else /* def ENOSYS */
1731 {errno = EINVAL; return -1;}
1732 #endif /* ndef ENOSYS */
1733 if (x == Mono_Posix_Errno_ENOTBLK)
1734 #ifdef ENOTBLK
1735 {*r = ENOTBLK; return 0;}
1736 #else /* def ENOTBLK */
1737 {errno = EINVAL; return -1;}
1738 #endif /* ndef ENOTBLK */
1739 if (x == Mono_Posix_Errno_ENOTCONN)
1740 #ifdef ENOTCONN
1741 {*r = ENOTCONN; return 0;}
1742 #else /* def ENOTCONN */
1743 {errno = EINVAL; return -1;}
1744 #endif /* ndef ENOTCONN */
1745 if (x == Mono_Posix_Errno_ENOTDIR)
1746 #ifdef ENOTDIR
1747 {*r = ENOTDIR; return 0;}
1748 #else /* def ENOTDIR */
1749 {errno = EINVAL; return -1;}
1750 #endif /* ndef ENOTDIR */
1751 if (x == Mono_Posix_Errno_ENOTEMPTY)
1752 #ifdef ENOTEMPTY
1753 {*r = ENOTEMPTY; return 0;}
1754 #else /* def ENOTEMPTY */
1755 {errno = EINVAL; return -1;}
1756 #endif /* ndef ENOTEMPTY */
1757 if (x == Mono_Posix_Errno_ENOTNAM)
1758 #ifdef ENOTNAM
1759 {*r = ENOTNAM; return 0;}
1760 #else /* def ENOTNAM */
1761 {errno = EINVAL; return -1;}
1762 #endif /* ndef ENOTNAM */
1763 if (x == Mono_Posix_Errno_ENOTRECOVERABLE)
1764 #ifdef ENOTRECOVERABLE
1765 {*r = ENOTRECOVERABLE; return 0;}
1766 #else /* def ENOTRECOVERABLE */
1767 {errno = EINVAL; return -1;}
1768 #endif /* ndef ENOTRECOVERABLE */
1769 if (x == Mono_Posix_Errno_ENOTSOCK)
1770 #ifdef ENOTSOCK
1771 {*r = ENOTSOCK; return 0;}
1772 #else /* def ENOTSOCK */
1773 {errno = EINVAL; return -1;}
1774 #endif /* ndef ENOTSOCK */
1775 if (x == Mono_Posix_Errno_ENOTTY)
1776 #ifdef ENOTTY
1777 {*r = ENOTTY; return 0;}
1778 #else /* def ENOTTY */
1779 {errno = EINVAL; return -1;}
1780 #endif /* ndef ENOTTY */
1781 if (x == Mono_Posix_Errno_ENOTUNIQ)
1782 #ifdef ENOTUNIQ
1783 {*r = ENOTUNIQ; return 0;}
1784 #else /* def ENOTUNIQ */
1785 {errno = EINVAL; return -1;}
1786 #endif /* ndef ENOTUNIQ */
1787 if (x == Mono_Posix_Errno_ENXIO)
1788 #ifdef ENXIO
1789 {*r = ENXIO; return 0;}
1790 #else /* def ENXIO */
1791 {errno = EINVAL; return -1;}
1792 #endif /* ndef ENXIO */
1793 if (x == Mono_Posix_Errno_EOPNOTSUPP)
1794 #ifdef EOPNOTSUPP
1795 {*r = EOPNOTSUPP; return 0;}
1796 #else /* def EOPNOTSUPP */
1797 {errno = EINVAL; return -1;}
1798 #endif /* ndef EOPNOTSUPP */
1799 if (x == Mono_Posix_Errno_EOVERFLOW)
1800 #ifdef EOVERFLOW
1801 {*r = EOVERFLOW; return 0;}
1802 #else /* def EOVERFLOW */
1803 {errno = EINVAL; return -1;}
1804 #endif /* ndef EOVERFLOW */
1805 if (x == Mono_Posix_Errno_EOWNERDEAD)
1806 #ifdef EOWNERDEAD
1807 {*r = EOWNERDEAD; return 0;}
1808 #else /* def EOWNERDEAD */
1809 {errno = EINVAL; return -1;}
1810 #endif /* ndef EOWNERDEAD */
1811 if (x == Mono_Posix_Errno_EPERM)
1812 #ifdef EPERM
1813 {*r = EPERM; return 0;}
1814 #else /* def EPERM */
1815 {errno = EINVAL; return -1;}
1816 #endif /* ndef EPERM */
1817 if (x == Mono_Posix_Errno_EPFNOSUPPORT)
1818 #ifdef EPFNOSUPPORT
1819 {*r = EPFNOSUPPORT; return 0;}
1820 #else /* def EPFNOSUPPORT */
1821 {errno = EINVAL; return -1;}
1822 #endif /* ndef EPFNOSUPPORT */
1823 if (x == Mono_Posix_Errno_EPIPE)
1824 #ifdef EPIPE
1825 {*r = EPIPE; return 0;}
1826 #else /* def EPIPE */
1827 {errno = EINVAL; return -1;}
1828 #endif /* ndef EPIPE */
1829 if (x == Mono_Posix_Errno_EPROCLIM)
1830 #ifdef EPROCLIM
1831 {*r = EPROCLIM; return 0;}
1832 #else /* def EPROCLIM */
1833 {errno = EINVAL; return -1;}
1834 #endif /* ndef EPROCLIM */
1835 if (x == Mono_Posix_Errno_EPROCUNAVAIL)
1836 #ifdef EPROCUNAVAIL
1837 {*r = EPROCUNAVAIL; return 0;}
1838 #else /* def EPROCUNAVAIL */
1839 {errno = EINVAL; return -1;}
1840 #endif /* ndef EPROCUNAVAIL */
1841 if (x == Mono_Posix_Errno_EPROGMISMATCH)
1842 #ifdef EPROGMISMATCH
1843 {*r = EPROGMISMATCH; return 0;}
1844 #else /* def EPROGMISMATCH */
1845 {errno = EINVAL; return -1;}
1846 #endif /* ndef EPROGMISMATCH */
1847 if (x == Mono_Posix_Errno_EPROGUNAVAIL)
1848 #ifdef EPROGUNAVAIL
1849 {*r = EPROGUNAVAIL; return 0;}
1850 #else /* def EPROGUNAVAIL */
1851 {errno = EINVAL; return -1;}
1852 #endif /* ndef EPROGUNAVAIL */
1853 if (x == Mono_Posix_Errno_EPROTO)
1854 #ifdef EPROTO
1855 {*r = EPROTO; return 0;}
1856 #else /* def EPROTO */
1857 {errno = EINVAL; return -1;}
1858 #endif /* ndef EPROTO */
1859 if (x == Mono_Posix_Errno_EPROTONOSUPPORT)
1860 #ifdef EPROTONOSUPPORT
1861 {*r = EPROTONOSUPPORT; return 0;}
1862 #else /* def EPROTONOSUPPORT */
1863 {errno = EINVAL; return -1;}
1864 #endif /* ndef EPROTONOSUPPORT */
1865 if (x == Mono_Posix_Errno_EPROTOTYPE)
1866 #ifdef EPROTOTYPE
1867 {*r = EPROTOTYPE; return 0;}
1868 #else /* def EPROTOTYPE */
1869 {errno = EINVAL; return -1;}
1870 #endif /* ndef EPROTOTYPE */
1871 if (x == Mono_Posix_Errno_EPWROFF)
1872 #ifdef EPWROFF
1873 {*r = EPWROFF; return 0;}
1874 #else /* def EPWROFF */
1875 {errno = EINVAL; return -1;}
1876 #endif /* ndef EPWROFF */
1877 if (x == Mono_Posix_Errno_ERANGE)
1878 #ifdef ERANGE
1879 {*r = ERANGE; return 0;}
1880 #else /* def ERANGE */
1881 {errno = EINVAL; return -1;}
1882 #endif /* ndef ERANGE */
1883 if (x == Mono_Posix_Errno_EREMCHG)
1884 #ifdef EREMCHG
1885 {*r = EREMCHG; return 0;}
1886 #else /* def EREMCHG */
1887 {errno = EINVAL; return -1;}
1888 #endif /* ndef EREMCHG */
1889 if (x == Mono_Posix_Errno_EREMOTE)
1890 #ifdef EREMOTE
1891 {*r = EREMOTE; return 0;}
1892 #else /* def EREMOTE */
1893 {errno = EINVAL; return -1;}
1894 #endif /* ndef EREMOTE */
1895 if (x == Mono_Posix_Errno_EREMOTEIO)
1896 #ifdef EREMOTEIO
1897 {*r = EREMOTEIO; return 0;}
1898 #else /* def EREMOTEIO */
1899 {errno = EINVAL; return -1;}
1900 #endif /* ndef EREMOTEIO */
1901 if (x == Mono_Posix_Errno_ERESTART)
1902 #ifdef ERESTART
1903 {*r = ERESTART; return 0;}
1904 #else /* def ERESTART */
1905 {errno = EINVAL; return -1;}
1906 #endif /* ndef ERESTART */
1907 if (x == Mono_Posix_Errno_EROFS)
1908 #ifdef EROFS
1909 {*r = EROFS; return 0;}
1910 #else /* def EROFS */
1911 {errno = EINVAL; return -1;}
1912 #endif /* ndef EROFS */
1913 if (x == Mono_Posix_Errno_ERPCMISMATCH)
1914 #ifdef ERPCMISMATCH
1915 {*r = ERPCMISMATCH; return 0;}
1916 #else /* def ERPCMISMATCH */
1917 {errno = EINVAL; return -1;}
1918 #endif /* ndef ERPCMISMATCH */
1919 if (x == Mono_Posix_Errno_ESHLIBVERS)
1920 #ifdef ESHLIBVERS
1921 {*r = ESHLIBVERS; return 0;}
1922 #else /* def ESHLIBVERS */
1923 {errno = EINVAL; return -1;}
1924 #endif /* ndef ESHLIBVERS */
1925 if (x == Mono_Posix_Errno_ESHUTDOWN)
1926 #ifdef ESHUTDOWN
1927 {*r = ESHUTDOWN; return 0;}
1928 #else /* def ESHUTDOWN */
1929 {errno = EINVAL; return -1;}
1930 #endif /* ndef ESHUTDOWN */
1931 if (x == Mono_Posix_Errno_ESOCKTNOSUPPORT)
1932 #ifdef ESOCKTNOSUPPORT
1933 {*r = ESOCKTNOSUPPORT; return 0;}
1934 #else /* def ESOCKTNOSUPPORT */
1935 {errno = EINVAL; return -1;}
1936 #endif /* ndef ESOCKTNOSUPPORT */
1937 if (x == Mono_Posix_Errno_ESPIPE)
1938 #ifdef ESPIPE
1939 {*r = ESPIPE; return 0;}
1940 #else /* def ESPIPE */
1941 {errno = EINVAL; return -1;}
1942 #endif /* ndef ESPIPE */
1943 if (x == Mono_Posix_Errno_ESRCH)
1944 #ifdef ESRCH
1945 {*r = ESRCH; return 0;}
1946 #else /* def ESRCH */
1947 {errno = EINVAL; return -1;}
1948 #endif /* ndef ESRCH */
1949 if (x == Mono_Posix_Errno_ESRMNT)
1950 #ifdef ESRMNT
1951 {*r = ESRMNT; return 0;}
1952 #else /* def ESRMNT */
1953 {errno = EINVAL; return -1;}
1954 #endif /* ndef ESRMNT */
1955 if (x == Mono_Posix_Errno_ESTALE)
1956 #ifdef ESTALE
1957 {*r = ESTALE; return 0;}
1958 #else /* def ESTALE */
1959 {errno = EINVAL; return -1;}
1960 #endif /* ndef ESTALE */
1961 if (x == Mono_Posix_Errno_ESTRPIPE)
1962 #ifdef ESTRPIPE
1963 {*r = ESTRPIPE; return 0;}
1964 #else /* def ESTRPIPE */
1965 {errno = EINVAL; return -1;}
1966 #endif /* ndef ESTRPIPE */
1967 if (x == Mono_Posix_Errno_ETIME)
1968 #ifdef ETIME
1969 {*r = ETIME; return 0;}
1970 #else /* def ETIME */
1971 {errno = EINVAL; return -1;}
1972 #endif /* ndef ETIME */
1973 if (x == Mono_Posix_Errno_ETIMEDOUT)
1974 #ifdef ETIMEDOUT
1975 {*r = ETIMEDOUT; return 0;}
1976 #else /* def ETIMEDOUT */
1977 {errno = EINVAL; return -1;}
1978 #endif /* ndef ETIMEDOUT */
1979 if (x == Mono_Posix_Errno_ETOOMANYREFS)
1980 #ifdef ETOOMANYREFS
1981 {*r = ETOOMANYREFS; return 0;}
1982 #else /* def ETOOMANYREFS */
1983 {errno = EINVAL; return -1;}
1984 #endif /* ndef ETOOMANYREFS */
1985 if (x == Mono_Posix_Errno_ETXTBSY)
1986 #ifdef ETXTBSY
1987 {*r = ETXTBSY; return 0;}
1988 #else /* def ETXTBSY */
1989 {errno = EINVAL; return -1;}
1990 #endif /* ndef ETXTBSY */
1991 if (x == Mono_Posix_Errno_EUCLEAN)
1992 #ifdef EUCLEAN
1993 {*r = EUCLEAN; return 0;}
1994 #else /* def EUCLEAN */
1995 {errno = EINVAL; return -1;}
1996 #endif /* ndef EUCLEAN */
1997 if (x == Mono_Posix_Errno_EUNATCH)
1998 #ifdef EUNATCH
1999 {*r = EUNATCH; return 0;}
2000 #else /* def EUNATCH */
2001 {errno = EINVAL; return -1;}
2002 #endif /* ndef EUNATCH */
2003 if (x == Mono_Posix_Errno_EUSERS)
2004 #ifdef EUSERS
2005 {*r = EUSERS; return 0;}
2006 #else /* def EUSERS */
2007 {errno = EINVAL; return -1;}
2008 #endif /* ndef EUSERS */
2009 if (x == Mono_Posix_Errno_EWOULDBLOCK)
2010 #ifdef EWOULDBLOCK
2011 {*r = EWOULDBLOCK; return 0;}
2012 #else /* def EWOULDBLOCK */
2013 {errno = EINVAL; return -1;}
2014 #endif /* ndef EWOULDBLOCK */
2015 if (x == Mono_Posix_Errno_EXDEV)
2016 #ifdef EXDEV
2017 {*r = EXDEV; return 0;}
2018 #else /* def EXDEV */
2019 {errno = EINVAL; return -1;}
2020 #endif /* ndef EXDEV */
2021 if (x == Mono_Posix_Errno_EXFULL)
2022 #ifdef EXFULL
2023 {*r = EXFULL; return 0;}
2024 #else /* def EXFULL */
2025 {errno = EINVAL; return -1;}
2026 #endif /* ndef EXFULL */
2027 if (x == 0)
2028 return 0;
2029 errno = EINVAL; return -1;
2032 int Mono_Posix_ToErrno (int x, int *r)
2034 *r = 0;
2035 if (x == 0)
2036 return 0;
2037 #ifdef E2BIG
2038 if (x == E2BIG)
2039 {*r = Mono_Posix_Errno_E2BIG; return 0;}
2040 #endif /* ndef E2BIG */
2041 #ifdef EACCES
2042 if (x == EACCES)
2043 {*r = Mono_Posix_Errno_EACCES; return 0;}
2044 #endif /* ndef EACCES */
2045 #ifdef EADDRINUSE
2046 if (x == EADDRINUSE)
2047 {*r = Mono_Posix_Errno_EADDRINUSE; return 0;}
2048 #endif /* ndef EADDRINUSE */
2049 #ifdef EADDRNOTAVAIL
2050 if (x == EADDRNOTAVAIL)
2051 {*r = Mono_Posix_Errno_EADDRNOTAVAIL; return 0;}
2052 #endif /* ndef EADDRNOTAVAIL */
2053 #ifdef EADV
2054 if (x == EADV)
2055 {*r = Mono_Posix_Errno_EADV; return 0;}
2056 #endif /* ndef EADV */
2057 #ifdef EAFNOSUPPORT
2058 if (x == EAFNOSUPPORT)
2059 {*r = Mono_Posix_Errno_EAFNOSUPPORT; return 0;}
2060 #endif /* ndef EAFNOSUPPORT */
2061 #ifdef EAGAIN
2062 if (x == EAGAIN)
2063 {*r = Mono_Posix_Errno_EAGAIN; return 0;}
2064 #endif /* ndef EAGAIN */
2065 #ifdef EALREADY
2066 if (x == EALREADY)
2067 {*r = Mono_Posix_Errno_EALREADY; return 0;}
2068 #endif /* ndef EALREADY */
2069 #ifdef EAUTH
2070 if (x == EAUTH)
2071 {*r = Mono_Posix_Errno_EAUTH; return 0;}
2072 #endif /* ndef EAUTH */
2073 #ifdef EBADARCH
2074 if (x == EBADARCH)
2075 {*r = Mono_Posix_Errno_EBADARCH; return 0;}
2076 #endif /* ndef EBADARCH */
2077 #ifdef EBADE
2078 if (x == EBADE)
2079 {*r = Mono_Posix_Errno_EBADE; return 0;}
2080 #endif /* ndef EBADE */
2081 #ifdef EBADEXEC
2082 if (x == EBADEXEC)
2083 {*r = Mono_Posix_Errno_EBADEXEC; return 0;}
2084 #endif /* ndef EBADEXEC */
2085 #ifdef EBADF
2086 if (x == EBADF)
2087 {*r = Mono_Posix_Errno_EBADF; return 0;}
2088 #endif /* ndef EBADF */
2089 #ifdef EBADFD
2090 if (x == EBADFD)
2091 {*r = Mono_Posix_Errno_EBADFD; return 0;}
2092 #endif /* ndef EBADFD */
2093 #ifdef EBADMACHO
2094 if (x == EBADMACHO)
2095 {*r = Mono_Posix_Errno_EBADMACHO; return 0;}
2096 #endif /* ndef EBADMACHO */
2097 #ifdef EBADMSG
2098 if (x == EBADMSG)
2099 {*r = Mono_Posix_Errno_EBADMSG; return 0;}
2100 #endif /* ndef EBADMSG */
2101 #ifdef EBADR
2102 if (x == EBADR)
2103 {*r = Mono_Posix_Errno_EBADR; return 0;}
2104 #endif /* ndef EBADR */
2105 #ifdef EBADRPC
2106 if (x == EBADRPC)
2107 {*r = Mono_Posix_Errno_EBADRPC; return 0;}
2108 #endif /* ndef EBADRPC */
2109 #ifdef EBADRQC
2110 if (x == EBADRQC)
2111 {*r = Mono_Posix_Errno_EBADRQC; return 0;}
2112 #endif /* ndef EBADRQC */
2113 #ifdef EBADSLT
2114 if (x == EBADSLT)
2115 {*r = Mono_Posix_Errno_EBADSLT; return 0;}
2116 #endif /* ndef EBADSLT */
2117 #ifdef EBFONT
2118 if (x == EBFONT)
2119 {*r = Mono_Posix_Errno_EBFONT; return 0;}
2120 #endif /* ndef EBFONT */
2121 #ifdef EBUSY
2122 if (x == EBUSY)
2123 {*r = Mono_Posix_Errno_EBUSY; return 0;}
2124 #endif /* ndef EBUSY */
2125 #ifdef ECANCELED
2126 if (x == ECANCELED)
2127 {*r = Mono_Posix_Errno_ECANCELED; return 0;}
2128 #endif /* ndef ECANCELED */
2129 #ifdef ECHILD
2130 if (x == ECHILD)
2131 {*r = Mono_Posix_Errno_ECHILD; return 0;}
2132 #endif /* ndef ECHILD */
2133 #ifdef ECHRNG
2134 if (x == ECHRNG)
2135 {*r = Mono_Posix_Errno_ECHRNG; return 0;}
2136 #endif /* ndef ECHRNG */
2137 #ifdef ECOMM
2138 if (x == ECOMM)
2139 {*r = Mono_Posix_Errno_ECOMM; return 0;}
2140 #endif /* ndef ECOMM */
2141 #ifdef ECONNABORTED
2142 if (x == ECONNABORTED)
2143 {*r = Mono_Posix_Errno_ECONNABORTED; return 0;}
2144 #endif /* ndef ECONNABORTED */
2145 #ifdef ECONNREFUSED
2146 if (x == ECONNREFUSED)
2147 {*r = Mono_Posix_Errno_ECONNREFUSED; return 0;}
2148 #endif /* ndef ECONNREFUSED */
2149 #ifdef ECONNRESET
2150 if (x == ECONNRESET)
2151 {*r = Mono_Posix_Errno_ECONNRESET; return 0;}
2152 #endif /* ndef ECONNRESET */
2153 #ifdef EDEADLK
2154 if (x == EDEADLK)
2155 {*r = Mono_Posix_Errno_EDEADLK; return 0;}
2156 #endif /* ndef EDEADLK */
2157 #ifdef EDEADLOCK
2158 if (x == EDEADLOCK)
2159 {*r = Mono_Posix_Errno_EDEADLOCK; return 0;}
2160 #endif /* ndef EDEADLOCK */
2161 #ifdef EDESTADDRREQ
2162 if (x == EDESTADDRREQ)
2163 {*r = Mono_Posix_Errno_EDESTADDRREQ; return 0;}
2164 #endif /* ndef EDESTADDRREQ */
2165 #ifdef EDEVERR
2166 if (x == EDEVERR)
2167 {*r = Mono_Posix_Errno_EDEVERR; return 0;}
2168 #endif /* ndef EDEVERR */
2169 #ifdef EDOM
2170 if (x == EDOM)
2171 {*r = Mono_Posix_Errno_EDOM; return 0;}
2172 #endif /* ndef EDOM */
2173 #ifdef EDOTDOT
2174 if (x == EDOTDOT)
2175 {*r = Mono_Posix_Errno_EDOTDOT; return 0;}
2176 #endif /* ndef EDOTDOT */
2177 #ifdef EDQUOT
2178 if (x == EDQUOT)
2179 {*r = Mono_Posix_Errno_EDQUOT; return 0;}
2180 #endif /* ndef EDQUOT */
2181 #ifdef EEXIST
2182 if (x == EEXIST)
2183 {*r = Mono_Posix_Errno_EEXIST; return 0;}
2184 #endif /* ndef EEXIST */
2185 #ifdef EFAULT
2186 if (x == EFAULT)
2187 {*r = Mono_Posix_Errno_EFAULT; return 0;}
2188 #endif /* ndef EFAULT */
2189 #ifdef EFBIG
2190 if (x == EFBIG)
2191 {*r = Mono_Posix_Errno_EFBIG; return 0;}
2192 #endif /* ndef EFBIG */
2193 #ifdef EFTYPE
2194 if (x == EFTYPE)
2195 {*r = Mono_Posix_Errno_EFTYPE; return 0;}
2196 #endif /* ndef EFTYPE */
2197 #ifdef EHOSTDOWN
2198 if (x == EHOSTDOWN)
2199 {*r = Mono_Posix_Errno_EHOSTDOWN; return 0;}
2200 #endif /* ndef EHOSTDOWN */
2201 #ifdef EHOSTUNREACH
2202 if (x == EHOSTUNREACH)
2203 {*r = Mono_Posix_Errno_EHOSTUNREACH; return 0;}
2204 #endif /* ndef EHOSTUNREACH */
2205 #ifdef EIDRM
2206 if (x == EIDRM)
2207 {*r = Mono_Posix_Errno_EIDRM; return 0;}
2208 #endif /* ndef EIDRM */
2209 #ifdef EILSEQ
2210 if (x == EILSEQ)
2211 {*r = Mono_Posix_Errno_EILSEQ; return 0;}
2212 #endif /* ndef EILSEQ */
2213 #ifdef EINPROGRESS
2214 if (x == EINPROGRESS)
2215 {*r = Mono_Posix_Errno_EINPROGRESS; return 0;}
2216 #endif /* ndef EINPROGRESS */
2217 #ifdef EINTR
2218 if (x == EINTR)
2219 {*r = Mono_Posix_Errno_EINTR; return 0;}
2220 #endif /* ndef EINTR */
2221 #ifdef EINVAL
2222 if (x == EINVAL)
2223 {*r = Mono_Posix_Errno_EINVAL; return 0;}
2224 #endif /* ndef EINVAL */
2225 #ifdef EIO
2226 if (x == EIO)
2227 {*r = Mono_Posix_Errno_EIO; return 0;}
2228 #endif /* ndef EIO */
2229 #ifdef EISCONN
2230 if (x == EISCONN)
2231 {*r = Mono_Posix_Errno_EISCONN; return 0;}
2232 #endif /* ndef EISCONN */
2233 #ifdef EISDIR
2234 if (x == EISDIR)
2235 {*r = Mono_Posix_Errno_EISDIR; return 0;}
2236 #endif /* ndef EISDIR */
2237 #ifdef EISNAM
2238 if (x == EISNAM)
2239 {*r = Mono_Posix_Errno_EISNAM; return 0;}
2240 #endif /* ndef EISNAM */
2241 #ifdef EKEYEXPIRED
2242 if (x == EKEYEXPIRED)
2243 {*r = Mono_Posix_Errno_EKEYEXPIRED; return 0;}
2244 #endif /* ndef EKEYEXPIRED */
2245 #ifdef EKEYREJECTED
2246 if (x == EKEYREJECTED)
2247 {*r = Mono_Posix_Errno_EKEYREJECTED; return 0;}
2248 #endif /* ndef EKEYREJECTED */
2249 #ifdef EKEYREVOKED
2250 if (x == EKEYREVOKED)
2251 {*r = Mono_Posix_Errno_EKEYREVOKED; return 0;}
2252 #endif /* ndef EKEYREVOKED */
2253 #ifdef EL2HLT
2254 if (x == EL2HLT)
2255 {*r = Mono_Posix_Errno_EL2HLT; return 0;}
2256 #endif /* ndef EL2HLT */
2257 #ifdef EL2NSYNC
2258 if (x == EL2NSYNC)
2259 {*r = Mono_Posix_Errno_EL2NSYNC; return 0;}
2260 #endif /* ndef EL2NSYNC */
2261 #ifdef EL3HLT
2262 if (x == EL3HLT)
2263 {*r = Mono_Posix_Errno_EL3HLT; return 0;}
2264 #endif /* ndef EL3HLT */
2265 #ifdef EL3RST
2266 if (x == EL3RST)
2267 {*r = Mono_Posix_Errno_EL3RST; return 0;}
2268 #endif /* ndef EL3RST */
2269 #ifdef ELIBACC
2270 if (x == ELIBACC)
2271 {*r = Mono_Posix_Errno_ELIBACC; return 0;}
2272 #endif /* ndef ELIBACC */
2273 #ifdef ELIBBAD
2274 if (x == ELIBBAD)
2275 {*r = Mono_Posix_Errno_ELIBBAD; return 0;}
2276 #endif /* ndef ELIBBAD */
2277 #ifdef ELIBEXEC
2278 if (x == ELIBEXEC)
2279 {*r = Mono_Posix_Errno_ELIBEXEC; return 0;}
2280 #endif /* ndef ELIBEXEC */
2281 #ifdef ELIBMAX
2282 if (x == ELIBMAX)
2283 {*r = Mono_Posix_Errno_ELIBMAX; return 0;}
2284 #endif /* ndef ELIBMAX */
2285 #ifdef ELIBSCN
2286 if (x == ELIBSCN)
2287 {*r = Mono_Posix_Errno_ELIBSCN; return 0;}
2288 #endif /* ndef ELIBSCN */
2289 #ifdef ELNRNG
2290 if (x == ELNRNG)
2291 {*r = Mono_Posix_Errno_ELNRNG; return 0;}
2292 #endif /* ndef ELNRNG */
2293 #ifdef ELOOP
2294 if (x == ELOOP)
2295 {*r = Mono_Posix_Errno_ELOOP; return 0;}
2296 #endif /* ndef ELOOP */
2297 #ifdef EMEDIUMTYPE
2298 if (x == EMEDIUMTYPE)
2299 {*r = Mono_Posix_Errno_EMEDIUMTYPE; return 0;}
2300 #endif /* ndef EMEDIUMTYPE */
2301 #ifdef EMFILE
2302 if (x == EMFILE)
2303 {*r = Mono_Posix_Errno_EMFILE; return 0;}
2304 #endif /* ndef EMFILE */
2305 #ifdef EMLINK
2306 if (x == EMLINK)
2307 {*r = Mono_Posix_Errno_EMLINK; return 0;}
2308 #endif /* ndef EMLINK */
2309 #ifdef EMSGSIZE
2310 if (x == EMSGSIZE)
2311 {*r = Mono_Posix_Errno_EMSGSIZE; return 0;}
2312 #endif /* ndef EMSGSIZE */
2313 #ifdef EMULTIHOP
2314 if (x == EMULTIHOP)
2315 {*r = Mono_Posix_Errno_EMULTIHOP; return 0;}
2316 #endif /* ndef EMULTIHOP */
2317 #ifdef ENAMETOOLONG
2318 if (x == ENAMETOOLONG)
2319 {*r = Mono_Posix_Errno_ENAMETOOLONG; return 0;}
2320 #endif /* ndef ENAMETOOLONG */
2321 #ifdef ENAVAIL
2322 if (x == ENAVAIL)
2323 {*r = Mono_Posix_Errno_ENAVAIL; return 0;}
2324 #endif /* ndef ENAVAIL */
2325 #ifdef ENEEDAUTH
2326 if (x == ENEEDAUTH)
2327 {*r = Mono_Posix_Errno_ENEEDAUTH; return 0;}
2328 #endif /* ndef ENEEDAUTH */
2329 #ifdef ENETDOWN
2330 if (x == ENETDOWN)
2331 {*r = Mono_Posix_Errno_ENETDOWN; return 0;}
2332 #endif /* ndef ENETDOWN */
2333 #ifdef ENETRESET
2334 if (x == ENETRESET)
2335 {*r = Mono_Posix_Errno_ENETRESET; return 0;}
2336 #endif /* ndef ENETRESET */
2337 #ifdef ENETUNREACH
2338 if (x == ENETUNREACH)
2339 {*r = Mono_Posix_Errno_ENETUNREACH; return 0;}
2340 #endif /* ndef ENETUNREACH */
2341 #ifdef ENFILE
2342 if (x == ENFILE)
2343 {*r = Mono_Posix_Errno_ENFILE; return 0;}
2344 #endif /* ndef ENFILE */
2345 #ifdef ENOANO
2346 if (x == ENOANO)
2347 {*r = Mono_Posix_Errno_ENOANO; return 0;}
2348 #endif /* ndef ENOANO */
2349 #ifdef ENOATTR
2350 if (x == ENOATTR)
2351 {*r = Mono_Posix_Errno_ENOATTR; return 0;}
2352 #endif /* ndef ENOATTR */
2353 #ifdef ENOBUFS
2354 if (x == ENOBUFS)
2355 {*r = Mono_Posix_Errno_ENOBUFS; return 0;}
2356 #endif /* ndef ENOBUFS */
2357 #ifdef ENOCSI
2358 if (x == ENOCSI)
2359 {*r = Mono_Posix_Errno_ENOCSI; return 0;}
2360 #endif /* ndef ENOCSI */
2361 #ifdef ENODATA
2362 if (x == ENODATA)
2363 {*r = Mono_Posix_Errno_ENODATA; return 0;}
2364 #endif /* ndef ENODATA */
2365 #ifdef ENODEV
2366 if (x == ENODEV)
2367 {*r = Mono_Posix_Errno_ENODEV; return 0;}
2368 #endif /* ndef ENODEV */
2369 #ifdef ENOENT
2370 if (x == ENOENT)
2371 {*r = Mono_Posix_Errno_ENOENT; return 0;}
2372 #endif /* ndef ENOENT */
2373 #ifdef ENOEXEC
2374 if (x == ENOEXEC)
2375 {*r = Mono_Posix_Errno_ENOEXEC; return 0;}
2376 #endif /* ndef ENOEXEC */
2377 #ifdef ENOKEY
2378 if (x == ENOKEY)
2379 {*r = Mono_Posix_Errno_ENOKEY; return 0;}
2380 #endif /* ndef ENOKEY */
2381 #ifdef ENOLCK
2382 if (x == ENOLCK)
2383 {*r = Mono_Posix_Errno_ENOLCK; return 0;}
2384 #endif /* ndef ENOLCK */
2385 #ifdef ENOLINK
2386 if (x == ENOLINK)
2387 {*r = Mono_Posix_Errno_ENOLINK; return 0;}
2388 #endif /* ndef ENOLINK */
2389 #ifdef ENOMEDIUM
2390 if (x == ENOMEDIUM)
2391 {*r = Mono_Posix_Errno_ENOMEDIUM; return 0;}
2392 #endif /* ndef ENOMEDIUM */
2393 #ifdef ENOMEM
2394 if (x == ENOMEM)
2395 {*r = Mono_Posix_Errno_ENOMEM; return 0;}
2396 #endif /* ndef ENOMEM */
2397 #ifdef ENOMSG
2398 if (x == ENOMSG)
2399 {*r = Mono_Posix_Errno_ENOMSG; return 0;}
2400 #endif /* ndef ENOMSG */
2401 #ifdef ENONET
2402 if (x == ENONET)
2403 {*r = Mono_Posix_Errno_ENONET; return 0;}
2404 #endif /* ndef ENONET */
2405 #ifdef ENOPKG
2406 if (x == ENOPKG)
2407 {*r = Mono_Posix_Errno_ENOPKG; return 0;}
2408 #endif /* ndef ENOPKG */
2409 #ifdef ENOPOLICY
2410 if (x == ENOPOLICY)
2411 {*r = Mono_Posix_Errno_ENOPOLICY; return 0;}
2412 #endif /* ndef ENOPOLICY */
2413 #ifdef ENOPROTOOPT
2414 if (x == ENOPROTOOPT)
2415 {*r = Mono_Posix_Errno_ENOPROTOOPT; return 0;}
2416 #endif /* ndef ENOPROTOOPT */
2417 #ifdef ENOSPC
2418 if (x == ENOSPC)
2419 {*r = Mono_Posix_Errno_ENOSPC; return 0;}
2420 #endif /* ndef ENOSPC */
2421 #ifdef ENOSR
2422 if (x == ENOSR)
2423 {*r = Mono_Posix_Errno_ENOSR; return 0;}
2424 #endif /* ndef ENOSR */
2425 #ifdef ENOSTR
2426 if (x == ENOSTR)
2427 {*r = Mono_Posix_Errno_ENOSTR; return 0;}
2428 #endif /* ndef ENOSTR */
2429 #ifdef ENOSYS
2430 if (x == ENOSYS)
2431 {*r = Mono_Posix_Errno_ENOSYS; return 0;}
2432 #endif /* ndef ENOSYS */
2433 #ifdef ENOTBLK
2434 if (x == ENOTBLK)
2435 {*r = Mono_Posix_Errno_ENOTBLK; return 0;}
2436 #endif /* ndef ENOTBLK */
2437 #ifdef ENOTCONN
2438 if (x == ENOTCONN)
2439 {*r = Mono_Posix_Errno_ENOTCONN; return 0;}
2440 #endif /* ndef ENOTCONN */
2441 #ifdef ENOTDIR
2442 if (x == ENOTDIR)
2443 {*r = Mono_Posix_Errno_ENOTDIR; return 0;}
2444 #endif /* ndef ENOTDIR */
2445 #ifdef ENOTEMPTY
2446 if (x == ENOTEMPTY)
2447 {*r = Mono_Posix_Errno_ENOTEMPTY; return 0;}
2448 #endif /* ndef ENOTEMPTY */
2449 #ifdef ENOTNAM
2450 if (x == ENOTNAM)
2451 {*r = Mono_Posix_Errno_ENOTNAM; return 0;}
2452 #endif /* ndef ENOTNAM */
2453 #ifdef ENOTRECOVERABLE
2454 if (x == ENOTRECOVERABLE)
2455 {*r = Mono_Posix_Errno_ENOTRECOVERABLE; return 0;}
2456 #endif /* ndef ENOTRECOVERABLE */
2457 #ifdef ENOTSOCK
2458 if (x == ENOTSOCK)
2459 {*r = Mono_Posix_Errno_ENOTSOCK; return 0;}
2460 #endif /* ndef ENOTSOCK */
2461 #ifdef ENOTTY
2462 if (x == ENOTTY)
2463 {*r = Mono_Posix_Errno_ENOTTY; return 0;}
2464 #endif /* ndef ENOTTY */
2465 #ifdef ENOTUNIQ
2466 if (x == ENOTUNIQ)
2467 {*r = Mono_Posix_Errno_ENOTUNIQ; return 0;}
2468 #endif /* ndef ENOTUNIQ */
2469 #ifdef ENXIO
2470 if (x == ENXIO)
2471 {*r = Mono_Posix_Errno_ENXIO; return 0;}
2472 #endif /* ndef ENXIO */
2473 #ifdef EOPNOTSUPP
2474 if (x == EOPNOTSUPP)
2475 {*r = Mono_Posix_Errno_EOPNOTSUPP; return 0;}
2476 #endif /* ndef EOPNOTSUPP */
2477 #ifdef EOVERFLOW
2478 if (x == EOVERFLOW)
2479 {*r = Mono_Posix_Errno_EOVERFLOW; return 0;}
2480 #endif /* ndef EOVERFLOW */
2481 #ifdef EOWNERDEAD
2482 if (x == EOWNERDEAD)
2483 {*r = Mono_Posix_Errno_EOWNERDEAD; return 0;}
2484 #endif /* ndef EOWNERDEAD */
2485 #ifdef EPERM
2486 if (x == EPERM)
2487 {*r = Mono_Posix_Errno_EPERM; return 0;}
2488 #endif /* ndef EPERM */
2489 #ifdef EPFNOSUPPORT
2490 if (x == EPFNOSUPPORT)
2491 {*r = Mono_Posix_Errno_EPFNOSUPPORT; return 0;}
2492 #endif /* ndef EPFNOSUPPORT */
2493 #ifdef EPIPE
2494 if (x == EPIPE)
2495 {*r = Mono_Posix_Errno_EPIPE; return 0;}
2496 #endif /* ndef EPIPE */
2497 #ifdef EPROCLIM
2498 if (x == EPROCLIM)
2499 {*r = Mono_Posix_Errno_EPROCLIM; return 0;}
2500 #endif /* ndef EPROCLIM */
2501 #ifdef EPROCUNAVAIL
2502 if (x == EPROCUNAVAIL)
2503 {*r = Mono_Posix_Errno_EPROCUNAVAIL; return 0;}
2504 #endif /* ndef EPROCUNAVAIL */
2505 #ifdef EPROGMISMATCH
2506 if (x == EPROGMISMATCH)
2507 {*r = Mono_Posix_Errno_EPROGMISMATCH; return 0;}
2508 #endif /* ndef EPROGMISMATCH */
2509 #ifdef EPROGUNAVAIL
2510 if (x == EPROGUNAVAIL)
2511 {*r = Mono_Posix_Errno_EPROGUNAVAIL; return 0;}
2512 #endif /* ndef EPROGUNAVAIL */
2513 #ifdef EPROTO
2514 if (x == EPROTO)
2515 {*r = Mono_Posix_Errno_EPROTO; return 0;}
2516 #endif /* ndef EPROTO */
2517 #ifdef EPROTONOSUPPORT
2518 if (x == EPROTONOSUPPORT)
2519 {*r = Mono_Posix_Errno_EPROTONOSUPPORT; return 0;}
2520 #endif /* ndef EPROTONOSUPPORT */
2521 #ifdef EPROTOTYPE
2522 if (x == EPROTOTYPE)
2523 {*r = Mono_Posix_Errno_EPROTOTYPE; return 0;}
2524 #endif /* ndef EPROTOTYPE */
2525 #ifdef EPWROFF
2526 if (x == EPWROFF)
2527 {*r = Mono_Posix_Errno_EPWROFF; return 0;}
2528 #endif /* ndef EPWROFF */
2529 #ifdef ERANGE
2530 if (x == ERANGE)
2531 {*r = Mono_Posix_Errno_ERANGE; return 0;}
2532 #endif /* ndef ERANGE */
2533 #ifdef EREMCHG
2534 if (x == EREMCHG)
2535 {*r = Mono_Posix_Errno_EREMCHG; return 0;}
2536 #endif /* ndef EREMCHG */
2537 #ifdef EREMOTE
2538 if (x == EREMOTE)
2539 {*r = Mono_Posix_Errno_EREMOTE; return 0;}
2540 #endif /* ndef EREMOTE */
2541 #ifdef EREMOTEIO
2542 if (x == EREMOTEIO)
2543 {*r = Mono_Posix_Errno_EREMOTEIO; return 0;}
2544 #endif /* ndef EREMOTEIO */
2545 #ifdef ERESTART
2546 if (x == ERESTART)
2547 {*r = Mono_Posix_Errno_ERESTART; return 0;}
2548 #endif /* ndef ERESTART */
2549 #ifdef EROFS
2550 if (x == EROFS)
2551 {*r = Mono_Posix_Errno_EROFS; return 0;}
2552 #endif /* ndef EROFS */
2553 #ifdef ERPCMISMATCH
2554 if (x == ERPCMISMATCH)
2555 {*r = Mono_Posix_Errno_ERPCMISMATCH; return 0;}
2556 #endif /* ndef ERPCMISMATCH */
2557 #ifdef ESHLIBVERS
2558 if (x == ESHLIBVERS)
2559 {*r = Mono_Posix_Errno_ESHLIBVERS; return 0;}
2560 #endif /* ndef ESHLIBVERS */
2561 #ifdef ESHUTDOWN
2562 if (x == ESHUTDOWN)
2563 {*r = Mono_Posix_Errno_ESHUTDOWN; return 0;}
2564 #endif /* ndef ESHUTDOWN */
2565 #ifdef ESOCKTNOSUPPORT
2566 if (x == ESOCKTNOSUPPORT)
2567 {*r = Mono_Posix_Errno_ESOCKTNOSUPPORT; return 0;}
2568 #endif /* ndef ESOCKTNOSUPPORT */
2569 #ifdef ESPIPE
2570 if (x == ESPIPE)
2571 {*r = Mono_Posix_Errno_ESPIPE; return 0;}
2572 #endif /* ndef ESPIPE */
2573 #ifdef ESRCH
2574 if (x == ESRCH)
2575 {*r = Mono_Posix_Errno_ESRCH; return 0;}
2576 #endif /* ndef ESRCH */
2577 #ifdef ESRMNT
2578 if (x == ESRMNT)
2579 {*r = Mono_Posix_Errno_ESRMNT; return 0;}
2580 #endif /* ndef ESRMNT */
2581 #ifdef ESTALE
2582 if (x == ESTALE)
2583 {*r = Mono_Posix_Errno_ESTALE; return 0;}
2584 #endif /* ndef ESTALE */
2585 #ifdef ESTRPIPE
2586 if (x == ESTRPIPE)
2587 {*r = Mono_Posix_Errno_ESTRPIPE; return 0;}
2588 #endif /* ndef ESTRPIPE */
2589 #ifdef ETIME
2590 if (x == ETIME)
2591 {*r = Mono_Posix_Errno_ETIME; return 0;}
2592 #endif /* ndef ETIME */
2593 #ifdef ETIMEDOUT
2594 if (x == ETIMEDOUT)
2595 {*r = Mono_Posix_Errno_ETIMEDOUT; return 0;}
2596 #endif /* ndef ETIMEDOUT */
2597 #ifdef ETOOMANYREFS
2598 if (x == ETOOMANYREFS)
2599 {*r = Mono_Posix_Errno_ETOOMANYREFS; return 0;}
2600 #endif /* ndef ETOOMANYREFS */
2601 #ifdef ETXTBSY
2602 if (x == ETXTBSY)
2603 {*r = Mono_Posix_Errno_ETXTBSY; return 0;}
2604 #endif /* ndef ETXTBSY */
2605 #ifdef EUCLEAN
2606 if (x == EUCLEAN)
2607 {*r = Mono_Posix_Errno_EUCLEAN; return 0;}
2608 #endif /* ndef EUCLEAN */
2609 #ifdef EUNATCH
2610 if (x == EUNATCH)
2611 {*r = Mono_Posix_Errno_EUNATCH; return 0;}
2612 #endif /* ndef EUNATCH */
2613 #ifdef EUSERS
2614 if (x == EUSERS)
2615 {*r = Mono_Posix_Errno_EUSERS; return 0;}
2616 #endif /* ndef EUSERS */
2617 #ifdef EWOULDBLOCK
2618 if (x == EWOULDBLOCK)
2619 {*r = Mono_Posix_Errno_EWOULDBLOCK; return 0;}
2620 #endif /* ndef EWOULDBLOCK */
2621 #ifdef EXDEV
2622 if (x == EXDEV)
2623 {*r = Mono_Posix_Errno_EXDEV; return 0;}
2624 #endif /* ndef EXDEV */
2625 #ifdef EXFULL
2626 if (x == EXFULL)
2627 {*r = Mono_Posix_Errno_EXFULL; return 0;}
2628 #endif /* ndef EXFULL */
2629 errno = EINVAL; return -1;
2632 int Mono_Posix_FromFcntlCommand (int x, int *r)
2634 *r = 0;
2635 if (x == Mono_Posix_FcntlCommand_F_DUPFD)
2636 #ifdef F_DUPFD
2637 {*r = F_DUPFD; return 0;}
2638 #else /* def F_DUPFD */
2639 {errno = EINVAL; return -1;}
2640 #endif /* ndef F_DUPFD */
2641 if (x == Mono_Posix_FcntlCommand_F_GETFD)
2642 #ifdef F_GETFD
2643 {*r = F_GETFD; return 0;}
2644 #else /* def F_GETFD */
2645 {errno = EINVAL; return -1;}
2646 #endif /* ndef F_GETFD */
2647 if (x == Mono_Posix_FcntlCommand_F_GETFL)
2648 #ifdef F_GETFL
2649 {*r = F_GETFL; return 0;}
2650 #else /* def F_GETFL */
2651 {errno = EINVAL; return -1;}
2652 #endif /* ndef F_GETFL */
2653 if (x == Mono_Posix_FcntlCommand_F_GETLEASE)
2654 #ifdef F_GETLEASE
2655 {*r = F_GETLEASE; return 0;}
2656 #else /* def F_GETLEASE */
2657 {errno = EINVAL; return -1;}
2658 #endif /* ndef F_GETLEASE */
2659 if (x == Mono_Posix_FcntlCommand_F_GETLK)
2660 #ifdef F_GETLK
2661 {*r = F_GETLK; return 0;}
2662 #else /* def F_GETLK */
2663 {errno = EINVAL; return -1;}
2664 #endif /* ndef F_GETLK */
2665 if (x == Mono_Posix_FcntlCommand_F_GETOWN)
2666 #ifdef F_GETOWN
2667 {*r = F_GETOWN; return 0;}
2668 #else /* def F_GETOWN */
2669 {errno = EINVAL; return -1;}
2670 #endif /* ndef F_GETOWN */
2671 if (x == Mono_Posix_FcntlCommand_F_GETSIG)
2672 #ifdef F_GETSIG
2673 {*r = F_GETSIG; return 0;}
2674 #else /* def F_GETSIG */
2675 {errno = EINVAL; return -1;}
2676 #endif /* ndef F_GETSIG */
2677 if (x == Mono_Posix_FcntlCommand_F_NOCACHE)
2678 #ifdef F_NOCACHE
2679 {*r = F_NOCACHE; return 0;}
2680 #else /* def F_NOCACHE */
2681 {errno = EINVAL; return -1;}
2682 #endif /* ndef F_NOCACHE */
2683 if (x == Mono_Posix_FcntlCommand_F_NOTIFY)
2684 #ifdef F_NOTIFY
2685 {*r = F_NOTIFY; return 0;}
2686 #else /* def F_NOTIFY */
2687 {errno = EINVAL; return -1;}
2688 #endif /* ndef F_NOTIFY */
2689 if (x == Mono_Posix_FcntlCommand_F_OFD_GETLK)
2690 #ifdef F_OFD_GETLK
2691 {*r = F_OFD_GETLK; return 0;}
2692 #else /* def F_OFD_GETLK */
2693 {errno = EINVAL; return -1;}
2694 #endif /* ndef F_OFD_GETLK */
2695 if (x == Mono_Posix_FcntlCommand_F_OFD_SETLK)
2696 #ifdef F_OFD_SETLK
2697 {*r = F_OFD_SETLK; return 0;}
2698 #else /* def F_OFD_SETLK */
2699 {errno = EINVAL; return -1;}
2700 #endif /* ndef F_OFD_SETLK */
2701 if (x == Mono_Posix_FcntlCommand_F_OFD_SETLKW)
2702 #ifdef F_OFD_SETLKW
2703 {*r = F_OFD_SETLKW; return 0;}
2704 #else /* def F_OFD_SETLKW */
2705 {errno = EINVAL; return -1;}
2706 #endif /* ndef F_OFD_SETLKW */
2707 if (x == Mono_Posix_FcntlCommand_F_SETFD)
2708 #ifdef F_SETFD
2709 {*r = F_SETFD; return 0;}
2710 #else /* def F_SETFD */
2711 {errno = EINVAL; return -1;}
2712 #endif /* ndef F_SETFD */
2713 if (x == Mono_Posix_FcntlCommand_F_SETFL)
2714 #ifdef F_SETFL
2715 {*r = F_SETFL; return 0;}
2716 #else /* def F_SETFL */
2717 {errno = EINVAL; return -1;}
2718 #endif /* ndef F_SETFL */
2719 if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
2720 #ifdef F_SETLEASE
2721 {*r = F_SETLEASE; return 0;}
2722 #else /* def F_SETLEASE */
2723 {errno = EINVAL; return -1;}
2724 #endif /* ndef F_SETLEASE */
2725 if (x == Mono_Posix_FcntlCommand_F_SETLK)
2726 #ifdef F_SETLK
2727 {*r = F_SETLK; return 0;}
2728 #else /* def F_SETLK */
2729 {errno = EINVAL; return -1;}
2730 #endif /* ndef F_SETLK */
2731 if (x == Mono_Posix_FcntlCommand_F_SETLKW)
2732 #ifdef F_SETLKW
2733 {*r = F_SETLKW; return 0;}
2734 #else /* def F_SETLKW */
2735 {errno = EINVAL; return -1;}
2736 #endif /* ndef F_SETLKW */
2737 if (x == Mono_Posix_FcntlCommand_F_SETOWN)
2738 #ifdef F_SETOWN
2739 {*r = F_SETOWN; return 0;}
2740 #else /* def F_SETOWN */
2741 {errno = EINVAL; return -1;}
2742 #endif /* ndef F_SETOWN */
2743 if (x == Mono_Posix_FcntlCommand_F_SETSIG)
2744 #ifdef F_SETSIG
2745 {*r = F_SETSIG; return 0;}
2746 #else /* def F_SETSIG */
2747 {errno = EINVAL; return -1;}
2748 #endif /* ndef F_SETSIG */
2749 if (x == 0)
2750 return 0;
2751 errno = EINVAL; return -1;
2754 int Mono_Posix_ToFcntlCommand (int x, int *r)
2756 *r = 0;
2757 if (x == 0)
2758 return 0;
2759 #ifdef F_DUPFD
2760 if (x == F_DUPFD)
2761 {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
2762 #endif /* ndef F_DUPFD */
2763 #ifdef F_GETFD
2764 if (x == F_GETFD)
2765 {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
2766 #endif /* ndef F_GETFD */
2767 #ifdef F_GETFL
2768 if (x == F_GETFL)
2769 {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
2770 #endif /* ndef F_GETFL */
2771 #ifdef F_GETLEASE
2772 if (x == F_GETLEASE)
2773 {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
2774 #endif /* ndef F_GETLEASE */
2775 #ifdef F_GETLK
2776 if (x == F_GETLK)
2777 {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
2778 #endif /* ndef F_GETLK */
2779 #ifdef F_GETOWN
2780 if (x == F_GETOWN)
2781 {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
2782 #endif /* ndef F_GETOWN */
2783 #ifdef F_GETSIG
2784 if (x == F_GETSIG)
2785 {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
2786 #endif /* ndef F_GETSIG */
2787 #ifdef F_NOCACHE
2788 if (x == F_NOCACHE)
2789 {*r = Mono_Posix_FcntlCommand_F_NOCACHE; return 0;}
2790 #endif /* ndef F_NOCACHE */
2791 #ifdef F_NOTIFY
2792 if (x == F_NOTIFY)
2793 {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
2794 #endif /* ndef F_NOTIFY */
2795 #ifdef F_OFD_GETLK
2796 if (x == F_OFD_GETLK)
2797 {*r = Mono_Posix_FcntlCommand_F_OFD_GETLK; return 0;}
2798 #endif /* ndef F_OFD_GETLK */
2799 #ifdef F_OFD_SETLK
2800 if (x == F_OFD_SETLK)
2801 {*r = Mono_Posix_FcntlCommand_F_OFD_SETLK; return 0;}
2802 #endif /* ndef F_OFD_SETLK */
2803 #ifdef F_OFD_SETLKW
2804 if (x == F_OFD_SETLKW)
2805 {*r = Mono_Posix_FcntlCommand_F_OFD_SETLKW; return 0;}
2806 #endif /* ndef F_OFD_SETLKW */
2807 #ifdef F_SETFD
2808 if (x == F_SETFD)
2809 {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
2810 #endif /* ndef F_SETFD */
2811 #ifdef F_SETFL
2812 if (x == F_SETFL)
2813 {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
2814 #endif /* ndef F_SETFL */
2815 #ifdef F_SETLEASE
2816 if (x == F_SETLEASE)
2817 {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
2818 #endif /* ndef F_SETLEASE */
2819 #ifdef F_SETLK
2820 if (x == F_SETLK)
2821 {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
2822 #endif /* ndef F_SETLK */
2823 #ifdef F_SETLKW
2824 if (x == F_SETLKW)
2825 {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
2826 #endif /* ndef F_SETLKW */
2827 #ifdef F_SETOWN
2828 if (x == F_SETOWN)
2829 {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
2830 #endif /* ndef F_SETOWN */
2831 #ifdef F_SETSIG
2832 if (x == F_SETSIG)
2833 {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
2834 #endif /* ndef F_SETSIG */
2835 errno = EINVAL; return -1;
2838 int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
2840 *r = 0;
2841 if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
2842 #ifdef ACCESSPERMS
2843 *r |= ACCESSPERMS;
2844 #else /* def ACCESSPERMS */
2845 {/* Ignoring Mono_Posix_FilePermissions_ACCESSPERMS, as it is constructed from other values */}
2846 #endif /* ndef ACCESSPERMS */
2847 if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
2848 #ifdef ALLPERMS
2849 *r |= ALLPERMS;
2850 #else /* def ALLPERMS */
2851 {/* Ignoring Mono_Posix_FilePermissions_ALLPERMS, as it is constructed from other values */}
2852 #endif /* ndef ALLPERMS */
2853 if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
2854 #ifdef DEFFILEMODE
2855 *r |= DEFFILEMODE;
2856 #else /* def DEFFILEMODE */
2857 {/* Ignoring Mono_Posix_FilePermissions_DEFFILEMODE, as it is constructed from other values */}
2858 #endif /* ndef DEFFILEMODE */
2859 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFBLK)
2860 #ifdef S_IFBLK
2861 *r |= S_IFBLK;
2862 #else /* def S_IFBLK */
2863 {errno = EINVAL; return -1;}
2864 #endif /* ndef S_IFBLK */
2865 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFCHR)
2866 #ifdef S_IFCHR
2867 *r |= S_IFCHR;
2868 #else /* def S_IFCHR */
2869 {errno = EINVAL; return -1;}
2870 #endif /* ndef S_IFCHR */
2871 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFDIR)
2872 #ifdef S_IFDIR
2873 *r |= S_IFDIR;
2874 #else /* def S_IFDIR */
2875 {errno = EINVAL; return -1;}
2876 #endif /* ndef S_IFDIR */
2877 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFIFO)
2878 #ifdef S_IFIFO
2879 *r |= S_IFIFO;
2880 #else /* def S_IFIFO */
2881 {errno = EINVAL; return -1;}
2882 #endif /* ndef S_IFIFO */
2883 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFLNK)
2884 #ifdef S_IFLNK
2885 *r |= S_IFLNK;
2886 #else /* def S_IFLNK */
2887 {errno = EINVAL; return -1;}
2888 #endif /* ndef S_IFLNK */
2889 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
2890 #ifdef S_IFMT
2891 *r |= S_IFMT;
2892 #else /* def S_IFMT */
2893 {/* Ignoring Mono_Posix_FilePermissions_S_IFMT, as it is constructed from other values */}
2894 #endif /* ndef S_IFMT */
2895 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFREG)
2896 #ifdef S_IFREG
2897 *r |= S_IFREG;
2898 #else /* def S_IFREG */
2899 {errno = EINVAL; return -1;}
2900 #endif /* ndef S_IFREG */
2901 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFSOCK)
2902 #ifdef S_IFSOCK
2903 *r |= S_IFSOCK;
2904 #else /* def S_IFSOCK */
2905 {errno = EINVAL; return -1;}
2906 #endif /* ndef S_IFSOCK */
2907 if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
2908 #ifdef S_IRGRP
2909 *r |= S_IRGRP;
2910 #else /* def S_IRGRP */
2911 {errno = EINVAL; return -1;}
2912 #endif /* ndef S_IRGRP */
2913 if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
2914 #ifdef S_IROTH
2915 *r |= S_IROTH;
2916 #else /* def S_IROTH */
2917 {errno = EINVAL; return -1;}
2918 #endif /* ndef S_IROTH */
2919 if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
2920 #ifdef S_IRUSR
2921 *r |= S_IRUSR;
2922 #else /* def S_IRUSR */
2923 {errno = EINVAL; return -1;}
2924 #endif /* ndef S_IRUSR */
2925 if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
2926 #ifdef S_IRWXG
2927 *r |= S_IRWXG;
2928 #else /* def S_IRWXG */
2929 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXG, as it is constructed from other values */}
2930 #endif /* ndef S_IRWXG */
2931 if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
2932 #ifdef S_IRWXO
2933 *r |= S_IRWXO;
2934 #else /* def S_IRWXO */
2935 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXO, as it is constructed from other values */}
2936 #endif /* ndef S_IRWXO */
2937 if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
2938 #ifdef S_IRWXU
2939 *r |= S_IRWXU;
2940 #else /* def S_IRWXU */
2941 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXU, as it is constructed from other values */}
2942 #endif /* ndef S_IRWXU */
2943 if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
2944 #ifdef S_ISGID
2945 *r |= S_ISGID;
2946 #else /* def S_ISGID */
2947 {errno = EINVAL; return -1;}
2948 #endif /* ndef S_ISGID */
2949 if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
2950 #ifdef S_ISUID
2951 *r |= S_ISUID;
2952 #else /* def S_ISUID */
2953 {errno = EINVAL; return -1;}
2954 #endif /* ndef S_ISUID */
2955 if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
2956 #ifdef S_ISVTX
2957 *r |= S_ISVTX;
2958 #else /* def S_ISVTX */
2959 {errno = EINVAL; return -1;}
2960 #endif /* ndef S_ISVTX */
2961 if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
2962 #ifdef S_IWGRP
2963 *r |= S_IWGRP;
2964 #else /* def S_IWGRP */
2965 {errno = EINVAL; return -1;}
2966 #endif /* ndef S_IWGRP */
2967 if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
2968 #ifdef S_IWOTH
2969 *r |= S_IWOTH;
2970 #else /* def S_IWOTH */
2971 {errno = EINVAL; return -1;}
2972 #endif /* ndef S_IWOTH */
2973 if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
2974 #ifdef S_IWUSR
2975 *r |= S_IWUSR;
2976 #else /* def S_IWUSR */
2977 {errno = EINVAL; return -1;}
2978 #endif /* ndef S_IWUSR */
2979 if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
2980 #ifdef S_IXGRP
2981 *r |= S_IXGRP;
2982 #else /* def S_IXGRP */
2983 {errno = EINVAL; return -1;}
2984 #endif /* ndef S_IXGRP */
2985 if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
2986 #ifdef S_IXOTH
2987 *r |= S_IXOTH;
2988 #else /* def S_IXOTH */
2989 {errno = EINVAL; return -1;}
2990 #endif /* ndef S_IXOTH */
2991 if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
2992 #ifdef S_IXUSR
2993 *r |= S_IXUSR;
2994 #else /* def S_IXUSR */
2995 {errno = EINVAL; return -1;}
2996 #endif /* ndef S_IXUSR */
2997 if (x == 0)
2998 return 0;
2999 return 0;
3002 int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
3004 *r = 0;
3005 if (x == 0)
3006 return 0;
3007 #ifdef ACCESSPERMS
3008 if ((x & ACCESSPERMS) == ACCESSPERMS)
3009 *r |= Mono_Posix_FilePermissions_ACCESSPERMS;
3010 #endif /* ndef ACCESSPERMS */
3011 #ifdef ALLPERMS
3012 if ((x & ALLPERMS) == ALLPERMS)
3013 *r |= Mono_Posix_FilePermissions_ALLPERMS;
3014 #endif /* ndef ALLPERMS */
3015 #ifdef DEFFILEMODE
3016 if ((x & DEFFILEMODE) == DEFFILEMODE)
3017 *r |= Mono_Posix_FilePermissions_DEFFILEMODE;
3018 #endif /* ndef DEFFILEMODE */
3019 #ifdef S_IFBLK
3020 if ((x & S_IFMT) == S_IFBLK)
3021 *r |= Mono_Posix_FilePermissions_S_IFBLK;
3022 #endif /* ndef S_IFBLK */
3023 #ifdef S_IFCHR
3024 if ((x & S_IFMT) == S_IFCHR)
3025 *r |= Mono_Posix_FilePermissions_S_IFCHR;
3026 #endif /* ndef S_IFCHR */
3027 #ifdef S_IFDIR
3028 if ((x & S_IFMT) == S_IFDIR)
3029 *r |= Mono_Posix_FilePermissions_S_IFDIR;
3030 #endif /* ndef S_IFDIR */
3031 #ifdef S_IFIFO
3032 if ((x & S_IFMT) == S_IFIFO)
3033 *r |= Mono_Posix_FilePermissions_S_IFIFO;
3034 #endif /* ndef S_IFIFO */
3035 #ifdef S_IFLNK
3036 if ((x & S_IFMT) == S_IFLNK)
3037 *r |= Mono_Posix_FilePermissions_S_IFLNK;
3038 #endif /* ndef S_IFLNK */
3039 #ifdef S_IFMT
3040 if ((x & S_IFMT) == S_IFMT)
3041 *r |= Mono_Posix_FilePermissions_S_IFMT;
3042 #endif /* ndef S_IFMT */
3043 #ifdef S_IFREG
3044 if ((x & S_IFMT) == S_IFREG)
3045 *r |= Mono_Posix_FilePermissions_S_IFREG;
3046 #endif /* ndef S_IFREG */
3047 #ifdef S_IFSOCK
3048 if ((x & S_IFMT) == S_IFSOCK)
3049 *r |= Mono_Posix_FilePermissions_S_IFSOCK;
3050 #endif /* ndef S_IFSOCK */
3051 #ifdef S_IRGRP
3052 if ((x & S_IRGRP) == S_IRGRP)
3053 *r |= Mono_Posix_FilePermissions_S_IRGRP;
3054 #endif /* ndef S_IRGRP */
3055 #ifdef S_IROTH
3056 if ((x & S_IROTH) == S_IROTH)
3057 *r |= Mono_Posix_FilePermissions_S_IROTH;
3058 #endif /* ndef S_IROTH */
3059 #ifdef S_IRUSR
3060 if ((x & S_IRUSR) == S_IRUSR)
3061 *r |= Mono_Posix_FilePermissions_S_IRUSR;
3062 #endif /* ndef S_IRUSR */
3063 #ifdef S_IRWXG
3064 if ((x & S_IRWXG) == S_IRWXG)
3065 *r |= Mono_Posix_FilePermissions_S_IRWXG;
3066 #endif /* ndef S_IRWXG */
3067 #ifdef S_IRWXO
3068 if ((x & S_IRWXO) == S_IRWXO)
3069 *r |= Mono_Posix_FilePermissions_S_IRWXO;
3070 #endif /* ndef S_IRWXO */
3071 #ifdef S_IRWXU
3072 if ((x & S_IRWXU) == S_IRWXU)
3073 *r |= Mono_Posix_FilePermissions_S_IRWXU;
3074 #endif /* ndef S_IRWXU */
3075 #ifdef S_ISGID
3076 if ((x & S_ISGID) == S_ISGID)
3077 *r |= Mono_Posix_FilePermissions_S_ISGID;
3078 #endif /* ndef S_ISGID */
3079 #ifdef S_ISUID
3080 if ((x & S_ISUID) == S_ISUID)
3081 *r |= Mono_Posix_FilePermissions_S_ISUID;
3082 #endif /* ndef S_ISUID */
3083 #ifdef S_ISVTX
3084 if ((x & S_ISVTX) == S_ISVTX)
3085 *r |= Mono_Posix_FilePermissions_S_ISVTX;
3086 #endif /* ndef S_ISVTX */
3087 #ifdef S_IWGRP
3088 if ((x & S_IWGRP) == S_IWGRP)
3089 *r |= Mono_Posix_FilePermissions_S_IWGRP;
3090 #endif /* ndef S_IWGRP */
3091 #ifdef S_IWOTH
3092 if ((x & S_IWOTH) == S_IWOTH)
3093 *r |= Mono_Posix_FilePermissions_S_IWOTH;
3094 #endif /* ndef S_IWOTH */
3095 #ifdef S_IWUSR
3096 if ((x & S_IWUSR) == S_IWUSR)
3097 *r |= Mono_Posix_FilePermissions_S_IWUSR;
3098 #endif /* ndef S_IWUSR */
3099 #ifdef S_IXGRP
3100 if ((x & S_IXGRP) == S_IXGRP)
3101 *r |= Mono_Posix_FilePermissions_S_IXGRP;
3102 #endif /* ndef S_IXGRP */
3103 #ifdef S_IXOTH
3104 if ((x & S_IXOTH) == S_IXOTH)
3105 *r |= Mono_Posix_FilePermissions_S_IXOTH;
3106 #endif /* ndef S_IXOTH */
3107 #ifdef S_IXUSR
3108 if ((x & S_IXUSR) == S_IXUSR)
3109 *r |= Mono_Posix_FilePermissions_S_IXUSR;
3110 #endif /* ndef S_IXUSR */
3111 return 0;
3114 #ifdef HAVE_STRUCT_FLOCK
3116 Mono_Posix_FromFlock (struct Mono_Posix_Flock *from, struct flock *to)
3118 _cnm_return_val_if_overflow (off_t, from->l_start, -1);
3119 _cnm_return_val_if_overflow (off_t, from->l_len, -1);
3120 _cnm_return_val_if_overflow (pid_t, from->l_pid, -1);
3122 memset (to, 0, sizeof(*to));
3124 if (Mono_Posix_FromLockType (from->l_type, &to->l_type) != 0) {
3125 return -1;
3127 if (Mono_Posix_FromSeekFlags (from->l_whence, &to->l_whence) != 0) {
3128 return -1;
3130 to->l_start = from->l_start;
3131 to->l_len = from->l_len;
3132 to->l_pid = from->l_pid;
3134 return 0;
3136 #endif /* ndef HAVE_STRUCT_FLOCK */
3139 #ifdef HAVE_STRUCT_FLOCK
3141 Mono_Posix_ToFlock (struct flock *from, struct Mono_Posix_Flock *to)
3143 _cnm_return_val_if_overflow (gint64, from->l_start, -1);
3144 _cnm_return_val_if_overflow (gint64, from->l_len, -1);
3145 _cnm_return_val_if_overflow (int, from->l_pid, -1);
3147 memset (to, 0, sizeof(*to));
3149 if (Mono_Posix_ToLockType (from->l_type, &to->l_type) != 0) {
3150 return -1;
3152 if (Mono_Posix_ToSeekFlags (from->l_whence, &to->l_whence) != 0) {
3153 return -1;
3155 to->l_start = from->l_start;
3156 to->l_len = from->l_len;
3157 to->l_pid = from->l_pid;
3159 return 0;
3161 #endif /* ndef HAVE_STRUCT_FLOCK */
3164 #ifdef HAVE_STRUCT_IOVEC
3166 Mono_Posix_FromIovec (struct Mono_Posix_Iovec *from, struct iovec *to)
3168 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3170 memset (to, 0, sizeof(*to));
3172 to->iov_base = from->iov_base;
3173 to->iov_len = from->iov_len;
3175 return 0;
3177 #endif /* ndef HAVE_STRUCT_IOVEC */
3180 #ifdef HAVE_STRUCT_IOVEC
3182 Mono_Posix_ToIovec (struct iovec *from, struct Mono_Posix_Iovec *to)
3184 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3186 memset (to, 0, sizeof(*to));
3188 to->iov_base = from->iov_base;
3189 to->iov_len = from->iov_len;
3191 return 0;
3193 #endif /* ndef HAVE_STRUCT_IOVEC */
3196 #ifdef HAVE_STRUCT_LINGER
3198 Mono_Posix_FromLinger (struct Mono_Posix_Linger *from, struct linger *to)
3200 _cnm_return_val_if_overflow (int, from->l_onoff, -1);
3201 _cnm_return_val_if_overflow (int, from->l_linger, -1);
3203 memset (to, 0, sizeof(*to));
3205 to->l_onoff = from->l_onoff;
3206 to->l_linger = from->l_linger;
3208 return 0;
3210 #endif /* ndef HAVE_STRUCT_LINGER */
3213 #ifdef HAVE_STRUCT_LINGER
3215 Mono_Posix_ToLinger (struct linger *from, struct Mono_Posix_Linger *to)
3217 _cnm_return_val_if_overflow (int, from->l_onoff, -1);
3218 _cnm_return_val_if_overflow (int, from->l_linger, -1);
3220 memset (to, 0, sizeof(*to));
3222 to->l_onoff = from->l_onoff;
3223 to->l_linger = from->l_linger;
3225 return 0;
3227 #endif /* ndef HAVE_STRUCT_LINGER */
3230 int Mono_Posix_FromLockType (short x, short *r)
3232 *r = 0;
3233 if (x == Mono_Posix_LockType_F_RDLCK)
3234 #ifdef F_RDLCK
3235 {*r = F_RDLCK; return 0;}
3236 #else /* def F_RDLCK */
3237 {errno = EINVAL; return -1;}
3238 #endif /* ndef F_RDLCK */
3239 if (x == Mono_Posix_LockType_F_UNLCK)
3240 #ifdef F_UNLCK
3241 {*r = F_UNLCK; return 0;}
3242 #else /* def F_UNLCK */
3243 {errno = EINVAL; return -1;}
3244 #endif /* ndef F_UNLCK */
3245 if (x == Mono_Posix_LockType_F_WRLCK)
3246 #ifdef F_WRLCK
3247 {*r = F_WRLCK; return 0;}
3248 #else /* def F_WRLCK */
3249 {errno = EINVAL; return -1;}
3250 #endif /* ndef F_WRLCK */
3251 if (x == 0)
3252 return 0;
3253 errno = EINVAL; return -1;
3256 int Mono_Posix_ToLockType (short x, short *r)
3258 *r = 0;
3259 if (x == 0)
3260 return 0;
3261 #ifdef F_RDLCK
3262 if (x == F_RDLCK)
3263 {*r = Mono_Posix_LockType_F_RDLCK; return 0;}
3264 #endif /* ndef F_RDLCK */
3265 #ifdef F_UNLCK
3266 if (x == F_UNLCK)
3267 {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
3268 #endif /* ndef F_UNLCK */
3269 #ifdef F_WRLCK
3270 if (x == F_WRLCK)
3271 {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
3272 #endif /* ndef F_WRLCK */
3273 errno = EINVAL; return -1;
3276 int Mono_Posix_FromLockfCommand (int x, int *r)
3278 *r = 0;
3279 if (x == Mono_Posix_LockfCommand_F_LOCK)
3280 #ifdef F_LOCK
3281 {*r = F_LOCK; return 0;}
3282 #else /* def F_LOCK */
3283 {errno = EINVAL; return -1;}
3284 #endif /* ndef F_LOCK */
3285 if (x == Mono_Posix_LockfCommand_F_TEST)
3286 #ifdef F_TEST
3287 {*r = F_TEST; return 0;}
3288 #else /* def F_TEST */
3289 {errno = EINVAL; return -1;}
3290 #endif /* ndef F_TEST */
3291 if (x == Mono_Posix_LockfCommand_F_TLOCK)
3292 #ifdef F_TLOCK
3293 {*r = F_TLOCK; return 0;}
3294 #else /* def F_TLOCK */
3295 {errno = EINVAL; return -1;}
3296 #endif /* ndef F_TLOCK */
3297 if (x == Mono_Posix_LockfCommand_F_ULOCK)
3298 #ifdef F_ULOCK
3299 {*r = F_ULOCK; return 0;}
3300 #else /* def F_ULOCK */
3301 {errno = EINVAL; return -1;}
3302 #endif /* ndef F_ULOCK */
3303 if (x == 0)
3304 return 0;
3305 errno = EINVAL; return -1;
3308 int Mono_Posix_ToLockfCommand (int x, int *r)
3310 *r = 0;
3311 if (x == 0)
3312 return 0;
3313 #ifdef F_LOCK
3314 if (x == F_LOCK)
3315 {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
3316 #endif /* ndef F_LOCK */
3317 #ifdef F_TEST
3318 if (x == F_TEST)
3319 {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
3320 #endif /* ndef F_TEST */
3321 #ifdef F_TLOCK
3322 if (x == F_TLOCK)
3323 {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
3324 #endif /* ndef F_TLOCK */
3325 #ifdef F_ULOCK
3326 if (x == F_ULOCK)
3327 {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
3328 #endif /* ndef F_ULOCK */
3329 errno = EINVAL; return -1;
3332 int Mono_Posix_FromMessageFlags (int x, int *r)
3334 *r = 0;
3335 if ((x & Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC) == Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC)
3336 #ifdef MSG_CMSG_CLOEXEC
3337 *r |= MSG_CMSG_CLOEXEC;
3338 #else /* def MSG_CMSG_CLOEXEC */
3339 {errno = EINVAL; return -1;}
3340 #endif /* ndef MSG_CMSG_CLOEXEC */
3341 if ((x & Mono_Posix_MessageFlags_MSG_CONFIRM) == Mono_Posix_MessageFlags_MSG_CONFIRM)
3342 #ifdef MSG_CONFIRM
3343 *r |= MSG_CONFIRM;
3344 #else /* def MSG_CONFIRM */
3345 {errno = EINVAL; return -1;}
3346 #endif /* ndef MSG_CONFIRM */
3347 if ((x & Mono_Posix_MessageFlags_MSG_CTRUNC) == Mono_Posix_MessageFlags_MSG_CTRUNC)
3348 #ifdef MSG_CTRUNC
3349 *r |= MSG_CTRUNC;
3350 #else /* def MSG_CTRUNC */
3351 {errno = EINVAL; return -1;}
3352 #endif /* ndef MSG_CTRUNC */
3353 if ((x & Mono_Posix_MessageFlags_MSG_DONTROUTE) == Mono_Posix_MessageFlags_MSG_DONTROUTE)
3354 #ifdef MSG_DONTROUTE
3355 *r |= MSG_DONTROUTE;
3356 #else /* def MSG_DONTROUTE */
3357 {errno = EINVAL; return -1;}
3358 #endif /* ndef MSG_DONTROUTE */
3359 if ((x & Mono_Posix_MessageFlags_MSG_DONTWAIT) == Mono_Posix_MessageFlags_MSG_DONTWAIT)
3360 #ifdef MSG_DONTWAIT
3361 *r |= MSG_DONTWAIT;
3362 #else /* def MSG_DONTWAIT */
3363 {errno = EINVAL; return -1;}
3364 #endif /* ndef MSG_DONTWAIT */
3365 if ((x & Mono_Posix_MessageFlags_MSG_EOR) == Mono_Posix_MessageFlags_MSG_EOR)
3366 #ifdef MSG_EOR
3367 *r |= MSG_EOR;
3368 #else /* def MSG_EOR */
3369 {errno = EINVAL; return -1;}
3370 #endif /* ndef MSG_EOR */
3371 if ((x & Mono_Posix_MessageFlags_MSG_ERRQUEUE) == Mono_Posix_MessageFlags_MSG_ERRQUEUE)
3372 #ifdef MSG_ERRQUEUE
3373 *r |= MSG_ERRQUEUE;
3374 #else /* def MSG_ERRQUEUE */
3375 {errno = EINVAL; return -1;}
3376 #endif /* ndef MSG_ERRQUEUE */
3377 if ((x & Mono_Posix_MessageFlags_MSG_FASTOPEN) == Mono_Posix_MessageFlags_MSG_FASTOPEN)
3378 #ifdef MSG_FASTOPEN
3379 *r |= MSG_FASTOPEN;
3380 #else /* def MSG_FASTOPEN */
3381 {errno = EINVAL; return -1;}
3382 #endif /* ndef MSG_FASTOPEN */
3383 if ((x & Mono_Posix_MessageFlags_MSG_FIN) == Mono_Posix_MessageFlags_MSG_FIN)
3384 #ifdef MSG_FIN
3385 *r |= MSG_FIN;
3386 #else /* def MSG_FIN */
3387 {errno = EINVAL; return -1;}
3388 #endif /* ndef MSG_FIN */
3389 if ((x & Mono_Posix_MessageFlags_MSG_MORE) == Mono_Posix_MessageFlags_MSG_MORE)
3390 #ifdef MSG_MORE
3391 *r |= MSG_MORE;
3392 #else /* def MSG_MORE */
3393 {errno = EINVAL; return -1;}
3394 #endif /* ndef MSG_MORE */
3395 if ((x & Mono_Posix_MessageFlags_MSG_NOSIGNAL) == Mono_Posix_MessageFlags_MSG_NOSIGNAL)
3396 #ifdef MSG_NOSIGNAL
3397 *r |= MSG_NOSIGNAL;
3398 #else /* def MSG_NOSIGNAL */
3399 {errno = EINVAL; return -1;}
3400 #endif /* ndef MSG_NOSIGNAL */
3401 if ((x & Mono_Posix_MessageFlags_MSG_OOB) == Mono_Posix_MessageFlags_MSG_OOB)
3402 #ifdef MSG_OOB
3403 *r |= MSG_OOB;
3404 #else /* def MSG_OOB */
3405 {errno = EINVAL; return -1;}
3406 #endif /* ndef MSG_OOB */
3407 if ((x & Mono_Posix_MessageFlags_MSG_PEEK) == Mono_Posix_MessageFlags_MSG_PEEK)
3408 #ifdef MSG_PEEK
3409 *r |= MSG_PEEK;
3410 #else /* def MSG_PEEK */
3411 {errno = EINVAL; return -1;}
3412 #endif /* ndef MSG_PEEK */
3413 if ((x & Mono_Posix_MessageFlags_MSG_PROXY) == Mono_Posix_MessageFlags_MSG_PROXY)
3414 #ifdef MSG_PROXY
3415 *r |= MSG_PROXY;
3416 #else /* def MSG_PROXY */
3417 {errno = EINVAL; return -1;}
3418 #endif /* ndef MSG_PROXY */
3419 if ((x & Mono_Posix_MessageFlags_MSG_RST) == Mono_Posix_MessageFlags_MSG_RST)
3420 #ifdef MSG_RST
3421 *r |= MSG_RST;
3422 #else /* def MSG_RST */
3423 {errno = EINVAL; return -1;}
3424 #endif /* ndef MSG_RST */
3425 if ((x & Mono_Posix_MessageFlags_MSG_SYN) == Mono_Posix_MessageFlags_MSG_SYN)
3426 #ifdef MSG_SYN
3427 *r |= MSG_SYN;
3428 #else /* def MSG_SYN */
3429 {errno = EINVAL; return -1;}
3430 #endif /* ndef MSG_SYN */
3431 if ((x & Mono_Posix_MessageFlags_MSG_TRUNC) == Mono_Posix_MessageFlags_MSG_TRUNC)
3432 #ifdef MSG_TRUNC
3433 *r |= MSG_TRUNC;
3434 #else /* def MSG_TRUNC */
3435 {errno = EINVAL; return -1;}
3436 #endif /* ndef MSG_TRUNC */
3437 if ((x & Mono_Posix_MessageFlags_MSG_WAITALL) == Mono_Posix_MessageFlags_MSG_WAITALL)
3438 #ifdef MSG_WAITALL
3439 *r |= MSG_WAITALL;
3440 #else /* def MSG_WAITALL */
3441 {errno = EINVAL; return -1;}
3442 #endif /* ndef MSG_WAITALL */
3443 if ((x & Mono_Posix_MessageFlags_MSG_WAITFORONE) == Mono_Posix_MessageFlags_MSG_WAITFORONE)
3444 #ifdef MSG_WAITFORONE
3445 *r |= MSG_WAITFORONE;
3446 #else /* def MSG_WAITFORONE */
3447 {errno = EINVAL; return -1;}
3448 #endif /* ndef MSG_WAITFORONE */
3449 if (x == 0)
3450 return 0;
3451 return 0;
3454 int Mono_Posix_ToMessageFlags (int x, int *r)
3456 *r = 0;
3457 if (x == 0)
3458 return 0;
3459 #ifdef MSG_CMSG_CLOEXEC
3460 if ((x & MSG_CMSG_CLOEXEC) == MSG_CMSG_CLOEXEC)
3461 *r |= Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC;
3462 #endif /* ndef MSG_CMSG_CLOEXEC */
3463 #ifdef MSG_CONFIRM
3464 if ((x & MSG_CONFIRM) == MSG_CONFIRM)
3465 *r |= Mono_Posix_MessageFlags_MSG_CONFIRM;
3466 #endif /* ndef MSG_CONFIRM */
3467 #ifdef MSG_CTRUNC
3468 if ((x & MSG_CTRUNC) == MSG_CTRUNC)
3469 *r |= Mono_Posix_MessageFlags_MSG_CTRUNC;
3470 #endif /* ndef MSG_CTRUNC */
3471 #ifdef MSG_DONTROUTE
3472 if ((x & MSG_DONTROUTE) == MSG_DONTROUTE)
3473 *r |= Mono_Posix_MessageFlags_MSG_DONTROUTE;
3474 #endif /* ndef MSG_DONTROUTE */
3475 #ifdef MSG_DONTWAIT
3476 if ((x & MSG_DONTWAIT) == MSG_DONTWAIT)
3477 *r |= Mono_Posix_MessageFlags_MSG_DONTWAIT;
3478 #endif /* ndef MSG_DONTWAIT */
3479 #ifdef MSG_EOR
3480 if ((x & MSG_EOR) == MSG_EOR)
3481 *r |= Mono_Posix_MessageFlags_MSG_EOR;
3482 #endif /* ndef MSG_EOR */
3483 #ifdef MSG_ERRQUEUE
3484 if ((x & MSG_ERRQUEUE) == MSG_ERRQUEUE)
3485 *r |= Mono_Posix_MessageFlags_MSG_ERRQUEUE;
3486 #endif /* ndef MSG_ERRQUEUE */
3487 #ifdef MSG_FASTOPEN
3488 if ((x & MSG_FASTOPEN) == MSG_FASTOPEN)
3489 *r |= Mono_Posix_MessageFlags_MSG_FASTOPEN;
3490 #endif /* ndef MSG_FASTOPEN */
3491 #ifdef MSG_FIN
3492 if ((x & MSG_FIN) == MSG_FIN)
3493 *r |= Mono_Posix_MessageFlags_MSG_FIN;
3494 #endif /* ndef MSG_FIN */
3495 #ifdef MSG_MORE
3496 if ((x & MSG_MORE) == MSG_MORE)
3497 *r |= Mono_Posix_MessageFlags_MSG_MORE;
3498 #endif /* ndef MSG_MORE */
3499 #ifdef MSG_NOSIGNAL
3500 if ((x & MSG_NOSIGNAL) == MSG_NOSIGNAL)
3501 *r |= Mono_Posix_MessageFlags_MSG_NOSIGNAL;
3502 #endif /* ndef MSG_NOSIGNAL */
3503 #ifdef MSG_OOB
3504 if ((x & MSG_OOB) == MSG_OOB)
3505 *r |= Mono_Posix_MessageFlags_MSG_OOB;
3506 #endif /* ndef MSG_OOB */
3507 #ifdef MSG_PEEK
3508 if ((x & MSG_PEEK) == MSG_PEEK)
3509 *r |= Mono_Posix_MessageFlags_MSG_PEEK;
3510 #endif /* ndef MSG_PEEK */
3511 #ifdef MSG_PROXY
3512 if ((x & MSG_PROXY) == MSG_PROXY)
3513 *r |= Mono_Posix_MessageFlags_MSG_PROXY;
3514 #endif /* ndef MSG_PROXY */
3515 #ifdef MSG_RST
3516 if ((x & MSG_RST) == MSG_RST)
3517 *r |= Mono_Posix_MessageFlags_MSG_RST;
3518 #endif /* ndef MSG_RST */
3519 #ifdef MSG_SYN
3520 if ((x & MSG_SYN) == MSG_SYN)
3521 *r |= Mono_Posix_MessageFlags_MSG_SYN;
3522 #endif /* ndef MSG_SYN */
3523 #ifdef MSG_TRUNC
3524 if ((x & MSG_TRUNC) == MSG_TRUNC)
3525 *r |= Mono_Posix_MessageFlags_MSG_TRUNC;
3526 #endif /* ndef MSG_TRUNC */
3527 #ifdef MSG_WAITALL
3528 if ((x & MSG_WAITALL) == MSG_WAITALL)
3529 *r |= Mono_Posix_MessageFlags_MSG_WAITALL;
3530 #endif /* ndef MSG_WAITALL */
3531 #ifdef MSG_WAITFORONE
3532 if ((x & MSG_WAITFORONE) == MSG_WAITFORONE)
3533 *r |= Mono_Posix_MessageFlags_MSG_WAITFORONE;
3534 #endif /* ndef MSG_WAITFORONE */
3535 return 0;
3538 int Mono_Posix_FromMlockallFlags (int x, int *r)
3540 *r = 0;
3541 if ((x & Mono_Posix_MlockallFlags_MCL_CURRENT) == Mono_Posix_MlockallFlags_MCL_CURRENT)
3542 #ifdef MCL_CURRENT
3543 *r |= MCL_CURRENT;
3544 #else /* def MCL_CURRENT */
3545 {errno = EINVAL; return -1;}
3546 #endif /* ndef MCL_CURRENT */
3547 if ((x & Mono_Posix_MlockallFlags_MCL_FUTURE) == Mono_Posix_MlockallFlags_MCL_FUTURE)
3548 #ifdef MCL_FUTURE
3549 *r |= MCL_FUTURE;
3550 #else /* def MCL_FUTURE */
3551 {errno = EINVAL; return -1;}
3552 #endif /* ndef MCL_FUTURE */
3553 if (x == 0)
3554 return 0;
3555 return 0;
3558 int Mono_Posix_ToMlockallFlags (int x, int *r)
3560 *r = 0;
3561 if (x == 0)
3562 return 0;
3563 #ifdef MCL_CURRENT
3564 if ((x & MCL_CURRENT) == MCL_CURRENT)
3565 *r |= Mono_Posix_MlockallFlags_MCL_CURRENT;
3566 #endif /* ndef MCL_CURRENT */
3567 #ifdef MCL_FUTURE
3568 if ((x & MCL_FUTURE) == MCL_FUTURE)
3569 *r |= Mono_Posix_MlockallFlags_MCL_FUTURE;
3570 #endif /* ndef MCL_FUTURE */
3571 return 0;
3574 int Mono_Posix_FromMmapFlags (int x, int *r)
3576 *r = 0;
3577 if ((x & Mono_Posix_MmapFlags_MAP_ANON) == Mono_Posix_MmapFlags_MAP_ANON)
3578 #ifdef MAP_ANON
3579 *r |= MAP_ANON;
3580 #else /* def MAP_ANON */
3581 {errno = EINVAL; return -1;}
3582 #endif /* ndef MAP_ANON */
3583 if ((x & Mono_Posix_MmapFlags_MAP_ANONYMOUS) == Mono_Posix_MmapFlags_MAP_ANONYMOUS)
3584 #ifdef MAP_ANONYMOUS
3585 *r |= MAP_ANONYMOUS;
3586 #else /* def MAP_ANONYMOUS */
3587 {errno = EINVAL; return -1;}
3588 #endif /* ndef MAP_ANONYMOUS */
3589 if ((x & Mono_Posix_MmapFlags_MAP_DENYWRITE) == Mono_Posix_MmapFlags_MAP_DENYWRITE)
3590 #ifdef MAP_DENYWRITE
3591 *r |= MAP_DENYWRITE;
3592 #else /* def MAP_DENYWRITE */
3593 {errno = EINVAL; return -1;}
3594 #endif /* ndef MAP_DENYWRITE */
3595 if ((x & Mono_Posix_MmapFlags_MAP_EXECUTABLE) == Mono_Posix_MmapFlags_MAP_EXECUTABLE)
3596 #ifdef MAP_EXECUTABLE
3597 *r |= MAP_EXECUTABLE;
3598 #else /* def MAP_EXECUTABLE */
3599 {errno = EINVAL; return -1;}
3600 #endif /* ndef MAP_EXECUTABLE */
3601 if ((x & Mono_Posix_MmapFlags_MAP_FILE) == Mono_Posix_MmapFlags_MAP_FILE)
3602 #ifdef MAP_FILE
3603 *r |= MAP_FILE;
3604 #else /* def MAP_FILE */
3605 {errno = EINVAL; return -1;}
3606 #endif /* ndef MAP_FILE */
3607 if ((x & Mono_Posix_MmapFlags_MAP_FIXED) == Mono_Posix_MmapFlags_MAP_FIXED)
3608 #ifdef MAP_FIXED
3609 *r |= MAP_FIXED;
3610 #else /* def MAP_FIXED */
3611 {errno = EINVAL; return -1;}
3612 #endif /* ndef MAP_FIXED */
3613 if ((x & Mono_Posix_MmapFlags_MAP_GROWSDOWN) == Mono_Posix_MmapFlags_MAP_GROWSDOWN)
3614 #ifdef MAP_GROWSDOWN
3615 *r |= MAP_GROWSDOWN;
3616 #else /* def MAP_GROWSDOWN */
3617 {errno = EINVAL; return -1;}
3618 #endif /* ndef MAP_GROWSDOWN */
3619 if ((x & Mono_Posix_MmapFlags_MAP_LOCKED) == Mono_Posix_MmapFlags_MAP_LOCKED)
3620 #ifdef MAP_LOCKED
3621 *r |= MAP_LOCKED;
3622 #else /* def MAP_LOCKED */
3623 {errno = EINVAL; return -1;}
3624 #endif /* ndef MAP_LOCKED */
3625 if ((x & Mono_Posix_MmapFlags_MAP_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK)
3626 #ifdef MAP_NONBLOCK
3627 *r |= MAP_NONBLOCK;
3628 #else /* def MAP_NONBLOCK */
3629 {errno = EINVAL; return -1;}
3630 #endif /* ndef MAP_NONBLOCK */
3631 if ((x & Mono_Posix_MmapFlags_MAP_NORESERVE) == Mono_Posix_MmapFlags_MAP_NORESERVE)
3632 #ifdef MAP_NORESERVE
3633 *r |= MAP_NORESERVE;
3634 #else /* def MAP_NORESERVE */
3635 {errno = EINVAL; return -1;}
3636 #endif /* ndef MAP_NORESERVE */
3637 if ((x & Mono_Posix_MmapFlags_MAP_POPULATE) == Mono_Posix_MmapFlags_MAP_POPULATE)
3638 #ifdef MAP_POPULATE
3639 *r |= MAP_POPULATE;
3640 #else /* def MAP_POPULATE */
3641 {errno = EINVAL; return -1;}
3642 #endif /* ndef MAP_POPULATE */
3643 if ((x & Mono_Posix_MmapFlags_MAP_PRIVATE) == Mono_Posix_MmapFlags_MAP_PRIVATE)
3644 #ifdef MAP_PRIVATE
3645 *r |= MAP_PRIVATE;
3646 #else /* def MAP_PRIVATE */
3647 {errno = EINVAL; return -1;}
3648 #endif /* ndef MAP_PRIVATE */
3649 if ((x & Mono_Posix_MmapFlags_MAP_SHARED) == Mono_Posix_MmapFlags_MAP_SHARED)
3650 #ifdef MAP_SHARED
3651 *r |= MAP_SHARED;
3652 #else /* def MAP_SHARED */
3653 {errno = EINVAL; return -1;}
3654 #endif /* ndef MAP_SHARED */
3655 if ((x & Mono_Posix_MmapFlags_MAP_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE)
3656 #ifdef MAP_TYPE
3657 *r |= MAP_TYPE;
3658 #else /* def MAP_TYPE */
3659 {errno = EINVAL; return -1;}
3660 #endif /* ndef MAP_TYPE */
3661 if (x == 0)
3662 return 0;
3663 return 0;
3666 int Mono_Posix_ToMmapFlags (int x, int *r)
3668 *r = 0;
3669 if (x == 0)
3670 return 0;
3671 #ifdef MAP_ANON
3672 if ((x & MAP_ANON) == MAP_ANON)
3673 *r |= Mono_Posix_MmapFlags_MAP_ANON;
3674 #endif /* ndef MAP_ANON */
3675 #ifdef MAP_ANONYMOUS
3676 if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
3677 *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
3678 #endif /* ndef MAP_ANONYMOUS */
3679 #ifdef MAP_DENYWRITE
3680 if ((x & MAP_DENYWRITE) == MAP_DENYWRITE)
3681 *r |= Mono_Posix_MmapFlags_MAP_DENYWRITE;
3682 #endif /* ndef MAP_DENYWRITE */
3683 #ifdef MAP_EXECUTABLE
3684 if ((x & MAP_EXECUTABLE) == MAP_EXECUTABLE)
3685 *r |= Mono_Posix_MmapFlags_MAP_EXECUTABLE;
3686 #endif /* ndef MAP_EXECUTABLE */
3687 #ifdef MAP_FILE
3688 if ((x & MAP_FILE) == MAP_FILE)
3689 *r |= Mono_Posix_MmapFlags_MAP_FILE;
3690 #endif /* ndef MAP_FILE */
3691 #ifdef MAP_FIXED
3692 if ((x & MAP_FIXED) == MAP_FIXED)
3693 *r |= Mono_Posix_MmapFlags_MAP_FIXED;
3694 #endif /* ndef MAP_FIXED */
3695 #ifdef MAP_GROWSDOWN
3696 if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
3697 *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
3698 #endif /* ndef MAP_GROWSDOWN */
3699 #ifdef MAP_LOCKED
3700 if ((x & MAP_LOCKED) == MAP_LOCKED)
3701 *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
3702 #endif /* ndef MAP_LOCKED */
3703 #ifdef MAP_NONBLOCK
3704 if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
3705 *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
3706 #endif /* ndef MAP_NONBLOCK */
3707 #ifdef MAP_NORESERVE
3708 if ((x & MAP_NORESERVE) == MAP_NORESERVE)
3709 *r |= Mono_Posix_MmapFlags_MAP_NORESERVE;
3710 #endif /* ndef MAP_NORESERVE */
3711 #ifdef MAP_POPULATE
3712 if ((x & MAP_POPULATE) == MAP_POPULATE)
3713 *r |= Mono_Posix_MmapFlags_MAP_POPULATE;
3714 #endif /* ndef MAP_POPULATE */
3715 #ifdef MAP_PRIVATE
3716 if ((x & MAP_PRIVATE) == MAP_PRIVATE)
3717 *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
3718 #endif /* ndef MAP_PRIVATE */
3719 #ifdef MAP_SHARED
3720 if ((x & MAP_SHARED) == MAP_SHARED)
3721 *r |= Mono_Posix_MmapFlags_MAP_SHARED;
3722 #endif /* ndef MAP_SHARED */
3723 #ifdef MAP_TYPE
3724 if ((x & MAP_TYPE) == MAP_TYPE)
3725 *r |= Mono_Posix_MmapFlags_MAP_TYPE;
3726 #endif /* ndef MAP_TYPE */
3727 return 0;
3730 int Mono_Posix_FromMmapProts (int x, int *r)
3732 *r = 0;
3733 if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
3734 #ifdef PROT_EXEC
3735 *r |= PROT_EXEC;
3736 #else /* def PROT_EXEC */
3737 {errno = EINVAL; return -1;}
3738 #endif /* ndef PROT_EXEC */
3739 if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
3740 #ifdef PROT_GROWSDOWN
3741 *r |= PROT_GROWSDOWN;
3742 #else /* def PROT_GROWSDOWN */
3743 {errno = EINVAL; return -1;}
3744 #endif /* ndef PROT_GROWSDOWN */
3745 if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
3746 #ifdef PROT_GROWSUP
3747 *r |= PROT_GROWSUP;
3748 #else /* def PROT_GROWSUP */
3749 {errno = EINVAL; return -1;}
3750 #endif /* ndef PROT_GROWSUP */
3751 if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
3752 #ifdef PROT_NONE
3753 *r |= PROT_NONE;
3754 #else /* def PROT_NONE */
3755 {errno = EINVAL; return -1;}
3756 #endif /* ndef PROT_NONE */
3757 if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
3758 #ifdef PROT_READ
3759 *r |= PROT_READ;
3760 #else /* def PROT_READ */
3761 {errno = EINVAL; return -1;}
3762 #endif /* ndef PROT_READ */
3763 if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
3764 #ifdef PROT_WRITE
3765 *r |= PROT_WRITE;
3766 #else /* def PROT_WRITE */
3767 {errno = EINVAL; return -1;}
3768 #endif /* ndef PROT_WRITE */
3769 if (x == 0)
3770 return 0;
3771 return 0;
3774 int Mono_Posix_ToMmapProts (int x, int *r)
3776 *r = 0;
3777 if (x == 0)
3778 return 0;
3779 #ifdef PROT_EXEC
3780 if ((x & PROT_EXEC) == PROT_EXEC)
3781 *r |= Mono_Posix_MmapProts_PROT_EXEC;
3782 #endif /* ndef PROT_EXEC */
3783 #ifdef PROT_GROWSDOWN
3784 if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
3785 *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
3786 #endif /* ndef PROT_GROWSDOWN */
3787 #ifdef PROT_GROWSUP
3788 if ((x & PROT_GROWSUP) == PROT_GROWSUP)
3789 *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
3790 #endif /* ndef PROT_GROWSUP */
3791 #ifdef PROT_NONE
3792 if ((x & PROT_NONE) == PROT_NONE)
3793 *r |= Mono_Posix_MmapProts_PROT_NONE;
3794 #endif /* ndef PROT_NONE */
3795 #ifdef PROT_READ
3796 if ((x & PROT_READ) == PROT_READ)
3797 *r |= Mono_Posix_MmapProts_PROT_READ;
3798 #endif /* ndef PROT_READ */
3799 #ifdef PROT_WRITE
3800 if ((x & PROT_WRITE) == PROT_WRITE)
3801 *r |= Mono_Posix_MmapProts_PROT_WRITE;
3802 #endif /* ndef PROT_WRITE */
3803 return 0;
3806 int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
3808 *r = 0;
3809 if ((x & Mono_Posix_MountFlags_ST_APPEND) == Mono_Posix_MountFlags_ST_APPEND)
3810 #ifdef ST_APPEND
3811 *r |= ST_APPEND;
3812 #else /* def ST_APPEND */
3813 {errno = EINVAL; return -1;}
3814 #endif /* ndef ST_APPEND */
3815 if ((x & Mono_Posix_MountFlags_ST_BIND) == Mono_Posix_MountFlags_ST_BIND)
3816 #ifdef ST_BIND
3817 *r |= ST_BIND;
3818 #else /* def ST_BIND */
3819 {errno = EINVAL; return -1;}
3820 #endif /* ndef ST_BIND */
3821 if ((x & Mono_Posix_MountFlags_ST_IMMUTABLE) == Mono_Posix_MountFlags_ST_IMMUTABLE)
3822 #ifdef ST_IMMUTABLE
3823 *r |= ST_IMMUTABLE;
3824 #else /* def ST_IMMUTABLE */
3825 {errno = EINVAL; return -1;}
3826 #endif /* ndef ST_IMMUTABLE */
3827 if ((x & Mono_Posix_MountFlags_ST_MANDLOCK) == Mono_Posix_MountFlags_ST_MANDLOCK)
3828 #ifdef ST_MANDLOCK
3829 *r |= ST_MANDLOCK;
3830 #else /* def ST_MANDLOCK */
3831 {errno = EINVAL; return -1;}
3832 #endif /* ndef ST_MANDLOCK */
3833 if ((x & Mono_Posix_MountFlags_ST_NOATIME) == Mono_Posix_MountFlags_ST_NOATIME)
3834 #ifdef ST_NOATIME
3835 *r |= ST_NOATIME;
3836 #else /* def ST_NOATIME */
3837 {errno = EINVAL; return -1;}
3838 #endif /* ndef ST_NOATIME */
3839 if ((x & Mono_Posix_MountFlags_ST_NODEV) == Mono_Posix_MountFlags_ST_NODEV)
3840 #ifdef ST_NODEV
3841 *r |= ST_NODEV;
3842 #else /* def ST_NODEV */
3843 {errno = EINVAL; return -1;}
3844 #endif /* ndef ST_NODEV */
3845 if ((x & Mono_Posix_MountFlags_ST_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME)
3846 #ifdef ST_NODIRATIME
3847 *r |= ST_NODIRATIME;
3848 #else /* def ST_NODIRATIME */
3849 {errno = EINVAL; return -1;}
3850 #endif /* ndef ST_NODIRATIME */
3851 if ((x & Mono_Posix_MountFlags_ST_NOEXEC) == Mono_Posix_MountFlags_ST_NOEXEC)
3852 #ifdef ST_NOEXEC
3853 *r |= ST_NOEXEC;
3854 #else /* def ST_NOEXEC */
3855 {errno = EINVAL; return -1;}
3856 #endif /* ndef ST_NOEXEC */
3857 if ((x & Mono_Posix_MountFlags_ST_NOSUID) == Mono_Posix_MountFlags_ST_NOSUID)
3858 #ifdef ST_NOSUID
3859 *r |= ST_NOSUID;
3860 #else /* def ST_NOSUID */
3861 {errno = EINVAL; return -1;}
3862 #endif /* ndef ST_NOSUID */
3863 if ((x & Mono_Posix_MountFlags_ST_RDONLY) == Mono_Posix_MountFlags_ST_RDONLY)
3864 #ifdef ST_RDONLY
3865 *r |= ST_RDONLY;
3866 #else /* def ST_RDONLY */
3867 {errno = EINVAL; return -1;}
3868 #endif /* ndef ST_RDONLY */
3869 if ((x & Mono_Posix_MountFlags_ST_REMOUNT) == Mono_Posix_MountFlags_ST_REMOUNT)
3870 #ifdef ST_REMOUNT
3871 *r |= ST_REMOUNT;
3872 #else /* def ST_REMOUNT */
3873 {errno = EINVAL; return -1;}
3874 #endif /* ndef ST_REMOUNT */
3875 if ((x & Mono_Posix_MountFlags_ST_SYNCHRONOUS) == Mono_Posix_MountFlags_ST_SYNCHRONOUS)
3876 #ifdef ST_SYNCHRONOUS
3877 *r |= ST_SYNCHRONOUS;
3878 #else /* def ST_SYNCHRONOUS */
3879 {errno = EINVAL; return -1;}
3880 #endif /* ndef ST_SYNCHRONOUS */
3881 if ((x & Mono_Posix_MountFlags_ST_WRITE) == Mono_Posix_MountFlags_ST_WRITE)
3882 #ifdef ST_WRITE
3883 *r |= ST_WRITE;
3884 #else /* def ST_WRITE */
3885 {errno = EINVAL; return -1;}
3886 #endif /* ndef ST_WRITE */
3887 if (x == 0)
3888 return 0;
3889 return 0;
3892 int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
3894 *r = 0;
3895 if (x == 0)
3896 return 0;
3897 #ifdef ST_APPEND
3898 if ((x & ST_APPEND) == ST_APPEND)
3899 *r |= Mono_Posix_MountFlags_ST_APPEND;
3900 #endif /* ndef ST_APPEND */
3901 #ifdef ST_BIND
3902 if ((x & ST_BIND) == ST_BIND)
3903 *r |= Mono_Posix_MountFlags_ST_BIND;
3904 #endif /* ndef ST_BIND */
3905 #ifdef ST_IMMUTABLE
3906 if ((x & ST_IMMUTABLE) == ST_IMMUTABLE)
3907 *r |= Mono_Posix_MountFlags_ST_IMMUTABLE;
3908 #endif /* ndef ST_IMMUTABLE */
3909 #ifdef ST_MANDLOCK
3910 if ((x & ST_MANDLOCK) == ST_MANDLOCK)
3911 *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
3912 #endif /* ndef ST_MANDLOCK */
3913 #ifdef ST_NOATIME
3914 if ((x & ST_NOATIME) == ST_NOATIME)
3915 *r |= Mono_Posix_MountFlags_ST_NOATIME;
3916 #endif /* ndef ST_NOATIME */
3917 #ifdef ST_NODEV
3918 if ((x & ST_NODEV) == ST_NODEV)
3919 *r |= Mono_Posix_MountFlags_ST_NODEV;
3920 #endif /* ndef ST_NODEV */
3921 #ifdef ST_NODIRATIME
3922 if ((x & ST_NODIRATIME) == ST_NODIRATIME)
3923 *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
3924 #endif /* ndef ST_NODIRATIME */
3925 #ifdef ST_NOEXEC
3926 if ((x & ST_NOEXEC) == ST_NOEXEC)
3927 *r |= Mono_Posix_MountFlags_ST_NOEXEC;
3928 #endif /* ndef ST_NOEXEC */
3929 #ifdef ST_NOSUID
3930 if ((x & ST_NOSUID) == ST_NOSUID)
3931 *r |= Mono_Posix_MountFlags_ST_NOSUID;
3932 #endif /* ndef ST_NOSUID */
3933 #ifdef ST_RDONLY
3934 if ((x & ST_RDONLY) == ST_RDONLY)
3935 *r |= Mono_Posix_MountFlags_ST_RDONLY;
3936 #endif /* ndef ST_RDONLY */
3937 #ifdef ST_REMOUNT
3938 if ((x & ST_REMOUNT) == ST_REMOUNT)
3939 *r |= Mono_Posix_MountFlags_ST_REMOUNT;
3940 #endif /* ndef ST_REMOUNT */
3941 #ifdef ST_SYNCHRONOUS
3942 if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
3943 *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
3944 #endif /* ndef ST_SYNCHRONOUS */
3945 #ifdef ST_WRITE
3946 if ((x & ST_WRITE) == ST_WRITE)
3947 *r |= Mono_Posix_MountFlags_ST_WRITE;
3948 #endif /* ndef ST_WRITE */
3949 return 0;
3952 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
3954 *r = 0;
3955 #ifndef __NetBSD__
3956 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3957 #ifdef MREMAP_MAYMOVE
3958 *r |= MREMAP_MAYMOVE;
3959 #else /* def MREMAP_MAYMOVE */
3960 {errno = EINVAL; return -1;}
3961 #endif /* ndef MREMAP_MAYMOVE */
3962 #else /* def __NetBSD__ */
3963 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) != Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3964 *r = MAP_FIXED;
3965 #endif /* def __NetBSD__ */
3966 if (x == 0)
3967 return 0;
3968 return 0;
3971 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
3973 *r = 0;
3974 #ifndef __NetBSD__
3975 if (x == 0)
3976 return 0;
3977 #ifdef MREMAP_MAYMOVE
3978 if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
3979 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3980 #endif /* ndef MREMAP_MAYMOVE */
3981 #else /* def __NetBSD__ */
3982 if ((x & MAP_FIXED) != MAP_FIXED)
3983 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3984 #endif
3985 return 0;
3988 int Mono_Posix_FromMsyncFlags (int x, int *r)
3990 *r = 0;
3991 if ((x & Mono_Posix_MsyncFlags_MS_ASYNC) == Mono_Posix_MsyncFlags_MS_ASYNC)
3992 #ifdef MS_ASYNC
3993 *r |= MS_ASYNC;
3994 #else /* def MS_ASYNC */
3995 {errno = EINVAL; return -1;}
3996 #endif /* ndef MS_ASYNC */
3997 if ((x & Mono_Posix_MsyncFlags_MS_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE)
3998 #ifdef MS_INVALIDATE
3999 *r |= MS_INVALIDATE;
4000 #else /* def MS_INVALIDATE */
4001 {errno = EINVAL; return -1;}
4002 #endif /* ndef MS_INVALIDATE */
4003 if ((x & Mono_Posix_MsyncFlags_MS_SYNC) == Mono_Posix_MsyncFlags_MS_SYNC)
4004 #ifdef MS_SYNC
4005 *r |= MS_SYNC;
4006 #else /* def MS_SYNC */
4007 {errno = EINVAL; return -1;}
4008 #endif /* ndef MS_SYNC */
4009 if (x == 0)
4010 return 0;
4011 return 0;
4014 int Mono_Posix_ToMsyncFlags (int x, int *r)
4016 *r = 0;
4017 if (x == 0)
4018 return 0;
4019 #ifdef MS_ASYNC
4020 if ((x & MS_ASYNC) == MS_ASYNC)
4021 *r |= Mono_Posix_MsyncFlags_MS_ASYNC;
4022 #endif /* ndef MS_ASYNC */
4023 #ifdef MS_INVALIDATE
4024 if ((x & MS_INVALIDATE) == MS_INVALIDATE)
4025 *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
4026 #endif /* ndef MS_INVALIDATE */
4027 #ifdef MS_SYNC
4028 if ((x & MS_SYNC) == MS_SYNC)
4029 *r |= Mono_Posix_MsyncFlags_MS_SYNC;
4030 #endif /* ndef MS_SYNC */
4031 return 0;
4034 int Mono_Posix_FromOpenFlags (int x, int *r)
4036 *r = 0;
4037 if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND)
4038 #ifdef O_APPEND
4039 *r |= O_APPEND;
4040 #else /* def O_APPEND */
4041 {errno = EINVAL; return -1;}
4042 #endif /* ndef O_APPEND */
4043 if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC)
4044 #ifdef O_ASYNC
4045 *r |= O_ASYNC;
4046 #else /* def O_ASYNC */
4047 {errno = EINVAL; return -1;}
4048 #endif /* ndef O_ASYNC */
4049 if ((x & Mono_Posix_OpenFlags_O_CLOEXEC) == Mono_Posix_OpenFlags_O_CLOEXEC)
4050 #ifdef O_CLOEXEC
4051 *r |= O_CLOEXEC;
4052 #else /* def O_CLOEXEC */
4053 {errno = EINVAL; return -1;}
4054 #endif /* ndef O_CLOEXEC */
4055 if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT)
4056 #ifdef O_CREAT
4057 *r |= O_CREAT;
4058 #else /* def O_CREAT */
4059 {errno = EINVAL; return -1;}
4060 #endif /* ndef O_CREAT */
4061 if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT)
4062 #ifdef O_DIRECT
4063 *r |= O_DIRECT;
4064 #else /* def O_DIRECT */
4065 {errno = EINVAL; return -1;}
4066 #endif /* ndef O_DIRECT */
4067 if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY)
4068 #ifdef O_DIRECTORY
4069 *r |= O_DIRECTORY;
4070 #else /* def O_DIRECTORY */
4071 {errno = EINVAL; return -1;}
4072 #endif /* ndef O_DIRECTORY */
4073 if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL)
4074 #ifdef O_EXCL
4075 *r |= O_EXCL;
4076 #else /* def O_EXCL */
4077 {errno = EINVAL; return -1;}
4078 #endif /* ndef O_EXCL */
4079 if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
4080 #ifdef O_LARGEFILE
4081 *r |= O_LARGEFILE;
4082 #else /* def O_LARGEFILE */
4083 {errno = EINVAL; return -1;}
4084 #endif /* ndef O_LARGEFILE */
4085 if ((x & Mono_Posix_OpenFlags_O_NOATIME) == Mono_Posix_OpenFlags_O_NOATIME)
4086 #ifdef O_NOATIME
4087 *r |= O_NOATIME;
4088 #else /* def O_NOATIME */
4089 {errno = EINVAL; return -1;}
4090 #endif /* ndef O_NOATIME */
4091 if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY)
4092 #ifdef O_NOCTTY
4093 *r |= O_NOCTTY;
4094 #else /* def O_NOCTTY */
4095 {errno = EINVAL; return -1;}
4096 #endif /* ndef O_NOCTTY */
4097 if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW)
4098 #ifdef O_NOFOLLOW
4099 *r |= O_NOFOLLOW;
4100 #else /* def O_NOFOLLOW */
4101 {errno = EINVAL; return -1;}
4102 #endif /* ndef O_NOFOLLOW */
4103 if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK)
4104 #ifdef O_NONBLOCK
4105 *r |= O_NONBLOCK;
4106 #else /* def O_NONBLOCK */
4107 {errno = EINVAL; return -1;}
4108 #endif /* ndef O_NONBLOCK */
4109 if ((x & Mono_Posix_OpenFlags_O_PATH) == Mono_Posix_OpenFlags_O_PATH)
4110 #ifdef O_PATH
4111 *r |= O_PATH;
4112 #else /* def O_PATH */
4113 {errno = EINVAL; return -1;}
4114 #endif /* ndef O_PATH */
4115 if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY)
4116 #ifdef O_RDONLY
4117 *r |= O_RDONLY;
4118 #else /* def O_RDONLY */
4119 {errno = EINVAL; return -1;}
4120 #endif /* ndef O_RDONLY */
4121 if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR)
4122 #ifdef O_RDWR
4123 *r |= O_RDWR;
4124 #else /* def O_RDWR */
4125 {errno = EINVAL; return -1;}
4126 #endif /* ndef O_RDWR */
4127 if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC)
4128 #ifdef O_SYNC
4129 *r |= O_SYNC;
4130 #else /* def O_SYNC */
4131 {errno = EINVAL; return -1;}
4132 #endif /* ndef O_SYNC */
4133 if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC)
4134 #ifdef O_TRUNC
4135 *r |= O_TRUNC;
4136 #else /* def O_TRUNC */
4137 {errno = EINVAL; return -1;}
4138 #endif /* ndef O_TRUNC */
4139 if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
4140 #ifdef O_WRONLY
4141 *r |= O_WRONLY;
4142 #else /* def O_WRONLY */
4143 {errno = EINVAL; return -1;}
4144 #endif /* ndef O_WRONLY */
4145 if (x == 0)
4146 return 0;
4147 return 0;
4150 int Mono_Posix_ToOpenFlags (int x, int *r)
4152 *r = 0;
4153 if (x == 0)
4154 return 0;
4155 #ifdef O_APPEND
4156 if ((x & O_APPEND) == O_APPEND)
4157 *r |= Mono_Posix_OpenFlags_O_APPEND;
4158 #endif /* ndef O_APPEND */
4159 #ifdef O_ASYNC
4160 if ((x & O_ASYNC) == O_ASYNC)
4161 *r |= Mono_Posix_OpenFlags_O_ASYNC;
4162 #endif /* ndef O_ASYNC */
4163 #ifdef O_CLOEXEC
4164 if ((x & O_CLOEXEC) == O_CLOEXEC)
4165 *r |= Mono_Posix_OpenFlags_O_CLOEXEC;
4166 #endif /* ndef O_CLOEXEC */
4167 #ifdef O_CREAT
4168 if ((x & O_CREAT) == O_CREAT)
4169 *r |= Mono_Posix_OpenFlags_O_CREAT;
4170 #endif /* ndef O_CREAT */
4171 #ifdef O_DIRECT
4172 if ((x & O_DIRECT) == O_DIRECT)
4173 *r |= Mono_Posix_OpenFlags_O_DIRECT;
4174 #endif /* ndef O_DIRECT */
4175 #ifdef O_DIRECTORY
4176 if ((x & O_DIRECTORY) == O_DIRECTORY)
4177 *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
4178 #endif /* ndef O_DIRECTORY */
4179 #ifdef O_EXCL
4180 if ((x & O_EXCL) == O_EXCL)
4181 *r |= Mono_Posix_OpenFlags_O_EXCL;
4182 #endif /* ndef O_EXCL */
4183 #ifdef O_LARGEFILE
4184 if ((x & O_LARGEFILE) == O_LARGEFILE)
4185 *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
4186 #endif /* ndef O_LARGEFILE */
4187 #ifdef O_NOATIME
4188 if ((x & O_NOATIME) == O_NOATIME)
4189 *r |= Mono_Posix_OpenFlags_O_NOATIME;
4190 #endif /* ndef O_NOATIME */
4191 #ifdef O_NOCTTY
4192 if ((x & O_NOCTTY) == O_NOCTTY)
4193 *r |= Mono_Posix_OpenFlags_O_NOCTTY;
4194 #endif /* ndef O_NOCTTY */
4195 #ifdef O_NOFOLLOW
4196 if ((x & O_NOFOLLOW) == O_NOFOLLOW)
4197 *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
4198 #endif /* ndef O_NOFOLLOW */
4199 #ifdef O_NONBLOCK
4200 if ((x & O_NONBLOCK) == O_NONBLOCK)
4201 *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
4202 #endif /* ndef O_NONBLOCK */
4203 #ifdef O_PATH
4204 if ((x & O_PATH) == O_PATH)
4205 *r |= Mono_Posix_OpenFlags_O_PATH;
4206 #endif /* ndef O_PATH */
4207 #ifdef O_RDONLY
4208 if ((x & O_RDONLY) == O_RDONLY)
4209 *r |= Mono_Posix_OpenFlags_O_RDONLY;
4210 #endif /* ndef O_RDONLY */
4211 #ifdef O_RDWR
4212 if ((x & O_RDWR) == O_RDWR)
4213 *r |= Mono_Posix_OpenFlags_O_RDWR;
4214 #endif /* ndef O_RDWR */
4215 #ifdef O_SYNC
4216 if ((x & O_SYNC) == O_SYNC)
4217 *r |= Mono_Posix_OpenFlags_O_SYNC;
4218 #endif /* ndef O_SYNC */
4219 #ifdef O_TRUNC
4220 if ((x & O_TRUNC) == O_TRUNC)
4221 *r |= Mono_Posix_OpenFlags_O_TRUNC;
4222 #endif /* ndef O_TRUNC */
4223 #ifdef O_WRONLY
4224 if ((x & O_WRONLY) == O_WRONLY)
4225 *r |= Mono_Posix_OpenFlags_O_WRONLY;
4226 #endif /* ndef O_WRONLY */
4227 return 0;
4230 int Mono_Posix_FromPathconfName (int x, int *r)
4232 *r = 0;
4233 if (x == Mono_Posix_PathconfName__PC_2_SYMLINKS)
4234 #ifdef _PC_2_SYMLINKS
4235 {*r = _PC_2_SYMLINKS; return 0;}
4236 #else /* def _PC_2_SYMLINKS */
4237 {errno = EINVAL; return -1;}
4238 #endif /* ndef _PC_2_SYMLINKS */
4239 if (x == Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN)
4240 #ifdef _PC_ALLOC_SIZE_MIN
4241 {*r = _PC_ALLOC_SIZE_MIN; return 0;}
4242 #else /* def _PC_ALLOC_SIZE_MIN */
4243 {errno = EINVAL; return -1;}
4244 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4245 if (x == Mono_Posix_PathconfName__PC_ASYNC_IO)
4246 #ifdef _PC_ASYNC_IO
4247 {*r = _PC_ASYNC_IO; return 0;}
4248 #else /* def _PC_ASYNC_IO */
4249 {errno = EINVAL; return -1;}
4250 #endif /* ndef _PC_ASYNC_IO */
4251 if (x == Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED)
4252 #ifdef _PC_CHOWN_RESTRICTED
4253 {*r = _PC_CHOWN_RESTRICTED; return 0;}
4254 #else /* def _PC_CHOWN_RESTRICTED */
4255 {errno = EINVAL; return -1;}
4256 #endif /* ndef _PC_CHOWN_RESTRICTED */
4257 if (x == Mono_Posix_PathconfName__PC_FILESIZEBITS)
4258 #ifdef _PC_FILESIZEBITS
4259 {*r = _PC_FILESIZEBITS; return 0;}
4260 #else /* def _PC_FILESIZEBITS */
4261 {errno = EINVAL; return -1;}
4262 #endif /* ndef _PC_FILESIZEBITS */
4263 if (x == Mono_Posix_PathconfName__PC_LINK_MAX)
4264 #ifdef _PC_LINK_MAX
4265 {*r = _PC_LINK_MAX; return 0;}
4266 #else /* def _PC_LINK_MAX */
4267 {errno = EINVAL; return -1;}
4268 #endif /* ndef _PC_LINK_MAX */
4269 if (x == Mono_Posix_PathconfName__PC_MAX_CANON)
4270 #ifdef _PC_MAX_CANON
4271 {*r = _PC_MAX_CANON; return 0;}
4272 #else /* def _PC_MAX_CANON */
4273 {errno = EINVAL; return -1;}
4274 #endif /* ndef _PC_MAX_CANON */
4275 if (x == Mono_Posix_PathconfName__PC_MAX_INPUT)
4276 #ifdef _PC_MAX_INPUT
4277 {*r = _PC_MAX_INPUT; return 0;}
4278 #else /* def _PC_MAX_INPUT */
4279 {errno = EINVAL; return -1;}
4280 #endif /* ndef _PC_MAX_INPUT */
4281 if (x == Mono_Posix_PathconfName__PC_NAME_MAX)
4282 #ifdef _PC_NAME_MAX
4283 {*r = _PC_NAME_MAX; return 0;}
4284 #else /* def _PC_NAME_MAX */
4285 {errno = EINVAL; return -1;}
4286 #endif /* ndef _PC_NAME_MAX */
4287 if (x == Mono_Posix_PathconfName__PC_NO_TRUNC)
4288 #ifdef _PC_NO_TRUNC
4289 {*r = _PC_NO_TRUNC; return 0;}
4290 #else /* def _PC_NO_TRUNC */
4291 {errno = EINVAL; return -1;}
4292 #endif /* ndef _PC_NO_TRUNC */
4293 if (x == Mono_Posix_PathconfName__PC_PATH_MAX)
4294 #ifdef _PC_PATH_MAX
4295 {*r = _PC_PATH_MAX; return 0;}
4296 #else /* def _PC_PATH_MAX */
4297 {errno = EINVAL; return -1;}
4298 #endif /* ndef _PC_PATH_MAX */
4299 if (x == Mono_Posix_PathconfName__PC_PIPE_BUF)
4300 #ifdef _PC_PIPE_BUF
4301 {*r = _PC_PIPE_BUF; return 0;}
4302 #else /* def _PC_PIPE_BUF */
4303 {errno = EINVAL; return -1;}
4304 #endif /* ndef _PC_PIPE_BUF */
4305 if (x == Mono_Posix_PathconfName__PC_PRIO_IO)
4306 #ifdef _PC_PRIO_IO
4307 {*r = _PC_PRIO_IO; return 0;}
4308 #else /* def _PC_PRIO_IO */
4309 {errno = EINVAL; return -1;}
4310 #endif /* ndef _PC_PRIO_IO */
4311 if (x == Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE)
4312 #ifdef _PC_REC_INCR_XFER_SIZE
4313 {*r = _PC_REC_INCR_XFER_SIZE; return 0;}
4314 #else /* def _PC_REC_INCR_XFER_SIZE */
4315 {errno = EINVAL; return -1;}
4316 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4317 if (x == Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE)
4318 #ifdef _PC_REC_MAX_XFER_SIZE
4319 {*r = _PC_REC_MAX_XFER_SIZE; return 0;}
4320 #else /* def _PC_REC_MAX_XFER_SIZE */
4321 {errno = EINVAL; return -1;}
4322 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4323 if (x == Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE)
4324 #ifdef _PC_REC_MIN_XFER_SIZE
4325 {*r = _PC_REC_MIN_XFER_SIZE; return 0;}
4326 #else /* def _PC_REC_MIN_XFER_SIZE */
4327 {errno = EINVAL; return -1;}
4328 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4329 if (x == Mono_Posix_PathconfName__PC_REC_XFER_ALIGN)
4330 #ifdef _PC_REC_XFER_ALIGN
4331 {*r = _PC_REC_XFER_ALIGN; return 0;}
4332 #else /* def _PC_REC_XFER_ALIGN */
4333 {errno = EINVAL; return -1;}
4334 #endif /* ndef _PC_REC_XFER_ALIGN */
4335 if (x == Mono_Posix_PathconfName__PC_SOCK_MAXBUF)
4336 #ifdef _PC_SOCK_MAXBUF
4337 {*r = _PC_SOCK_MAXBUF; return 0;}
4338 #else /* def _PC_SOCK_MAXBUF */
4339 {errno = EINVAL; return -1;}
4340 #endif /* ndef _PC_SOCK_MAXBUF */
4341 if (x == Mono_Posix_PathconfName__PC_SYMLINK_MAX)
4342 #ifdef _PC_SYMLINK_MAX
4343 {*r = _PC_SYMLINK_MAX; return 0;}
4344 #else /* def _PC_SYMLINK_MAX */
4345 {errno = EINVAL; return -1;}
4346 #endif /* ndef _PC_SYMLINK_MAX */
4347 if (x == Mono_Posix_PathconfName__PC_SYNC_IO)
4348 #ifdef _PC_SYNC_IO
4349 {*r = _PC_SYNC_IO; return 0;}
4350 #else /* def _PC_SYNC_IO */
4351 {errno = EINVAL; return -1;}
4352 #endif /* ndef _PC_SYNC_IO */
4353 if (x == Mono_Posix_PathconfName__PC_VDISABLE)
4354 #ifdef _PC_VDISABLE
4355 {*r = _PC_VDISABLE; return 0;}
4356 #else /* def _PC_VDISABLE */
4357 {errno = EINVAL; return -1;}
4358 #endif /* ndef _PC_VDISABLE */
4359 if (x == 0)
4360 return 0;
4361 errno = EINVAL; return -1;
4364 int Mono_Posix_ToPathconfName (int x, int *r)
4366 *r = 0;
4367 if (x == 0)
4368 return 0;
4369 #ifdef _PC_2_SYMLINKS
4370 if (x == _PC_2_SYMLINKS)
4371 {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
4372 #endif /* ndef _PC_2_SYMLINKS */
4373 #ifdef _PC_ALLOC_SIZE_MIN
4374 if (x == _PC_ALLOC_SIZE_MIN)
4375 {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
4376 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4377 #ifdef _PC_ASYNC_IO
4378 if (x == _PC_ASYNC_IO)
4379 {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
4380 #endif /* ndef _PC_ASYNC_IO */
4381 #ifdef _PC_CHOWN_RESTRICTED
4382 if (x == _PC_CHOWN_RESTRICTED)
4383 {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
4384 #endif /* ndef _PC_CHOWN_RESTRICTED */
4385 #ifdef _PC_FILESIZEBITS
4386 if (x == _PC_FILESIZEBITS)
4387 {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
4388 #endif /* ndef _PC_FILESIZEBITS */
4389 #ifdef _PC_LINK_MAX
4390 if (x == _PC_LINK_MAX)
4391 {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
4392 #endif /* ndef _PC_LINK_MAX */
4393 #ifdef _PC_MAX_CANON
4394 if (x == _PC_MAX_CANON)
4395 {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
4396 #endif /* ndef _PC_MAX_CANON */
4397 #ifdef _PC_MAX_INPUT
4398 if (x == _PC_MAX_INPUT)
4399 {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
4400 #endif /* ndef _PC_MAX_INPUT */
4401 #ifdef _PC_NAME_MAX
4402 if (x == _PC_NAME_MAX)
4403 {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
4404 #endif /* ndef _PC_NAME_MAX */
4405 #ifdef _PC_NO_TRUNC
4406 if (x == _PC_NO_TRUNC)
4407 {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
4408 #endif /* ndef _PC_NO_TRUNC */
4409 #ifdef _PC_PATH_MAX
4410 if (x == _PC_PATH_MAX)
4411 {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
4412 #endif /* ndef _PC_PATH_MAX */
4413 #ifdef _PC_PIPE_BUF
4414 if (x == _PC_PIPE_BUF)
4415 {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
4416 #endif /* ndef _PC_PIPE_BUF */
4417 #ifdef _PC_PRIO_IO
4418 if (x == _PC_PRIO_IO)
4419 {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
4420 #endif /* ndef _PC_PRIO_IO */
4421 #ifdef _PC_REC_INCR_XFER_SIZE
4422 if (x == _PC_REC_INCR_XFER_SIZE)
4423 {*r = Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE; return 0;}
4424 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4425 #ifdef _PC_REC_MAX_XFER_SIZE
4426 if (x == _PC_REC_MAX_XFER_SIZE)
4427 {*r = Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE; return 0;}
4428 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4429 #ifdef _PC_REC_MIN_XFER_SIZE
4430 if (x == _PC_REC_MIN_XFER_SIZE)
4431 {*r = Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE; return 0;}
4432 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4433 #ifdef _PC_REC_XFER_ALIGN
4434 if (x == _PC_REC_XFER_ALIGN)
4435 {*r = Mono_Posix_PathconfName__PC_REC_XFER_ALIGN; return 0;}
4436 #endif /* ndef _PC_REC_XFER_ALIGN */
4437 #ifdef _PC_SOCK_MAXBUF
4438 if (x == _PC_SOCK_MAXBUF)
4439 {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
4440 #endif /* ndef _PC_SOCK_MAXBUF */
4441 #ifdef _PC_SYMLINK_MAX
4442 if (x == _PC_SYMLINK_MAX)
4443 {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
4444 #endif /* ndef _PC_SYMLINK_MAX */
4445 #ifdef _PC_SYNC_IO
4446 if (x == _PC_SYNC_IO)
4447 {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
4448 #endif /* ndef _PC_SYNC_IO */
4449 #ifdef _PC_VDISABLE
4450 if (x == _PC_VDISABLE)
4451 {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
4452 #endif /* ndef _PC_VDISABLE */
4453 errno = EINVAL; return -1;
4456 int Mono_Posix_FromPollEvents (short x, short *r)
4458 *r = 0;
4459 if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR)
4460 #ifdef POLLERR
4461 *r |= POLLERR;
4462 #else /* def POLLERR */
4463 {errno = EINVAL; return -1;}
4464 #endif /* ndef POLLERR */
4465 if ((x & Mono_Posix_PollEvents_POLLHUP) == Mono_Posix_PollEvents_POLLHUP)
4466 #ifdef POLLHUP
4467 *r |= POLLHUP;
4468 #else /* def POLLHUP */
4469 {errno = EINVAL; return -1;}
4470 #endif /* ndef POLLHUP */
4471 if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN)
4472 #ifdef POLLIN
4473 *r |= POLLIN;
4474 #else /* def POLLIN */
4475 {errno = EINVAL; return -1;}
4476 #endif /* ndef POLLIN */
4477 if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL)
4478 #ifdef POLLNVAL
4479 *r |= POLLNVAL;
4480 #else /* def POLLNVAL */
4481 {errno = EINVAL; return -1;}
4482 #endif /* ndef POLLNVAL */
4483 if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
4484 #ifdef POLLOUT
4485 *r |= POLLOUT;
4486 #else /* def POLLOUT */
4487 {errno = EINVAL; return -1;}
4488 #endif /* ndef POLLOUT */
4489 if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI)
4490 #ifdef POLLPRI
4491 *r |= POLLPRI;
4492 #else /* def POLLPRI */
4493 {errno = EINVAL; return -1;}
4494 #endif /* ndef POLLPRI */
4495 if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
4496 #ifdef POLLRDBAND
4497 *r |= POLLRDBAND;
4498 #else /* def POLLRDBAND */
4499 {errno = EINVAL; return -1;}
4500 #endif /* ndef POLLRDBAND */
4501 if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM)
4502 #ifdef POLLRDNORM
4503 *r |= POLLRDNORM;
4504 #else /* def POLLRDNORM */
4505 {errno = EINVAL; return -1;}
4506 #endif /* ndef POLLRDNORM */
4507 if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
4508 #ifdef POLLWRBAND
4509 *r |= POLLWRBAND;
4510 #else /* def POLLWRBAND */
4511 {errno = EINVAL; return -1;}
4512 #endif /* ndef POLLWRBAND */
4513 if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
4514 #ifdef POLLWRNORM
4515 *r |= POLLWRNORM;
4516 #else /* def POLLWRNORM */
4517 {errno = EINVAL; return -1;}
4518 #endif /* ndef POLLWRNORM */
4519 if (x == 0)
4520 return 0;
4521 return 0;
4524 int Mono_Posix_ToPollEvents (short x, short *r)
4526 *r = 0;
4527 if (x == 0)
4528 return 0;
4529 #ifdef POLLERR
4530 if ((x & POLLERR) == POLLERR)
4531 *r |= Mono_Posix_PollEvents_POLLERR;
4532 #endif /* ndef POLLERR */
4533 #ifdef POLLHUP
4534 if ((x & POLLHUP) == POLLHUP)
4535 *r |= Mono_Posix_PollEvents_POLLHUP;
4536 #endif /* ndef POLLHUP */
4537 #ifdef POLLIN
4538 if ((x & POLLIN) == POLLIN)
4539 *r |= Mono_Posix_PollEvents_POLLIN;
4540 #endif /* ndef POLLIN */
4541 #ifdef POLLNVAL
4542 if ((x & POLLNVAL) == POLLNVAL)
4543 *r |= Mono_Posix_PollEvents_POLLNVAL;
4544 #endif /* ndef POLLNVAL */
4545 #ifdef POLLOUT
4546 if ((x & POLLOUT) == POLLOUT)
4547 *r |= Mono_Posix_PollEvents_POLLOUT;
4548 #endif /* ndef POLLOUT */
4549 #ifdef POLLPRI
4550 if ((x & POLLPRI) == POLLPRI)
4551 *r |= Mono_Posix_PollEvents_POLLPRI;
4552 #endif /* ndef POLLPRI */
4553 #ifdef POLLRDBAND
4554 if ((x & POLLRDBAND) == POLLRDBAND)
4555 *r |= Mono_Posix_PollEvents_POLLRDBAND;
4556 #endif /* ndef POLLRDBAND */
4557 #ifdef POLLRDNORM
4558 if ((x & POLLRDNORM) == POLLRDNORM)
4559 *r |= Mono_Posix_PollEvents_POLLRDNORM;
4560 #endif /* ndef POLLRDNORM */
4561 #ifdef POLLWRBAND
4562 if ((x & POLLWRBAND) == POLLWRBAND)
4563 *r |= Mono_Posix_PollEvents_POLLWRBAND;
4564 #endif /* ndef POLLWRBAND */
4565 #ifdef POLLWRNORM
4566 if ((x & POLLWRNORM) == POLLWRNORM)
4567 *r |= Mono_Posix_PollEvents_POLLWRNORM;
4568 #endif /* ndef POLLWRNORM */
4569 return 0;
4572 #ifdef HAVE_STRUCT_POLLFD
4574 Mono_Posix_FromPollfd (struct Mono_Posix_Pollfd *from, struct pollfd *to)
4576 _cnm_return_val_if_overflow (int, from->fd, -1);
4578 memset (to, 0, sizeof(*to));
4580 to->fd = from->fd;
4581 if (Mono_Posix_FromPollEvents (from->events, &to->events) != 0) {
4582 return -1;
4584 if (Mono_Posix_FromPollEvents (from->revents, &to->revents) != 0) {
4585 return -1;
4588 return 0;
4590 #endif /* ndef HAVE_STRUCT_POLLFD */
4593 #ifdef HAVE_STRUCT_POLLFD
4595 Mono_Posix_ToPollfd (struct pollfd *from, struct Mono_Posix_Pollfd *to)
4597 _cnm_return_val_if_overflow (int, from->fd, -1);
4599 memset (to, 0, sizeof(*to));
4601 to->fd = from->fd;
4602 if (Mono_Posix_ToPollEvents (from->events, &to->events) != 0) {
4603 return -1;
4605 if (Mono_Posix_ToPollEvents (from->revents, &to->revents) != 0) {
4606 return -1;
4609 return 0;
4611 #endif /* ndef HAVE_STRUCT_POLLFD */
4614 int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
4616 *r = 0;
4617 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
4618 #ifdef POSIX_FADV_DONTNEED
4619 {*r = POSIX_FADV_DONTNEED; return 0;}
4620 #else /* def POSIX_FADV_DONTNEED */
4621 {errno = EINVAL; return -1;}
4622 #endif /* ndef POSIX_FADV_DONTNEED */
4623 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
4624 #ifdef POSIX_FADV_NOREUSE
4625 {*r = POSIX_FADV_NOREUSE; return 0;}
4626 #else /* def POSIX_FADV_NOREUSE */
4627 {errno = EINVAL; return -1;}
4628 #endif /* ndef POSIX_FADV_NOREUSE */
4629 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
4630 #ifdef POSIX_FADV_NORMAL
4631 {*r = POSIX_FADV_NORMAL; return 0;}
4632 #else /* def POSIX_FADV_NORMAL */
4633 {errno = EINVAL; return -1;}
4634 #endif /* ndef POSIX_FADV_NORMAL */
4635 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
4636 #ifdef POSIX_FADV_RANDOM
4637 {*r = POSIX_FADV_RANDOM; return 0;}
4638 #else /* def POSIX_FADV_RANDOM */
4639 {errno = EINVAL; return -1;}
4640 #endif /* ndef POSIX_FADV_RANDOM */
4641 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
4642 #ifdef POSIX_FADV_SEQUENTIAL
4643 {*r = POSIX_FADV_SEQUENTIAL; return 0;}
4644 #else /* def POSIX_FADV_SEQUENTIAL */
4645 {errno = EINVAL; return -1;}
4646 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4647 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
4648 #ifdef POSIX_FADV_WILLNEED
4649 {*r = POSIX_FADV_WILLNEED; return 0;}
4650 #else /* def POSIX_FADV_WILLNEED */
4651 {errno = EINVAL; return -1;}
4652 #endif /* ndef POSIX_FADV_WILLNEED */
4653 if (x == 0)
4654 return 0;
4655 errno = EINVAL; return -1;
4658 int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
4660 *r = 0;
4661 if (x == 0)
4662 return 0;
4663 #ifdef POSIX_FADV_DONTNEED
4664 if (x == POSIX_FADV_DONTNEED)
4665 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
4666 #endif /* ndef POSIX_FADV_DONTNEED */
4667 #ifdef POSIX_FADV_NOREUSE
4668 if (x == POSIX_FADV_NOREUSE)
4669 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
4670 #endif /* ndef POSIX_FADV_NOREUSE */
4671 #ifdef POSIX_FADV_NORMAL
4672 if (x == POSIX_FADV_NORMAL)
4673 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
4674 #endif /* ndef POSIX_FADV_NORMAL */
4675 #ifdef POSIX_FADV_RANDOM
4676 if (x == POSIX_FADV_RANDOM)
4677 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
4678 #endif /* ndef POSIX_FADV_RANDOM */
4679 #ifdef POSIX_FADV_SEQUENTIAL
4680 if (x == POSIX_FADV_SEQUENTIAL)
4681 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
4682 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4683 #ifdef POSIX_FADV_WILLNEED
4684 if (x == POSIX_FADV_WILLNEED)
4685 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
4686 #endif /* ndef POSIX_FADV_WILLNEED */
4687 errno = EINVAL; return -1;
4690 int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
4692 *r = 0;
4693 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
4694 #ifdef POSIX_MADV_DONTNEED
4695 {*r = POSIX_MADV_DONTNEED; return 0;}
4696 #else /* def POSIX_MADV_DONTNEED */
4697 {errno = EINVAL; return -1;}
4698 #endif /* ndef POSIX_MADV_DONTNEED */
4699 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
4700 #ifdef POSIX_MADV_NORMAL
4701 {*r = POSIX_MADV_NORMAL; return 0;}
4702 #else /* def POSIX_MADV_NORMAL */
4703 {errno = EINVAL; return -1;}
4704 #endif /* ndef POSIX_MADV_NORMAL */
4705 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
4706 #ifdef POSIX_MADV_RANDOM
4707 {*r = POSIX_MADV_RANDOM; return 0;}
4708 #else /* def POSIX_MADV_RANDOM */
4709 {errno = EINVAL; return -1;}
4710 #endif /* ndef POSIX_MADV_RANDOM */
4711 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
4712 #ifdef POSIX_MADV_SEQUENTIAL
4713 {*r = POSIX_MADV_SEQUENTIAL; return 0;}
4714 #else /* def POSIX_MADV_SEQUENTIAL */
4715 {errno = EINVAL; return -1;}
4716 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4717 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
4718 #ifdef POSIX_MADV_WILLNEED
4719 {*r = POSIX_MADV_WILLNEED; return 0;}
4720 #else /* def POSIX_MADV_WILLNEED */
4721 {errno = EINVAL; return -1;}
4722 #endif /* ndef POSIX_MADV_WILLNEED */
4723 if (x == 0)
4724 return 0;
4725 errno = EINVAL; return -1;
4728 int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
4730 *r = 0;
4731 if (x == 0)
4732 return 0;
4733 #ifdef POSIX_MADV_DONTNEED
4734 if (x == POSIX_MADV_DONTNEED)
4735 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
4736 #endif /* ndef POSIX_MADV_DONTNEED */
4737 #ifdef POSIX_MADV_NORMAL
4738 if (x == POSIX_MADV_NORMAL)
4739 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
4740 #endif /* ndef POSIX_MADV_NORMAL */
4741 #ifdef POSIX_MADV_RANDOM
4742 if (x == POSIX_MADV_RANDOM)
4743 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
4744 #endif /* ndef POSIX_MADV_RANDOM */
4745 #ifdef POSIX_MADV_SEQUENTIAL
4746 if (x == POSIX_MADV_SEQUENTIAL)
4747 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
4748 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4749 #ifdef POSIX_MADV_WILLNEED
4750 if (x == POSIX_MADV_WILLNEED)
4751 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
4752 #endif /* ndef POSIX_MADV_WILLNEED */
4753 errno = EINVAL; return -1;
4756 int Mono_Posix_FromSeekFlags (short x, short *r)
4758 *r = 0;
4759 if (x == Mono_Posix_SeekFlags_L_INCR)
4760 #ifdef L_INCR
4761 {*r = L_INCR; return 0;}
4762 #else /* def L_INCR */
4763 {errno = EINVAL; return -1;}
4764 #endif /* ndef L_INCR */
4765 if (x == Mono_Posix_SeekFlags_L_SET)
4766 #ifdef L_SET
4767 {*r = L_SET; return 0;}
4768 #else /* def L_SET */
4769 {errno = EINVAL; return -1;}
4770 #endif /* ndef L_SET */
4771 if (x == Mono_Posix_SeekFlags_L_XTND)
4772 #ifdef L_XTND
4773 {*r = L_XTND; return 0;}
4774 #else /* def L_XTND */
4775 {errno = EINVAL; return -1;}
4776 #endif /* ndef L_XTND */
4777 if (x == Mono_Posix_SeekFlags_SEEK_CUR)
4778 #ifdef SEEK_CUR
4779 {*r = SEEK_CUR; return 0;}
4780 #else /* def SEEK_CUR */
4781 {errno = EINVAL; return -1;}
4782 #endif /* ndef SEEK_CUR */
4783 if (x == Mono_Posix_SeekFlags_SEEK_END)
4784 #ifdef SEEK_END
4785 {*r = SEEK_END; return 0;}
4786 #else /* def SEEK_END */
4787 {errno = EINVAL; return -1;}
4788 #endif /* ndef SEEK_END */
4789 if (x == Mono_Posix_SeekFlags_SEEK_SET)
4790 #ifdef SEEK_SET
4791 {*r = SEEK_SET; return 0;}
4792 #else /* def SEEK_SET */
4793 {errno = EINVAL; return -1;}
4794 #endif /* ndef SEEK_SET */
4795 if (x == 0)
4796 return 0;
4797 errno = EINVAL; return -1;
4800 int Mono_Posix_ToSeekFlags (short x, short *r)
4802 *r = 0;
4803 if (x == 0)
4804 return 0;
4805 #ifdef L_INCR
4806 if (x == L_INCR)
4807 {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
4808 #endif /* ndef L_INCR */
4809 #ifdef L_SET
4810 if (x == L_SET)
4811 {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
4812 #endif /* ndef L_SET */
4813 #ifdef L_XTND
4814 if (x == L_XTND)
4815 {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
4816 #endif /* ndef L_XTND */
4817 #ifdef SEEK_CUR
4818 if (x == SEEK_CUR)
4819 {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
4820 #endif /* ndef SEEK_CUR */
4821 #ifdef SEEK_END
4822 if (x == SEEK_END)
4823 {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
4824 #endif /* ndef SEEK_END */
4825 #ifdef SEEK_SET
4826 if (x == SEEK_SET)
4827 {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
4828 #endif /* ndef SEEK_SET */
4829 errno = EINVAL; return -1;
4832 int Mono_Posix_FromShutdownOption (int x, int *r)
4834 *r = 0;
4835 if (x == Mono_Posix_ShutdownOption_SHUT_RD)
4836 #ifdef SHUT_RD
4837 {*r = SHUT_RD; return 0;}
4838 #else /* def SHUT_RD */
4839 {errno = EINVAL; return -1;}
4840 #endif /* ndef SHUT_RD */
4841 if (x == Mono_Posix_ShutdownOption_SHUT_RDWR)
4842 #ifdef SHUT_RDWR
4843 {*r = SHUT_RDWR; return 0;}
4844 #else /* def SHUT_RDWR */
4845 {errno = EINVAL; return -1;}
4846 #endif /* ndef SHUT_RDWR */
4847 if (x == Mono_Posix_ShutdownOption_SHUT_WR)
4848 #ifdef SHUT_WR
4849 {*r = SHUT_WR; return 0;}
4850 #else /* def SHUT_WR */
4851 {errno = EINVAL; return -1;}
4852 #endif /* ndef SHUT_WR */
4853 if (x == 0)
4854 return 0;
4855 errno = EINVAL; return -1;
4858 int Mono_Posix_ToShutdownOption (int x, int *r)
4860 *r = 0;
4861 if (x == 0)
4862 return 0;
4863 #ifdef SHUT_RD
4864 if (x == SHUT_RD)
4865 {*r = Mono_Posix_ShutdownOption_SHUT_RD; return 0;}
4866 #endif /* ndef SHUT_RD */
4867 #ifdef SHUT_RDWR
4868 if (x == SHUT_RDWR)
4869 {*r = Mono_Posix_ShutdownOption_SHUT_RDWR; return 0;}
4870 #endif /* ndef SHUT_RDWR */
4871 #ifdef SHUT_WR
4872 if (x == SHUT_WR)
4873 {*r = Mono_Posix_ShutdownOption_SHUT_WR; return 0;}
4874 #endif /* ndef SHUT_WR */
4875 errno = EINVAL; return -1;
4878 int Mono_Posix_FromSignum (int x, int *r)
4880 *r = 0;
4881 if (x == Mono_Posix_Signum_SIGABRT)
4882 #ifdef SIGABRT
4883 {*r = SIGABRT; return 0;}
4884 #else /* def SIGABRT */
4885 {errno = EINVAL; return -1;}
4886 #endif /* ndef SIGABRT */
4887 if (x == Mono_Posix_Signum_SIGALRM)
4888 #ifdef SIGALRM
4889 {*r = SIGALRM; return 0;}
4890 #else /* def SIGALRM */
4891 {errno = EINVAL; return -1;}
4892 #endif /* ndef SIGALRM */
4893 if (x == Mono_Posix_Signum_SIGBUS)
4894 #ifdef SIGBUS
4895 {*r = SIGBUS; return 0;}
4896 #else /* def SIGBUS */
4897 {errno = EINVAL; return -1;}
4898 #endif /* ndef SIGBUS */
4899 if (x == Mono_Posix_Signum_SIGCHLD)
4900 #ifdef SIGCHLD
4901 {*r = SIGCHLD; return 0;}
4902 #else /* def SIGCHLD */
4903 {errno = EINVAL; return -1;}
4904 #endif /* ndef SIGCHLD */
4905 if (x == Mono_Posix_Signum_SIGCLD)
4906 #ifdef SIGCLD
4907 {*r = SIGCLD; return 0;}
4908 #else /* def SIGCLD */
4909 {errno = EINVAL; return -1;}
4910 #endif /* ndef SIGCLD */
4911 if (x == Mono_Posix_Signum_SIGCONT)
4912 #ifdef SIGCONT
4913 {*r = SIGCONT; return 0;}
4914 #else /* def SIGCONT */
4915 {errno = EINVAL; return -1;}
4916 #endif /* ndef SIGCONT */
4917 if (x == Mono_Posix_Signum_SIGFPE)
4918 #ifdef SIGFPE
4919 {*r = SIGFPE; return 0;}
4920 #else /* def SIGFPE */
4921 {errno = EINVAL; return -1;}
4922 #endif /* ndef SIGFPE */
4923 if (x == Mono_Posix_Signum_SIGHUP)
4924 #ifdef SIGHUP
4925 {*r = SIGHUP; return 0;}
4926 #else /* def SIGHUP */
4927 {errno = EINVAL; return -1;}
4928 #endif /* ndef SIGHUP */
4929 if (x == Mono_Posix_Signum_SIGILL)
4930 #ifdef SIGILL
4931 {*r = SIGILL; return 0;}
4932 #else /* def SIGILL */
4933 {errno = EINVAL; return -1;}
4934 #endif /* ndef SIGILL */
4935 if (x == Mono_Posix_Signum_SIGINT)
4936 #ifdef SIGINT
4937 {*r = SIGINT; return 0;}
4938 #else /* def SIGINT */
4939 {errno = EINVAL; return -1;}
4940 #endif /* ndef SIGINT */
4941 if (x == Mono_Posix_Signum_SIGIO)
4942 #ifdef SIGIO
4943 {*r = SIGIO; return 0;}
4944 #else /* def SIGIO */
4945 {errno = EINVAL; return -1;}
4946 #endif /* ndef SIGIO */
4947 if (x == Mono_Posix_Signum_SIGIOT)
4948 #ifdef SIGIOT
4949 {*r = SIGIOT; return 0;}
4950 #else /* def SIGIOT */
4951 {errno = EINVAL; return -1;}
4952 #endif /* ndef SIGIOT */
4953 if (x == Mono_Posix_Signum_SIGKILL)
4954 #ifdef SIGKILL
4955 {*r = SIGKILL; return 0;}
4956 #else /* def SIGKILL */
4957 {errno = EINVAL; return -1;}
4958 #endif /* ndef SIGKILL */
4959 if (x == Mono_Posix_Signum_SIGPIPE)
4960 #ifdef SIGPIPE
4961 {*r = SIGPIPE; return 0;}
4962 #else /* def SIGPIPE */
4963 {errno = EINVAL; return -1;}
4964 #endif /* ndef SIGPIPE */
4965 if (x == Mono_Posix_Signum_SIGPOLL)
4966 #ifdef SIGPOLL
4967 {*r = SIGPOLL; return 0;}
4968 #else /* def SIGPOLL */
4969 {errno = EINVAL; return -1;}
4970 #endif /* ndef SIGPOLL */
4971 if (x == Mono_Posix_Signum_SIGPROF)
4972 #ifdef SIGPROF
4973 {*r = SIGPROF; return 0;}
4974 #else /* def SIGPROF */
4975 {errno = EINVAL; return -1;}
4976 #endif /* ndef SIGPROF */
4977 if (x == Mono_Posix_Signum_SIGPWR)
4978 #ifdef SIGPWR
4979 {*r = SIGPWR; return 0;}
4980 #else /* def SIGPWR */
4981 {errno = EINVAL; return -1;}
4982 #endif /* ndef SIGPWR */
4983 if (x == Mono_Posix_Signum_SIGQUIT)
4984 #ifdef SIGQUIT
4985 {*r = SIGQUIT; return 0;}
4986 #else /* def SIGQUIT */
4987 {errno = EINVAL; return -1;}
4988 #endif /* ndef SIGQUIT */
4989 if (x == Mono_Posix_Signum_SIGSEGV)
4990 #ifdef SIGSEGV
4991 {*r = SIGSEGV; return 0;}
4992 #else /* def SIGSEGV */
4993 {errno = EINVAL; return -1;}
4994 #endif /* ndef SIGSEGV */
4995 if (x == Mono_Posix_Signum_SIGSTKFLT)
4996 #ifdef SIGSTKFLT
4997 {*r = SIGSTKFLT; return 0;}
4998 #else /* def SIGSTKFLT */
4999 {errno = EINVAL; return -1;}
5000 #endif /* ndef SIGSTKFLT */
5001 if (x == Mono_Posix_Signum_SIGSTOP)
5002 #ifdef SIGSTOP
5003 {*r = SIGSTOP; return 0;}
5004 #else /* def SIGSTOP */
5005 {errno = EINVAL; return -1;}
5006 #endif /* ndef SIGSTOP */
5007 if (x == Mono_Posix_Signum_SIGSYS)
5008 #ifdef SIGSYS
5009 {*r = SIGSYS; return 0;}
5010 #else /* def SIGSYS */
5011 {errno = EINVAL; return -1;}
5012 #endif /* ndef SIGSYS */
5013 if (x == Mono_Posix_Signum_SIGTERM)
5014 #ifdef SIGTERM
5015 {*r = SIGTERM; return 0;}
5016 #else /* def SIGTERM */
5017 {errno = EINVAL; return -1;}
5018 #endif /* ndef SIGTERM */
5019 if (x == Mono_Posix_Signum_SIGTRAP)
5020 #ifdef SIGTRAP
5021 {*r = SIGTRAP; return 0;}
5022 #else /* def SIGTRAP */
5023 {errno = EINVAL; return -1;}
5024 #endif /* ndef SIGTRAP */
5025 if (x == Mono_Posix_Signum_SIGTSTP)
5026 #ifdef SIGTSTP
5027 {*r = SIGTSTP; return 0;}
5028 #else /* def SIGTSTP */
5029 {errno = EINVAL; return -1;}
5030 #endif /* ndef SIGTSTP */
5031 if (x == Mono_Posix_Signum_SIGTTIN)
5032 #ifdef SIGTTIN
5033 {*r = SIGTTIN; return 0;}
5034 #else /* def SIGTTIN */
5035 {errno = EINVAL; return -1;}
5036 #endif /* ndef SIGTTIN */
5037 if (x == Mono_Posix_Signum_SIGTTOU)
5038 #ifdef SIGTTOU
5039 {*r = SIGTTOU; return 0;}
5040 #else /* def SIGTTOU */
5041 {errno = EINVAL; return -1;}
5042 #endif /* ndef SIGTTOU */
5043 if (x == Mono_Posix_Signum_SIGUNUSED)
5044 #ifdef SIGUNUSED
5045 {*r = SIGUNUSED; return 0;}
5046 #else /* def SIGUNUSED */
5047 {errno = EINVAL; return -1;}
5048 #endif /* ndef SIGUNUSED */
5049 if (x == Mono_Posix_Signum_SIGURG)
5050 #ifdef SIGURG
5051 {*r = SIGURG; return 0;}
5052 #else /* def SIGURG */
5053 {errno = EINVAL; return -1;}
5054 #endif /* ndef SIGURG */
5055 if (x == Mono_Posix_Signum_SIGUSR1)
5056 #ifdef SIGUSR1
5057 {*r = SIGUSR1; return 0;}
5058 #else /* def SIGUSR1 */
5059 {errno = EINVAL; return -1;}
5060 #endif /* ndef SIGUSR1 */
5061 if (x == Mono_Posix_Signum_SIGUSR2)
5062 #ifdef SIGUSR2
5063 {*r = SIGUSR2; return 0;}
5064 #else /* def SIGUSR2 */
5065 {errno = EINVAL; return -1;}
5066 #endif /* ndef SIGUSR2 */
5067 if (x == Mono_Posix_Signum_SIGVTALRM)
5068 #ifdef SIGVTALRM
5069 {*r = SIGVTALRM; return 0;}
5070 #else /* def SIGVTALRM */
5071 {errno = EINVAL; return -1;}
5072 #endif /* ndef SIGVTALRM */
5073 if (x == Mono_Posix_Signum_SIGWINCH)
5074 #ifdef SIGWINCH
5075 {*r = SIGWINCH; return 0;}
5076 #else /* def SIGWINCH */
5077 {errno = EINVAL; return -1;}
5078 #endif /* ndef SIGWINCH */
5079 if (x == Mono_Posix_Signum_SIGXCPU)
5080 #ifdef SIGXCPU
5081 {*r = SIGXCPU; return 0;}
5082 #else /* def SIGXCPU */
5083 {errno = EINVAL; return -1;}
5084 #endif /* ndef SIGXCPU */
5085 if (x == Mono_Posix_Signum_SIGXFSZ)
5086 #ifdef SIGXFSZ
5087 {*r = SIGXFSZ; return 0;}
5088 #else /* def SIGXFSZ */
5089 {errno = EINVAL; return -1;}
5090 #endif /* ndef SIGXFSZ */
5091 if (x == 0)
5092 return 0;
5093 errno = EINVAL; return -1;
5096 int Mono_Posix_ToSignum (int x, int *r)
5098 *r = 0;
5099 if (x == 0)
5100 return 0;
5101 #ifdef SIGABRT
5102 if (x == SIGABRT)
5103 {*r = Mono_Posix_Signum_SIGABRT; return 0;}
5104 #endif /* ndef SIGABRT */
5105 #ifdef SIGALRM
5106 if (x == SIGALRM)
5107 {*r = Mono_Posix_Signum_SIGALRM; return 0;}
5108 #endif /* ndef SIGALRM */
5109 #ifdef SIGBUS
5110 if (x == SIGBUS)
5111 {*r = Mono_Posix_Signum_SIGBUS; return 0;}
5112 #endif /* ndef SIGBUS */
5113 #ifdef SIGCHLD
5114 if (x == SIGCHLD)
5115 {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
5116 #endif /* ndef SIGCHLD */
5117 #ifdef SIGCLD
5118 if (x == SIGCLD)
5119 {*r = Mono_Posix_Signum_SIGCLD; return 0;}
5120 #endif /* ndef SIGCLD */
5121 #ifdef SIGCONT
5122 if (x == SIGCONT)
5123 {*r = Mono_Posix_Signum_SIGCONT; return 0;}
5124 #endif /* ndef SIGCONT */
5125 #ifdef SIGFPE
5126 if (x == SIGFPE)
5127 {*r = Mono_Posix_Signum_SIGFPE; return 0;}
5128 #endif /* ndef SIGFPE */
5129 #ifdef SIGHUP
5130 if (x == SIGHUP)
5131 {*r = Mono_Posix_Signum_SIGHUP; return 0;}
5132 #endif /* ndef SIGHUP */
5133 #ifdef SIGILL
5134 if (x == SIGILL)
5135 {*r = Mono_Posix_Signum_SIGILL; return 0;}
5136 #endif /* ndef SIGILL */
5137 #ifdef SIGINT
5138 if (x == SIGINT)
5139 {*r = Mono_Posix_Signum_SIGINT; return 0;}
5140 #endif /* ndef SIGINT */
5141 #ifdef SIGIO
5142 if (x == SIGIO)
5143 {*r = Mono_Posix_Signum_SIGIO; return 0;}
5144 #endif /* ndef SIGIO */
5145 #ifdef SIGIOT
5146 if (x == SIGIOT)
5147 {*r = Mono_Posix_Signum_SIGIOT; return 0;}
5148 #endif /* ndef SIGIOT */
5149 #ifdef SIGKILL
5150 if (x == SIGKILL)
5151 {*r = Mono_Posix_Signum_SIGKILL; return 0;}
5152 #endif /* ndef SIGKILL */
5153 #ifdef SIGPIPE
5154 if (x == SIGPIPE)
5155 {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
5156 #endif /* ndef SIGPIPE */
5157 #ifdef SIGPOLL
5158 if (x == SIGPOLL)
5159 {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
5160 #endif /* ndef SIGPOLL */
5161 #ifdef SIGPROF
5162 if (x == SIGPROF)
5163 {*r = Mono_Posix_Signum_SIGPROF; return 0;}
5164 #endif /* ndef SIGPROF */
5165 #ifdef SIGPWR
5166 if (x == SIGPWR)
5167 {*r = Mono_Posix_Signum_SIGPWR; return 0;}
5168 #endif /* ndef SIGPWR */
5169 #ifdef SIGQUIT
5170 if (x == SIGQUIT)
5171 {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
5172 #endif /* ndef SIGQUIT */
5173 #ifdef SIGSEGV
5174 if (x == SIGSEGV)
5175 {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
5176 #endif /* ndef SIGSEGV */
5177 #ifdef SIGSTKFLT
5178 if (x == SIGSTKFLT)
5179 {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
5180 #endif /* ndef SIGSTKFLT */
5181 #ifdef SIGSTOP
5182 if (x == SIGSTOP)
5183 {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
5184 #endif /* ndef SIGSTOP */
5185 #ifdef SIGSYS
5186 if (x == SIGSYS)
5187 {*r = Mono_Posix_Signum_SIGSYS; return 0;}
5188 #endif /* ndef SIGSYS */
5189 #ifdef SIGTERM
5190 if (x == SIGTERM)
5191 {*r = Mono_Posix_Signum_SIGTERM; return 0;}
5192 #endif /* ndef SIGTERM */
5193 #ifdef SIGTRAP
5194 if (x == SIGTRAP)
5195 {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
5196 #endif /* ndef SIGTRAP */
5197 #ifdef SIGTSTP
5198 if (x == SIGTSTP)
5199 {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
5200 #endif /* ndef SIGTSTP */
5201 #ifdef SIGTTIN
5202 if (x == SIGTTIN)
5203 {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
5204 #endif /* ndef SIGTTIN */
5205 #ifdef SIGTTOU
5206 if (x == SIGTTOU)
5207 {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
5208 #endif /* ndef SIGTTOU */
5209 #ifdef SIGUNUSED
5210 if (x == SIGUNUSED)
5211 {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
5212 #endif /* ndef SIGUNUSED */
5213 #ifdef SIGURG
5214 if (x == SIGURG)
5215 {*r = Mono_Posix_Signum_SIGURG; return 0;}
5216 #endif /* ndef SIGURG */
5217 #ifdef SIGUSR1
5218 if (x == SIGUSR1)
5219 {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
5220 #endif /* ndef SIGUSR1 */
5221 #ifdef SIGUSR2
5222 if (x == SIGUSR2)
5223 {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
5224 #endif /* ndef SIGUSR2 */
5225 #ifdef SIGVTALRM
5226 if (x == SIGVTALRM)
5227 {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
5228 #endif /* ndef SIGVTALRM */
5229 #ifdef SIGWINCH
5230 if (x == SIGWINCH)
5231 {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
5232 #endif /* ndef SIGWINCH */
5233 #ifdef SIGXCPU
5234 if (x == SIGXCPU)
5235 {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
5236 #endif /* ndef SIGXCPU */
5237 #ifdef SIGXFSZ
5238 if (x == SIGXFSZ)
5239 {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
5240 #endif /* ndef SIGXFSZ */
5241 errno = EINVAL; return -1;
5244 #ifdef HAVE_STRUCT_SOCKADDR_IN
5246 Mono_Posix_FromSockaddrIn (struct Mono_Posix_SockaddrIn *from, struct sockaddr_in *to)
5248 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5250 memset (to, 0, sizeof(*to));
5252 to->sin_port = from->sin_port;
5253 if (Mono_Posix_FromInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5254 return -1;
5257 return 0;
5259 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5262 #ifdef HAVE_STRUCT_SOCKADDR_IN
5264 Mono_Posix_ToSockaddrIn (struct sockaddr_in *from, struct Mono_Posix_SockaddrIn *to)
5266 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5268 memset (to, 0, sizeof(*to));
5270 to->sin_port = from->sin_port;
5271 if (Mono_Posix_ToInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5272 return -1;
5275 return 0;
5277 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5280 #if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
5282 Mono_Posix_FromSockaddrIn6 (struct Mono_Posix_SockaddrIn6 *from, struct sockaddr_in6 *to)
5284 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5285 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5286 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5288 memset (to, 0, sizeof(*to));
5290 to->sin6_port = from->sin6_port;
5291 to->sin6_flowinfo = from->sin6_flowinfo;
5292 if (Mono_Posix_FromIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5293 return -1;
5295 to->sin6_scope_id = from->sin6_scope_id;
5297 return 0;
5299 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5302 #if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
5304 Mono_Posix_ToSockaddrIn6 (struct sockaddr_in6 *from, struct Mono_Posix_SockaddrIn6 *to)
5306 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5307 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5308 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5310 memset (to, 0, sizeof(*to));
5312 to->sin6_port = from->sin6_port;
5313 to->sin6_flowinfo = from->sin6_flowinfo;
5314 if (Mono_Posix_ToIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5315 return -1;
5317 to->sin6_scope_id = from->sin6_scope_id;
5319 return 0;
5321 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5324 int Mono_Posix_FromSockaddrType (int x, int *r)
5326 *r = 0;
5327 if (x == Mono_Posix_SockaddrType_Invalid)
5328 #ifdef Invalid
5329 {*r = Invalid; return 0;}
5330 #else /* def Invalid */
5331 {errno = EINVAL; return -1;}
5332 #endif /* ndef Invalid */
5333 if (x == Mono_Posix_SockaddrType_MustBeWrapped)
5334 #ifdef MustBeWrapped
5335 {*r = MustBeWrapped; return 0;}
5336 #else /* def MustBeWrapped */
5337 {errno = EINVAL; return -1;}
5338 #endif /* ndef MustBeWrapped */
5339 if (x == Mono_Posix_SockaddrType_Sockaddr)
5340 #ifdef Sockaddr
5341 {*r = Sockaddr; return 0;}
5342 #else /* def Sockaddr */
5343 {errno = EINVAL; return -1;}
5344 #endif /* ndef Sockaddr */
5345 if (x == Mono_Posix_SockaddrType_SockaddrIn)
5346 #ifdef SockaddrIn
5347 {*r = SockaddrIn; return 0;}
5348 #else /* def SockaddrIn */
5349 {errno = EINVAL; return -1;}
5350 #endif /* ndef SockaddrIn */
5351 if (x == Mono_Posix_SockaddrType_SockaddrIn6)
5352 #ifdef SockaddrIn6
5353 {*r = SockaddrIn6; return 0;}
5354 #else /* def SockaddrIn6 */
5355 {errno = EINVAL; return -1;}
5356 #endif /* ndef SockaddrIn6 */
5357 if (x == Mono_Posix_SockaddrType_SockaddrStorage)
5358 #ifdef SockaddrStorage
5359 {*r = SockaddrStorage; return 0;}
5360 #else /* def SockaddrStorage */
5361 {errno = EINVAL; return -1;}
5362 #endif /* ndef SockaddrStorage */
5363 if (x == Mono_Posix_SockaddrType_SockaddrUn)
5364 #ifdef SockaddrUn
5365 {*r = SockaddrUn; return 0;}
5366 #else /* def SockaddrUn */
5367 {errno = EINVAL; return -1;}
5368 #endif /* ndef SockaddrUn */
5369 if (x == 0)
5370 return 0;
5371 errno = EINVAL; return -1;
5374 int Mono_Posix_ToSockaddrType (int x, int *r)
5376 *r = 0;
5377 if (x == 0)
5378 return 0;
5379 #ifdef Invalid
5380 if (x == Invalid)
5381 {*r = Mono_Posix_SockaddrType_Invalid; return 0;}
5382 #endif /* ndef Invalid */
5383 #ifdef MustBeWrapped
5384 if (x == MustBeWrapped)
5385 {*r = Mono_Posix_SockaddrType_MustBeWrapped; return 0;}
5386 #endif /* ndef MustBeWrapped */
5387 #ifdef Sockaddr
5388 if (x == Sockaddr)
5389 {*r = Mono_Posix_SockaddrType_Sockaddr; return 0;}
5390 #endif /* ndef Sockaddr */
5391 #ifdef SockaddrIn
5392 if (x == SockaddrIn)
5393 {*r = Mono_Posix_SockaddrType_SockaddrIn; return 0;}
5394 #endif /* ndef SockaddrIn */
5395 #ifdef SockaddrIn6
5396 if (x == SockaddrIn6)
5397 {*r = Mono_Posix_SockaddrType_SockaddrIn6; return 0;}
5398 #endif /* ndef SockaddrIn6 */
5399 #ifdef SockaddrStorage
5400 if (x == SockaddrStorage)
5401 {*r = Mono_Posix_SockaddrType_SockaddrStorage; return 0;}
5402 #endif /* ndef SockaddrStorage */
5403 #ifdef SockaddrUn
5404 if (x == SockaddrUn)
5405 {*r = Mono_Posix_SockaddrType_SockaddrUn; return 0;}
5406 #endif /* ndef SockaddrUn */
5407 errno = EINVAL; return -1;
5410 int Mono_Posix_FromSysconfName (int x, int *r)
5412 *r = 0;
5413 if (x == Mono_Posix_SysconfName__SC_2_CHAR_TERM)
5414 #ifdef _SC_2_CHAR_TERM
5415 {*r = _SC_2_CHAR_TERM; return 0;}
5416 #else /* def _SC_2_CHAR_TERM */
5417 {errno = EINVAL; return -1;}
5418 #endif /* ndef _SC_2_CHAR_TERM */
5419 if (x == Mono_Posix_SysconfName__SC_2_C_BIND)
5420 #ifdef _SC_2_C_BIND
5421 {*r = _SC_2_C_BIND; return 0;}
5422 #else /* def _SC_2_C_BIND */
5423 {errno = EINVAL; return -1;}
5424 #endif /* ndef _SC_2_C_BIND */
5425 if (x == Mono_Posix_SysconfName__SC_2_C_DEV)
5426 #ifdef _SC_2_C_DEV
5427 {*r = _SC_2_C_DEV; return 0;}
5428 #else /* def _SC_2_C_DEV */
5429 {errno = EINVAL; return -1;}
5430 #endif /* ndef _SC_2_C_DEV */
5431 if (x == Mono_Posix_SysconfName__SC_2_C_VERSION)
5432 #ifdef _SC_2_C_VERSION
5433 {*r = _SC_2_C_VERSION; return 0;}
5434 #else /* def _SC_2_C_VERSION */
5435 {errno = EINVAL; return -1;}
5436 #endif /* ndef _SC_2_C_VERSION */
5437 if (x == Mono_Posix_SysconfName__SC_2_FORT_DEV)
5438 #ifdef _SC_2_FORT_DEV
5439 {*r = _SC_2_FORT_DEV; return 0;}
5440 #else /* def _SC_2_FORT_DEV */
5441 {errno = EINVAL; return -1;}
5442 #endif /* ndef _SC_2_FORT_DEV */
5443 if (x == Mono_Posix_SysconfName__SC_2_FORT_RUN)
5444 #ifdef _SC_2_FORT_RUN
5445 {*r = _SC_2_FORT_RUN; return 0;}
5446 #else /* def _SC_2_FORT_RUN */
5447 {errno = EINVAL; return -1;}
5448 #endif /* ndef _SC_2_FORT_RUN */
5449 if (x == Mono_Posix_SysconfName__SC_2_LOCALEDEF)
5450 #ifdef _SC_2_LOCALEDEF
5451 {*r = _SC_2_LOCALEDEF; return 0;}
5452 #else /* def _SC_2_LOCALEDEF */
5453 {errno = EINVAL; return -1;}
5454 #endif /* ndef _SC_2_LOCALEDEF */
5455 if (x == Mono_Posix_SysconfName__SC_2_PBS)
5456 #ifdef _SC_2_PBS
5457 {*r = _SC_2_PBS; return 0;}
5458 #else /* def _SC_2_PBS */
5459 {errno = EINVAL; return -1;}
5460 #endif /* ndef _SC_2_PBS */
5461 if (x == Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING)
5462 #ifdef _SC_2_PBS_ACCOUNTING
5463 {*r = _SC_2_PBS_ACCOUNTING; return 0;}
5464 #else /* def _SC_2_PBS_ACCOUNTING */
5465 {errno = EINVAL; return -1;}
5466 #endif /* ndef _SC_2_PBS_ACCOUNTING */
5467 if (x == Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT)
5468 #ifdef _SC_2_PBS_CHECKPOINT
5469 {*r = _SC_2_PBS_CHECKPOINT; return 0;}
5470 #else /* def _SC_2_PBS_CHECKPOINT */
5471 {errno = EINVAL; return -1;}
5472 #endif /* ndef _SC_2_PBS_CHECKPOINT */
5473 if (x == Mono_Posix_SysconfName__SC_2_PBS_LOCATE)
5474 #ifdef _SC_2_PBS_LOCATE
5475 {*r = _SC_2_PBS_LOCATE; return 0;}
5476 #else /* def _SC_2_PBS_LOCATE */
5477 {errno = EINVAL; return -1;}
5478 #endif /* ndef _SC_2_PBS_LOCATE */
5479 if (x == Mono_Posix_SysconfName__SC_2_PBS_MESSAGE)
5480 #ifdef _SC_2_PBS_MESSAGE
5481 {*r = _SC_2_PBS_MESSAGE; return 0;}
5482 #else /* def _SC_2_PBS_MESSAGE */
5483 {errno = EINVAL; return -1;}
5484 #endif /* ndef _SC_2_PBS_MESSAGE */
5485 if (x == Mono_Posix_SysconfName__SC_2_PBS_TRACK)
5486 #ifdef _SC_2_PBS_TRACK
5487 {*r = _SC_2_PBS_TRACK; return 0;}
5488 #else /* def _SC_2_PBS_TRACK */
5489 {errno = EINVAL; return -1;}
5490 #endif /* ndef _SC_2_PBS_TRACK */
5491 if (x == Mono_Posix_SysconfName__SC_2_SW_DEV)
5492 #ifdef _SC_2_SW_DEV
5493 {*r = _SC_2_SW_DEV; return 0;}
5494 #else /* def _SC_2_SW_DEV */
5495 {errno = EINVAL; return -1;}
5496 #endif /* ndef _SC_2_SW_DEV */
5497 if (x == Mono_Posix_SysconfName__SC_2_UPE)
5498 #ifdef _SC_2_UPE
5499 {*r = _SC_2_UPE; return 0;}
5500 #else /* def _SC_2_UPE */
5501 {errno = EINVAL; return -1;}
5502 #endif /* ndef _SC_2_UPE */
5503 if (x == Mono_Posix_SysconfName__SC_2_VERSION)
5504 #ifdef _SC_2_VERSION
5505 {*r = _SC_2_VERSION; return 0;}
5506 #else /* def _SC_2_VERSION */
5507 {errno = EINVAL; return -1;}
5508 #endif /* ndef _SC_2_VERSION */
5509 if (x == Mono_Posix_SysconfName__SC_ADVISORY_INFO)
5510 #ifdef _SC_ADVISORY_INFO
5511 {*r = _SC_ADVISORY_INFO; return 0;}
5512 #else /* def _SC_ADVISORY_INFO */
5513 {errno = EINVAL; return -1;}
5514 #endif /* ndef _SC_ADVISORY_INFO */
5515 if (x == Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX)
5516 #ifdef _SC_AIO_LISTIO_MAX
5517 {*r = _SC_AIO_LISTIO_MAX; return 0;}
5518 #else /* def _SC_AIO_LISTIO_MAX */
5519 {errno = EINVAL; return -1;}
5520 #endif /* ndef _SC_AIO_LISTIO_MAX */
5521 if (x == Mono_Posix_SysconfName__SC_AIO_MAX)
5522 #ifdef _SC_AIO_MAX
5523 {*r = _SC_AIO_MAX; return 0;}
5524 #else /* def _SC_AIO_MAX */
5525 {errno = EINVAL; return -1;}
5526 #endif /* ndef _SC_AIO_MAX */
5527 if (x == Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX)
5528 #ifdef _SC_AIO_PRIO_DELTA_MAX
5529 {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
5530 #else /* def _SC_AIO_PRIO_DELTA_MAX */
5531 {errno = EINVAL; return -1;}
5532 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
5533 if (x == Mono_Posix_SysconfName__SC_ARG_MAX)
5534 #ifdef _SC_ARG_MAX
5535 {*r = _SC_ARG_MAX; return 0;}
5536 #else /* def _SC_ARG_MAX */
5537 {errno = EINVAL; return -1;}
5538 #endif /* ndef _SC_ARG_MAX */
5539 if (x == Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO)
5540 #ifdef _SC_ASYNCHRONOUS_IO
5541 {*r = _SC_ASYNCHRONOUS_IO; return 0;}
5542 #else /* def _SC_ASYNCHRONOUS_IO */
5543 {errno = EINVAL; return -1;}
5544 #endif /* ndef _SC_ASYNCHRONOUS_IO */
5545 if (x == Mono_Posix_SysconfName__SC_ATEXIT_MAX)
5546 #ifdef _SC_ATEXIT_MAX
5547 {*r = _SC_ATEXIT_MAX; return 0;}
5548 #else /* def _SC_ATEXIT_MAX */
5549 {errno = EINVAL; return -1;}
5550 #endif /* ndef _SC_ATEXIT_MAX */
5551 if (x == Mono_Posix_SysconfName__SC_AVPHYS_PAGES)
5552 #ifdef _SC_AVPHYS_PAGES
5553 {*r = _SC_AVPHYS_PAGES; return 0;}
5554 #else /* def _SC_AVPHYS_PAGES */
5555 {errno = EINVAL; return -1;}
5556 #endif /* ndef _SC_AVPHYS_PAGES */
5557 if (x == Mono_Posix_SysconfName__SC_BARRIERS)
5558 #ifdef _SC_BARRIERS
5559 {*r = _SC_BARRIERS; return 0;}
5560 #else /* def _SC_BARRIERS */
5561 {errno = EINVAL; return -1;}
5562 #endif /* ndef _SC_BARRIERS */
5563 if (x == Mono_Posix_SysconfName__SC_BASE)
5564 #ifdef _SC_BASE
5565 {*r = _SC_BASE; return 0;}
5566 #else /* def _SC_BASE */
5567 {errno = EINVAL; return -1;}
5568 #endif /* ndef _SC_BASE */
5569 if (x == Mono_Posix_SysconfName__SC_BC_BASE_MAX)
5570 #ifdef _SC_BC_BASE_MAX
5571 {*r = _SC_BC_BASE_MAX; return 0;}
5572 #else /* def _SC_BC_BASE_MAX */
5573 {errno = EINVAL; return -1;}
5574 #endif /* ndef _SC_BC_BASE_MAX */
5575 if (x == Mono_Posix_SysconfName__SC_BC_DIM_MAX)
5576 #ifdef _SC_BC_DIM_MAX
5577 {*r = _SC_BC_DIM_MAX; return 0;}
5578 #else /* def _SC_BC_DIM_MAX */
5579 {errno = EINVAL; return -1;}
5580 #endif /* ndef _SC_BC_DIM_MAX */
5581 if (x == Mono_Posix_SysconfName__SC_BC_SCALE_MAX)
5582 #ifdef _SC_BC_SCALE_MAX
5583 {*r = _SC_BC_SCALE_MAX; return 0;}
5584 #else /* def _SC_BC_SCALE_MAX */
5585 {errno = EINVAL; return -1;}
5586 #endif /* ndef _SC_BC_SCALE_MAX */
5587 if (x == Mono_Posix_SysconfName__SC_BC_STRING_MAX)
5588 #ifdef _SC_BC_STRING_MAX
5589 {*r = _SC_BC_STRING_MAX; return 0;}
5590 #else /* def _SC_BC_STRING_MAX */
5591 {errno = EINVAL; return -1;}
5592 #endif /* ndef _SC_BC_STRING_MAX */
5593 if (x == Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX)
5594 #ifdef _SC_CHARCLASS_NAME_MAX
5595 {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
5596 #else /* def _SC_CHARCLASS_NAME_MAX */
5597 {errno = EINVAL; return -1;}
5598 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
5599 if (x == Mono_Posix_SysconfName__SC_CHAR_BIT)
5600 #ifdef _SC_CHAR_BIT
5601 {*r = _SC_CHAR_BIT; return 0;}
5602 #else /* def _SC_CHAR_BIT */
5603 {errno = EINVAL; return -1;}
5604 #endif /* ndef _SC_CHAR_BIT */
5605 if (x == Mono_Posix_SysconfName__SC_CHAR_MAX)
5606 #ifdef _SC_CHAR_MAX
5607 {*r = _SC_CHAR_MAX; return 0;}
5608 #else /* def _SC_CHAR_MAX */
5609 {errno = EINVAL; return -1;}
5610 #endif /* ndef _SC_CHAR_MAX */
5611 if (x == Mono_Posix_SysconfName__SC_CHAR_MIN)
5612 #ifdef _SC_CHAR_MIN
5613 {*r = _SC_CHAR_MIN; return 0;}
5614 #else /* def _SC_CHAR_MIN */
5615 {errno = EINVAL; return -1;}
5616 #endif /* ndef _SC_CHAR_MIN */
5617 if (x == Mono_Posix_SysconfName__SC_CHILD_MAX)
5618 #ifdef _SC_CHILD_MAX
5619 {*r = _SC_CHILD_MAX; return 0;}
5620 #else /* def _SC_CHILD_MAX */
5621 {errno = EINVAL; return -1;}
5622 #endif /* ndef _SC_CHILD_MAX */
5623 if (x == Mono_Posix_SysconfName__SC_CLK_TCK)
5624 #ifdef _SC_CLK_TCK
5625 {*r = _SC_CLK_TCK; return 0;}
5626 #else /* def _SC_CLK_TCK */
5627 {errno = EINVAL; return -1;}
5628 #endif /* ndef _SC_CLK_TCK */
5629 if (x == Mono_Posix_SysconfName__SC_CLOCK_SELECTION)
5630 #ifdef _SC_CLOCK_SELECTION
5631 {*r = _SC_CLOCK_SELECTION; return 0;}
5632 #else /* def _SC_CLOCK_SELECTION */
5633 {errno = EINVAL; return -1;}
5634 #endif /* ndef _SC_CLOCK_SELECTION */
5635 if (x == Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX)
5636 #ifdef _SC_COLL_WEIGHTS_MAX
5637 {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
5638 #else /* def _SC_COLL_WEIGHTS_MAX */
5639 {errno = EINVAL; return -1;}
5640 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
5641 if (x == Mono_Posix_SysconfName__SC_CPUTIME)
5642 #ifdef _SC_CPUTIME
5643 {*r = _SC_CPUTIME; return 0;}
5644 #else /* def _SC_CPUTIME */
5645 {errno = EINVAL; return -1;}
5646 #endif /* ndef _SC_CPUTIME */
5647 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT)
5648 #ifdef _SC_C_LANG_SUPPORT
5649 {*r = _SC_C_LANG_SUPPORT; return 0;}
5650 #else /* def _SC_C_LANG_SUPPORT */
5651 {errno = EINVAL; return -1;}
5652 #endif /* ndef _SC_C_LANG_SUPPORT */
5653 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R)
5654 #ifdef _SC_C_LANG_SUPPORT_R
5655 {*r = _SC_C_LANG_SUPPORT_R; return 0;}
5656 #else /* def _SC_C_LANG_SUPPORT_R */
5657 {errno = EINVAL; return -1;}
5658 #endif /* ndef _SC_C_LANG_SUPPORT_R */
5659 if (x == Mono_Posix_SysconfName__SC_DELAYTIMER_MAX)
5660 #ifdef _SC_DELAYTIMER_MAX
5661 {*r = _SC_DELAYTIMER_MAX; return 0;}
5662 #else /* def _SC_DELAYTIMER_MAX */
5663 {errno = EINVAL; return -1;}
5664 #endif /* ndef _SC_DELAYTIMER_MAX */
5665 if (x == Mono_Posix_SysconfName__SC_DEVICE_IO)
5666 #ifdef _SC_DEVICE_IO
5667 {*r = _SC_DEVICE_IO; return 0;}
5668 #else /* def _SC_DEVICE_IO */
5669 {errno = EINVAL; return -1;}
5670 #endif /* ndef _SC_DEVICE_IO */
5671 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC)
5672 #ifdef _SC_DEVICE_SPECIFIC
5673 {*r = _SC_DEVICE_SPECIFIC; return 0;}
5674 #else /* def _SC_DEVICE_SPECIFIC */
5675 {errno = EINVAL; return -1;}
5676 #endif /* ndef _SC_DEVICE_SPECIFIC */
5677 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R)
5678 #ifdef _SC_DEVICE_SPECIFIC_R
5679 {*r = _SC_DEVICE_SPECIFIC_R; return 0;}
5680 #else /* def _SC_DEVICE_SPECIFIC_R */
5681 {errno = EINVAL; return -1;}
5682 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
5683 if (x == Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX)
5684 #ifdef _SC_EQUIV_CLASS_MAX
5685 {*r = _SC_EQUIV_CLASS_MAX; return 0;}
5686 #else /* def _SC_EQUIV_CLASS_MAX */
5687 {errno = EINVAL; return -1;}
5688 #endif /* ndef _SC_EQUIV_CLASS_MAX */
5689 if (x == Mono_Posix_SysconfName__SC_EXPR_NEST_MAX)
5690 #ifdef _SC_EXPR_NEST_MAX
5691 {*r = _SC_EXPR_NEST_MAX; return 0;}
5692 #else /* def _SC_EXPR_NEST_MAX */
5693 {errno = EINVAL; return -1;}
5694 #endif /* ndef _SC_EXPR_NEST_MAX */
5695 if (x == Mono_Posix_SysconfName__SC_FD_MGMT)
5696 #ifdef _SC_FD_MGMT
5697 {*r = _SC_FD_MGMT; return 0;}
5698 #else /* def _SC_FD_MGMT */
5699 {errno = EINVAL; return -1;}
5700 #endif /* ndef _SC_FD_MGMT */
5701 if (x == Mono_Posix_SysconfName__SC_FIFO)
5702 #ifdef _SC_FIFO
5703 {*r = _SC_FIFO; return 0;}
5704 #else /* def _SC_FIFO */
5705 {errno = EINVAL; return -1;}
5706 #endif /* ndef _SC_FIFO */
5707 if (x == Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES)
5708 #ifdef _SC_FILE_ATTRIBUTES
5709 {*r = _SC_FILE_ATTRIBUTES; return 0;}
5710 #else /* def _SC_FILE_ATTRIBUTES */
5711 {errno = EINVAL; return -1;}
5712 #endif /* ndef _SC_FILE_ATTRIBUTES */
5713 if (x == Mono_Posix_SysconfName__SC_FILE_LOCKING)
5714 #ifdef _SC_FILE_LOCKING
5715 {*r = _SC_FILE_LOCKING; return 0;}
5716 #else /* def _SC_FILE_LOCKING */
5717 {errno = EINVAL; return -1;}
5718 #endif /* ndef _SC_FILE_LOCKING */
5719 if (x == Mono_Posix_SysconfName__SC_FILE_SYSTEM)
5720 #ifdef _SC_FILE_SYSTEM
5721 {*r = _SC_FILE_SYSTEM; return 0;}
5722 #else /* def _SC_FILE_SYSTEM */
5723 {errno = EINVAL; return -1;}
5724 #endif /* ndef _SC_FILE_SYSTEM */
5725 if (x == Mono_Posix_SysconfName__SC_FSYNC)
5726 #ifdef _SC_FSYNC
5727 {*r = _SC_FSYNC; return 0;}
5728 #else /* def _SC_FSYNC */
5729 {errno = EINVAL; return -1;}
5730 #endif /* ndef _SC_FSYNC */
5731 if (x == Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX)
5732 #ifdef _SC_GETGR_R_SIZE_MAX
5733 {*r = _SC_GETGR_R_SIZE_MAX; return 0;}
5734 #else /* def _SC_GETGR_R_SIZE_MAX */
5735 {errno = EINVAL; return -1;}
5736 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
5737 if (x == Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX)
5738 #ifdef _SC_GETPW_R_SIZE_MAX
5739 {*r = _SC_GETPW_R_SIZE_MAX; return 0;}
5740 #else /* def _SC_GETPW_R_SIZE_MAX */
5741 {errno = EINVAL; return -1;}
5742 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
5743 if (x == Mono_Posix_SysconfName__SC_HOST_NAME_MAX)
5744 #ifdef _SC_HOST_NAME_MAX
5745 {*r = _SC_HOST_NAME_MAX; return 0;}
5746 #else /* def _SC_HOST_NAME_MAX */
5747 {errno = EINVAL; return -1;}
5748 #endif /* ndef _SC_HOST_NAME_MAX */
5749 if (x == Mono_Posix_SysconfName__SC_INT_MAX)
5750 #ifdef _SC_INT_MAX
5751 {*r = _SC_INT_MAX; return 0;}
5752 #else /* def _SC_INT_MAX */
5753 {errno = EINVAL; return -1;}
5754 #endif /* ndef _SC_INT_MAX */
5755 if (x == Mono_Posix_SysconfName__SC_INT_MIN)
5756 #ifdef _SC_INT_MIN
5757 {*r = _SC_INT_MIN; return 0;}
5758 #else /* def _SC_INT_MIN */
5759 {errno = EINVAL; return -1;}
5760 #endif /* ndef _SC_INT_MIN */
5761 if (x == Mono_Posix_SysconfName__SC_IOV_MAX)
5762 #ifdef _SC_IOV_MAX
5763 {*r = _SC_IOV_MAX; return 0;}
5764 #else /* def _SC_IOV_MAX */
5765 {errno = EINVAL; return -1;}
5766 #endif /* ndef _SC_IOV_MAX */
5767 if (x == Mono_Posix_SysconfName__SC_JOB_CONTROL)
5768 #ifdef _SC_JOB_CONTROL
5769 {*r = _SC_JOB_CONTROL; return 0;}
5770 #else /* def _SC_JOB_CONTROL */
5771 {errno = EINVAL; return -1;}
5772 #endif /* ndef _SC_JOB_CONTROL */
5773 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC)
5774 #ifdef _SC_LEVEL1_DCACHE_ASSOC
5775 {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;}
5776 #else /* def _SC_LEVEL1_DCACHE_ASSOC */
5777 {errno = EINVAL; return -1;}
5778 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
5779 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE)
5780 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
5781 {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;}
5782 #else /* def _SC_LEVEL1_DCACHE_LINESIZE */
5783 {errno = EINVAL; return -1;}
5784 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
5785 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE)
5786 #ifdef _SC_LEVEL1_DCACHE_SIZE
5787 {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;}
5788 #else /* def _SC_LEVEL1_DCACHE_SIZE */
5789 {errno = EINVAL; return -1;}
5790 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
5791 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC)
5792 #ifdef _SC_LEVEL1_ICACHE_ASSOC
5793 {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;}
5794 #else /* def _SC_LEVEL1_ICACHE_ASSOC */
5795 {errno = EINVAL; return -1;}
5796 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
5797 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE)
5798 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
5799 {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;}
5800 #else /* def _SC_LEVEL1_ICACHE_LINESIZE */
5801 {errno = EINVAL; return -1;}
5802 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
5803 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE)
5804 #ifdef _SC_LEVEL1_ICACHE_SIZE
5805 {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;}
5806 #else /* def _SC_LEVEL1_ICACHE_SIZE */
5807 {errno = EINVAL; return -1;}
5808 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
5809 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC)
5810 #ifdef _SC_LEVEL2_CACHE_ASSOC
5811 {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;}
5812 #else /* def _SC_LEVEL2_CACHE_ASSOC */
5813 {errno = EINVAL; return -1;}
5814 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
5815 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE)
5816 #ifdef _SC_LEVEL2_CACHE_LINESIZE
5817 {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;}
5818 #else /* def _SC_LEVEL2_CACHE_LINESIZE */
5819 {errno = EINVAL; return -1;}
5820 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
5821 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE)
5822 #ifdef _SC_LEVEL2_CACHE_SIZE
5823 {*r = _SC_LEVEL2_CACHE_SIZE; return 0;}
5824 #else /* def _SC_LEVEL2_CACHE_SIZE */
5825 {errno = EINVAL; return -1;}
5826 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
5827 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC)
5828 #ifdef _SC_LEVEL3_CACHE_ASSOC
5829 {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;}
5830 #else /* def _SC_LEVEL3_CACHE_ASSOC */
5831 {errno = EINVAL; return -1;}
5832 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
5833 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE)
5834 #ifdef _SC_LEVEL3_CACHE_LINESIZE
5835 {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;}
5836 #else /* def _SC_LEVEL3_CACHE_LINESIZE */
5837 {errno = EINVAL; return -1;}
5838 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
5839 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE)
5840 #ifdef _SC_LEVEL3_CACHE_SIZE
5841 {*r = _SC_LEVEL3_CACHE_SIZE; return 0;}
5842 #else /* def _SC_LEVEL3_CACHE_SIZE */
5843 {errno = EINVAL; return -1;}
5844 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
5845 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC)
5846 #ifdef _SC_LEVEL4_CACHE_ASSOC
5847 {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;}
5848 #else /* def _SC_LEVEL4_CACHE_ASSOC */
5849 {errno = EINVAL; return -1;}
5850 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
5851 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE)
5852 #ifdef _SC_LEVEL4_CACHE_LINESIZE
5853 {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;}
5854 #else /* def _SC_LEVEL4_CACHE_LINESIZE */
5855 {errno = EINVAL; return -1;}
5856 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
5857 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE)
5858 #ifdef _SC_LEVEL4_CACHE_SIZE
5859 {*r = _SC_LEVEL4_CACHE_SIZE; return 0;}
5860 #else /* def _SC_LEVEL4_CACHE_SIZE */
5861 {errno = EINVAL; return -1;}
5862 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
5863 if (x == Mono_Posix_SysconfName__SC_LINE_MAX)
5864 #ifdef _SC_LINE_MAX
5865 {*r = _SC_LINE_MAX; return 0;}
5866 #else /* def _SC_LINE_MAX */
5867 {errno = EINVAL; return -1;}
5868 #endif /* ndef _SC_LINE_MAX */
5869 if (x == Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX)
5870 #ifdef _SC_LOGIN_NAME_MAX
5871 {*r = _SC_LOGIN_NAME_MAX; return 0;}
5872 #else /* def _SC_LOGIN_NAME_MAX */
5873 {errno = EINVAL; return -1;}
5874 #endif /* ndef _SC_LOGIN_NAME_MAX */
5875 if (x == Mono_Posix_SysconfName__SC_LONG_BIT)
5876 #ifdef _SC_LONG_BIT
5877 {*r = _SC_LONG_BIT; return 0;}
5878 #else /* def _SC_LONG_BIT */
5879 {errno = EINVAL; return -1;}
5880 #endif /* ndef _SC_LONG_BIT */
5881 if (x == Mono_Posix_SysconfName__SC_MAPPED_FILES)
5882 #ifdef _SC_MAPPED_FILES
5883 {*r = _SC_MAPPED_FILES; return 0;}
5884 #else /* def _SC_MAPPED_FILES */
5885 {errno = EINVAL; return -1;}
5886 #endif /* ndef _SC_MAPPED_FILES */
5887 if (x == Mono_Posix_SysconfName__SC_MB_LEN_MAX)
5888 #ifdef _SC_MB_LEN_MAX
5889 {*r = _SC_MB_LEN_MAX; return 0;}
5890 #else /* def _SC_MB_LEN_MAX */
5891 {errno = EINVAL; return -1;}
5892 #endif /* ndef _SC_MB_LEN_MAX */
5893 if (x == Mono_Posix_SysconfName__SC_MEMLOCK)
5894 #ifdef _SC_MEMLOCK
5895 {*r = _SC_MEMLOCK; return 0;}
5896 #else /* def _SC_MEMLOCK */
5897 {errno = EINVAL; return -1;}
5898 #endif /* ndef _SC_MEMLOCK */
5899 if (x == Mono_Posix_SysconfName__SC_MEMLOCK_RANGE)
5900 #ifdef _SC_MEMLOCK_RANGE
5901 {*r = _SC_MEMLOCK_RANGE; return 0;}
5902 #else /* def _SC_MEMLOCK_RANGE */
5903 {errno = EINVAL; return -1;}
5904 #endif /* ndef _SC_MEMLOCK_RANGE */
5905 if (x == Mono_Posix_SysconfName__SC_MEMORY_PROTECTION)
5906 #ifdef _SC_MEMORY_PROTECTION
5907 {*r = _SC_MEMORY_PROTECTION; return 0;}
5908 #else /* def _SC_MEMORY_PROTECTION */
5909 {errno = EINVAL; return -1;}
5910 #endif /* ndef _SC_MEMORY_PROTECTION */
5911 if (x == Mono_Posix_SysconfName__SC_MESSAGE_PASSING)
5912 #ifdef _SC_MESSAGE_PASSING
5913 {*r = _SC_MESSAGE_PASSING; return 0;}
5914 #else /* def _SC_MESSAGE_PASSING */
5915 {errno = EINVAL; return -1;}
5916 #endif /* ndef _SC_MESSAGE_PASSING */
5917 if (x == Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK)
5918 #ifdef _SC_MONOTONIC_CLOCK
5919 {*r = _SC_MONOTONIC_CLOCK; return 0;}
5920 #else /* def _SC_MONOTONIC_CLOCK */
5921 {errno = EINVAL; return -1;}
5922 #endif /* ndef _SC_MONOTONIC_CLOCK */
5923 if (x == Mono_Posix_SysconfName__SC_MQ_OPEN_MAX)
5924 #ifdef _SC_MQ_OPEN_MAX
5925 {*r = _SC_MQ_OPEN_MAX; return 0;}
5926 #else /* def _SC_MQ_OPEN_MAX */
5927 {errno = EINVAL; return -1;}
5928 #endif /* ndef _SC_MQ_OPEN_MAX */
5929 if (x == Mono_Posix_SysconfName__SC_MQ_PRIO_MAX)
5930 #ifdef _SC_MQ_PRIO_MAX
5931 {*r = _SC_MQ_PRIO_MAX; return 0;}
5932 #else /* def _SC_MQ_PRIO_MAX */
5933 {errno = EINVAL; return -1;}
5934 #endif /* ndef _SC_MQ_PRIO_MAX */
5935 if (x == Mono_Posix_SysconfName__SC_MULTI_PROCESS)
5936 #ifdef _SC_MULTI_PROCESS
5937 {*r = _SC_MULTI_PROCESS; return 0;}
5938 #else /* def _SC_MULTI_PROCESS */
5939 {errno = EINVAL; return -1;}
5940 #endif /* ndef _SC_MULTI_PROCESS */
5941 if (x == Mono_Posix_SysconfName__SC_NETWORKING)
5942 #ifdef _SC_NETWORKING
5943 {*r = _SC_NETWORKING; return 0;}
5944 #else /* def _SC_NETWORKING */
5945 {errno = EINVAL; return -1;}
5946 #endif /* ndef _SC_NETWORKING */
5947 if (x == Mono_Posix_SysconfName__SC_NGROUPS_MAX)
5948 #ifdef _SC_NGROUPS_MAX
5949 {*r = _SC_NGROUPS_MAX; return 0;}
5950 #else /* def _SC_NGROUPS_MAX */
5951 {errno = EINVAL; return -1;}
5952 #endif /* ndef _SC_NGROUPS_MAX */
5953 if (x == Mono_Posix_SysconfName__SC_NL_ARGMAX)
5954 #ifdef _SC_NL_ARGMAX
5955 {*r = _SC_NL_ARGMAX; return 0;}
5956 #else /* def _SC_NL_ARGMAX */
5957 {errno = EINVAL; return -1;}
5958 #endif /* ndef _SC_NL_ARGMAX */
5959 if (x == Mono_Posix_SysconfName__SC_NL_LANGMAX)
5960 #ifdef _SC_NL_LANGMAX
5961 {*r = _SC_NL_LANGMAX; return 0;}
5962 #else /* def _SC_NL_LANGMAX */
5963 {errno = EINVAL; return -1;}
5964 #endif /* ndef _SC_NL_LANGMAX */
5965 if (x == Mono_Posix_SysconfName__SC_NL_MSGMAX)
5966 #ifdef _SC_NL_MSGMAX
5967 {*r = _SC_NL_MSGMAX; return 0;}
5968 #else /* def _SC_NL_MSGMAX */
5969 {errno = EINVAL; return -1;}
5970 #endif /* ndef _SC_NL_MSGMAX */
5971 if (x == Mono_Posix_SysconfName__SC_NL_NMAX)
5972 #ifdef _SC_NL_NMAX
5973 {*r = _SC_NL_NMAX; return 0;}
5974 #else /* def _SC_NL_NMAX */
5975 {errno = EINVAL; return -1;}
5976 #endif /* ndef _SC_NL_NMAX */
5977 if (x == Mono_Posix_SysconfName__SC_NL_SETMAX)
5978 #ifdef _SC_NL_SETMAX
5979 {*r = _SC_NL_SETMAX; return 0;}
5980 #else /* def _SC_NL_SETMAX */
5981 {errno = EINVAL; return -1;}
5982 #endif /* ndef _SC_NL_SETMAX */
5983 if (x == Mono_Posix_SysconfName__SC_NL_TEXTMAX)
5984 #ifdef _SC_NL_TEXTMAX
5985 {*r = _SC_NL_TEXTMAX; return 0;}
5986 #else /* def _SC_NL_TEXTMAX */
5987 {errno = EINVAL; return -1;}
5988 #endif /* ndef _SC_NL_TEXTMAX */
5989 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_CONF)
5990 #ifdef _SC_NPROCESSORS_CONF
5991 {*r = _SC_NPROCESSORS_CONF; return 0;}
5992 #else /* def _SC_NPROCESSORS_CONF */
5993 {errno = EINVAL; return -1;}
5994 #endif /* ndef _SC_NPROCESSORS_CONF */
5995 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN)
5996 #ifdef _SC_NPROCESSORS_ONLN
5997 {*r = _SC_NPROCESSORS_ONLN; return 0;}
5998 #else /* def _SC_NPROCESSORS_ONLN */
5999 {errno = EINVAL; return -1;}
6000 #endif /* ndef _SC_NPROCESSORS_ONLN */
6001 if (x == Mono_Posix_SysconfName__SC_NZERO)
6002 #ifdef _SC_NZERO
6003 {*r = _SC_NZERO; return 0;}
6004 #else /* def _SC_NZERO */
6005 {errno = EINVAL; return -1;}
6006 #endif /* ndef _SC_NZERO */
6007 if (x == Mono_Posix_SysconfName__SC_OPEN_MAX)
6008 #ifdef _SC_OPEN_MAX
6009 {*r = _SC_OPEN_MAX; return 0;}
6010 #else /* def _SC_OPEN_MAX */
6011 {errno = EINVAL; return -1;}
6012 #endif /* ndef _SC_OPEN_MAX */
6013 if (x == Mono_Posix_SysconfName__SC_PAGESIZE)
6014 #ifdef _SC_PAGESIZE
6015 {*r = _SC_PAGESIZE; return 0;}
6016 #else /* def _SC_PAGESIZE */
6017 {errno = EINVAL; return -1;}
6018 #endif /* ndef _SC_PAGESIZE */
6019 if (x == Mono_Posix_SysconfName__SC_PASS_MAX)
6020 #ifdef _SC_PASS_MAX
6021 {*r = _SC_PASS_MAX; return 0;}
6022 #else /* def _SC_PASS_MAX */
6023 {errno = EINVAL; return -1;}
6024 #endif /* ndef _SC_PASS_MAX */
6025 if (x == Mono_Posix_SysconfName__SC_PHYS_PAGES)
6026 #ifdef _SC_PHYS_PAGES
6027 {*r = _SC_PHYS_PAGES; return 0;}
6028 #else /* def _SC_PHYS_PAGES */
6029 {errno = EINVAL; return -1;}
6030 #endif /* ndef _SC_PHYS_PAGES */
6031 if (x == Mono_Posix_SysconfName__SC_PII)
6032 #ifdef _SC_PII
6033 {*r = _SC_PII; return 0;}
6034 #else /* def _SC_PII */
6035 {errno = EINVAL; return -1;}
6036 #endif /* ndef _SC_PII */
6037 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET)
6038 #ifdef _SC_PII_INTERNET
6039 {*r = _SC_PII_INTERNET; return 0;}
6040 #else /* def _SC_PII_INTERNET */
6041 {errno = EINVAL; return -1;}
6042 #endif /* ndef _SC_PII_INTERNET */
6043 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM)
6044 #ifdef _SC_PII_INTERNET_DGRAM
6045 {*r = _SC_PII_INTERNET_DGRAM; return 0;}
6046 #else /* def _SC_PII_INTERNET_DGRAM */
6047 {errno = EINVAL; return -1;}
6048 #endif /* ndef _SC_PII_INTERNET_DGRAM */
6049 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM)
6050 #ifdef _SC_PII_INTERNET_STREAM
6051 {*r = _SC_PII_INTERNET_STREAM; return 0;}
6052 #else /* def _SC_PII_INTERNET_STREAM */
6053 {errno = EINVAL; return -1;}
6054 #endif /* ndef _SC_PII_INTERNET_STREAM */
6055 if (x == Mono_Posix_SysconfName__SC_PII_OSI)
6056 #ifdef _SC_PII_OSI
6057 {*r = _SC_PII_OSI; return 0;}
6058 #else /* def _SC_PII_OSI */
6059 {errno = EINVAL; return -1;}
6060 #endif /* ndef _SC_PII_OSI */
6061 if (x == Mono_Posix_SysconfName__SC_PII_OSI_CLTS)
6062 #ifdef _SC_PII_OSI_CLTS
6063 {*r = _SC_PII_OSI_CLTS; return 0;}
6064 #else /* def _SC_PII_OSI_CLTS */
6065 {errno = EINVAL; return -1;}
6066 #endif /* ndef _SC_PII_OSI_CLTS */
6067 if (x == Mono_Posix_SysconfName__SC_PII_OSI_COTS)
6068 #ifdef _SC_PII_OSI_COTS
6069 {*r = _SC_PII_OSI_COTS; return 0;}
6070 #else /* def _SC_PII_OSI_COTS */
6071 {errno = EINVAL; return -1;}
6072 #endif /* ndef _SC_PII_OSI_COTS */
6073 if (x == Mono_Posix_SysconfName__SC_PII_OSI_M)
6074 #ifdef _SC_PII_OSI_M
6075 {*r = _SC_PII_OSI_M; return 0;}
6076 #else /* def _SC_PII_OSI_M */
6077 {errno = EINVAL; return -1;}
6078 #endif /* ndef _SC_PII_OSI_M */
6079 if (x == Mono_Posix_SysconfName__SC_PII_SOCKET)
6080 #ifdef _SC_PII_SOCKET
6081 {*r = _SC_PII_SOCKET; return 0;}
6082 #else /* def _SC_PII_SOCKET */
6083 {errno = EINVAL; return -1;}
6084 #endif /* ndef _SC_PII_SOCKET */
6085 if (x == Mono_Posix_SysconfName__SC_PII_XTI)
6086 #ifdef _SC_PII_XTI
6087 {*r = _SC_PII_XTI; return 0;}
6088 #else /* def _SC_PII_XTI */
6089 {errno = EINVAL; return -1;}
6090 #endif /* ndef _SC_PII_XTI */
6091 if (x == Mono_Posix_SysconfName__SC_PIPE)
6092 #ifdef _SC_PIPE
6093 {*r = _SC_PIPE; return 0;}
6094 #else /* def _SC_PIPE */
6095 {errno = EINVAL; return -1;}
6096 #endif /* ndef _SC_PIPE */
6097 if (x == Mono_Posix_SysconfName__SC_POLL)
6098 #ifdef _SC_POLL
6099 {*r = _SC_POLL; return 0;}
6100 #else /* def _SC_POLL */
6101 {errno = EINVAL; return -1;}
6102 #endif /* ndef _SC_POLL */
6103 if (x == Mono_Posix_SysconfName__SC_PRIORITIZED_IO)
6104 #ifdef _SC_PRIORITIZED_IO
6105 {*r = _SC_PRIORITIZED_IO; return 0;}
6106 #else /* def _SC_PRIORITIZED_IO */
6107 {errno = EINVAL; return -1;}
6108 #endif /* ndef _SC_PRIORITIZED_IO */
6109 if (x == Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING)
6110 #ifdef _SC_PRIORITY_SCHEDULING
6111 {*r = _SC_PRIORITY_SCHEDULING; return 0;}
6112 #else /* def _SC_PRIORITY_SCHEDULING */
6113 {errno = EINVAL; return -1;}
6114 #endif /* ndef _SC_PRIORITY_SCHEDULING */
6115 if (x == Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS)
6116 #ifdef _SC_READER_WRITER_LOCKS
6117 {*r = _SC_READER_WRITER_LOCKS; return 0;}
6118 #else /* def _SC_READER_WRITER_LOCKS */
6119 {errno = EINVAL; return -1;}
6120 #endif /* ndef _SC_READER_WRITER_LOCKS */
6121 if (x == Mono_Posix_SysconfName__SC_REALTIME_SIGNALS)
6122 #ifdef _SC_REALTIME_SIGNALS
6123 {*r = _SC_REALTIME_SIGNALS; return 0;}
6124 #else /* def _SC_REALTIME_SIGNALS */
6125 {errno = EINVAL; return -1;}
6126 #endif /* ndef _SC_REALTIME_SIGNALS */
6127 if (x == Mono_Posix_SysconfName__SC_REGEXP)
6128 #ifdef _SC_REGEXP
6129 {*r = _SC_REGEXP; return 0;}
6130 #else /* def _SC_REGEXP */
6131 {errno = EINVAL; return -1;}
6132 #endif /* ndef _SC_REGEXP */
6133 if (x == Mono_Posix_SysconfName__SC_REGEX_VERSION)
6134 #ifdef _SC_REGEX_VERSION
6135 {*r = _SC_REGEX_VERSION; return 0;}
6136 #else /* def _SC_REGEX_VERSION */
6137 {errno = EINVAL; return -1;}
6138 #endif /* ndef _SC_REGEX_VERSION */
6139 if (x == Mono_Posix_SysconfName__SC_RE_DUP_MAX)
6140 #ifdef _SC_RE_DUP_MAX
6141 {*r = _SC_RE_DUP_MAX; return 0;}
6142 #else /* def _SC_RE_DUP_MAX */
6143 {errno = EINVAL; return -1;}
6144 #endif /* ndef _SC_RE_DUP_MAX */
6145 if (x == Mono_Posix_SysconfName__SC_RTSIG_MAX)
6146 #ifdef _SC_RTSIG_MAX
6147 {*r = _SC_RTSIG_MAX; return 0;}
6148 #else /* def _SC_RTSIG_MAX */
6149 {errno = EINVAL; return -1;}
6150 #endif /* ndef _SC_RTSIG_MAX */
6151 if (x == Mono_Posix_SysconfName__SC_SAVED_IDS)
6152 #ifdef _SC_SAVED_IDS
6153 {*r = _SC_SAVED_IDS; return 0;}
6154 #else /* def _SC_SAVED_IDS */
6155 {errno = EINVAL; return -1;}
6156 #endif /* ndef _SC_SAVED_IDS */
6157 if (x == Mono_Posix_SysconfName__SC_SCHAR_MAX)
6158 #ifdef _SC_SCHAR_MAX
6159 {*r = _SC_SCHAR_MAX; return 0;}
6160 #else /* def _SC_SCHAR_MAX */
6161 {errno = EINVAL; return -1;}
6162 #endif /* ndef _SC_SCHAR_MAX */
6163 if (x == Mono_Posix_SysconfName__SC_SCHAR_MIN)
6164 #ifdef _SC_SCHAR_MIN
6165 {*r = _SC_SCHAR_MIN; return 0;}
6166 #else /* def _SC_SCHAR_MIN */
6167 {errno = EINVAL; return -1;}
6168 #endif /* ndef _SC_SCHAR_MIN */
6169 if (x == Mono_Posix_SysconfName__SC_SELECT)
6170 #ifdef _SC_SELECT
6171 {*r = _SC_SELECT; return 0;}
6172 #else /* def _SC_SELECT */
6173 {errno = EINVAL; return -1;}
6174 #endif /* ndef _SC_SELECT */
6175 if (x == Mono_Posix_SysconfName__SC_SEMAPHORES)
6176 #ifdef _SC_SEMAPHORES
6177 {*r = _SC_SEMAPHORES; return 0;}
6178 #else /* def _SC_SEMAPHORES */
6179 {errno = EINVAL; return -1;}
6180 #endif /* ndef _SC_SEMAPHORES */
6181 if (x == Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX)
6182 #ifdef _SC_SEM_NSEMS_MAX
6183 {*r = _SC_SEM_NSEMS_MAX; return 0;}
6184 #else /* def _SC_SEM_NSEMS_MAX */
6185 {errno = EINVAL; return -1;}
6186 #endif /* ndef _SC_SEM_NSEMS_MAX */
6187 if (x == Mono_Posix_SysconfName__SC_SEM_VALUE_MAX)
6188 #ifdef _SC_SEM_VALUE_MAX
6189 {*r = _SC_SEM_VALUE_MAX; return 0;}
6190 #else /* def _SC_SEM_VALUE_MAX */
6191 {errno = EINVAL; return -1;}
6192 #endif /* ndef _SC_SEM_VALUE_MAX */
6193 if (x == Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS)
6194 #ifdef _SC_SHARED_MEMORY_OBJECTS
6195 {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
6196 #else /* def _SC_SHARED_MEMORY_OBJECTS */
6197 {errno = EINVAL; return -1;}
6198 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
6199 if (x == Mono_Posix_SysconfName__SC_SHELL)
6200 #ifdef _SC_SHELL
6201 {*r = _SC_SHELL; return 0;}
6202 #else /* def _SC_SHELL */
6203 {errno = EINVAL; return -1;}
6204 #endif /* ndef _SC_SHELL */
6205 if (x == Mono_Posix_SysconfName__SC_SHRT_MAX)
6206 #ifdef _SC_SHRT_MAX
6207 {*r = _SC_SHRT_MAX; return 0;}
6208 #else /* def _SC_SHRT_MAX */
6209 {errno = EINVAL; return -1;}
6210 #endif /* ndef _SC_SHRT_MAX */
6211 if (x == Mono_Posix_SysconfName__SC_SHRT_MIN)
6212 #ifdef _SC_SHRT_MIN
6213 {*r = _SC_SHRT_MIN; return 0;}
6214 #else /* def _SC_SHRT_MIN */
6215 {errno = EINVAL; return -1;}
6216 #endif /* ndef _SC_SHRT_MIN */
6217 if (x == Mono_Posix_SysconfName__SC_SIGNALS)
6218 #ifdef _SC_SIGNALS
6219 {*r = _SC_SIGNALS; return 0;}
6220 #else /* def _SC_SIGNALS */
6221 {errno = EINVAL; return -1;}
6222 #endif /* ndef _SC_SIGNALS */
6223 if (x == Mono_Posix_SysconfName__SC_SIGQUEUE_MAX)
6224 #ifdef _SC_SIGQUEUE_MAX
6225 {*r = _SC_SIGQUEUE_MAX; return 0;}
6226 #else /* def _SC_SIGQUEUE_MAX */
6227 {errno = EINVAL; return -1;}
6228 #endif /* ndef _SC_SIGQUEUE_MAX */
6229 if (x == Mono_Posix_SysconfName__SC_SINGLE_PROCESS)
6230 #ifdef _SC_SINGLE_PROCESS
6231 {*r = _SC_SINGLE_PROCESS; return 0;}
6232 #else /* def _SC_SINGLE_PROCESS */
6233 {errno = EINVAL; return -1;}
6234 #endif /* ndef _SC_SINGLE_PROCESS */
6235 if (x == Mono_Posix_SysconfName__SC_SPAWN)
6236 #ifdef _SC_SPAWN
6237 {*r = _SC_SPAWN; return 0;}
6238 #else /* def _SC_SPAWN */
6239 {errno = EINVAL; return -1;}
6240 #endif /* ndef _SC_SPAWN */
6241 if (x == Mono_Posix_SysconfName__SC_SPIN_LOCKS)
6242 #ifdef _SC_SPIN_LOCKS
6243 {*r = _SC_SPIN_LOCKS; return 0;}
6244 #else /* def _SC_SPIN_LOCKS */
6245 {errno = EINVAL; return -1;}
6246 #endif /* ndef _SC_SPIN_LOCKS */
6247 if (x == Mono_Posix_SysconfName__SC_SPORADIC_SERVER)
6248 #ifdef _SC_SPORADIC_SERVER
6249 {*r = _SC_SPORADIC_SERVER; return 0;}
6250 #else /* def _SC_SPORADIC_SERVER */
6251 {errno = EINVAL; return -1;}
6252 #endif /* ndef _SC_SPORADIC_SERVER */
6253 if (x == Mono_Posix_SysconfName__SC_SSIZE_MAX)
6254 #ifdef _SC_SSIZE_MAX
6255 {*r = _SC_SSIZE_MAX; return 0;}
6256 #else /* def _SC_SSIZE_MAX */
6257 {errno = EINVAL; return -1;}
6258 #endif /* ndef _SC_SSIZE_MAX */
6259 if (x == Mono_Posix_SysconfName__SC_STREAMS)
6260 #ifdef _SC_STREAMS
6261 {*r = _SC_STREAMS; return 0;}
6262 #else /* def _SC_STREAMS */
6263 {errno = EINVAL; return -1;}
6264 #endif /* ndef _SC_STREAMS */
6265 if (x == Mono_Posix_SysconfName__SC_STREAM_MAX)
6266 #ifdef _SC_STREAM_MAX
6267 {*r = _SC_STREAM_MAX; return 0;}
6268 #else /* def _SC_STREAM_MAX */
6269 {errno = EINVAL; return -1;}
6270 #endif /* ndef _SC_STREAM_MAX */
6271 if (x == Mono_Posix_SysconfName__SC_SYMLOOP_MAX)
6272 #ifdef _SC_SYMLOOP_MAX
6273 {*r = _SC_SYMLOOP_MAX; return 0;}
6274 #else /* def _SC_SYMLOOP_MAX */
6275 {errno = EINVAL; return -1;}
6276 #endif /* ndef _SC_SYMLOOP_MAX */
6277 if (x == Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO)
6278 #ifdef _SC_SYNCHRONIZED_IO
6279 {*r = _SC_SYNCHRONIZED_IO; return 0;}
6280 #else /* def _SC_SYNCHRONIZED_IO */
6281 {errno = EINVAL; return -1;}
6282 #endif /* ndef _SC_SYNCHRONIZED_IO */
6283 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE)
6284 #ifdef _SC_SYSTEM_DATABASE
6285 {*r = _SC_SYSTEM_DATABASE; return 0;}
6286 #else /* def _SC_SYSTEM_DATABASE */
6287 {errno = EINVAL; return -1;}
6288 #endif /* ndef _SC_SYSTEM_DATABASE */
6289 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R)
6290 #ifdef _SC_SYSTEM_DATABASE_R
6291 {*r = _SC_SYSTEM_DATABASE_R; return 0;}
6292 #else /* def _SC_SYSTEM_DATABASE_R */
6293 {errno = EINVAL; return -1;}
6294 #endif /* ndef _SC_SYSTEM_DATABASE_R */
6295 if (x == Mono_Posix_SysconfName__SC_THREADS)
6296 #ifdef _SC_THREADS
6297 {*r = _SC_THREADS; return 0;}
6298 #else /* def _SC_THREADS */
6299 {errno = EINVAL; return -1;}
6300 #endif /* ndef _SC_THREADS */
6301 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR)
6302 #ifdef _SC_THREAD_ATTR_STACKADDR
6303 {*r = _SC_THREAD_ATTR_STACKADDR; return 0;}
6304 #else /* def _SC_THREAD_ATTR_STACKADDR */
6305 {errno = EINVAL; return -1;}
6306 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
6307 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE)
6308 #ifdef _SC_THREAD_ATTR_STACKSIZE
6309 {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;}
6310 #else /* def _SC_THREAD_ATTR_STACKSIZE */
6311 {errno = EINVAL; return -1;}
6312 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
6313 if (x == Mono_Posix_SysconfName__SC_THREAD_CPUTIME)
6314 #ifdef _SC_THREAD_CPUTIME
6315 {*r = _SC_THREAD_CPUTIME; return 0;}
6316 #else /* def _SC_THREAD_CPUTIME */
6317 {errno = EINVAL; return -1;}
6318 #endif /* ndef _SC_THREAD_CPUTIME */
6319 if (x == Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS)
6320 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
6321 {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
6322 #else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */
6323 {errno = EINVAL; return -1;}
6324 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
6325 if (x == Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX)
6326 #ifdef _SC_THREAD_KEYS_MAX
6327 {*r = _SC_THREAD_KEYS_MAX; return 0;}
6328 #else /* def _SC_THREAD_KEYS_MAX */
6329 {errno = EINVAL; return -1;}
6330 #endif /* ndef _SC_THREAD_KEYS_MAX */
6331 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING)
6332 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
6333 {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;}
6334 #else /* def _SC_THREAD_PRIORITY_SCHEDULING */
6335 {errno = EINVAL; return -1;}
6336 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
6337 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT)
6338 #ifdef _SC_THREAD_PRIO_INHERIT
6339 {*r = _SC_THREAD_PRIO_INHERIT; return 0;}
6340 #else /* def _SC_THREAD_PRIO_INHERIT */
6341 {errno = EINVAL; return -1;}
6342 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
6343 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT)
6344 #ifdef _SC_THREAD_PRIO_PROTECT
6345 {*r = _SC_THREAD_PRIO_PROTECT; return 0;}
6346 #else /* def _SC_THREAD_PRIO_PROTECT */
6347 {errno = EINVAL; return -1;}
6348 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
6349 if (x == Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED)
6350 #ifdef _SC_THREAD_PROCESS_SHARED
6351 {*r = _SC_THREAD_PROCESS_SHARED; return 0;}
6352 #else /* def _SC_THREAD_PROCESS_SHARED */
6353 {errno = EINVAL; return -1;}
6354 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
6355 if (x == Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS)
6356 #ifdef _SC_THREAD_SAFE_FUNCTIONS
6357 {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;}
6358 #else /* def _SC_THREAD_SAFE_FUNCTIONS */
6359 {errno = EINVAL; return -1;}
6360 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
6361 if (x == Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER)
6362 #ifdef _SC_THREAD_SPORADIC_SERVER
6363 {*r = _SC_THREAD_SPORADIC_SERVER; return 0;}
6364 #else /* def _SC_THREAD_SPORADIC_SERVER */
6365 {errno = EINVAL; return -1;}
6366 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
6367 if (x == Mono_Posix_SysconfName__SC_THREAD_STACK_MIN)
6368 #ifdef _SC_THREAD_STACK_MIN
6369 {*r = _SC_THREAD_STACK_MIN; return 0;}
6370 #else /* def _SC_THREAD_STACK_MIN */
6371 {errno = EINVAL; return -1;}
6372 #endif /* ndef _SC_THREAD_STACK_MIN */
6373 if (x == Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX)
6374 #ifdef _SC_THREAD_THREADS_MAX
6375 {*r = _SC_THREAD_THREADS_MAX; return 0;}
6376 #else /* def _SC_THREAD_THREADS_MAX */
6377 {errno = EINVAL; return -1;}
6378 #endif /* ndef _SC_THREAD_THREADS_MAX */
6379 if (x == Mono_Posix_SysconfName__SC_TIMEOUTS)
6380 #ifdef _SC_TIMEOUTS
6381 {*r = _SC_TIMEOUTS; return 0;}
6382 #else /* def _SC_TIMEOUTS */
6383 {errno = EINVAL; return -1;}
6384 #endif /* ndef _SC_TIMEOUTS */
6385 if (x == Mono_Posix_SysconfName__SC_TIMERS)
6386 #ifdef _SC_TIMERS
6387 {*r = _SC_TIMERS; return 0;}
6388 #else /* def _SC_TIMERS */
6389 {errno = EINVAL; return -1;}
6390 #endif /* ndef _SC_TIMERS */
6391 if (x == Mono_Posix_SysconfName__SC_TIMER_MAX)
6392 #ifdef _SC_TIMER_MAX
6393 {*r = _SC_TIMER_MAX; return 0;}
6394 #else /* def _SC_TIMER_MAX */
6395 {errno = EINVAL; return -1;}
6396 #endif /* ndef _SC_TIMER_MAX */
6397 if (x == Mono_Posix_SysconfName__SC_TRACE)
6398 #ifdef _SC_TRACE
6399 {*r = _SC_TRACE; return 0;}
6400 #else /* def _SC_TRACE */
6401 {errno = EINVAL; return -1;}
6402 #endif /* ndef _SC_TRACE */
6403 if (x == Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER)
6404 #ifdef _SC_TRACE_EVENT_FILTER
6405 {*r = _SC_TRACE_EVENT_FILTER; return 0;}
6406 #else /* def _SC_TRACE_EVENT_FILTER */
6407 {errno = EINVAL; return -1;}
6408 #endif /* ndef _SC_TRACE_EVENT_FILTER */
6409 if (x == Mono_Posix_SysconfName__SC_TRACE_INHERIT)
6410 #ifdef _SC_TRACE_INHERIT
6411 {*r = _SC_TRACE_INHERIT; return 0;}
6412 #else /* def _SC_TRACE_INHERIT */
6413 {errno = EINVAL; return -1;}
6414 #endif /* ndef _SC_TRACE_INHERIT */
6415 if (x == Mono_Posix_SysconfName__SC_TRACE_LOG)
6416 #ifdef _SC_TRACE_LOG
6417 {*r = _SC_TRACE_LOG; return 0;}
6418 #else /* def _SC_TRACE_LOG */
6419 {errno = EINVAL; return -1;}
6420 #endif /* ndef _SC_TRACE_LOG */
6421 if (x == Mono_Posix_SysconfName__SC_TTY_NAME_MAX)
6422 #ifdef _SC_TTY_NAME_MAX
6423 {*r = _SC_TTY_NAME_MAX; return 0;}
6424 #else /* def _SC_TTY_NAME_MAX */
6425 {errno = EINVAL; return -1;}
6426 #endif /* ndef _SC_TTY_NAME_MAX */
6427 if (x == Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS)
6428 #ifdef _SC_TYPED_MEMORY_OBJECTS
6429 {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;}
6430 #else /* def _SC_TYPED_MEMORY_OBJECTS */
6431 {errno = EINVAL; return -1;}
6432 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
6433 if (x == Mono_Posix_SysconfName__SC_TZNAME_MAX)
6434 #ifdef _SC_TZNAME_MAX
6435 {*r = _SC_TZNAME_MAX; return 0;}
6436 #else /* def _SC_TZNAME_MAX */
6437 {errno = EINVAL; return -1;}
6438 #endif /* ndef _SC_TZNAME_MAX */
6439 if (x == Mono_Posix_SysconfName__SC_T_IOV_MAX)
6440 #ifdef _SC_T_IOV_MAX
6441 {*r = _SC_T_IOV_MAX; return 0;}
6442 #else /* def _SC_T_IOV_MAX */
6443 {errno = EINVAL; return -1;}
6444 #endif /* ndef _SC_T_IOV_MAX */
6445 if (x == Mono_Posix_SysconfName__SC_UCHAR_MAX)
6446 #ifdef _SC_UCHAR_MAX
6447 {*r = _SC_UCHAR_MAX; return 0;}
6448 #else /* def _SC_UCHAR_MAX */
6449 {errno = EINVAL; return -1;}
6450 #endif /* ndef _SC_UCHAR_MAX */
6451 if (x == Mono_Posix_SysconfName__SC_UINT_MAX)
6452 #ifdef _SC_UINT_MAX
6453 {*r = _SC_UINT_MAX; return 0;}
6454 #else /* def _SC_UINT_MAX */
6455 {errno = EINVAL; return -1;}
6456 #endif /* ndef _SC_UINT_MAX */
6457 if (x == Mono_Posix_SysconfName__SC_UIO_MAXIOV)
6458 #ifdef _SC_UIO_MAXIOV
6459 {*r = _SC_UIO_MAXIOV; return 0;}
6460 #else /* def _SC_UIO_MAXIOV */
6461 {errno = EINVAL; return -1;}
6462 #endif /* ndef _SC_UIO_MAXIOV */
6463 if (x == Mono_Posix_SysconfName__SC_ULONG_MAX)
6464 #ifdef _SC_ULONG_MAX
6465 {*r = _SC_ULONG_MAX; return 0;}
6466 #else /* def _SC_ULONG_MAX */
6467 {errno = EINVAL; return -1;}
6468 #endif /* ndef _SC_ULONG_MAX */
6469 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS)
6470 #ifdef _SC_USER_GROUPS
6471 {*r = _SC_USER_GROUPS; return 0;}
6472 #else /* def _SC_USER_GROUPS */
6473 {errno = EINVAL; return -1;}
6474 #endif /* ndef _SC_USER_GROUPS */
6475 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS_R)
6476 #ifdef _SC_USER_GROUPS_R
6477 {*r = _SC_USER_GROUPS_R; return 0;}
6478 #else /* def _SC_USER_GROUPS_R */
6479 {errno = EINVAL; return -1;}
6480 #endif /* ndef _SC_USER_GROUPS_R */
6481 if (x == Mono_Posix_SysconfName__SC_USHRT_MAX)
6482 #ifdef _SC_USHRT_MAX
6483 {*r = _SC_USHRT_MAX; return 0;}
6484 #else /* def _SC_USHRT_MAX */
6485 {errno = EINVAL; return -1;}
6486 #endif /* ndef _SC_USHRT_MAX */
6487 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFF32)
6488 #ifdef _SC_V6_ILP32_OFF32
6489 {*r = _SC_V6_ILP32_OFF32; return 0;}
6490 #else /* def _SC_V6_ILP32_OFF32 */
6491 {errno = EINVAL; return -1;}
6492 #endif /* ndef _SC_V6_ILP32_OFF32 */
6493 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG)
6494 #ifdef _SC_V6_ILP32_OFFBIG
6495 {*r = _SC_V6_ILP32_OFFBIG; return 0;}
6496 #else /* def _SC_V6_ILP32_OFFBIG */
6497 {errno = EINVAL; return -1;}
6498 #endif /* ndef _SC_V6_ILP32_OFFBIG */
6499 if (x == Mono_Posix_SysconfName__SC_V6_LP64_OFF64)
6500 #ifdef _SC_V6_LP64_OFF64
6501 {*r = _SC_V6_LP64_OFF64; return 0;}
6502 #else /* def _SC_V6_LP64_OFF64 */
6503 {errno = EINVAL; return -1;}
6504 #endif /* ndef _SC_V6_LP64_OFF64 */
6505 if (x == Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG)
6506 #ifdef _SC_V6_LPBIG_OFFBIG
6507 {*r = _SC_V6_LPBIG_OFFBIG; return 0;}
6508 #else /* def _SC_V6_LPBIG_OFFBIG */
6509 {errno = EINVAL; return -1;}
6510 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
6511 if (x == Mono_Posix_SysconfName__SC_VERSION)
6512 #ifdef _SC_VERSION
6513 {*r = _SC_VERSION; return 0;}
6514 #else /* def _SC_VERSION */
6515 {errno = EINVAL; return -1;}
6516 #endif /* ndef _SC_VERSION */
6517 if (x == Mono_Posix_SysconfName__SC_WORD_BIT)
6518 #ifdef _SC_WORD_BIT
6519 {*r = _SC_WORD_BIT; return 0;}
6520 #else /* def _SC_WORD_BIT */
6521 {errno = EINVAL; return -1;}
6522 #endif /* ndef _SC_WORD_BIT */
6523 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32)
6524 #ifdef _SC_XBS5_ILP32_OFF32
6525 {*r = _SC_XBS5_ILP32_OFF32; return 0;}
6526 #else /* def _SC_XBS5_ILP32_OFF32 */
6527 {errno = EINVAL; return -1;}
6528 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
6529 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG)
6530 #ifdef _SC_XBS5_ILP32_OFFBIG
6531 {*r = _SC_XBS5_ILP32_OFFBIG; return 0;}
6532 #else /* def _SC_XBS5_ILP32_OFFBIG */
6533 {errno = EINVAL; return -1;}
6534 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
6535 if (x == Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64)
6536 #ifdef _SC_XBS5_LP64_OFF64
6537 {*r = _SC_XBS5_LP64_OFF64; return 0;}
6538 #else /* def _SC_XBS5_LP64_OFF64 */
6539 {errno = EINVAL; return -1;}
6540 #endif /* ndef _SC_XBS5_LP64_OFF64 */
6541 if (x == Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG)
6542 #ifdef _SC_XBS5_LPBIG_OFFBIG
6543 {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;}
6544 #else /* def _SC_XBS5_LPBIG_OFFBIG */
6545 {errno = EINVAL; return -1;}
6546 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
6547 if (x == Mono_Posix_SysconfName__SC_XOPEN_CRYPT)
6548 #ifdef _SC_XOPEN_CRYPT
6549 {*r = _SC_XOPEN_CRYPT; return 0;}
6550 #else /* def _SC_XOPEN_CRYPT */
6551 {errno = EINVAL; return -1;}
6552 #endif /* ndef _SC_XOPEN_CRYPT */
6553 if (x == Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N)
6554 #ifdef _SC_XOPEN_ENH_I18N
6555 {*r = _SC_XOPEN_ENH_I18N; return 0;}
6556 #else /* def _SC_XOPEN_ENH_I18N */
6557 {errno = EINVAL; return -1;}
6558 #endif /* ndef _SC_XOPEN_ENH_I18N */
6559 if (x == Mono_Posix_SysconfName__SC_XOPEN_LEGACY)
6560 #ifdef _SC_XOPEN_LEGACY
6561 {*r = _SC_XOPEN_LEGACY; return 0;}
6562 #else /* def _SC_XOPEN_LEGACY */
6563 {errno = EINVAL; return -1;}
6564 #endif /* ndef _SC_XOPEN_LEGACY */
6565 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME)
6566 #ifdef _SC_XOPEN_REALTIME
6567 {*r = _SC_XOPEN_REALTIME; return 0;}
6568 #else /* def _SC_XOPEN_REALTIME */
6569 {errno = EINVAL; return -1;}
6570 #endif /* ndef _SC_XOPEN_REALTIME */
6571 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS)
6572 #ifdef _SC_XOPEN_REALTIME_THREADS
6573 {*r = _SC_XOPEN_REALTIME_THREADS; return 0;}
6574 #else /* def _SC_XOPEN_REALTIME_THREADS */
6575 {errno = EINVAL; return -1;}
6576 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6577 if (x == Mono_Posix_SysconfName__SC_XOPEN_SHM)
6578 #ifdef _SC_XOPEN_SHM
6579 {*r = _SC_XOPEN_SHM; return 0;}
6580 #else /* def _SC_XOPEN_SHM */
6581 {errno = EINVAL; return -1;}
6582 #endif /* ndef _SC_XOPEN_SHM */
6583 if (x == Mono_Posix_SysconfName__SC_XOPEN_UNIX)
6584 #ifdef _SC_XOPEN_UNIX
6585 {*r = _SC_XOPEN_UNIX; return 0;}
6586 #else /* def _SC_XOPEN_UNIX */
6587 {errno = EINVAL; return -1;}
6588 #endif /* ndef _SC_XOPEN_UNIX */
6589 if (x == Mono_Posix_SysconfName__SC_XOPEN_VERSION)
6590 #ifdef _SC_XOPEN_VERSION
6591 {*r = _SC_XOPEN_VERSION; return 0;}
6592 #else /* def _SC_XOPEN_VERSION */
6593 {errno = EINVAL; return -1;}
6594 #endif /* ndef _SC_XOPEN_VERSION */
6595 if (x == Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION)
6596 #ifdef _SC_XOPEN_XCU_VERSION
6597 {*r = _SC_XOPEN_XCU_VERSION; return 0;}
6598 #else /* def _SC_XOPEN_XCU_VERSION */
6599 {errno = EINVAL; return -1;}
6600 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6601 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG2)
6602 #ifdef _SC_XOPEN_XPG2
6603 {*r = _SC_XOPEN_XPG2; return 0;}
6604 #else /* def _SC_XOPEN_XPG2 */
6605 {errno = EINVAL; return -1;}
6606 #endif /* ndef _SC_XOPEN_XPG2 */
6607 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG3)
6608 #ifdef _SC_XOPEN_XPG3
6609 {*r = _SC_XOPEN_XPG3; return 0;}
6610 #else /* def _SC_XOPEN_XPG3 */
6611 {errno = EINVAL; return -1;}
6612 #endif /* ndef _SC_XOPEN_XPG3 */
6613 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG4)
6614 #ifdef _SC_XOPEN_XPG4
6615 {*r = _SC_XOPEN_XPG4; return 0;}
6616 #else /* def _SC_XOPEN_XPG4 */
6617 {errno = EINVAL; return -1;}
6618 #endif /* ndef _SC_XOPEN_XPG4 */
6619 if (x == 0)
6620 return 0;
6621 errno = EINVAL; return -1;
6624 int Mono_Posix_ToSysconfName (int x, int *r)
6626 *r = 0;
6627 if (x == 0)
6628 return 0;
6629 #ifdef _SC_2_CHAR_TERM
6630 if (x == _SC_2_CHAR_TERM)
6631 {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
6632 #endif /* ndef _SC_2_CHAR_TERM */
6633 #ifdef _SC_2_C_BIND
6634 if (x == _SC_2_C_BIND)
6635 {*r = Mono_Posix_SysconfName__SC_2_C_BIND; return 0;}
6636 #endif /* ndef _SC_2_C_BIND */
6637 #ifdef _SC_2_C_DEV
6638 if (x == _SC_2_C_DEV)
6639 {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
6640 #endif /* ndef _SC_2_C_DEV */
6641 #ifdef _SC_2_C_VERSION
6642 if (x == _SC_2_C_VERSION)
6643 {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
6644 #endif /* ndef _SC_2_C_VERSION */
6645 #ifdef _SC_2_FORT_DEV
6646 if (x == _SC_2_FORT_DEV)
6647 {*r = Mono_Posix_SysconfName__SC_2_FORT_DEV; return 0;}
6648 #endif /* ndef _SC_2_FORT_DEV */
6649 #ifdef _SC_2_FORT_RUN
6650 if (x == _SC_2_FORT_RUN)
6651 {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
6652 #endif /* ndef _SC_2_FORT_RUN */
6653 #ifdef _SC_2_LOCALEDEF
6654 if (x == _SC_2_LOCALEDEF)
6655 {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
6656 #endif /* ndef _SC_2_LOCALEDEF */
6657 #ifdef _SC_2_PBS
6658 if (x == _SC_2_PBS)
6659 {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
6660 #endif /* ndef _SC_2_PBS */
6661 #ifdef _SC_2_PBS_ACCOUNTING
6662 if (x == _SC_2_PBS_ACCOUNTING)
6663 {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
6664 #endif /* ndef _SC_2_PBS_ACCOUNTING */
6665 #ifdef _SC_2_PBS_CHECKPOINT
6666 if (x == _SC_2_PBS_CHECKPOINT)
6667 {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
6668 #endif /* ndef _SC_2_PBS_CHECKPOINT */
6669 #ifdef _SC_2_PBS_LOCATE
6670 if (x == _SC_2_PBS_LOCATE)
6671 {*r = Mono_Posix_SysconfName__SC_2_PBS_LOCATE; return 0;}
6672 #endif /* ndef _SC_2_PBS_LOCATE */
6673 #ifdef _SC_2_PBS_MESSAGE
6674 if (x == _SC_2_PBS_MESSAGE)
6675 {*r = Mono_Posix_SysconfName__SC_2_PBS_MESSAGE; return 0;}
6676 #endif /* ndef _SC_2_PBS_MESSAGE */
6677 #ifdef _SC_2_PBS_TRACK
6678 if (x == _SC_2_PBS_TRACK)
6679 {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
6680 #endif /* ndef _SC_2_PBS_TRACK */
6681 #ifdef _SC_2_SW_DEV
6682 if (x == _SC_2_SW_DEV)
6683 {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
6684 #endif /* ndef _SC_2_SW_DEV */
6685 #ifdef _SC_2_UPE
6686 if (x == _SC_2_UPE)
6687 {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
6688 #endif /* ndef _SC_2_UPE */
6689 #ifdef _SC_2_VERSION
6690 if (x == _SC_2_VERSION)
6691 {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
6692 #endif /* ndef _SC_2_VERSION */
6693 #ifdef _SC_ADVISORY_INFO
6694 if (x == _SC_ADVISORY_INFO)
6695 {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
6696 #endif /* ndef _SC_ADVISORY_INFO */
6697 #ifdef _SC_AIO_LISTIO_MAX
6698 if (x == _SC_AIO_LISTIO_MAX)
6699 {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
6700 #endif /* ndef _SC_AIO_LISTIO_MAX */
6701 #ifdef _SC_AIO_MAX
6702 if (x == _SC_AIO_MAX)
6703 {*r = Mono_Posix_SysconfName__SC_AIO_MAX; return 0;}
6704 #endif /* ndef _SC_AIO_MAX */
6705 #ifdef _SC_AIO_PRIO_DELTA_MAX
6706 if (x == _SC_AIO_PRIO_DELTA_MAX)
6707 {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
6708 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
6709 #ifdef _SC_ARG_MAX
6710 if (x == _SC_ARG_MAX)
6711 {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
6712 #endif /* ndef _SC_ARG_MAX */
6713 #ifdef _SC_ASYNCHRONOUS_IO
6714 if (x == _SC_ASYNCHRONOUS_IO)
6715 {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
6716 #endif /* ndef _SC_ASYNCHRONOUS_IO */
6717 #ifdef _SC_ATEXIT_MAX
6718 if (x == _SC_ATEXIT_MAX)
6719 {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
6720 #endif /* ndef _SC_ATEXIT_MAX */
6721 #ifdef _SC_AVPHYS_PAGES
6722 if (x == _SC_AVPHYS_PAGES)
6723 {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
6724 #endif /* ndef _SC_AVPHYS_PAGES */
6725 #ifdef _SC_BARRIERS
6726 if (x == _SC_BARRIERS)
6727 {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
6728 #endif /* ndef _SC_BARRIERS */
6729 #ifdef _SC_BASE
6730 if (x == _SC_BASE)
6731 {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
6732 #endif /* ndef _SC_BASE */
6733 #ifdef _SC_BC_BASE_MAX
6734 if (x == _SC_BC_BASE_MAX)
6735 {*r = Mono_Posix_SysconfName__SC_BC_BASE_MAX; return 0;}
6736 #endif /* ndef _SC_BC_BASE_MAX */
6737 #ifdef _SC_BC_DIM_MAX
6738 if (x == _SC_BC_DIM_MAX)
6739 {*r = Mono_Posix_SysconfName__SC_BC_DIM_MAX; return 0;}
6740 #endif /* ndef _SC_BC_DIM_MAX */
6741 #ifdef _SC_BC_SCALE_MAX
6742 if (x == _SC_BC_SCALE_MAX)
6743 {*r = Mono_Posix_SysconfName__SC_BC_SCALE_MAX; return 0;}
6744 #endif /* ndef _SC_BC_SCALE_MAX */
6745 #ifdef _SC_BC_STRING_MAX
6746 if (x == _SC_BC_STRING_MAX)
6747 {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
6748 #endif /* ndef _SC_BC_STRING_MAX */
6749 #ifdef _SC_CHARCLASS_NAME_MAX
6750 if (x == _SC_CHARCLASS_NAME_MAX)
6751 {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
6752 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
6753 #ifdef _SC_CHAR_BIT
6754 if (x == _SC_CHAR_BIT)
6755 {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
6756 #endif /* ndef _SC_CHAR_BIT */
6757 #ifdef _SC_CHAR_MAX
6758 if (x == _SC_CHAR_MAX)
6759 {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
6760 #endif /* ndef _SC_CHAR_MAX */
6761 #ifdef _SC_CHAR_MIN
6762 if (x == _SC_CHAR_MIN)
6763 {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
6764 #endif /* ndef _SC_CHAR_MIN */
6765 #ifdef _SC_CHILD_MAX
6766 if (x == _SC_CHILD_MAX)
6767 {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
6768 #endif /* ndef _SC_CHILD_MAX */
6769 #ifdef _SC_CLK_TCK
6770 if (x == _SC_CLK_TCK)
6771 {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
6772 #endif /* ndef _SC_CLK_TCK */
6773 #ifdef _SC_CLOCK_SELECTION
6774 if (x == _SC_CLOCK_SELECTION)
6775 {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
6776 #endif /* ndef _SC_CLOCK_SELECTION */
6777 #ifdef _SC_COLL_WEIGHTS_MAX
6778 if (x == _SC_COLL_WEIGHTS_MAX)
6779 {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
6780 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
6781 #ifdef _SC_CPUTIME
6782 if (x == _SC_CPUTIME)
6783 {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
6784 #endif /* ndef _SC_CPUTIME */
6785 #ifdef _SC_C_LANG_SUPPORT
6786 if (x == _SC_C_LANG_SUPPORT)
6787 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT; return 0;}
6788 #endif /* ndef _SC_C_LANG_SUPPORT */
6789 #ifdef _SC_C_LANG_SUPPORT_R
6790 if (x == _SC_C_LANG_SUPPORT_R)
6791 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
6792 #endif /* ndef _SC_C_LANG_SUPPORT_R */
6793 #ifdef _SC_DELAYTIMER_MAX
6794 if (x == _SC_DELAYTIMER_MAX)
6795 {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
6796 #endif /* ndef _SC_DELAYTIMER_MAX */
6797 #ifdef _SC_DEVICE_IO
6798 if (x == _SC_DEVICE_IO)
6799 {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
6800 #endif /* ndef _SC_DEVICE_IO */
6801 #ifdef _SC_DEVICE_SPECIFIC
6802 if (x == _SC_DEVICE_SPECIFIC)
6803 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
6804 #endif /* ndef _SC_DEVICE_SPECIFIC */
6805 #ifdef _SC_DEVICE_SPECIFIC_R
6806 if (x == _SC_DEVICE_SPECIFIC_R)
6807 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
6808 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
6809 #ifdef _SC_EQUIV_CLASS_MAX
6810 if (x == _SC_EQUIV_CLASS_MAX)
6811 {*r = Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX; return 0;}
6812 #endif /* ndef _SC_EQUIV_CLASS_MAX */
6813 #ifdef _SC_EXPR_NEST_MAX
6814 if (x == _SC_EXPR_NEST_MAX)
6815 {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
6816 #endif /* ndef _SC_EXPR_NEST_MAX */
6817 #ifdef _SC_FD_MGMT
6818 if (x == _SC_FD_MGMT)
6819 {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
6820 #endif /* ndef _SC_FD_MGMT */
6821 #ifdef _SC_FIFO
6822 if (x == _SC_FIFO)
6823 {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
6824 #endif /* ndef _SC_FIFO */
6825 #ifdef _SC_FILE_ATTRIBUTES
6826 if (x == _SC_FILE_ATTRIBUTES)
6827 {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
6828 #endif /* ndef _SC_FILE_ATTRIBUTES */
6829 #ifdef _SC_FILE_LOCKING
6830 if (x == _SC_FILE_LOCKING)
6831 {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
6832 #endif /* ndef _SC_FILE_LOCKING */
6833 #ifdef _SC_FILE_SYSTEM
6834 if (x == _SC_FILE_SYSTEM)
6835 {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
6836 #endif /* ndef _SC_FILE_SYSTEM */
6837 #ifdef _SC_FSYNC
6838 if (x == _SC_FSYNC)
6839 {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
6840 #endif /* ndef _SC_FSYNC */
6841 #ifdef _SC_GETGR_R_SIZE_MAX
6842 if (x == _SC_GETGR_R_SIZE_MAX)
6843 {*r = Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX; return 0;}
6844 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
6845 #ifdef _SC_GETPW_R_SIZE_MAX
6846 if (x == _SC_GETPW_R_SIZE_MAX)
6847 {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
6848 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
6849 #ifdef _SC_HOST_NAME_MAX
6850 if (x == _SC_HOST_NAME_MAX)
6851 {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
6852 #endif /* ndef _SC_HOST_NAME_MAX */
6853 #ifdef _SC_INT_MAX
6854 if (x == _SC_INT_MAX)
6855 {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
6856 #endif /* ndef _SC_INT_MAX */
6857 #ifdef _SC_INT_MIN
6858 if (x == _SC_INT_MIN)
6859 {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
6860 #endif /* ndef _SC_INT_MIN */
6861 #ifdef _SC_IOV_MAX
6862 if (x == _SC_IOV_MAX)
6863 {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
6864 #endif /* ndef _SC_IOV_MAX */
6865 #ifdef _SC_JOB_CONTROL
6866 if (x == _SC_JOB_CONTROL)
6867 {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
6868 #endif /* ndef _SC_JOB_CONTROL */
6869 #ifdef _SC_LEVEL1_DCACHE_ASSOC
6870 if (x == _SC_LEVEL1_DCACHE_ASSOC)
6871 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC; return 0;}
6872 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
6873 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
6874 if (x == _SC_LEVEL1_DCACHE_LINESIZE)
6875 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
6876 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
6877 #ifdef _SC_LEVEL1_DCACHE_SIZE
6878 if (x == _SC_LEVEL1_DCACHE_SIZE)
6879 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
6880 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
6881 #ifdef _SC_LEVEL1_ICACHE_ASSOC
6882 if (x == _SC_LEVEL1_ICACHE_ASSOC)
6883 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC; return 0;}
6884 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
6885 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
6886 if (x == _SC_LEVEL1_ICACHE_LINESIZE)
6887 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
6888 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
6889 #ifdef _SC_LEVEL1_ICACHE_SIZE
6890 if (x == _SC_LEVEL1_ICACHE_SIZE)
6891 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
6892 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
6893 #ifdef _SC_LEVEL2_CACHE_ASSOC
6894 if (x == _SC_LEVEL2_CACHE_ASSOC)
6895 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC; return 0;}
6896 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
6897 #ifdef _SC_LEVEL2_CACHE_LINESIZE
6898 if (x == _SC_LEVEL2_CACHE_LINESIZE)
6899 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
6900 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
6901 #ifdef _SC_LEVEL2_CACHE_SIZE
6902 if (x == _SC_LEVEL2_CACHE_SIZE)
6903 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
6904 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
6905 #ifdef _SC_LEVEL3_CACHE_ASSOC
6906 if (x == _SC_LEVEL3_CACHE_ASSOC)
6907 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC; return 0;}
6908 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
6909 #ifdef _SC_LEVEL3_CACHE_LINESIZE
6910 if (x == _SC_LEVEL3_CACHE_LINESIZE)
6911 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
6912 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
6913 #ifdef _SC_LEVEL3_CACHE_SIZE
6914 if (x == _SC_LEVEL3_CACHE_SIZE)
6915 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
6916 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
6917 #ifdef _SC_LEVEL4_CACHE_ASSOC
6918 if (x == _SC_LEVEL4_CACHE_ASSOC)
6919 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC; return 0;}
6920 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
6921 #ifdef _SC_LEVEL4_CACHE_LINESIZE
6922 if (x == _SC_LEVEL4_CACHE_LINESIZE)
6923 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
6924 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
6925 #ifdef _SC_LEVEL4_CACHE_SIZE
6926 if (x == _SC_LEVEL4_CACHE_SIZE)
6927 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
6928 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
6929 #ifdef _SC_LINE_MAX
6930 if (x == _SC_LINE_MAX)
6931 {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
6932 #endif /* ndef _SC_LINE_MAX */
6933 #ifdef _SC_LOGIN_NAME_MAX
6934 if (x == _SC_LOGIN_NAME_MAX)
6935 {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
6936 #endif /* ndef _SC_LOGIN_NAME_MAX */
6937 #ifdef _SC_LONG_BIT
6938 if (x == _SC_LONG_BIT)
6939 {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
6940 #endif /* ndef _SC_LONG_BIT */
6941 #ifdef _SC_MAPPED_FILES
6942 if (x == _SC_MAPPED_FILES)
6943 {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
6944 #endif /* ndef _SC_MAPPED_FILES */
6945 #ifdef _SC_MB_LEN_MAX
6946 if (x == _SC_MB_LEN_MAX)
6947 {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
6948 #endif /* ndef _SC_MB_LEN_MAX */
6949 #ifdef _SC_MEMLOCK
6950 if (x == _SC_MEMLOCK)
6951 {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
6952 #endif /* ndef _SC_MEMLOCK */
6953 #ifdef _SC_MEMLOCK_RANGE
6954 if (x == _SC_MEMLOCK_RANGE)
6955 {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
6956 #endif /* ndef _SC_MEMLOCK_RANGE */
6957 #ifdef _SC_MEMORY_PROTECTION
6958 if (x == _SC_MEMORY_PROTECTION)
6959 {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
6960 #endif /* ndef _SC_MEMORY_PROTECTION */
6961 #ifdef _SC_MESSAGE_PASSING
6962 if (x == _SC_MESSAGE_PASSING)
6963 {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
6964 #endif /* ndef _SC_MESSAGE_PASSING */
6965 #ifdef _SC_MONOTONIC_CLOCK
6966 if (x == _SC_MONOTONIC_CLOCK)
6967 {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
6968 #endif /* ndef _SC_MONOTONIC_CLOCK */
6969 #ifdef _SC_MQ_OPEN_MAX
6970 if (x == _SC_MQ_OPEN_MAX)
6971 {*r = Mono_Posix_SysconfName__SC_MQ_OPEN_MAX; return 0;}
6972 #endif /* ndef _SC_MQ_OPEN_MAX */
6973 #ifdef _SC_MQ_PRIO_MAX
6974 if (x == _SC_MQ_PRIO_MAX)
6975 {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
6976 #endif /* ndef _SC_MQ_PRIO_MAX */
6977 #ifdef _SC_MULTI_PROCESS
6978 if (x == _SC_MULTI_PROCESS)
6979 {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
6980 #endif /* ndef _SC_MULTI_PROCESS */
6981 #ifdef _SC_NETWORKING
6982 if (x == _SC_NETWORKING)
6983 {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
6984 #endif /* ndef _SC_NETWORKING */
6985 #ifdef _SC_NGROUPS_MAX
6986 if (x == _SC_NGROUPS_MAX)
6987 {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
6988 #endif /* ndef _SC_NGROUPS_MAX */
6989 #ifdef _SC_NL_ARGMAX
6990 if (x == _SC_NL_ARGMAX)
6991 {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
6992 #endif /* ndef _SC_NL_ARGMAX */
6993 #ifdef _SC_NL_LANGMAX
6994 if (x == _SC_NL_LANGMAX)
6995 {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
6996 #endif /* ndef _SC_NL_LANGMAX */
6997 #ifdef _SC_NL_MSGMAX
6998 if (x == _SC_NL_MSGMAX)
6999 {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
7000 #endif /* ndef _SC_NL_MSGMAX */
7001 #ifdef _SC_NL_NMAX
7002 if (x == _SC_NL_NMAX)
7003 {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
7004 #endif /* ndef _SC_NL_NMAX */
7005 #ifdef _SC_NL_SETMAX
7006 if (x == _SC_NL_SETMAX)
7007 {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
7008 #endif /* ndef _SC_NL_SETMAX */
7009 #ifdef _SC_NL_TEXTMAX
7010 if (x == _SC_NL_TEXTMAX)
7011 {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
7012 #endif /* ndef _SC_NL_TEXTMAX */
7013 #ifdef _SC_NPROCESSORS_CONF
7014 if (x == _SC_NPROCESSORS_CONF)
7015 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
7016 #endif /* ndef _SC_NPROCESSORS_CONF */
7017 #ifdef _SC_NPROCESSORS_ONLN
7018 if (x == _SC_NPROCESSORS_ONLN)
7019 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
7020 #endif /* ndef _SC_NPROCESSORS_ONLN */
7021 #ifdef _SC_NZERO
7022 if (x == _SC_NZERO)
7023 {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
7024 #endif /* ndef _SC_NZERO */
7025 #ifdef _SC_OPEN_MAX
7026 if (x == _SC_OPEN_MAX)
7027 {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
7028 #endif /* ndef _SC_OPEN_MAX */
7029 #ifdef _SC_PAGESIZE
7030 if (x == _SC_PAGESIZE)
7031 {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
7032 #endif /* ndef _SC_PAGESIZE */
7033 #ifdef _SC_PASS_MAX
7034 if (x == _SC_PASS_MAX)
7035 {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
7036 #endif /* ndef _SC_PASS_MAX */
7037 #ifdef _SC_PHYS_PAGES
7038 if (x == _SC_PHYS_PAGES)
7039 {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
7040 #endif /* ndef _SC_PHYS_PAGES */
7041 #ifdef _SC_PII
7042 if (x == _SC_PII)
7043 {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
7044 #endif /* ndef _SC_PII */
7045 #ifdef _SC_PII_INTERNET
7046 if (x == _SC_PII_INTERNET)
7047 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
7048 #endif /* ndef _SC_PII_INTERNET */
7049 #ifdef _SC_PII_INTERNET_DGRAM
7050 if (x == _SC_PII_INTERNET_DGRAM)
7051 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
7052 #endif /* ndef _SC_PII_INTERNET_DGRAM */
7053 #ifdef _SC_PII_INTERNET_STREAM
7054 if (x == _SC_PII_INTERNET_STREAM)
7055 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
7056 #endif /* ndef _SC_PII_INTERNET_STREAM */
7057 #ifdef _SC_PII_OSI
7058 if (x == _SC_PII_OSI)
7059 {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
7060 #endif /* ndef _SC_PII_OSI */
7061 #ifdef _SC_PII_OSI_CLTS
7062 if (x == _SC_PII_OSI_CLTS)
7063 {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
7064 #endif /* ndef _SC_PII_OSI_CLTS */
7065 #ifdef _SC_PII_OSI_COTS
7066 if (x == _SC_PII_OSI_COTS)
7067 {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
7068 #endif /* ndef _SC_PII_OSI_COTS */
7069 #ifdef _SC_PII_OSI_M
7070 if (x == _SC_PII_OSI_M)
7071 {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
7072 #endif /* ndef _SC_PII_OSI_M */
7073 #ifdef _SC_PII_SOCKET
7074 if (x == _SC_PII_SOCKET)
7075 {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
7076 #endif /* ndef _SC_PII_SOCKET */
7077 #ifdef _SC_PII_XTI
7078 if (x == _SC_PII_XTI)
7079 {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
7080 #endif /* ndef _SC_PII_XTI */
7081 #ifdef _SC_PIPE
7082 if (x == _SC_PIPE)
7083 {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
7084 #endif /* ndef _SC_PIPE */
7085 #ifdef _SC_POLL
7086 if (x == _SC_POLL)
7087 {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
7088 #endif /* ndef _SC_POLL */
7089 #ifdef _SC_PRIORITIZED_IO
7090 if (x == _SC_PRIORITIZED_IO)
7091 {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
7092 #endif /* ndef _SC_PRIORITIZED_IO */
7093 #ifdef _SC_PRIORITY_SCHEDULING
7094 if (x == _SC_PRIORITY_SCHEDULING)
7095 {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
7096 #endif /* ndef _SC_PRIORITY_SCHEDULING */
7097 #ifdef _SC_READER_WRITER_LOCKS
7098 if (x == _SC_READER_WRITER_LOCKS)
7099 {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
7100 #endif /* ndef _SC_READER_WRITER_LOCKS */
7101 #ifdef _SC_REALTIME_SIGNALS
7102 if (x == _SC_REALTIME_SIGNALS)
7103 {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
7104 #endif /* ndef _SC_REALTIME_SIGNALS */
7105 #ifdef _SC_REGEXP
7106 if (x == _SC_REGEXP)
7107 {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
7108 #endif /* ndef _SC_REGEXP */
7109 #ifdef _SC_REGEX_VERSION
7110 if (x == _SC_REGEX_VERSION)
7111 {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
7112 #endif /* ndef _SC_REGEX_VERSION */
7113 #ifdef _SC_RE_DUP_MAX
7114 if (x == _SC_RE_DUP_MAX)
7115 {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
7116 #endif /* ndef _SC_RE_DUP_MAX */
7117 #ifdef _SC_RTSIG_MAX
7118 if (x == _SC_RTSIG_MAX)
7119 {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
7120 #endif /* ndef _SC_RTSIG_MAX */
7121 #ifdef _SC_SAVED_IDS
7122 if (x == _SC_SAVED_IDS)
7123 {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
7124 #endif /* ndef _SC_SAVED_IDS */
7125 #ifdef _SC_SCHAR_MAX
7126 if (x == _SC_SCHAR_MAX)
7127 {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
7128 #endif /* ndef _SC_SCHAR_MAX */
7129 #ifdef _SC_SCHAR_MIN
7130 if (x == _SC_SCHAR_MIN)
7131 {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
7132 #endif /* ndef _SC_SCHAR_MIN */
7133 #ifdef _SC_SELECT
7134 if (x == _SC_SELECT)
7135 {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
7136 #endif /* ndef _SC_SELECT */
7137 #ifdef _SC_SEMAPHORES
7138 if (x == _SC_SEMAPHORES)
7139 {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
7140 #endif /* ndef _SC_SEMAPHORES */
7141 #ifdef _SC_SEM_NSEMS_MAX
7142 if (x == _SC_SEM_NSEMS_MAX)
7143 {*r = Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX; return 0;}
7144 #endif /* ndef _SC_SEM_NSEMS_MAX */
7145 #ifdef _SC_SEM_VALUE_MAX
7146 if (x == _SC_SEM_VALUE_MAX)
7147 {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
7148 #endif /* ndef _SC_SEM_VALUE_MAX */
7149 #ifdef _SC_SHARED_MEMORY_OBJECTS
7150 if (x == _SC_SHARED_MEMORY_OBJECTS)
7151 {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
7152 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
7153 #ifdef _SC_SHELL
7154 if (x == _SC_SHELL)
7155 {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
7156 #endif /* ndef _SC_SHELL */
7157 #ifdef _SC_SHRT_MAX
7158 if (x == _SC_SHRT_MAX)
7159 {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
7160 #endif /* ndef _SC_SHRT_MAX */
7161 #ifdef _SC_SHRT_MIN
7162 if (x == _SC_SHRT_MIN)
7163 {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
7164 #endif /* ndef _SC_SHRT_MIN */
7165 #ifdef _SC_SIGNALS
7166 if (x == _SC_SIGNALS)
7167 {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
7168 #endif /* ndef _SC_SIGNALS */
7169 #ifdef _SC_SIGQUEUE_MAX
7170 if (x == _SC_SIGQUEUE_MAX)
7171 {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
7172 #endif /* ndef _SC_SIGQUEUE_MAX */
7173 #ifdef _SC_SINGLE_PROCESS
7174 if (x == _SC_SINGLE_PROCESS)
7175 {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
7176 #endif /* ndef _SC_SINGLE_PROCESS */
7177 #ifdef _SC_SPAWN
7178 if (x == _SC_SPAWN)
7179 {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
7180 #endif /* ndef _SC_SPAWN */
7181 #ifdef _SC_SPIN_LOCKS
7182 if (x == _SC_SPIN_LOCKS)
7183 {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
7184 #endif /* ndef _SC_SPIN_LOCKS */
7185 #ifdef _SC_SPORADIC_SERVER
7186 if (x == _SC_SPORADIC_SERVER)
7187 {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
7188 #endif /* ndef _SC_SPORADIC_SERVER */
7189 #ifdef _SC_SSIZE_MAX
7190 if (x == _SC_SSIZE_MAX)
7191 {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
7192 #endif /* ndef _SC_SSIZE_MAX */
7193 #ifdef _SC_STREAMS
7194 if (x == _SC_STREAMS)
7195 {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
7196 #endif /* ndef _SC_STREAMS */
7197 #ifdef _SC_STREAM_MAX
7198 if (x == _SC_STREAM_MAX)
7199 {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
7200 #endif /* ndef _SC_STREAM_MAX */
7201 #ifdef _SC_SYMLOOP_MAX
7202 if (x == _SC_SYMLOOP_MAX)
7203 {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
7204 #endif /* ndef _SC_SYMLOOP_MAX */
7205 #ifdef _SC_SYNCHRONIZED_IO
7206 if (x == _SC_SYNCHRONIZED_IO)
7207 {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
7208 #endif /* ndef _SC_SYNCHRONIZED_IO */
7209 #ifdef _SC_SYSTEM_DATABASE
7210 if (x == _SC_SYSTEM_DATABASE)
7211 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
7212 #endif /* ndef _SC_SYSTEM_DATABASE */
7213 #ifdef _SC_SYSTEM_DATABASE_R
7214 if (x == _SC_SYSTEM_DATABASE_R)
7215 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
7216 #endif /* ndef _SC_SYSTEM_DATABASE_R */
7217 #ifdef _SC_THREADS
7218 if (x == _SC_THREADS)
7219 {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
7220 #endif /* ndef _SC_THREADS */
7221 #ifdef _SC_THREAD_ATTR_STACKADDR
7222 if (x == _SC_THREAD_ATTR_STACKADDR)
7223 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR; return 0;}
7224 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
7225 #ifdef _SC_THREAD_ATTR_STACKSIZE
7226 if (x == _SC_THREAD_ATTR_STACKSIZE)
7227 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
7228 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
7229 #ifdef _SC_THREAD_CPUTIME
7230 if (x == _SC_THREAD_CPUTIME)
7231 {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
7232 #endif /* ndef _SC_THREAD_CPUTIME */
7233 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
7234 if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
7235 {*r = Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
7236 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
7237 #ifdef _SC_THREAD_KEYS_MAX
7238 if (x == _SC_THREAD_KEYS_MAX)
7239 {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
7240 #endif /* ndef _SC_THREAD_KEYS_MAX */
7241 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
7242 if (x == _SC_THREAD_PRIORITY_SCHEDULING)
7243 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
7244 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
7245 #ifdef _SC_THREAD_PRIO_INHERIT
7246 if (x == _SC_THREAD_PRIO_INHERIT)
7247 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT; return 0;}
7248 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
7249 #ifdef _SC_THREAD_PRIO_PROTECT
7250 if (x == _SC_THREAD_PRIO_PROTECT)
7251 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT; return 0;}
7252 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
7253 #ifdef _SC_THREAD_PROCESS_SHARED
7254 if (x == _SC_THREAD_PROCESS_SHARED)
7255 {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
7256 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
7257 #ifdef _SC_THREAD_SAFE_FUNCTIONS
7258 if (x == _SC_THREAD_SAFE_FUNCTIONS)
7259 {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
7260 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
7261 #ifdef _SC_THREAD_SPORADIC_SERVER
7262 if (x == _SC_THREAD_SPORADIC_SERVER)
7263 {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
7264 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
7265 #ifdef _SC_THREAD_STACK_MIN
7266 if (x == _SC_THREAD_STACK_MIN)
7267 {*r = Mono_Posix_SysconfName__SC_THREAD_STACK_MIN; return 0;}
7268 #endif /* ndef _SC_THREAD_STACK_MIN */
7269 #ifdef _SC_THREAD_THREADS_MAX
7270 if (x == _SC_THREAD_THREADS_MAX)
7271 {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
7272 #endif /* ndef _SC_THREAD_THREADS_MAX */
7273 #ifdef _SC_TIMEOUTS
7274 if (x == _SC_TIMEOUTS)
7275 {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
7276 #endif /* ndef _SC_TIMEOUTS */
7277 #ifdef _SC_TIMERS
7278 if (x == _SC_TIMERS)
7279 {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
7280 #endif /* ndef _SC_TIMERS */
7281 #ifdef _SC_TIMER_MAX
7282 if (x == _SC_TIMER_MAX)
7283 {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
7284 #endif /* ndef _SC_TIMER_MAX */
7285 #ifdef _SC_TRACE
7286 if (x == _SC_TRACE)
7287 {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
7288 #endif /* ndef _SC_TRACE */
7289 #ifdef _SC_TRACE_EVENT_FILTER
7290 if (x == _SC_TRACE_EVENT_FILTER)
7291 {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
7292 #endif /* ndef _SC_TRACE_EVENT_FILTER */
7293 #ifdef _SC_TRACE_INHERIT
7294 if (x == _SC_TRACE_INHERIT)
7295 {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
7296 #endif /* ndef _SC_TRACE_INHERIT */
7297 #ifdef _SC_TRACE_LOG
7298 if (x == _SC_TRACE_LOG)
7299 {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
7300 #endif /* ndef _SC_TRACE_LOG */
7301 #ifdef _SC_TTY_NAME_MAX
7302 if (x == _SC_TTY_NAME_MAX)
7303 {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
7304 #endif /* ndef _SC_TTY_NAME_MAX */
7305 #ifdef _SC_TYPED_MEMORY_OBJECTS
7306 if (x == _SC_TYPED_MEMORY_OBJECTS)
7307 {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
7308 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
7309 #ifdef _SC_TZNAME_MAX
7310 if (x == _SC_TZNAME_MAX)
7311 {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
7312 #endif /* ndef _SC_TZNAME_MAX */
7313 #ifdef _SC_T_IOV_MAX
7314 if (x == _SC_T_IOV_MAX)
7315 {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
7316 #endif /* ndef _SC_T_IOV_MAX */
7317 #ifdef _SC_UCHAR_MAX
7318 if (x == _SC_UCHAR_MAX)
7319 {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
7320 #endif /* ndef _SC_UCHAR_MAX */
7321 #ifdef _SC_UINT_MAX
7322 if (x == _SC_UINT_MAX)
7323 {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
7324 #endif /* ndef _SC_UINT_MAX */
7325 #ifdef _SC_UIO_MAXIOV
7326 if (x == _SC_UIO_MAXIOV)
7327 {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
7328 #endif /* ndef _SC_UIO_MAXIOV */
7329 #ifdef _SC_ULONG_MAX
7330 if (x == _SC_ULONG_MAX)
7331 {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
7332 #endif /* ndef _SC_ULONG_MAX */
7333 #ifdef _SC_USER_GROUPS
7334 if (x == _SC_USER_GROUPS)
7335 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
7336 #endif /* ndef _SC_USER_GROUPS */
7337 #ifdef _SC_USER_GROUPS_R
7338 if (x == _SC_USER_GROUPS_R)
7339 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
7340 #endif /* ndef _SC_USER_GROUPS_R */
7341 #ifdef _SC_USHRT_MAX
7342 if (x == _SC_USHRT_MAX)
7343 {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
7344 #endif /* ndef _SC_USHRT_MAX */
7345 #ifdef _SC_V6_ILP32_OFF32
7346 if (x == _SC_V6_ILP32_OFF32)
7347 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFF32; return 0;}
7348 #endif /* ndef _SC_V6_ILP32_OFF32 */
7349 #ifdef _SC_V6_ILP32_OFFBIG
7350 if (x == _SC_V6_ILP32_OFFBIG)
7351 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG; return 0;}
7352 #endif /* ndef _SC_V6_ILP32_OFFBIG */
7353 #ifdef _SC_V6_LP64_OFF64
7354 if (x == _SC_V6_LP64_OFF64)
7355 {*r = Mono_Posix_SysconfName__SC_V6_LP64_OFF64; return 0;}
7356 #endif /* ndef _SC_V6_LP64_OFF64 */
7357 #ifdef _SC_V6_LPBIG_OFFBIG
7358 if (x == _SC_V6_LPBIG_OFFBIG)
7359 {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
7360 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
7361 #ifdef _SC_VERSION
7362 if (x == _SC_VERSION)
7363 {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
7364 #endif /* ndef _SC_VERSION */
7365 #ifdef _SC_WORD_BIT
7366 if (x == _SC_WORD_BIT)
7367 {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
7368 #endif /* ndef _SC_WORD_BIT */
7369 #ifdef _SC_XBS5_ILP32_OFF32
7370 if (x == _SC_XBS5_ILP32_OFF32)
7371 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32; return 0;}
7372 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
7373 #ifdef _SC_XBS5_ILP32_OFFBIG
7374 if (x == _SC_XBS5_ILP32_OFFBIG)
7375 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG; return 0;}
7376 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
7377 #ifdef _SC_XBS5_LP64_OFF64
7378 if (x == _SC_XBS5_LP64_OFF64)
7379 {*r = Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64; return 0;}
7380 #endif /* ndef _SC_XBS5_LP64_OFF64 */
7381 #ifdef _SC_XBS5_LPBIG_OFFBIG
7382 if (x == _SC_XBS5_LPBIG_OFFBIG)
7383 {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
7384 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
7385 #ifdef _SC_XOPEN_CRYPT
7386 if (x == _SC_XOPEN_CRYPT)
7387 {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
7388 #endif /* ndef _SC_XOPEN_CRYPT */
7389 #ifdef _SC_XOPEN_ENH_I18N
7390 if (x == _SC_XOPEN_ENH_I18N)
7391 {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
7392 #endif /* ndef _SC_XOPEN_ENH_I18N */
7393 #ifdef _SC_XOPEN_LEGACY
7394 if (x == _SC_XOPEN_LEGACY)
7395 {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
7396 #endif /* ndef _SC_XOPEN_LEGACY */
7397 #ifdef _SC_XOPEN_REALTIME
7398 if (x == _SC_XOPEN_REALTIME)
7399 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
7400 #endif /* ndef _SC_XOPEN_REALTIME */
7401 #ifdef _SC_XOPEN_REALTIME_THREADS
7402 if (x == _SC_XOPEN_REALTIME_THREADS)
7403 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
7404 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
7405 #ifdef _SC_XOPEN_SHM
7406 if (x == _SC_XOPEN_SHM)
7407 {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
7408 #endif /* ndef _SC_XOPEN_SHM */
7409 #ifdef _SC_XOPEN_UNIX
7410 if (x == _SC_XOPEN_UNIX)
7411 {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
7412 #endif /* ndef _SC_XOPEN_UNIX */
7413 #ifdef _SC_XOPEN_VERSION
7414 if (x == _SC_XOPEN_VERSION)
7415 {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
7416 #endif /* ndef _SC_XOPEN_VERSION */
7417 #ifdef _SC_XOPEN_XCU_VERSION
7418 if (x == _SC_XOPEN_XCU_VERSION)
7419 {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
7420 #endif /* ndef _SC_XOPEN_XCU_VERSION */
7421 #ifdef _SC_XOPEN_XPG2
7422 if (x == _SC_XOPEN_XPG2)
7423 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
7424 #endif /* ndef _SC_XOPEN_XPG2 */
7425 #ifdef _SC_XOPEN_XPG3
7426 if (x == _SC_XOPEN_XPG3)
7427 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
7428 #endif /* ndef _SC_XOPEN_XPG3 */
7429 #ifdef _SC_XOPEN_XPG4
7430 if (x == _SC_XOPEN_XPG4)
7431 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
7432 #endif /* ndef _SC_XOPEN_XPG4 */
7433 errno = EINVAL; return -1;
7436 int Mono_Posix_FromSyslogFacility (int x, int *r)
7438 *r = 0;
7439 if (x == Mono_Posix_SyslogFacility_LOG_AUTH)
7440 #ifdef LOG_AUTH
7441 {*r = LOG_AUTH; return 0;}
7442 #else /* def LOG_AUTH */
7443 {errno = EINVAL; return -1;}
7444 #endif /* ndef LOG_AUTH */
7445 if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
7446 #ifdef LOG_AUTHPRIV
7447 {*r = LOG_AUTHPRIV; return 0;}
7448 #else /* def LOG_AUTHPRIV */
7449 {errno = EINVAL; return -1;}
7450 #endif /* ndef LOG_AUTHPRIV */
7451 if (x == Mono_Posix_SyslogFacility_LOG_CRON)
7452 #ifdef LOG_CRON
7453 {*r = LOG_CRON; return 0;}
7454 #else /* def LOG_CRON */
7455 {errno = EINVAL; return -1;}
7456 #endif /* ndef LOG_CRON */
7457 if (x == Mono_Posix_SyslogFacility_LOG_DAEMON)
7458 #ifdef LOG_DAEMON
7459 {*r = LOG_DAEMON; return 0;}
7460 #else /* def LOG_DAEMON */
7461 {errno = EINVAL; return -1;}
7462 #endif /* ndef LOG_DAEMON */
7463 if (x == Mono_Posix_SyslogFacility_LOG_FTP)
7464 #ifdef LOG_FTP
7465 {*r = LOG_FTP; return 0;}
7466 #else /* def LOG_FTP */
7467 {errno = EINVAL; return -1;}
7468 #endif /* ndef LOG_FTP */
7469 if (x == Mono_Posix_SyslogFacility_LOG_KERN)
7470 #ifdef LOG_KERN
7471 {*r = LOG_KERN; return 0;}
7472 #else /* def LOG_KERN */
7473 {errno = EINVAL; return -1;}
7474 #endif /* ndef LOG_KERN */
7475 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0)
7476 #ifdef LOG_LOCAL0
7477 {*r = LOG_LOCAL0; return 0;}
7478 #else /* def LOG_LOCAL0 */
7479 {errno = EINVAL; return -1;}
7480 #endif /* ndef LOG_LOCAL0 */
7481 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1)
7482 #ifdef LOG_LOCAL1
7483 {*r = LOG_LOCAL1; return 0;}
7484 #else /* def LOG_LOCAL1 */
7485 {errno = EINVAL; return -1;}
7486 #endif /* ndef LOG_LOCAL1 */
7487 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2)
7488 #ifdef LOG_LOCAL2
7489 {*r = LOG_LOCAL2; return 0;}
7490 #else /* def LOG_LOCAL2 */
7491 {errno = EINVAL; return -1;}
7492 #endif /* ndef LOG_LOCAL2 */
7493 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3)
7494 #ifdef LOG_LOCAL3
7495 {*r = LOG_LOCAL3; return 0;}
7496 #else /* def LOG_LOCAL3 */
7497 {errno = EINVAL; return -1;}
7498 #endif /* ndef LOG_LOCAL3 */
7499 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4)
7500 #ifdef LOG_LOCAL4
7501 {*r = LOG_LOCAL4; return 0;}
7502 #else /* def LOG_LOCAL4 */
7503 {errno = EINVAL; return -1;}
7504 #endif /* ndef LOG_LOCAL4 */
7505 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5)
7506 #ifdef LOG_LOCAL5
7507 {*r = LOG_LOCAL5; return 0;}
7508 #else /* def LOG_LOCAL5 */
7509 {errno = EINVAL; return -1;}
7510 #endif /* ndef LOG_LOCAL5 */
7511 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6)
7512 #ifdef LOG_LOCAL6
7513 {*r = LOG_LOCAL6; return 0;}
7514 #else /* def LOG_LOCAL6 */
7515 {errno = EINVAL; return -1;}
7516 #endif /* ndef LOG_LOCAL6 */
7517 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7)
7518 #ifdef LOG_LOCAL7
7519 {*r = LOG_LOCAL7; return 0;}
7520 #else /* def LOG_LOCAL7 */
7521 {errno = EINVAL; return -1;}
7522 #endif /* ndef LOG_LOCAL7 */
7523 if (x == Mono_Posix_SyslogFacility_LOG_LPR)
7524 #ifdef LOG_LPR
7525 {*r = LOG_LPR; return 0;}
7526 #else /* def LOG_LPR */
7527 {errno = EINVAL; return -1;}
7528 #endif /* ndef LOG_LPR */
7529 if (x == Mono_Posix_SyslogFacility_LOG_MAIL)
7530 #ifdef LOG_MAIL
7531 {*r = LOG_MAIL; return 0;}
7532 #else /* def LOG_MAIL */
7533 {errno = EINVAL; return -1;}
7534 #endif /* ndef LOG_MAIL */
7535 if (x == Mono_Posix_SyslogFacility_LOG_NEWS)
7536 #ifdef LOG_NEWS
7537 {*r = LOG_NEWS; return 0;}
7538 #else /* def LOG_NEWS */
7539 {errno = EINVAL; return -1;}
7540 #endif /* ndef LOG_NEWS */
7541 if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG)
7542 #ifdef LOG_SYSLOG
7543 {*r = LOG_SYSLOG; return 0;}
7544 #else /* def LOG_SYSLOG */
7545 {errno = EINVAL; return -1;}
7546 #endif /* ndef LOG_SYSLOG */
7547 if (x == Mono_Posix_SyslogFacility_LOG_USER)
7548 #ifdef LOG_USER
7549 {*r = LOG_USER; return 0;}
7550 #else /* def LOG_USER */
7551 {errno = EINVAL; return -1;}
7552 #endif /* ndef LOG_USER */
7553 if (x == Mono_Posix_SyslogFacility_LOG_UUCP)
7554 #ifdef LOG_UUCP
7555 {*r = LOG_UUCP; return 0;}
7556 #else /* def LOG_UUCP */
7557 {errno = EINVAL; return -1;}
7558 #endif /* ndef LOG_UUCP */
7559 if (x == 0)
7560 return 0;
7561 errno = EINVAL; return -1;
7564 int Mono_Posix_ToSyslogFacility (int x, int *r)
7566 *r = 0;
7567 if (x == 0)
7568 return 0;
7569 #ifdef LOG_AUTH
7570 if (x == LOG_AUTH)
7571 {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
7572 #endif /* ndef LOG_AUTH */
7573 #ifdef LOG_AUTHPRIV
7574 if (x == LOG_AUTHPRIV)
7575 {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
7576 #endif /* ndef LOG_AUTHPRIV */
7577 #ifdef LOG_CRON
7578 if (x == LOG_CRON)
7579 {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
7580 #endif /* ndef LOG_CRON */
7581 #ifdef LOG_DAEMON
7582 if (x == LOG_DAEMON)
7583 {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
7584 #endif /* ndef LOG_DAEMON */
7585 #ifdef LOG_FTP
7586 if (x == LOG_FTP)
7587 {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
7588 #endif /* ndef LOG_FTP */
7589 #ifdef LOG_KERN
7590 if (x == LOG_KERN)
7591 {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
7592 #endif /* ndef LOG_KERN */
7593 #ifdef LOG_LOCAL0
7594 if (x == LOG_LOCAL0)
7595 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;}
7596 #endif /* ndef LOG_LOCAL0 */
7597 #ifdef LOG_LOCAL1
7598 if (x == LOG_LOCAL1)
7599 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;}
7600 #endif /* ndef LOG_LOCAL1 */
7601 #ifdef LOG_LOCAL2
7602 if (x == LOG_LOCAL2)
7603 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;}
7604 #endif /* ndef LOG_LOCAL2 */
7605 #ifdef LOG_LOCAL3
7606 if (x == LOG_LOCAL3)
7607 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;}
7608 #endif /* ndef LOG_LOCAL3 */
7609 #ifdef LOG_LOCAL4
7610 if (x == LOG_LOCAL4)
7611 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;}
7612 #endif /* ndef LOG_LOCAL4 */
7613 #ifdef LOG_LOCAL5
7614 if (x == LOG_LOCAL5)
7615 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;}
7616 #endif /* ndef LOG_LOCAL5 */
7617 #ifdef LOG_LOCAL6
7618 if (x == LOG_LOCAL6)
7619 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;}
7620 #endif /* ndef LOG_LOCAL6 */
7621 #ifdef LOG_LOCAL7
7622 if (x == LOG_LOCAL7)
7623 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;}
7624 #endif /* ndef LOG_LOCAL7 */
7625 #ifdef LOG_LPR
7626 if (x == LOG_LPR)
7627 {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
7628 #endif /* ndef LOG_LPR */
7629 #ifdef LOG_MAIL
7630 if (x == LOG_MAIL)
7631 {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
7632 #endif /* ndef LOG_MAIL */
7633 #ifdef LOG_NEWS
7634 if (x == LOG_NEWS)
7635 {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
7636 #endif /* ndef LOG_NEWS */
7637 #ifdef LOG_SYSLOG
7638 if (x == LOG_SYSLOG)
7639 {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
7640 #endif /* ndef LOG_SYSLOG */
7641 #ifdef LOG_USER
7642 if (x == LOG_USER)
7643 {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
7644 #endif /* ndef LOG_USER */
7645 #ifdef LOG_UUCP
7646 if (x == LOG_UUCP)
7647 {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
7648 #endif /* ndef LOG_UUCP */
7649 errno = EINVAL; return -1;
7652 int Mono_Posix_FromSyslogLevel (int x, int *r)
7654 *r = 0;
7655 if (x == Mono_Posix_SyslogLevel_LOG_ALERT)
7656 #ifdef LOG_ALERT
7657 {*r = LOG_ALERT; return 0;}
7658 #else /* def LOG_ALERT */
7659 {errno = EINVAL; return -1;}
7660 #endif /* ndef LOG_ALERT */
7661 if (x == Mono_Posix_SyslogLevel_LOG_CRIT)
7662 #ifdef LOG_CRIT
7663 {*r = LOG_CRIT; return 0;}
7664 #else /* def LOG_CRIT */
7665 {errno = EINVAL; return -1;}
7666 #endif /* ndef LOG_CRIT */
7667 if (x == Mono_Posix_SyslogLevel_LOG_DEBUG)
7668 #ifdef LOG_DEBUG
7669 {*r = LOG_DEBUG; return 0;}
7670 #else /* def LOG_DEBUG */
7671 {errno = EINVAL; return -1;}
7672 #endif /* ndef LOG_DEBUG */
7673 if (x == Mono_Posix_SyslogLevel_LOG_EMERG)
7674 #ifdef LOG_EMERG
7675 {*r = LOG_EMERG; return 0;}
7676 #else /* def LOG_EMERG */
7677 {errno = EINVAL; return -1;}
7678 #endif /* ndef LOG_EMERG */
7679 if (x == Mono_Posix_SyslogLevel_LOG_ERR)
7680 #ifdef LOG_ERR
7681 {*r = LOG_ERR; return 0;}
7682 #else /* def LOG_ERR */
7683 {errno = EINVAL; return -1;}
7684 #endif /* ndef LOG_ERR */
7685 if (x == Mono_Posix_SyslogLevel_LOG_INFO)
7686 #ifdef LOG_INFO
7687 {*r = LOG_INFO; return 0;}
7688 #else /* def LOG_INFO */
7689 {errno = EINVAL; return -1;}
7690 #endif /* ndef LOG_INFO */
7691 if (x == Mono_Posix_SyslogLevel_LOG_NOTICE)
7692 #ifdef LOG_NOTICE
7693 {*r = LOG_NOTICE; return 0;}
7694 #else /* def LOG_NOTICE */
7695 {errno = EINVAL; return -1;}
7696 #endif /* ndef LOG_NOTICE */
7697 if (x == Mono_Posix_SyslogLevel_LOG_WARNING)
7698 #ifdef LOG_WARNING
7699 {*r = LOG_WARNING; return 0;}
7700 #else /* def LOG_WARNING */
7701 {errno = EINVAL; return -1;}
7702 #endif /* ndef LOG_WARNING */
7703 if (x == 0)
7704 return 0;
7705 errno = EINVAL; return -1;
7708 int Mono_Posix_ToSyslogLevel (int x, int *r)
7710 *r = 0;
7711 if (x == 0)
7712 return 0;
7713 #ifdef LOG_ALERT
7714 if (x == LOG_ALERT)
7715 {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;}
7716 #endif /* ndef LOG_ALERT */
7717 #ifdef LOG_CRIT
7718 if (x == LOG_CRIT)
7719 {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;}
7720 #endif /* ndef LOG_CRIT */
7721 #ifdef LOG_DEBUG
7722 if (x == LOG_DEBUG)
7723 {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
7724 #endif /* ndef LOG_DEBUG */
7725 #ifdef LOG_EMERG
7726 if (x == LOG_EMERG)
7727 {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
7728 #endif /* ndef LOG_EMERG */
7729 #ifdef LOG_ERR
7730 if (x == LOG_ERR)
7731 {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
7732 #endif /* ndef LOG_ERR */
7733 #ifdef LOG_INFO
7734 if (x == LOG_INFO)
7735 {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
7736 #endif /* ndef LOG_INFO */
7737 #ifdef LOG_NOTICE
7738 if (x == LOG_NOTICE)
7739 {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
7740 #endif /* ndef LOG_NOTICE */
7741 #ifdef LOG_WARNING
7742 if (x == LOG_WARNING)
7743 {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
7744 #endif /* ndef LOG_WARNING */
7745 errno = EINVAL; return -1;
7748 int Mono_Posix_FromSyslogOptions (int x, int *r)
7750 *r = 0;
7751 if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
7752 #ifdef LOG_CONS
7753 *r |= LOG_CONS;
7754 #else /* def LOG_CONS */
7755 {errno = EINVAL; return -1;}
7756 #endif /* ndef LOG_CONS */
7757 if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
7758 #ifdef LOG_NDELAY
7759 *r |= LOG_NDELAY;
7760 #else /* def LOG_NDELAY */
7761 {errno = EINVAL; return -1;}
7762 #endif /* ndef LOG_NDELAY */
7763 if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
7764 #ifdef LOG_NOWAIT
7765 *r |= LOG_NOWAIT;
7766 #else /* def LOG_NOWAIT */
7767 {errno = EINVAL; return -1;}
7768 #endif /* ndef LOG_NOWAIT */
7769 if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
7770 #ifdef LOG_ODELAY
7771 *r |= LOG_ODELAY;
7772 #else /* def LOG_ODELAY */
7773 {errno = EINVAL; return -1;}
7774 #endif /* ndef LOG_ODELAY */
7775 if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
7776 #ifdef LOG_PERROR
7777 *r |= LOG_PERROR;
7778 #else /* def LOG_PERROR */
7779 {errno = EINVAL; return -1;}
7780 #endif /* ndef LOG_PERROR */
7781 if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
7782 #ifdef LOG_PID
7783 *r |= LOG_PID;
7784 #else /* def LOG_PID */
7785 {errno = EINVAL; return -1;}
7786 #endif /* ndef LOG_PID */
7787 if (x == 0)
7788 return 0;
7789 return 0;
7792 int Mono_Posix_ToSyslogOptions (int x, int *r)
7794 *r = 0;
7795 if (x == 0)
7796 return 0;
7797 #ifdef LOG_CONS
7798 if ((x & LOG_CONS) == LOG_CONS)
7799 *r |= Mono_Posix_SyslogOptions_LOG_CONS;
7800 #endif /* ndef LOG_CONS */
7801 #ifdef LOG_NDELAY
7802 if ((x & LOG_NDELAY) == LOG_NDELAY)
7803 *r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
7804 #endif /* ndef LOG_NDELAY */
7805 #ifdef LOG_NOWAIT
7806 if ((x & LOG_NOWAIT) == LOG_NOWAIT)
7807 *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
7808 #endif /* ndef LOG_NOWAIT */
7809 #ifdef LOG_ODELAY
7810 if ((x & LOG_ODELAY) == LOG_ODELAY)
7811 *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
7812 #endif /* ndef LOG_ODELAY */
7813 #ifdef LOG_PERROR
7814 if ((x & LOG_PERROR) == LOG_PERROR)
7815 *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
7816 #endif /* ndef LOG_PERROR */
7817 #ifdef LOG_PID
7818 if ((x & LOG_PID) == LOG_PID)
7819 *r |= Mono_Posix_SyslogOptions_LOG_PID;
7820 #endif /* ndef LOG_PID */
7821 return 0;
7824 #ifdef HAVE_STRUCT_TIMESPEC
7826 Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
7828 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7829 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7831 memset (to, 0, sizeof(*to));
7833 to->tv_sec = from->tv_sec;
7834 to->tv_nsec = from->tv_nsec;
7836 return 0;
7838 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7841 #ifdef HAVE_STRUCT_TIMESPEC
7843 Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
7845 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7846 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7848 memset (to, 0, sizeof(*to));
7850 to->tv_sec = from->tv_sec;
7851 to->tv_nsec = from->tv_nsec;
7853 return 0;
7855 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7858 #ifdef HAVE_STRUCT_TIMEVAL
7860 Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
7862 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7863 _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
7865 memset (to, 0, sizeof(*to));
7867 to->tv_sec = from->tv_sec;
7868 to->tv_usec = from->tv_usec;
7870 return 0;
7872 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7875 #ifdef HAVE_STRUCT_TIMEVAL
7877 Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
7879 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7880 _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
7882 memset (to, 0, sizeof(*to));
7884 to->tv_sec = from->tv_sec;
7885 to->tv_usec = from->tv_usec;
7887 return 0;
7889 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7892 #ifdef HAVE_STRUCT_TIMEZONE
7894 Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
7896 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7897 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7899 memset (to, 0, sizeof(*to));
7901 to->tz_minuteswest = from->tz_minuteswest;
7902 to->tz_dsttime = from->tz_dsttime;
7904 return 0;
7906 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7909 #ifdef HAVE_STRUCT_TIMEZONE
7911 Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
7913 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7914 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7916 memset (to, 0, sizeof(*to));
7918 to->tz_minuteswest = from->tz_minuteswest;
7919 to->tz_dsttime = from->tz_dsttime;
7921 return 0;
7923 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7926 int Mono_Posix_FromUnixAddressFamily (int x, int *r)
7928 *r = 0;
7929 if (x == Mono_Posix_UnixAddressFamily_AF_ALG)
7930 #ifdef AF_ALG
7931 {*r = AF_ALG; return 0;}
7932 #else /* def AF_ALG */
7933 {errno = EINVAL; return -1;}
7934 #endif /* ndef AF_ALG */
7935 if (x == Mono_Posix_UnixAddressFamily_AF_APPLETALK)
7936 #ifdef AF_APPLETALK
7937 {*r = AF_APPLETALK; return 0;}
7938 #else /* def AF_APPLETALK */
7939 {errno = EINVAL; return -1;}
7940 #endif /* ndef AF_APPLETALK */
7941 if (x == Mono_Posix_UnixAddressFamily_AF_ASH)
7942 #ifdef AF_ASH
7943 {*r = AF_ASH; return 0;}
7944 #else /* def AF_ASH */
7945 {errno = EINVAL; return -1;}
7946 #endif /* ndef AF_ASH */
7947 if (x == Mono_Posix_UnixAddressFamily_AF_ATMPVC)
7948 #ifdef AF_ATMPVC
7949 {*r = AF_ATMPVC; return 0;}
7950 #else /* def AF_ATMPVC */
7951 {errno = EINVAL; return -1;}
7952 #endif /* ndef AF_ATMPVC */
7953 if (x == Mono_Posix_UnixAddressFamily_AF_ATMSVC)
7954 #ifdef AF_ATMSVC
7955 {*r = AF_ATMSVC; return 0;}
7956 #else /* def AF_ATMSVC */
7957 {errno = EINVAL; return -1;}
7958 #endif /* ndef AF_ATMSVC */
7959 if (x == Mono_Posix_UnixAddressFamily_AF_AX25)
7960 #ifdef AF_AX25
7961 {*r = AF_AX25; return 0;}
7962 #else /* def AF_AX25 */
7963 {errno = EINVAL; return -1;}
7964 #endif /* ndef AF_AX25 */
7965 if (x == Mono_Posix_UnixAddressFamily_AF_BLUETOOTH)
7966 #ifdef AF_BLUETOOTH
7967 {*r = AF_BLUETOOTH; return 0;}
7968 #else /* def AF_BLUETOOTH */
7969 {errno = EINVAL; return -1;}
7970 #endif /* ndef AF_BLUETOOTH */
7971 if (x == Mono_Posix_UnixAddressFamily_AF_BRIDGE)
7972 #ifdef AF_BRIDGE
7973 {*r = AF_BRIDGE; return 0;}
7974 #else /* def AF_BRIDGE */
7975 {errno = EINVAL; return -1;}
7976 #endif /* ndef AF_BRIDGE */
7977 if (x == Mono_Posix_UnixAddressFamily_AF_CAIF)
7978 #ifdef AF_CAIF
7979 {*r = AF_CAIF; return 0;}
7980 #else /* def AF_CAIF */
7981 {errno = EINVAL; return -1;}
7982 #endif /* ndef AF_CAIF */
7983 if (x == Mono_Posix_UnixAddressFamily_AF_CAN)
7984 #ifdef AF_CAN
7985 {*r = AF_CAN; return 0;}
7986 #else /* def AF_CAN */
7987 {errno = EINVAL; return -1;}
7988 #endif /* ndef AF_CAN */
7989 if (x == Mono_Posix_UnixAddressFamily_AF_DECnet)
7990 #ifdef AF_DECnet
7991 {*r = AF_DECnet; return 0;}
7992 #else /* def AF_DECnet */
7993 {errno = EINVAL; return -1;}
7994 #endif /* ndef AF_DECnet */
7995 if (x == Mono_Posix_UnixAddressFamily_AF_ECONET)
7996 #ifdef AF_ECONET
7997 {*r = AF_ECONET; return 0;}
7998 #else /* def AF_ECONET */
7999 {errno = EINVAL; return -1;}
8000 #endif /* ndef AF_ECONET */
8001 if (x == Mono_Posix_UnixAddressFamily_AF_IEEE802154)
8002 #ifdef AF_IEEE802154
8003 {*r = AF_IEEE802154; return 0;}
8004 #else /* def AF_IEEE802154 */
8005 {errno = EINVAL; return -1;}
8006 #endif /* ndef AF_IEEE802154 */
8007 if (x == Mono_Posix_UnixAddressFamily_AF_INET)
8008 #ifdef AF_INET
8009 {*r = AF_INET; return 0;}
8010 #else /* def AF_INET */
8011 {errno = EINVAL; return -1;}
8012 #endif /* ndef AF_INET */
8013 if (x == Mono_Posix_UnixAddressFamily_AF_INET6)
8014 #ifdef AF_INET6
8015 {*r = AF_INET6; return 0;}
8016 #else /* def AF_INET6 */
8017 {errno = EINVAL; return -1;}
8018 #endif /* ndef AF_INET6 */
8019 if (x == Mono_Posix_UnixAddressFamily_AF_IPX)
8020 #ifdef AF_IPX
8021 {*r = AF_IPX; return 0;}
8022 #else /* def AF_IPX */
8023 {errno = EINVAL; return -1;}
8024 #endif /* ndef AF_IPX */
8025 if (x == Mono_Posix_UnixAddressFamily_AF_IRDA)
8026 #ifdef AF_IRDA
8027 {*r = AF_IRDA; return 0;}
8028 #else /* def AF_IRDA */
8029 {errno = EINVAL; return -1;}
8030 #endif /* ndef AF_IRDA */
8031 if (x == Mono_Posix_UnixAddressFamily_AF_ISDN)
8032 #ifdef AF_ISDN
8033 {*r = AF_ISDN; return 0;}
8034 #else /* def AF_ISDN */
8035 {errno = EINVAL; return -1;}
8036 #endif /* ndef AF_ISDN */
8037 if (x == Mono_Posix_UnixAddressFamily_AF_IUCV)
8038 #ifdef AF_IUCV
8039 {*r = AF_IUCV; return 0;}
8040 #else /* def AF_IUCV */
8041 {errno = EINVAL; return -1;}
8042 #endif /* ndef AF_IUCV */
8043 if (x == Mono_Posix_UnixAddressFamily_AF_KEY)
8044 #ifdef AF_KEY
8045 {*r = AF_KEY; return 0;}
8046 #else /* def AF_KEY */
8047 {errno = EINVAL; return -1;}
8048 #endif /* ndef AF_KEY */
8049 if (x == Mono_Posix_UnixAddressFamily_AF_LLC)
8050 #ifdef AF_LLC
8051 {*r = AF_LLC; return 0;}
8052 #else /* def AF_LLC */
8053 {errno = EINVAL; return -1;}
8054 #endif /* ndef AF_LLC */
8055 if (x == Mono_Posix_UnixAddressFamily_AF_NETBEUI)
8056 #ifdef AF_NETBEUI
8057 {*r = AF_NETBEUI; return 0;}
8058 #else /* def AF_NETBEUI */
8059 {errno = EINVAL; return -1;}
8060 #endif /* ndef AF_NETBEUI */
8061 if (x == Mono_Posix_UnixAddressFamily_AF_NETLINK)
8062 #ifdef AF_NETLINK
8063 {*r = AF_NETLINK; return 0;}
8064 #else /* def AF_NETLINK */
8065 {errno = EINVAL; return -1;}
8066 #endif /* ndef AF_NETLINK */
8067 if (x == Mono_Posix_UnixAddressFamily_AF_NETROM)
8068 #ifdef AF_NETROM
8069 {*r = AF_NETROM; return 0;}
8070 #else /* def AF_NETROM */
8071 {errno = EINVAL; return -1;}
8072 #endif /* ndef AF_NETROM */
8073 if (x == Mono_Posix_UnixAddressFamily_AF_NFC)
8074 #ifdef AF_NFC
8075 {*r = AF_NFC; return 0;}
8076 #else /* def AF_NFC */
8077 {errno = EINVAL; return -1;}
8078 #endif /* ndef AF_NFC */
8079 if (x == Mono_Posix_UnixAddressFamily_AF_PACKET)
8080 #ifdef AF_PACKET
8081 {*r = AF_PACKET; return 0;}
8082 #else /* def AF_PACKET */
8083 {errno = EINVAL; return -1;}
8084 #endif /* ndef AF_PACKET */
8085 if (x == Mono_Posix_UnixAddressFamily_AF_PHONET)
8086 #ifdef AF_PHONET
8087 {*r = AF_PHONET; return 0;}
8088 #else /* def AF_PHONET */
8089 {errno = EINVAL; return -1;}
8090 #endif /* ndef AF_PHONET */
8091 if (x == Mono_Posix_UnixAddressFamily_AF_PPPOX)
8092 #ifdef AF_PPPOX
8093 {*r = AF_PPPOX; return 0;}
8094 #else /* def AF_PPPOX */
8095 {errno = EINVAL; return -1;}
8096 #endif /* ndef AF_PPPOX */
8097 if (x == Mono_Posix_UnixAddressFamily_AF_RDS)
8098 #ifdef AF_RDS
8099 {*r = AF_RDS; return 0;}
8100 #else /* def AF_RDS */
8101 {errno = EINVAL; return -1;}
8102 #endif /* ndef AF_RDS */
8103 if (x == Mono_Posix_UnixAddressFamily_AF_ROSE)
8104 #ifdef AF_ROSE
8105 {*r = AF_ROSE; return 0;}
8106 #else /* def AF_ROSE */
8107 {errno = EINVAL; return -1;}
8108 #endif /* ndef AF_ROSE */
8109 if (x == Mono_Posix_UnixAddressFamily_AF_RXRPC)
8110 #ifdef AF_RXRPC
8111 {*r = AF_RXRPC; return 0;}
8112 #else /* def AF_RXRPC */
8113 {errno = EINVAL; return -1;}
8114 #endif /* ndef AF_RXRPC */
8115 if (x == Mono_Posix_UnixAddressFamily_AF_SECURITY)
8116 #ifdef AF_SECURITY
8117 {*r = AF_SECURITY; return 0;}
8118 #else /* def AF_SECURITY */
8119 {errno = EINVAL; return -1;}
8120 #endif /* ndef AF_SECURITY */
8121 if (x == Mono_Posix_UnixAddressFamily_AF_SNA)
8122 #ifdef AF_SNA
8123 {*r = AF_SNA; return 0;}
8124 #else /* def AF_SNA */
8125 {errno = EINVAL; return -1;}
8126 #endif /* ndef AF_SNA */
8127 if (x == Mono_Posix_UnixAddressFamily_AF_TIPC)
8128 #ifdef AF_TIPC
8129 {*r = AF_TIPC; return 0;}
8130 #else /* def AF_TIPC */
8131 {errno = EINVAL; return -1;}
8132 #endif /* ndef AF_TIPC */
8133 if (x == Mono_Posix_UnixAddressFamily_AF_UNIX)
8134 #ifdef AF_UNIX
8135 {*r = AF_UNIX; return 0;}
8136 #else /* def AF_UNIX */
8137 {errno = EINVAL; return -1;}
8138 #endif /* ndef AF_UNIX */
8139 if (x == Mono_Posix_UnixAddressFamily_AF_UNSPEC)
8140 #ifdef AF_UNSPEC
8141 {*r = AF_UNSPEC; return 0;}
8142 #else /* def AF_UNSPEC */
8143 {errno = EINVAL; return -1;}
8144 #endif /* ndef AF_UNSPEC */
8145 if (x == Mono_Posix_UnixAddressFamily_AF_VSOCK)
8146 #ifdef AF_VSOCK
8147 {*r = AF_VSOCK; return 0;}
8148 #else /* def AF_VSOCK */
8149 {errno = EINVAL; return -1;}
8150 #endif /* ndef AF_VSOCK */
8151 if (x == Mono_Posix_UnixAddressFamily_AF_WANPIPE)
8152 #ifdef AF_WANPIPE
8153 {*r = AF_WANPIPE; return 0;}
8154 #else /* def AF_WANPIPE */
8155 {errno = EINVAL; return -1;}
8156 #endif /* ndef AF_WANPIPE */
8157 if (x == Mono_Posix_UnixAddressFamily_AF_X25)
8158 #ifdef AF_X25
8159 {*r = AF_X25; return 0;}
8160 #else /* def AF_X25 */
8161 {errno = EINVAL; return -1;}
8162 #endif /* ndef AF_X25 */
8163 if (x == Mono_Posix_UnixAddressFamily_Unknown)
8164 #ifdef Unknown
8165 {*r = Unknown; return 0;}
8166 #else /* def Unknown */
8167 {errno = EINVAL; return -1;}
8168 #endif /* ndef Unknown */
8169 if (x == 0)
8170 return 0;
8171 errno = EINVAL; return -1;
8174 int Mono_Posix_ToUnixAddressFamily (int x, int *r)
8176 *r = 0;
8177 if (x == 0)
8178 return 0;
8179 #ifdef AF_ALG
8180 if (x == AF_ALG)
8181 {*r = Mono_Posix_UnixAddressFamily_AF_ALG; return 0;}
8182 #endif /* ndef AF_ALG */
8183 #ifdef AF_APPLETALK
8184 if (x == AF_APPLETALK)
8185 {*r = Mono_Posix_UnixAddressFamily_AF_APPLETALK; return 0;}
8186 #endif /* ndef AF_APPLETALK */
8187 #ifdef AF_ASH
8188 if (x == AF_ASH)
8189 {*r = Mono_Posix_UnixAddressFamily_AF_ASH; return 0;}
8190 #endif /* ndef AF_ASH */
8191 #ifdef AF_ATMPVC
8192 if (x == AF_ATMPVC)
8193 {*r = Mono_Posix_UnixAddressFamily_AF_ATMPVC; return 0;}
8194 #endif /* ndef AF_ATMPVC */
8195 #ifdef AF_ATMSVC
8196 if (x == AF_ATMSVC)
8197 {*r = Mono_Posix_UnixAddressFamily_AF_ATMSVC; return 0;}
8198 #endif /* ndef AF_ATMSVC */
8199 #ifdef AF_AX25
8200 if (x == AF_AX25)
8201 {*r = Mono_Posix_UnixAddressFamily_AF_AX25; return 0;}
8202 #endif /* ndef AF_AX25 */
8203 #ifdef AF_BLUETOOTH
8204 if (x == AF_BLUETOOTH)
8205 {*r = Mono_Posix_UnixAddressFamily_AF_BLUETOOTH; return 0;}
8206 #endif /* ndef AF_BLUETOOTH */
8207 #ifdef AF_BRIDGE
8208 if (x == AF_BRIDGE)
8209 {*r = Mono_Posix_UnixAddressFamily_AF_BRIDGE; return 0;}
8210 #endif /* ndef AF_BRIDGE */
8211 #ifdef AF_CAIF
8212 if (x == AF_CAIF)
8213 {*r = Mono_Posix_UnixAddressFamily_AF_CAIF; return 0;}
8214 #endif /* ndef AF_CAIF */
8215 #ifdef AF_CAN
8216 if (x == AF_CAN)
8217 {*r = Mono_Posix_UnixAddressFamily_AF_CAN; return 0;}
8218 #endif /* ndef AF_CAN */
8219 #ifdef AF_DECnet
8220 if (x == AF_DECnet)
8221 {*r = Mono_Posix_UnixAddressFamily_AF_DECnet; return 0;}
8222 #endif /* ndef AF_DECnet */
8223 #ifdef AF_ECONET
8224 if (x == AF_ECONET)
8225 {*r = Mono_Posix_UnixAddressFamily_AF_ECONET; return 0;}
8226 #endif /* ndef AF_ECONET */
8227 #ifdef AF_IEEE802154
8228 if (x == AF_IEEE802154)
8229 {*r = Mono_Posix_UnixAddressFamily_AF_IEEE802154; return 0;}
8230 #endif /* ndef AF_IEEE802154 */
8231 #ifdef AF_INET
8232 if (x == AF_INET)
8233 {*r = Mono_Posix_UnixAddressFamily_AF_INET; return 0;}
8234 #endif /* ndef AF_INET */
8235 #ifdef AF_INET6
8236 if (x == AF_INET6)
8237 {*r = Mono_Posix_UnixAddressFamily_AF_INET6; return 0;}
8238 #endif /* ndef AF_INET6 */
8239 #ifdef AF_IPX
8240 if (x == AF_IPX)
8241 {*r = Mono_Posix_UnixAddressFamily_AF_IPX; return 0;}
8242 #endif /* ndef AF_IPX */
8243 #ifdef AF_IRDA
8244 if (x == AF_IRDA)
8245 {*r = Mono_Posix_UnixAddressFamily_AF_IRDA; return 0;}
8246 #endif /* ndef AF_IRDA */
8247 #ifdef AF_ISDN
8248 if (x == AF_ISDN)
8249 {*r = Mono_Posix_UnixAddressFamily_AF_ISDN; return 0;}
8250 #endif /* ndef AF_ISDN */
8251 #ifdef AF_IUCV
8252 if (x == AF_IUCV)
8253 {*r = Mono_Posix_UnixAddressFamily_AF_IUCV; return 0;}
8254 #endif /* ndef AF_IUCV */
8255 #ifdef AF_KEY
8256 if (x == AF_KEY)
8257 {*r = Mono_Posix_UnixAddressFamily_AF_KEY; return 0;}
8258 #endif /* ndef AF_KEY */
8259 #ifdef AF_LLC
8260 if (x == AF_LLC)
8261 {*r = Mono_Posix_UnixAddressFamily_AF_LLC; return 0;}
8262 #endif /* ndef AF_LLC */
8263 #ifdef AF_NETBEUI
8264 if (x == AF_NETBEUI)
8265 {*r = Mono_Posix_UnixAddressFamily_AF_NETBEUI; return 0;}
8266 #endif /* ndef AF_NETBEUI */
8267 #ifdef AF_NETLINK
8268 if (x == AF_NETLINK)
8269 {*r = Mono_Posix_UnixAddressFamily_AF_NETLINK; return 0;}
8270 #endif /* ndef AF_NETLINK */
8271 #ifdef AF_NETROM
8272 if (x == AF_NETROM)
8273 {*r = Mono_Posix_UnixAddressFamily_AF_NETROM; return 0;}
8274 #endif /* ndef AF_NETROM */
8275 #ifdef AF_NFC
8276 if (x == AF_NFC)
8277 {*r = Mono_Posix_UnixAddressFamily_AF_NFC; return 0;}
8278 #endif /* ndef AF_NFC */
8279 #ifdef AF_PACKET
8280 if (x == AF_PACKET)
8281 {*r = Mono_Posix_UnixAddressFamily_AF_PACKET; return 0;}
8282 #endif /* ndef AF_PACKET */
8283 #ifdef AF_PHONET
8284 if (x == AF_PHONET)
8285 {*r = Mono_Posix_UnixAddressFamily_AF_PHONET; return 0;}
8286 #endif /* ndef AF_PHONET */
8287 #ifdef AF_PPPOX
8288 if (x == AF_PPPOX)
8289 {*r = Mono_Posix_UnixAddressFamily_AF_PPPOX; return 0;}
8290 #endif /* ndef AF_PPPOX */
8291 #ifdef AF_RDS
8292 if (x == AF_RDS)
8293 {*r = Mono_Posix_UnixAddressFamily_AF_RDS; return 0;}
8294 #endif /* ndef AF_RDS */
8295 #ifdef AF_ROSE
8296 if (x == AF_ROSE)
8297 {*r = Mono_Posix_UnixAddressFamily_AF_ROSE; return 0;}
8298 #endif /* ndef AF_ROSE */
8299 #ifdef AF_RXRPC
8300 if (x == AF_RXRPC)
8301 {*r = Mono_Posix_UnixAddressFamily_AF_RXRPC; return 0;}
8302 #endif /* ndef AF_RXRPC */
8303 #ifdef AF_SECURITY
8304 if (x == AF_SECURITY)
8305 {*r = Mono_Posix_UnixAddressFamily_AF_SECURITY; return 0;}
8306 #endif /* ndef AF_SECURITY */
8307 #ifdef AF_SNA
8308 if (x == AF_SNA)
8309 {*r = Mono_Posix_UnixAddressFamily_AF_SNA; return 0;}
8310 #endif /* ndef AF_SNA */
8311 #ifdef AF_TIPC
8312 if (x == AF_TIPC)
8313 {*r = Mono_Posix_UnixAddressFamily_AF_TIPC; return 0;}
8314 #endif /* ndef AF_TIPC */
8315 #ifdef AF_UNIX
8316 if (x == AF_UNIX)
8317 {*r = Mono_Posix_UnixAddressFamily_AF_UNIX; return 0;}
8318 #endif /* ndef AF_UNIX */
8319 #ifdef AF_UNSPEC
8320 if (x == AF_UNSPEC)
8321 {*r = Mono_Posix_UnixAddressFamily_AF_UNSPEC; return 0;}
8322 #endif /* ndef AF_UNSPEC */
8323 #ifdef AF_VSOCK
8324 if (x == AF_VSOCK)
8325 {*r = Mono_Posix_UnixAddressFamily_AF_VSOCK; return 0;}
8326 #endif /* ndef AF_VSOCK */
8327 #ifdef AF_WANPIPE
8328 if (x == AF_WANPIPE)
8329 {*r = Mono_Posix_UnixAddressFamily_AF_WANPIPE; return 0;}
8330 #endif /* ndef AF_WANPIPE */
8331 #ifdef AF_X25
8332 if (x == AF_X25)
8333 {*r = Mono_Posix_UnixAddressFamily_AF_X25; return 0;}
8334 #endif /* ndef AF_X25 */
8335 #ifdef Unknown
8336 if (x == Unknown)
8337 {*r = Mono_Posix_UnixAddressFamily_Unknown; return 0;}
8338 #endif /* ndef Unknown */
8339 errno = EINVAL; return -1;
8342 int Mono_Posix_FromUnixSocketControlMessage (int x, int *r)
8344 *r = 0;
8345 if (x == Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS)
8346 #ifdef SCM_CREDENTIALS
8347 {*r = SCM_CREDENTIALS; return 0;}
8348 #else /* def SCM_CREDENTIALS */
8349 {errno = EINVAL; return -1;}
8350 #endif /* ndef SCM_CREDENTIALS */
8351 if (x == Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS)
8352 #ifdef SCM_RIGHTS
8353 {*r = SCM_RIGHTS; return 0;}
8354 #else /* def SCM_RIGHTS */
8355 {errno = EINVAL; return -1;}
8356 #endif /* ndef SCM_RIGHTS */
8357 if (x == 0)
8358 return 0;
8359 errno = EINVAL; return -1;
8362 int Mono_Posix_ToUnixSocketControlMessage (int x, int *r)
8364 *r = 0;
8365 if (x == 0)
8366 return 0;
8367 #ifdef SCM_CREDENTIALS
8368 if (x == SCM_CREDENTIALS)
8369 {*r = Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS; return 0;}
8370 #endif /* ndef SCM_CREDENTIALS */
8371 #ifdef SCM_RIGHTS
8372 if (x == SCM_RIGHTS)
8373 {*r = Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS; return 0;}
8374 #endif /* ndef SCM_RIGHTS */
8375 errno = EINVAL; return -1;
8378 int Mono_Posix_FromUnixSocketFlags (int x, int *r)
8380 *r = 0;
8381 if ((x & Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC) == Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC)
8382 #ifdef SOCK_CLOEXEC
8383 *r |= SOCK_CLOEXEC;
8384 #else /* def SOCK_CLOEXEC */
8385 {errno = EINVAL; return -1;}
8386 #endif /* ndef SOCK_CLOEXEC */
8387 if ((x & Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK) == Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK)
8388 #ifdef SOCK_NONBLOCK
8389 *r |= SOCK_NONBLOCK;
8390 #else /* def SOCK_NONBLOCK */
8391 {errno = EINVAL; return -1;}
8392 #endif /* ndef SOCK_NONBLOCK */
8393 if (x == 0)
8394 return 0;
8395 return 0;
8398 int Mono_Posix_ToUnixSocketFlags (int x, int *r)
8400 *r = 0;
8401 if (x == 0)
8402 return 0;
8403 #ifdef SOCK_CLOEXEC
8404 if ((x & SOCK_CLOEXEC) == SOCK_CLOEXEC)
8405 *r |= Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC;
8406 #endif /* ndef SOCK_CLOEXEC */
8407 #ifdef SOCK_NONBLOCK
8408 if ((x & SOCK_NONBLOCK) == SOCK_NONBLOCK)
8409 *r |= Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK;
8410 #endif /* ndef SOCK_NONBLOCK */
8411 return 0;
8414 int Mono_Posix_FromUnixSocketOptionName (int x, int *r)
8416 *r = 0;
8417 if (x == Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN)
8418 #ifdef SO_ACCEPTCONN
8419 {*r = SO_ACCEPTCONN; return 0;}
8420 #else /* def SO_ACCEPTCONN */
8421 {errno = EINVAL; return -1;}
8422 #endif /* ndef SO_ACCEPTCONN */
8423 if (x == Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER)
8424 #ifdef SO_ATTACH_FILTER
8425 {*r = SO_ATTACH_FILTER; return 0;}
8426 #else /* def SO_ATTACH_FILTER */
8427 {errno = EINVAL; return -1;}
8428 #endif /* ndef SO_ATTACH_FILTER */
8429 if (x == Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE)
8430 #ifdef SO_BINDTODEVICE
8431 {*r = SO_BINDTODEVICE; return 0;}
8432 #else /* def SO_BINDTODEVICE */
8433 {errno = EINVAL; return -1;}
8434 #endif /* ndef SO_BINDTODEVICE */
8435 if (x == Mono_Posix_UnixSocketOptionName_SO_BROADCAST)
8436 #ifdef SO_BROADCAST
8437 {*r = SO_BROADCAST; return 0;}
8438 #else /* def SO_BROADCAST */
8439 {errno = EINVAL; return -1;}
8440 #endif /* ndef SO_BROADCAST */
8441 if (x == Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT)
8442 #ifdef SO_BSDCOMPAT
8443 {*r = SO_BSDCOMPAT; return 0;}
8444 #else /* def SO_BSDCOMPAT */
8445 {errno = EINVAL; return -1;}
8446 #endif /* ndef SO_BSDCOMPAT */
8447 if (x == Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL)
8448 #ifdef SO_BUSY_POLL
8449 {*r = SO_BUSY_POLL; return 0;}
8450 #else /* def SO_BUSY_POLL */
8451 {errno = EINVAL; return -1;}
8452 #endif /* ndef SO_BUSY_POLL */
8453 if (x == Mono_Posix_UnixSocketOptionName_SO_DEBUG)
8454 #ifdef SO_DEBUG
8455 {*r = SO_DEBUG; return 0;}
8456 #else /* def SO_DEBUG */
8457 {errno = EINVAL; return -1;}
8458 #endif /* ndef SO_DEBUG */
8459 if (x == Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER)
8460 #ifdef SO_DETACH_FILTER
8461 {*r = SO_DETACH_FILTER; return 0;}
8462 #else /* def SO_DETACH_FILTER */
8463 {errno = EINVAL; return -1;}
8464 #endif /* ndef SO_DETACH_FILTER */
8465 if (x == Mono_Posix_UnixSocketOptionName_SO_DOMAIN)
8466 #ifdef SO_DOMAIN
8467 {*r = SO_DOMAIN; return 0;}
8468 #else /* def SO_DOMAIN */
8469 {errno = EINVAL; return -1;}
8470 #endif /* ndef SO_DOMAIN */
8471 if (x == Mono_Posix_UnixSocketOptionName_SO_DONTROUTE)
8472 #ifdef SO_DONTROUTE
8473 {*r = SO_DONTROUTE; return 0;}
8474 #else /* def SO_DONTROUTE */
8475 {errno = EINVAL; return -1;}
8476 #endif /* ndef SO_DONTROUTE */
8477 if (x == Mono_Posix_UnixSocketOptionName_SO_ERROR)
8478 #ifdef SO_ERROR
8479 {*r = SO_ERROR; return 0;}
8480 #else /* def SO_ERROR */
8481 {errno = EINVAL; return -1;}
8482 #endif /* ndef SO_ERROR */
8483 if (x == Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE)
8484 #ifdef SO_KEEPALIVE
8485 {*r = SO_KEEPALIVE; return 0;}
8486 #else /* def SO_KEEPALIVE */
8487 {errno = EINVAL; return -1;}
8488 #endif /* ndef SO_KEEPALIVE */
8489 if (x == Mono_Posix_UnixSocketOptionName_SO_LINGER)
8490 #ifdef SO_LINGER
8491 {*r = SO_LINGER; return 0;}
8492 #else /* def SO_LINGER */
8493 {errno = EINVAL; return -1;}
8494 #endif /* ndef SO_LINGER */
8495 if (x == Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER)
8496 #ifdef SO_LOCK_FILTER
8497 {*r = SO_LOCK_FILTER; return 0;}
8498 #else /* def SO_LOCK_FILTER */
8499 {errno = EINVAL; return -1;}
8500 #endif /* ndef SO_LOCK_FILTER */
8501 if (x == Mono_Posix_UnixSocketOptionName_SO_MARK)
8502 #ifdef SO_MARK
8503 {*r = SO_MARK; return 0;}
8504 #else /* def SO_MARK */
8505 {errno = EINVAL; return -1;}
8506 #endif /* ndef SO_MARK */
8507 if (x == Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE)
8508 #ifdef SO_MAX_PACING_RATE
8509 {*r = SO_MAX_PACING_RATE; return 0;}
8510 #else /* def SO_MAX_PACING_RATE */
8511 {errno = EINVAL; return -1;}
8512 #endif /* ndef SO_MAX_PACING_RATE */
8513 if (x == Mono_Posix_UnixSocketOptionName_SO_NOFCS)
8514 #ifdef SO_NOFCS
8515 {*r = SO_NOFCS; return 0;}
8516 #else /* def SO_NOFCS */
8517 {errno = EINVAL; return -1;}
8518 #endif /* ndef SO_NOFCS */
8519 if (x == Mono_Posix_UnixSocketOptionName_SO_NO_CHECK)
8520 #ifdef SO_NO_CHECK
8521 {*r = SO_NO_CHECK; return 0;}
8522 #else /* def SO_NO_CHECK */
8523 {errno = EINVAL; return -1;}
8524 #endif /* ndef SO_NO_CHECK */
8525 if (x == Mono_Posix_UnixSocketOptionName_SO_OOBINLINE)
8526 #ifdef SO_OOBINLINE
8527 {*r = SO_OOBINLINE; return 0;}
8528 #else /* def SO_OOBINLINE */
8529 {errno = EINVAL; return -1;}
8530 #endif /* ndef SO_OOBINLINE */
8531 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSCRED)
8532 #ifdef SO_PASSCRED
8533 {*r = SO_PASSCRED; return 0;}
8534 #else /* def SO_PASSCRED */
8535 {errno = EINVAL; return -1;}
8536 #endif /* ndef SO_PASSCRED */
8537 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSSEC)
8538 #ifdef SO_PASSSEC
8539 {*r = SO_PASSSEC; return 0;}
8540 #else /* def SO_PASSSEC */
8541 {errno = EINVAL; return -1;}
8542 #endif /* ndef SO_PASSSEC */
8543 if (x == Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF)
8544 #ifdef SO_PEEK_OFF
8545 {*r = SO_PEEK_OFF; return 0;}
8546 #else /* def SO_PEEK_OFF */
8547 {errno = EINVAL; return -1;}
8548 #endif /* ndef SO_PEEK_OFF */
8549 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERCRED)
8550 #ifdef SO_PEERCRED
8551 {*r = SO_PEERCRED; return 0;}
8552 #else /* def SO_PEERCRED */
8553 {errno = EINVAL; return -1;}
8554 #endif /* ndef SO_PEERCRED */
8555 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERNAME)
8556 #ifdef SO_PEERNAME
8557 {*r = SO_PEERNAME; return 0;}
8558 #else /* def SO_PEERNAME */
8559 {errno = EINVAL; return -1;}
8560 #endif /* ndef SO_PEERNAME */
8561 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERSEC)
8562 #ifdef SO_PEERSEC
8563 {*r = SO_PEERSEC; return 0;}
8564 #else /* def SO_PEERSEC */
8565 {errno = EINVAL; return -1;}
8566 #endif /* ndef SO_PEERSEC */
8567 if (x == Mono_Posix_UnixSocketOptionName_SO_PRIORITY)
8568 #ifdef SO_PRIORITY
8569 {*r = SO_PRIORITY; return 0;}
8570 #else /* def SO_PRIORITY */
8571 {errno = EINVAL; return -1;}
8572 #endif /* ndef SO_PRIORITY */
8573 if (x == Mono_Posix_UnixSocketOptionName_SO_PROTOCOL)
8574 #ifdef SO_PROTOCOL
8575 {*r = SO_PROTOCOL; return 0;}
8576 #else /* def SO_PROTOCOL */
8577 {errno = EINVAL; return -1;}
8578 #endif /* ndef SO_PROTOCOL */
8579 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUF)
8580 #ifdef SO_RCVBUF
8581 {*r = SO_RCVBUF; return 0;}
8582 #else /* def SO_RCVBUF */
8583 {errno = EINVAL; return -1;}
8584 #endif /* ndef SO_RCVBUF */
8585 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE)
8586 #ifdef SO_RCVBUFFORCE
8587 {*r = SO_RCVBUFFORCE; return 0;}
8588 #else /* def SO_RCVBUFFORCE */
8589 {errno = EINVAL; return -1;}
8590 #endif /* ndef SO_RCVBUFFORCE */
8591 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT)
8592 #ifdef SO_RCVLOWAT
8593 {*r = SO_RCVLOWAT; return 0;}
8594 #else /* def SO_RCVLOWAT */
8595 {errno = EINVAL; return -1;}
8596 #endif /* ndef SO_RCVLOWAT */
8597 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO)
8598 #ifdef SO_RCVTIMEO
8599 {*r = SO_RCVTIMEO; return 0;}
8600 #else /* def SO_RCVTIMEO */
8601 {errno = EINVAL; return -1;}
8602 #endif /* ndef SO_RCVTIMEO */
8603 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEADDR)
8604 #ifdef SO_REUSEADDR
8605 {*r = SO_REUSEADDR; return 0;}
8606 #else /* def SO_REUSEADDR */
8607 {errno = EINVAL; return -1;}
8608 #endif /* ndef SO_REUSEADDR */
8609 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEPORT)
8610 #ifdef SO_REUSEPORT
8611 {*r = SO_REUSEPORT; return 0;}
8612 #else /* def SO_REUSEPORT */
8613 {errno = EINVAL; return -1;}
8614 #endif /* ndef SO_REUSEPORT */
8615 if (x == Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL)
8616 #ifdef SO_RXQ_OVFL
8617 {*r = SO_RXQ_OVFL; return 0;}
8618 #else /* def SO_RXQ_OVFL */
8619 {errno = EINVAL; return -1;}
8620 #endif /* ndef SO_RXQ_OVFL */
8621 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION)
8622 #ifdef SO_SECURITY_AUTHENTICATION
8623 {*r = SO_SECURITY_AUTHENTICATION; return 0;}
8624 #else /* def SO_SECURITY_AUTHENTICATION */
8625 {errno = EINVAL; return -1;}
8626 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8627 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK)
8628 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8629 {*r = SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8630 #else /* def SO_SECURITY_ENCRYPTION_NETWORK */
8631 {errno = EINVAL; return -1;}
8632 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8633 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT)
8634 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8635 {*r = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8636 #else /* def SO_SECURITY_ENCRYPTION_TRANSPORT */
8637 {errno = EINVAL; return -1;}
8638 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8639 if (x == Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE)
8640 #ifdef SO_SELECT_ERR_QUEUE
8641 {*r = SO_SELECT_ERR_QUEUE; return 0;}
8642 #else /* def SO_SELECT_ERR_QUEUE */
8643 {errno = EINVAL; return -1;}
8644 #endif /* ndef SO_SELECT_ERR_QUEUE */
8645 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUF)
8646 #ifdef SO_SNDBUF
8647 {*r = SO_SNDBUF; return 0;}
8648 #else /* def SO_SNDBUF */
8649 {errno = EINVAL; return -1;}
8650 #endif /* ndef SO_SNDBUF */
8651 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE)
8652 #ifdef SO_SNDBUFFORCE
8653 {*r = SO_SNDBUFFORCE; return 0;}
8654 #else /* def SO_SNDBUFFORCE */
8655 {errno = EINVAL; return -1;}
8656 #endif /* ndef SO_SNDBUFFORCE */
8657 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT)
8658 #ifdef SO_SNDLOWAT
8659 {*r = SO_SNDLOWAT; return 0;}
8660 #else /* def SO_SNDLOWAT */
8661 {errno = EINVAL; return -1;}
8662 #endif /* ndef SO_SNDLOWAT */
8663 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO)
8664 #ifdef SO_SNDTIMEO
8665 {*r = SO_SNDTIMEO; return 0;}
8666 #else /* def SO_SNDTIMEO */
8667 {errno = EINVAL; return -1;}
8668 #endif /* ndef SO_SNDTIMEO */
8669 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP)
8670 #ifdef SO_TIMESTAMP
8671 {*r = SO_TIMESTAMP; return 0;}
8672 #else /* def SO_TIMESTAMP */
8673 {errno = EINVAL; return -1;}
8674 #endif /* ndef SO_TIMESTAMP */
8675 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING)
8676 #ifdef SO_TIMESTAMPING
8677 {*r = SO_TIMESTAMPING; return 0;}
8678 #else /* def SO_TIMESTAMPING */
8679 {errno = EINVAL; return -1;}
8680 #endif /* ndef SO_TIMESTAMPING */
8681 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS)
8682 #ifdef SO_TIMESTAMPNS
8683 {*r = SO_TIMESTAMPNS; return 0;}
8684 #else /* def SO_TIMESTAMPNS */
8685 {errno = EINVAL; return -1;}
8686 #endif /* ndef SO_TIMESTAMPNS */
8687 if (x == Mono_Posix_UnixSocketOptionName_SO_TYPE)
8688 #ifdef SO_TYPE
8689 {*r = SO_TYPE; return 0;}
8690 #else /* def SO_TYPE */
8691 {errno = EINVAL; return -1;}
8692 #endif /* ndef SO_TYPE */
8693 if (x == Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS)
8694 #ifdef SO_WIFI_STATUS
8695 {*r = SO_WIFI_STATUS; return 0;}
8696 #else /* def SO_WIFI_STATUS */
8697 {errno = EINVAL; return -1;}
8698 #endif /* ndef SO_WIFI_STATUS */
8699 if (x == 0)
8700 return 0;
8701 errno = EINVAL; return -1;
8704 int Mono_Posix_ToUnixSocketOptionName (int x, int *r)
8706 *r = 0;
8707 if (x == 0)
8708 return 0;
8709 #ifdef SO_ACCEPTCONN
8710 if (x == SO_ACCEPTCONN)
8711 {*r = Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN; return 0;}
8712 #endif /* ndef SO_ACCEPTCONN */
8713 #ifdef SO_ATTACH_FILTER
8714 if (x == SO_ATTACH_FILTER)
8715 {*r = Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER; return 0;}
8716 #endif /* ndef SO_ATTACH_FILTER */
8717 #ifdef SO_BINDTODEVICE
8718 if (x == SO_BINDTODEVICE)
8719 {*r = Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE; return 0;}
8720 #endif /* ndef SO_BINDTODEVICE */
8721 #ifdef SO_BROADCAST
8722 if (x == SO_BROADCAST)
8723 {*r = Mono_Posix_UnixSocketOptionName_SO_BROADCAST; return 0;}
8724 #endif /* ndef SO_BROADCAST */
8725 #ifdef SO_BSDCOMPAT
8726 if (x == SO_BSDCOMPAT)
8727 {*r = Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT; return 0;}
8728 #endif /* ndef SO_BSDCOMPAT */
8729 #ifdef SO_BUSY_POLL
8730 if (x == SO_BUSY_POLL)
8731 {*r = Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL; return 0;}
8732 #endif /* ndef SO_BUSY_POLL */
8733 #ifdef SO_DEBUG
8734 if (x == SO_DEBUG)
8735 {*r = Mono_Posix_UnixSocketOptionName_SO_DEBUG; return 0;}
8736 #endif /* ndef SO_DEBUG */
8737 #ifdef SO_DETACH_FILTER
8738 if (x == SO_DETACH_FILTER)
8739 {*r = Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER; return 0;}
8740 #endif /* ndef SO_DETACH_FILTER */
8741 #ifdef SO_DOMAIN
8742 if (x == SO_DOMAIN)
8743 {*r = Mono_Posix_UnixSocketOptionName_SO_DOMAIN; return 0;}
8744 #endif /* ndef SO_DOMAIN */
8745 #ifdef SO_DONTROUTE
8746 if (x == SO_DONTROUTE)
8747 {*r = Mono_Posix_UnixSocketOptionName_SO_DONTROUTE; return 0;}
8748 #endif /* ndef SO_DONTROUTE */
8749 #ifdef SO_ERROR
8750 if (x == SO_ERROR)
8751 {*r = Mono_Posix_UnixSocketOptionName_SO_ERROR; return 0;}
8752 #endif /* ndef SO_ERROR */
8753 #ifdef SO_KEEPALIVE
8754 if (x == SO_KEEPALIVE)
8755 {*r = Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE; return 0;}
8756 #endif /* ndef SO_KEEPALIVE */
8757 #ifdef SO_LINGER
8758 if (x == SO_LINGER)
8759 {*r = Mono_Posix_UnixSocketOptionName_SO_LINGER; return 0;}
8760 #endif /* ndef SO_LINGER */
8761 #ifdef SO_LOCK_FILTER
8762 if (x == SO_LOCK_FILTER)
8763 {*r = Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER; return 0;}
8764 #endif /* ndef SO_LOCK_FILTER */
8765 #ifdef SO_MARK
8766 if (x == SO_MARK)
8767 {*r = Mono_Posix_UnixSocketOptionName_SO_MARK; return 0;}
8768 #endif /* ndef SO_MARK */
8769 #ifdef SO_MAX_PACING_RATE
8770 if (x == SO_MAX_PACING_RATE)
8771 {*r = Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE; return 0;}
8772 #endif /* ndef SO_MAX_PACING_RATE */
8773 #ifdef SO_NOFCS
8774 if (x == SO_NOFCS)
8775 {*r = Mono_Posix_UnixSocketOptionName_SO_NOFCS; return 0;}
8776 #endif /* ndef SO_NOFCS */
8777 #ifdef SO_NO_CHECK
8778 if (x == SO_NO_CHECK)
8779 {*r = Mono_Posix_UnixSocketOptionName_SO_NO_CHECK; return 0;}
8780 #endif /* ndef SO_NO_CHECK */
8781 #ifdef SO_OOBINLINE
8782 if (x == SO_OOBINLINE)
8783 {*r = Mono_Posix_UnixSocketOptionName_SO_OOBINLINE; return 0;}
8784 #endif /* ndef SO_OOBINLINE */
8785 #ifdef SO_PASSCRED
8786 if (x == SO_PASSCRED)
8787 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSCRED; return 0;}
8788 #endif /* ndef SO_PASSCRED */
8789 #ifdef SO_PASSSEC
8790 if (x == SO_PASSSEC)
8791 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSSEC; return 0;}
8792 #endif /* ndef SO_PASSSEC */
8793 #ifdef SO_PEEK_OFF
8794 if (x == SO_PEEK_OFF)
8795 {*r = Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF; return 0;}
8796 #endif /* ndef SO_PEEK_OFF */
8797 #ifdef SO_PEERCRED
8798 if (x == SO_PEERCRED)
8799 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERCRED; return 0;}
8800 #endif /* ndef SO_PEERCRED */
8801 #ifdef SO_PEERNAME
8802 if (x == SO_PEERNAME)
8803 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERNAME; return 0;}
8804 #endif /* ndef SO_PEERNAME */
8805 #ifdef SO_PEERSEC
8806 if (x == SO_PEERSEC)
8807 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERSEC; return 0;}
8808 #endif /* ndef SO_PEERSEC */
8809 #ifdef SO_PRIORITY
8810 if (x == SO_PRIORITY)
8811 {*r = Mono_Posix_UnixSocketOptionName_SO_PRIORITY; return 0;}
8812 #endif /* ndef SO_PRIORITY */
8813 #ifdef SO_PROTOCOL
8814 if (x == SO_PROTOCOL)
8815 {*r = Mono_Posix_UnixSocketOptionName_SO_PROTOCOL; return 0;}
8816 #endif /* ndef SO_PROTOCOL */
8817 #ifdef SO_RCVBUF
8818 if (x == SO_RCVBUF)
8819 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUF; return 0;}
8820 #endif /* ndef SO_RCVBUF */
8821 #ifdef SO_RCVBUFFORCE
8822 if (x == SO_RCVBUFFORCE)
8823 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE; return 0;}
8824 #endif /* ndef SO_RCVBUFFORCE */
8825 #ifdef SO_RCVLOWAT
8826 if (x == SO_RCVLOWAT)
8827 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT; return 0;}
8828 #endif /* ndef SO_RCVLOWAT */
8829 #ifdef SO_RCVTIMEO
8830 if (x == SO_RCVTIMEO)
8831 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO; return 0;}
8832 #endif /* ndef SO_RCVTIMEO */
8833 #ifdef SO_REUSEADDR
8834 if (x == SO_REUSEADDR)
8835 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEADDR; return 0;}
8836 #endif /* ndef SO_REUSEADDR */
8837 #ifdef SO_REUSEPORT
8838 if (x == SO_REUSEPORT)
8839 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEPORT; return 0;}
8840 #endif /* ndef SO_REUSEPORT */
8841 #ifdef SO_RXQ_OVFL
8842 if (x == SO_RXQ_OVFL)
8843 {*r = Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL; return 0;}
8844 #endif /* ndef SO_RXQ_OVFL */
8845 #ifdef SO_SECURITY_AUTHENTICATION
8846 if (x == SO_SECURITY_AUTHENTICATION)
8847 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION; return 0;}
8848 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8849 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8850 if (x == SO_SECURITY_ENCRYPTION_NETWORK)
8851 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8852 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8853 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8854 if (x == SO_SECURITY_ENCRYPTION_TRANSPORT)
8855 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8856 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8857 #ifdef SO_SELECT_ERR_QUEUE
8858 if (x == SO_SELECT_ERR_QUEUE)
8859 {*r = Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE; return 0;}
8860 #endif /* ndef SO_SELECT_ERR_QUEUE */
8861 #ifdef SO_SNDBUF
8862 if (x == SO_SNDBUF)
8863 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUF; return 0;}
8864 #endif /* ndef SO_SNDBUF */
8865 #ifdef SO_SNDBUFFORCE
8866 if (x == SO_SNDBUFFORCE)
8867 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE; return 0;}
8868 #endif /* ndef SO_SNDBUFFORCE */
8869 #ifdef SO_SNDLOWAT
8870 if (x == SO_SNDLOWAT)
8871 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT; return 0;}
8872 #endif /* ndef SO_SNDLOWAT */
8873 #ifdef SO_SNDTIMEO
8874 if (x == SO_SNDTIMEO)
8875 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO; return 0;}
8876 #endif /* ndef SO_SNDTIMEO */
8877 #ifdef SO_TIMESTAMP
8878 if (x == SO_TIMESTAMP)
8879 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP; return 0;}
8880 #endif /* ndef SO_TIMESTAMP */
8881 #ifdef SO_TIMESTAMPING
8882 if (x == SO_TIMESTAMPING)
8883 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING; return 0;}
8884 #endif /* ndef SO_TIMESTAMPING */
8885 #ifdef SO_TIMESTAMPNS
8886 if (x == SO_TIMESTAMPNS)
8887 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS; return 0;}
8888 #endif /* ndef SO_TIMESTAMPNS */
8889 #ifdef SO_TYPE
8890 if (x == SO_TYPE)
8891 {*r = Mono_Posix_UnixSocketOptionName_SO_TYPE; return 0;}
8892 #endif /* ndef SO_TYPE */
8893 #ifdef SO_WIFI_STATUS
8894 if (x == SO_WIFI_STATUS)
8895 {*r = Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS; return 0;}
8896 #endif /* ndef SO_WIFI_STATUS */
8897 errno = EINVAL; return -1;
8900 int Mono_Posix_FromUnixSocketProtocol (int x, int *r)
8902 *r = 0;
8903 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_AH)
8904 #ifdef IPPROTO_AH
8905 {*r = IPPROTO_AH; return 0;}
8906 #else /* def IPPROTO_AH */
8907 {errno = EINVAL; return -1;}
8908 #endif /* ndef IPPROTO_AH */
8909 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH)
8910 #ifdef IPPROTO_BEETPH
8911 {*r = IPPROTO_BEETPH; return 0;}
8912 #else /* def IPPROTO_BEETPH */
8913 {errno = EINVAL; return -1;}
8914 #endif /* ndef IPPROTO_BEETPH */
8915 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_COMP)
8916 #ifdef IPPROTO_COMP
8917 {*r = IPPROTO_COMP; return 0;}
8918 #else /* def IPPROTO_COMP */
8919 {errno = EINVAL; return -1;}
8920 #endif /* ndef IPPROTO_COMP */
8921 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP)
8922 #ifdef IPPROTO_DCCP
8923 {*r = IPPROTO_DCCP; return 0;}
8924 #else /* def IPPROTO_DCCP */
8925 {errno = EINVAL; return -1;}
8926 #endif /* ndef IPPROTO_DCCP */
8927 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_EGP)
8928 #ifdef IPPROTO_EGP
8929 {*r = IPPROTO_EGP; return 0;}
8930 #else /* def IPPROTO_EGP */
8931 {errno = EINVAL; return -1;}
8932 #endif /* ndef IPPROTO_EGP */
8933 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP)
8934 #ifdef IPPROTO_ENCAP
8935 {*r = IPPROTO_ENCAP; return 0;}
8936 #else /* def IPPROTO_ENCAP */
8937 {errno = EINVAL; return -1;}
8938 #endif /* ndef IPPROTO_ENCAP */
8939 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ESP)
8940 #ifdef IPPROTO_ESP
8941 {*r = IPPROTO_ESP; return 0;}
8942 #else /* def IPPROTO_ESP */
8943 {errno = EINVAL; return -1;}
8944 #endif /* ndef IPPROTO_ESP */
8945 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_GRE)
8946 #ifdef IPPROTO_GRE
8947 {*r = IPPROTO_GRE; return 0;}
8948 #else /* def IPPROTO_GRE */
8949 {errno = EINVAL; return -1;}
8950 #endif /* ndef IPPROTO_GRE */
8951 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP)
8952 #ifdef IPPROTO_ICMP
8953 {*r = IPPROTO_ICMP; return 0;}
8954 #else /* def IPPROTO_ICMP */
8955 {errno = EINVAL; return -1;}
8956 #endif /* ndef IPPROTO_ICMP */
8957 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IDP)
8958 #ifdef IPPROTO_IDP
8959 {*r = IPPROTO_IDP; return 0;}
8960 #else /* def IPPROTO_IDP */
8961 {errno = EINVAL; return -1;}
8962 #endif /* ndef IPPROTO_IDP */
8963 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP)
8964 #ifdef IPPROTO_IGMP
8965 {*r = IPPROTO_IGMP; return 0;}
8966 #else /* def IPPROTO_IGMP */
8967 {errno = EINVAL; return -1;}
8968 #endif /* ndef IPPROTO_IGMP */
8969 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IP)
8970 #ifdef IPPROTO_IP
8971 {*r = IPPROTO_IP; return 0;}
8972 #else /* def IPPROTO_IP */
8973 {errno = EINVAL; return -1;}
8974 #endif /* ndef IPPROTO_IP */
8975 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP)
8976 #ifdef IPPROTO_IPIP
8977 {*r = IPPROTO_IPIP; return 0;}
8978 #else /* def IPPROTO_IPIP */
8979 {errno = EINVAL; return -1;}
8980 #endif /* ndef IPPROTO_IPIP */
8981 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6)
8982 #ifdef IPPROTO_IPV6
8983 {*r = IPPROTO_IPV6; return 0;}
8984 #else /* def IPPROTO_IPV6 */
8985 {errno = EINVAL; return -1;}
8986 #endif /* ndef IPPROTO_IPV6 */
8987 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_MTP)
8988 #ifdef IPPROTO_MTP
8989 {*r = IPPROTO_MTP; return 0;}
8990 #else /* def IPPROTO_MTP */
8991 {errno = EINVAL; return -1;}
8992 #endif /* ndef IPPROTO_MTP */
8993 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PIM)
8994 #ifdef IPPROTO_PIM
8995 {*r = IPPROTO_PIM; return 0;}
8996 #else /* def IPPROTO_PIM */
8997 {errno = EINVAL; return -1;}
8998 #endif /* ndef IPPROTO_PIM */
8999 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PUP)
9000 #ifdef IPPROTO_PUP
9001 {*r = IPPROTO_PUP; return 0;}
9002 #else /* def IPPROTO_PUP */
9003 {errno = EINVAL; return -1;}
9004 #endif /* ndef IPPROTO_PUP */
9005 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RAW)
9006 #ifdef IPPROTO_RAW
9007 {*r = IPPROTO_RAW; return 0;}
9008 #else /* def IPPROTO_RAW */
9009 {errno = EINVAL; return -1;}
9010 #endif /* ndef IPPROTO_RAW */
9011 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP)
9012 #ifdef IPPROTO_RSVP
9013 {*r = IPPROTO_RSVP; return 0;}
9014 #else /* def IPPROTO_RSVP */
9015 {errno = EINVAL; return -1;}
9016 #endif /* ndef IPPROTO_RSVP */
9017 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP)
9018 #ifdef IPPROTO_SCTP
9019 {*r = IPPROTO_SCTP; return 0;}
9020 #else /* def IPPROTO_SCTP */
9021 {errno = EINVAL; return -1;}
9022 #endif /* ndef IPPROTO_SCTP */
9023 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TCP)
9024 #ifdef IPPROTO_TCP
9025 {*r = IPPROTO_TCP; return 0;}
9026 #else /* def IPPROTO_TCP */
9027 {errno = EINVAL; return -1;}
9028 #endif /* ndef IPPROTO_TCP */
9029 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TP)
9030 #ifdef IPPROTO_TP
9031 {*r = IPPROTO_TP; return 0;}
9032 #else /* def IPPROTO_TP */
9033 {errno = EINVAL; return -1;}
9034 #endif /* ndef IPPROTO_TP */
9035 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDP)
9036 #ifdef IPPROTO_UDP
9037 {*r = IPPROTO_UDP; return 0;}
9038 #else /* def IPPROTO_UDP */
9039 {errno = EINVAL; return -1;}
9040 #endif /* ndef IPPROTO_UDP */
9041 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE)
9042 #ifdef IPPROTO_UDPLITE
9043 {*r = IPPROTO_UDPLITE; return 0;}
9044 #else /* def IPPROTO_UDPLITE */
9045 {errno = EINVAL; return -1;}
9046 #endif /* ndef IPPROTO_UDPLITE */
9047 if (x == Mono_Posix_UnixSocketProtocol_SOL_SOCKET)
9048 #ifdef SOL_SOCKET
9049 {*r = SOL_SOCKET; return 0;}
9050 #else /* def SOL_SOCKET */
9051 {errno = EINVAL; return -1;}
9052 #endif /* ndef SOL_SOCKET */
9053 if (x == 0)
9054 return 0;
9055 errno = EINVAL; return -1;
9058 int Mono_Posix_ToUnixSocketProtocol (int x, int *r)
9060 *r = 0;
9061 if (x == 0)
9062 return 0;
9063 #ifdef IPPROTO_AH
9064 if (x == IPPROTO_AH)
9065 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_AH; return 0;}
9066 #endif /* ndef IPPROTO_AH */
9067 #ifdef IPPROTO_BEETPH
9068 if (x == IPPROTO_BEETPH)
9069 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH; return 0;}
9070 #endif /* ndef IPPROTO_BEETPH */
9071 #ifdef IPPROTO_COMP
9072 if (x == IPPROTO_COMP)
9073 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_COMP; return 0;}
9074 #endif /* ndef IPPROTO_COMP */
9075 #ifdef IPPROTO_DCCP
9076 if (x == IPPROTO_DCCP)
9077 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP; return 0;}
9078 #endif /* ndef IPPROTO_DCCP */
9079 #ifdef IPPROTO_EGP
9080 if (x == IPPROTO_EGP)
9081 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_EGP; return 0;}
9082 #endif /* ndef IPPROTO_EGP */
9083 #ifdef IPPROTO_ENCAP
9084 if (x == IPPROTO_ENCAP)
9085 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP; return 0;}
9086 #endif /* ndef IPPROTO_ENCAP */
9087 #ifdef IPPROTO_ESP
9088 if (x == IPPROTO_ESP)
9089 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ESP; return 0;}
9090 #endif /* ndef IPPROTO_ESP */
9091 #ifdef IPPROTO_GRE
9092 if (x == IPPROTO_GRE)
9093 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_GRE; return 0;}
9094 #endif /* ndef IPPROTO_GRE */
9095 #ifdef IPPROTO_ICMP
9096 if (x == IPPROTO_ICMP)
9097 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP; return 0;}
9098 #endif /* ndef IPPROTO_ICMP */
9099 #ifdef IPPROTO_IDP
9100 if (x == IPPROTO_IDP)
9101 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IDP; return 0;}
9102 #endif /* ndef IPPROTO_IDP */
9103 #ifdef IPPROTO_IGMP
9104 if (x == IPPROTO_IGMP)
9105 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP; return 0;}
9106 #endif /* ndef IPPROTO_IGMP */
9107 #ifdef IPPROTO_IP
9108 if (x == IPPROTO_IP)
9109 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IP; return 0;}
9110 #endif /* ndef IPPROTO_IP */
9111 #ifdef IPPROTO_IPIP
9112 if (x == IPPROTO_IPIP)
9113 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP; return 0;}
9114 #endif /* ndef IPPROTO_IPIP */
9115 #ifdef IPPROTO_IPV6
9116 if (x == IPPROTO_IPV6)
9117 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6; return 0;}
9118 #endif /* ndef IPPROTO_IPV6 */
9119 #ifdef IPPROTO_MTP
9120 if (x == IPPROTO_MTP)
9121 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_MTP; return 0;}
9122 #endif /* ndef IPPROTO_MTP */
9123 #ifdef IPPROTO_PIM
9124 if (x == IPPROTO_PIM)
9125 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PIM; return 0;}
9126 #endif /* ndef IPPROTO_PIM */
9127 #ifdef IPPROTO_PUP
9128 if (x == IPPROTO_PUP)
9129 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PUP; return 0;}
9130 #endif /* ndef IPPROTO_PUP */
9131 #ifdef IPPROTO_RAW
9132 if (x == IPPROTO_RAW)
9133 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RAW; return 0;}
9134 #endif /* ndef IPPROTO_RAW */
9135 #ifdef IPPROTO_RSVP
9136 if (x == IPPROTO_RSVP)
9137 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP; return 0;}
9138 #endif /* ndef IPPROTO_RSVP */
9139 #ifdef IPPROTO_SCTP
9140 if (x == IPPROTO_SCTP)
9141 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP; return 0;}
9142 #endif /* ndef IPPROTO_SCTP */
9143 #ifdef IPPROTO_TCP
9144 if (x == IPPROTO_TCP)
9145 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TCP; return 0;}
9146 #endif /* ndef IPPROTO_TCP */
9147 #ifdef IPPROTO_TP
9148 if (x == IPPROTO_TP)
9149 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TP; return 0;}
9150 #endif /* ndef IPPROTO_TP */
9151 #ifdef IPPROTO_UDP
9152 if (x == IPPROTO_UDP)
9153 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDP; return 0;}
9154 #endif /* ndef IPPROTO_UDP */
9155 #ifdef IPPROTO_UDPLITE
9156 if (x == IPPROTO_UDPLITE)
9157 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE; return 0;}
9158 #endif /* ndef IPPROTO_UDPLITE */
9159 #ifdef SOL_SOCKET
9160 if (x == SOL_SOCKET)
9161 {*r = Mono_Posix_UnixSocketProtocol_SOL_SOCKET; return 0;}
9162 #endif /* ndef SOL_SOCKET */
9163 errno = EINVAL; return -1;
9166 int Mono_Posix_FromUnixSocketType (int x, int *r)
9168 *r = 0;
9169 if (x == Mono_Posix_UnixSocketType_SOCK_DCCP)
9170 #ifdef SOCK_DCCP
9171 {*r = SOCK_DCCP; return 0;}
9172 #else /* def SOCK_DCCP */
9173 {errno = EINVAL; return -1;}
9174 #endif /* ndef SOCK_DCCP */
9175 if (x == Mono_Posix_UnixSocketType_SOCK_DGRAM)
9176 #ifdef SOCK_DGRAM
9177 {*r = SOCK_DGRAM; return 0;}
9178 #else /* def SOCK_DGRAM */
9179 {errno = EINVAL; return -1;}
9180 #endif /* ndef SOCK_DGRAM */
9181 if (x == Mono_Posix_UnixSocketType_SOCK_PACKET)
9182 #ifdef SOCK_PACKET
9183 {*r = SOCK_PACKET; return 0;}
9184 #else /* def SOCK_PACKET */
9185 {errno = EINVAL; return -1;}
9186 #endif /* ndef SOCK_PACKET */
9187 if (x == Mono_Posix_UnixSocketType_SOCK_RAW)
9188 #ifdef SOCK_RAW
9189 {*r = SOCK_RAW; return 0;}
9190 #else /* def SOCK_RAW */
9191 {errno = EINVAL; return -1;}
9192 #endif /* ndef SOCK_RAW */
9193 if (x == Mono_Posix_UnixSocketType_SOCK_RDM)
9194 #ifdef SOCK_RDM
9195 {*r = SOCK_RDM; return 0;}
9196 #else /* def SOCK_RDM */
9197 {errno = EINVAL; return -1;}
9198 #endif /* ndef SOCK_RDM */
9199 if (x == Mono_Posix_UnixSocketType_SOCK_SEQPACKET)
9200 #ifdef SOCK_SEQPACKET
9201 {*r = SOCK_SEQPACKET; return 0;}
9202 #else /* def SOCK_SEQPACKET */
9203 {errno = EINVAL; return -1;}
9204 #endif /* ndef SOCK_SEQPACKET */
9205 if (x == Mono_Posix_UnixSocketType_SOCK_STREAM)
9206 #ifdef SOCK_STREAM
9207 {*r = SOCK_STREAM; return 0;}
9208 #else /* def SOCK_STREAM */
9209 {errno = EINVAL; return -1;}
9210 #endif /* ndef SOCK_STREAM */
9211 if (x == 0)
9212 return 0;
9213 errno = EINVAL; return -1;
9216 int Mono_Posix_ToUnixSocketType (int x, int *r)
9218 *r = 0;
9219 if (x == 0)
9220 return 0;
9221 #ifdef SOCK_DCCP
9222 if (x == SOCK_DCCP)
9223 {*r = Mono_Posix_UnixSocketType_SOCK_DCCP; return 0;}
9224 #endif /* ndef SOCK_DCCP */
9225 #ifdef SOCK_DGRAM
9226 if (x == SOCK_DGRAM)
9227 {*r = Mono_Posix_UnixSocketType_SOCK_DGRAM; return 0;}
9228 #endif /* ndef SOCK_DGRAM */
9229 #ifdef SOCK_PACKET
9230 if (x == SOCK_PACKET)
9231 {*r = Mono_Posix_UnixSocketType_SOCK_PACKET; return 0;}
9232 #endif /* ndef SOCK_PACKET */
9233 #ifdef SOCK_RAW
9234 if (x == SOCK_RAW)
9235 {*r = Mono_Posix_UnixSocketType_SOCK_RAW; return 0;}
9236 #endif /* ndef SOCK_RAW */
9237 #ifdef SOCK_RDM
9238 if (x == SOCK_RDM)
9239 {*r = Mono_Posix_UnixSocketType_SOCK_RDM; return 0;}
9240 #endif /* ndef SOCK_RDM */
9241 #ifdef SOCK_SEQPACKET
9242 if (x == SOCK_SEQPACKET)
9243 {*r = Mono_Posix_UnixSocketType_SOCK_SEQPACKET; return 0;}
9244 #endif /* ndef SOCK_SEQPACKET */
9245 #ifdef SOCK_STREAM
9246 if (x == SOCK_STREAM)
9247 {*r = Mono_Posix_UnixSocketType_SOCK_STREAM; return 0;}
9248 #endif /* ndef SOCK_STREAM */
9249 errno = EINVAL; return -1;
9252 #ifdef HAVE_STRUCT_UTIMBUF
9254 Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
9256 _cnm_return_val_if_overflow (time_t, from->actime, -1);
9257 _cnm_return_val_if_overflow (time_t, from->modtime, -1);
9259 memset (to, 0, sizeof(*to));
9261 to->actime = from->actime;
9262 to->modtime = from->modtime;
9264 return 0;
9266 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9269 #ifdef HAVE_STRUCT_UTIMBUF
9271 Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
9273 _cnm_return_val_if_overflow (gint64, from->actime, -1);
9274 _cnm_return_val_if_overflow (gint64, from->modtime, -1);
9276 memset (to, 0, sizeof(*to));
9278 to->actime = from->actime;
9279 to->modtime = from->modtime;
9281 return 0;
9283 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9286 int Mono_Posix_FromWaitOptions (int x, int *r)
9288 *r = 0;
9289 if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
9290 #ifdef WNOHANG
9291 *r |= WNOHANG;
9292 #else /* def WNOHANG */
9293 {errno = EINVAL; return -1;}
9294 #endif /* ndef WNOHANG */
9295 if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
9296 #ifdef WUNTRACED
9297 *r |= WUNTRACED;
9298 #else /* def WUNTRACED */
9299 {errno = EINVAL; return -1;}
9300 #endif /* ndef WUNTRACED */
9301 if (x == 0)
9302 return 0;
9303 return 0;
9306 int Mono_Posix_ToWaitOptions (int x, int *r)
9308 *r = 0;
9309 if (x == 0)
9310 return 0;
9311 #ifdef WNOHANG
9312 if ((x & WNOHANG) == WNOHANG)
9313 *r |= Mono_Posix_WaitOptions_WNOHANG;
9314 #endif /* ndef WNOHANG */
9315 #ifdef WUNTRACED
9316 if ((x & WUNTRACED) == WUNTRACED)
9317 *r |= Mono_Posix_WaitOptions_WUNTRACED;
9318 #endif /* ndef WUNTRACED */
9319 return 0;
9322 int Mono_Posix_FromXattrFlags (int x, int *r)
9324 *r = 0;
9325 if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO)
9326 #ifdef XATTR_AUTO
9327 *r |= XATTR_AUTO;
9328 #else /* def XATTR_AUTO */
9329 {errno = EINVAL; return -1;}
9330 #endif /* ndef XATTR_AUTO */
9331 if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE)
9332 #ifdef XATTR_CREATE
9333 *r |= XATTR_CREATE;
9334 #else /* def XATTR_CREATE */
9335 {errno = EINVAL; return -1;}
9336 #endif /* ndef XATTR_CREATE */
9337 if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE)
9338 #ifdef XATTR_REPLACE
9339 *r |= XATTR_REPLACE;
9340 #else /* def XATTR_REPLACE */
9341 {errno = EINVAL; return -1;}
9342 #endif /* ndef XATTR_REPLACE */
9343 if (x == 0)
9344 return 0;
9345 return 0;
9348 int Mono_Posix_ToXattrFlags (int x, int *r)
9350 *r = 0;
9351 if (x == 0)
9352 return 0;
9353 #ifdef XATTR_AUTO
9354 if ((x & XATTR_AUTO) == XATTR_AUTO)
9355 *r |= Mono_Posix_XattrFlags_XATTR_AUTO;
9356 #endif /* ndef XATTR_AUTO */
9357 #ifdef XATTR_CREATE
9358 if ((x & XATTR_CREATE) == XATTR_CREATE)
9359 *r |= Mono_Posix_XattrFlags_XATTR_CREATE;
9360 #endif /* ndef XATTR_CREATE */
9361 #ifdef XATTR_REPLACE
9362 if ((x & XATTR_REPLACE) == XATTR_REPLACE)
9363 *r |= Mono_Posix_XattrFlags_XATTR_REPLACE;
9364 #endif /* ndef XATTR_REPLACE */
9365 return 0;