[sgen] Always use one concurrent worker
[mono-project.git] / support / map.c
blob615584889dfa5c4e7b8659d43b9dcc638481648c
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_SETFD)
2690 #ifdef F_SETFD
2691 {*r = F_SETFD; return 0;}
2692 #else /* def F_SETFD */
2693 {errno = EINVAL; return -1;}
2694 #endif /* ndef F_SETFD */
2695 if (x == Mono_Posix_FcntlCommand_F_SETFL)
2696 #ifdef F_SETFL
2697 {*r = F_SETFL; return 0;}
2698 #else /* def F_SETFL */
2699 {errno = EINVAL; return -1;}
2700 #endif /* ndef F_SETFL */
2701 if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
2702 #ifdef F_SETLEASE
2703 {*r = F_SETLEASE; return 0;}
2704 #else /* def F_SETLEASE */
2705 {errno = EINVAL; return -1;}
2706 #endif /* ndef F_SETLEASE */
2707 if (x == Mono_Posix_FcntlCommand_F_SETLK)
2708 #ifdef F_SETLK
2709 {*r = F_SETLK; return 0;}
2710 #else /* def F_SETLK */
2711 {errno = EINVAL; return -1;}
2712 #endif /* ndef F_SETLK */
2713 if (x == Mono_Posix_FcntlCommand_F_SETLKW)
2714 #ifdef F_SETLKW
2715 {*r = F_SETLKW; return 0;}
2716 #else /* def F_SETLKW */
2717 {errno = EINVAL; return -1;}
2718 #endif /* ndef F_SETLKW */
2719 if (x == Mono_Posix_FcntlCommand_F_SETOWN)
2720 #ifdef F_SETOWN
2721 {*r = F_SETOWN; return 0;}
2722 #else /* def F_SETOWN */
2723 {errno = EINVAL; return -1;}
2724 #endif /* ndef F_SETOWN */
2725 if (x == Mono_Posix_FcntlCommand_F_SETSIG)
2726 #ifdef F_SETSIG
2727 {*r = F_SETSIG; return 0;}
2728 #else /* def F_SETSIG */
2729 {errno = EINVAL; return -1;}
2730 #endif /* ndef F_SETSIG */
2731 if (x == 0)
2732 return 0;
2733 errno = EINVAL; return -1;
2736 int Mono_Posix_ToFcntlCommand (int x, int *r)
2738 *r = 0;
2739 if (x == 0)
2740 return 0;
2741 #ifdef F_DUPFD
2742 if (x == F_DUPFD)
2743 {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
2744 #endif /* ndef F_DUPFD */
2745 #ifdef F_GETFD
2746 if (x == F_GETFD)
2747 {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
2748 #endif /* ndef F_GETFD */
2749 #ifdef F_GETFL
2750 if (x == F_GETFL)
2751 {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
2752 #endif /* ndef F_GETFL */
2753 #ifdef F_GETLEASE
2754 if (x == F_GETLEASE)
2755 {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
2756 #endif /* ndef F_GETLEASE */
2757 #ifdef F_GETLK
2758 if (x == F_GETLK)
2759 {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
2760 #endif /* ndef F_GETLK */
2761 #ifdef F_GETOWN
2762 if (x == F_GETOWN)
2763 {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
2764 #endif /* ndef F_GETOWN */
2765 #ifdef F_GETSIG
2766 if (x == F_GETSIG)
2767 {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
2768 #endif /* ndef F_GETSIG */
2769 #ifdef F_NOCACHE
2770 if (x == F_NOCACHE)
2771 {*r = Mono_Posix_FcntlCommand_F_NOCACHE; return 0;}
2772 #endif /* ndef F_NOCACHE */
2773 #ifdef F_NOTIFY
2774 if (x == F_NOTIFY)
2775 {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
2776 #endif /* ndef F_NOTIFY */
2777 #ifdef F_SETFD
2778 if (x == F_SETFD)
2779 {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
2780 #endif /* ndef F_SETFD */
2781 #ifdef F_SETFL
2782 if (x == F_SETFL)
2783 {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
2784 #endif /* ndef F_SETFL */
2785 #ifdef F_SETLEASE
2786 if (x == F_SETLEASE)
2787 {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
2788 #endif /* ndef F_SETLEASE */
2789 #ifdef F_SETLK
2790 if (x == F_SETLK)
2791 {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
2792 #endif /* ndef F_SETLK */
2793 #ifdef F_SETLKW
2794 if (x == F_SETLKW)
2795 {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
2796 #endif /* ndef F_SETLKW */
2797 #ifdef F_SETOWN
2798 if (x == F_SETOWN)
2799 {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
2800 #endif /* ndef F_SETOWN */
2801 #ifdef F_SETSIG
2802 if (x == F_SETSIG)
2803 {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
2804 #endif /* ndef F_SETSIG */
2805 errno = EINVAL; return -1;
2808 int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
2810 *r = 0;
2811 if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
2812 #ifdef ACCESSPERMS
2813 *r |= ACCESSPERMS;
2814 #else /* def ACCESSPERMS */
2815 {/* Ignoring Mono_Posix_FilePermissions_ACCESSPERMS, as it is constructed from other values */}
2816 #endif /* ndef ACCESSPERMS */
2817 if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
2818 #ifdef ALLPERMS
2819 *r |= ALLPERMS;
2820 #else /* def ALLPERMS */
2821 {/* Ignoring Mono_Posix_FilePermissions_ALLPERMS, as it is constructed from other values */}
2822 #endif /* ndef ALLPERMS */
2823 if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
2824 #ifdef DEFFILEMODE
2825 *r |= DEFFILEMODE;
2826 #else /* def DEFFILEMODE */
2827 {/* Ignoring Mono_Posix_FilePermissions_DEFFILEMODE, as it is constructed from other values */}
2828 #endif /* ndef DEFFILEMODE */
2829 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFBLK)
2830 #ifdef S_IFBLK
2831 *r |= S_IFBLK;
2832 #else /* def S_IFBLK */
2833 {errno = EINVAL; return -1;}
2834 #endif /* ndef S_IFBLK */
2835 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFCHR)
2836 #ifdef S_IFCHR
2837 *r |= S_IFCHR;
2838 #else /* def S_IFCHR */
2839 {errno = EINVAL; return -1;}
2840 #endif /* ndef S_IFCHR */
2841 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFDIR)
2842 #ifdef S_IFDIR
2843 *r |= S_IFDIR;
2844 #else /* def S_IFDIR */
2845 {errno = EINVAL; return -1;}
2846 #endif /* ndef S_IFDIR */
2847 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFIFO)
2848 #ifdef S_IFIFO
2849 *r |= S_IFIFO;
2850 #else /* def S_IFIFO */
2851 {errno = EINVAL; return -1;}
2852 #endif /* ndef S_IFIFO */
2853 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFLNK)
2854 #ifdef S_IFLNK
2855 *r |= S_IFLNK;
2856 #else /* def S_IFLNK */
2857 {errno = EINVAL; return -1;}
2858 #endif /* ndef S_IFLNK */
2859 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
2860 #ifdef S_IFMT
2861 *r |= S_IFMT;
2862 #else /* def S_IFMT */
2863 {/* Ignoring Mono_Posix_FilePermissions_S_IFMT, as it is constructed from other values */}
2864 #endif /* ndef S_IFMT */
2865 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFREG)
2866 #ifdef S_IFREG
2867 *r |= S_IFREG;
2868 #else /* def S_IFREG */
2869 {errno = EINVAL; return -1;}
2870 #endif /* ndef S_IFREG */
2871 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFSOCK)
2872 #ifdef S_IFSOCK
2873 *r |= S_IFSOCK;
2874 #else /* def S_IFSOCK */
2875 {errno = EINVAL; return -1;}
2876 #endif /* ndef S_IFSOCK */
2877 if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
2878 #ifdef S_IRGRP
2879 *r |= S_IRGRP;
2880 #else /* def S_IRGRP */
2881 {errno = EINVAL; return -1;}
2882 #endif /* ndef S_IRGRP */
2883 if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
2884 #ifdef S_IROTH
2885 *r |= S_IROTH;
2886 #else /* def S_IROTH */
2887 {errno = EINVAL; return -1;}
2888 #endif /* ndef S_IROTH */
2889 if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
2890 #ifdef S_IRUSR
2891 *r |= S_IRUSR;
2892 #else /* def S_IRUSR */
2893 {errno = EINVAL; return -1;}
2894 #endif /* ndef S_IRUSR */
2895 if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
2896 #ifdef S_IRWXG
2897 *r |= S_IRWXG;
2898 #else /* def S_IRWXG */
2899 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXG, as it is constructed from other values */}
2900 #endif /* ndef S_IRWXG */
2901 if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
2902 #ifdef S_IRWXO
2903 *r |= S_IRWXO;
2904 #else /* def S_IRWXO */
2905 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXO, as it is constructed from other values */}
2906 #endif /* ndef S_IRWXO */
2907 if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
2908 #ifdef S_IRWXU
2909 *r |= S_IRWXU;
2910 #else /* def S_IRWXU */
2911 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXU, as it is constructed from other values */}
2912 #endif /* ndef S_IRWXU */
2913 if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
2914 #ifdef S_ISGID
2915 *r |= S_ISGID;
2916 #else /* def S_ISGID */
2917 {errno = EINVAL; return -1;}
2918 #endif /* ndef S_ISGID */
2919 if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
2920 #ifdef S_ISUID
2921 *r |= S_ISUID;
2922 #else /* def S_ISUID */
2923 {errno = EINVAL; return -1;}
2924 #endif /* ndef S_ISUID */
2925 if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
2926 #ifdef S_ISVTX
2927 *r |= S_ISVTX;
2928 #else /* def S_ISVTX */
2929 {errno = EINVAL; return -1;}
2930 #endif /* ndef S_ISVTX */
2931 if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
2932 #ifdef S_IWGRP
2933 *r |= S_IWGRP;
2934 #else /* def S_IWGRP */
2935 {errno = EINVAL; return -1;}
2936 #endif /* ndef S_IWGRP */
2937 if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
2938 #ifdef S_IWOTH
2939 *r |= S_IWOTH;
2940 #else /* def S_IWOTH */
2941 {errno = EINVAL; return -1;}
2942 #endif /* ndef S_IWOTH */
2943 if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
2944 #ifdef S_IWUSR
2945 *r |= S_IWUSR;
2946 #else /* def S_IWUSR */
2947 {errno = EINVAL; return -1;}
2948 #endif /* ndef S_IWUSR */
2949 if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
2950 #ifdef S_IXGRP
2951 *r |= S_IXGRP;
2952 #else /* def S_IXGRP */
2953 {errno = EINVAL; return -1;}
2954 #endif /* ndef S_IXGRP */
2955 if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
2956 #ifdef S_IXOTH
2957 *r |= S_IXOTH;
2958 #else /* def S_IXOTH */
2959 {errno = EINVAL; return -1;}
2960 #endif /* ndef S_IXOTH */
2961 if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
2962 #ifdef S_IXUSR
2963 *r |= S_IXUSR;
2964 #else /* def S_IXUSR */
2965 {errno = EINVAL; return -1;}
2966 #endif /* ndef S_IXUSR */
2967 if (x == 0)
2968 return 0;
2969 return 0;
2972 int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
2974 *r = 0;
2975 if (x == 0)
2976 return 0;
2977 #ifdef ACCESSPERMS
2978 if ((x & ACCESSPERMS) == ACCESSPERMS)
2979 *r |= Mono_Posix_FilePermissions_ACCESSPERMS;
2980 #endif /* ndef ACCESSPERMS */
2981 #ifdef ALLPERMS
2982 if ((x & ALLPERMS) == ALLPERMS)
2983 *r |= Mono_Posix_FilePermissions_ALLPERMS;
2984 #endif /* ndef ALLPERMS */
2985 #ifdef DEFFILEMODE
2986 if ((x & DEFFILEMODE) == DEFFILEMODE)
2987 *r |= Mono_Posix_FilePermissions_DEFFILEMODE;
2988 #endif /* ndef DEFFILEMODE */
2989 #ifdef S_IFBLK
2990 if ((x & S_IFMT) == S_IFBLK)
2991 *r |= Mono_Posix_FilePermissions_S_IFBLK;
2992 #endif /* ndef S_IFBLK */
2993 #ifdef S_IFCHR
2994 if ((x & S_IFMT) == S_IFCHR)
2995 *r |= Mono_Posix_FilePermissions_S_IFCHR;
2996 #endif /* ndef S_IFCHR */
2997 #ifdef S_IFDIR
2998 if ((x & S_IFMT) == S_IFDIR)
2999 *r |= Mono_Posix_FilePermissions_S_IFDIR;
3000 #endif /* ndef S_IFDIR */
3001 #ifdef S_IFIFO
3002 if ((x & S_IFMT) == S_IFIFO)
3003 *r |= Mono_Posix_FilePermissions_S_IFIFO;
3004 #endif /* ndef S_IFIFO */
3005 #ifdef S_IFLNK
3006 if ((x & S_IFMT) == S_IFLNK)
3007 *r |= Mono_Posix_FilePermissions_S_IFLNK;
3008 #endif /* ndef S_IFLNK */
3009 #ifdef S_IFMT
3010 if ((x & S_IFMT) == S_IFMT)
3011 *r |= Mono_Posix_FilePermissions_S_IFMT;
3012 #endif /* ndef S_IFMT */
3013 #ifdef S_IFREG
3014 if ((x & S_IFMT) == S_IFREG)
3015 *r |= Mono_Posix_FilePermissions_S_IFREG;
3016 #endif /* ndef S_IFREG */
3017 #ifdef S_IFSOCK
3018 if ((x & S_IFMT) == S_IFSOCK)
3019 *r |= Mono_Posix_FilePermissions_S_IFSOCK;
3020 #endif /* ndef S_IFSOCK */
3021 #ifdef S_IRGRP
3022 if ((x & S_IRGRP) == S_IRGRP)
3023 *r |= Mono_Posix_FilePermissions_S_IRGRP;
3024 #endif /* ndef S_IRGRP */
3025 #ifdef S_IROTH
3026 if ((x & S_IROTH) == S_IROTH)
3027 *r |= Mono_Posix_FilePermissions_S_IROTH;
3028 #endif /* ndef S_IROTH */
3029 #ifdef S_IRUSR
3030 if ((x & S_IRUSR) == S_IRUSR)
3031 *r |= Mono_Posix_FilePermissions_S_IRUSR;
3032 #endif /* ndef S_IRUSR */
3033 #ifdef S_IRWXG
3034 if ((x & S_IRWXG) == S_IRWXG)
3035 *r |= Mono_Posix_FilePermissions_S_IRWXG;
3036 #endif /* ndef S_IRWXG */
3037 #ifdef S_IRWXO
3038 if ((x & S_IRWXO) == S_IRWXO)
3039 *r |= Mono_Posix_FilePermissions_S_IRWXO;
3040 #endif /* ndef S_IRWXO */
3041 #ifdef S_IRWXU
3042 if ((x & S_IRWXU) == S_IRWXU)
3043 *r |= Mono_Posix_FilePermissions_S_IRWXU;
3044 #endif /* ndef S_IRWXU */
3045 #ifdef S_ISGID
3046 if ((x & S_ISGID) == S_ISGID)
3047 *r |= Mono_Posix_FilePermissions_S_ISGID;
3048 #endif /* ndef S_ISGID */
3049 #ifdef S_ISUID
3050 if ((x & S_ISUID) == S_ISUID)
3051 *r |= Mono_Posix_FilePermissions_S_ISUID;
3052 #endif /* ndef S_ISUID */
3053 #ifdef S_ISVTX
3054 if ((x & S_ISVTX) == S_ISVTX)
3055 *r |= Mono_Posix_FilePermissions_S_ISVTX;
3056 #endif /* ndef S_ISVTX */
3057 #ifdef S_IWGRP
3058 if ((x & S_IWGRP) == S_IWGRP)
3059 *r |= Mono_Posix_FilePermissions_S_IWGRP;
3060 #endif /* ndef S_IWGRP */
3061 #ifdef S_IWOTH
3062 if ((x & S_IWOTH) == S_IWOTH)
3063 *r |= Mono_Posix_FilePermissions_S_IWOTH;
3064 #endif /* ndef S_IWOTH */
3065 #ifdef S_IWUSR
3066 if ((x & S_IWUSR) == S_IWUSR)
3067 *r |= Mono_Posix_FilePermissions_S_IWUSR;
3068 #endif /* ndef S_IWUSR */
3069 #ifdef S_IXGRP
3070 if ((x & S_IXGRP) == S_IXGRP)
3071 *r |= Mono_Posix_FilePermissions_S_IXGRP;
3072 #endif /* ndef S_IXGRP */
3073 #ifdef S_IXOTH
3074 if ((x & S_IXOTH) == S_IXOTH)
3075 *r |= Mono_Posix_FilePermissions_S_IXOTH;
3076 #endif /* ndef S_IXOTH */
3077 #ifdef S_IXUSR
3078 if ((x & S_IXUSR) == S_IXUSR)
3079 *r |= Mono_Posix_FilePermissions_S_IXUSR;
3080 #endif /* ndef S_IXUSR */
3081 return 0;
3084 #ifdef HAVE_STRUCT_FLOCK
3086 Mono_Posix_FromFlock (struct Mono_Posix_Flock *from, struct flock *to)
3088 _cnm_return_val_if_overflow (off_t, from->l_start, -1);
3089 _cnm_return_val_if_overflow (off_t, from->l_len, -1);
3090 _cnm_return_val_if_overflow (pid_t, from->l_pid, -1);
3092 memset (to, 0, sizeof(*to));
3094 if (Mono_Posix_FromLockType (from->l_type, &to->l_type) != 0) {
3095 return -1;
3097 if (Mono_Posix_FromSeekFlags (from->l_whence, &to->l_whence) != 0) {
3098 return -1;
3100 to->l_start = from->l_start;
3101 to->l_len = from->l_len;
3102 to->l_pid = from->l_pid;
3104 return 0;
3106 #endif /* ndef HAVE_STRUCT_FLOCK */
3109 #ifdef HAVE_STRUCT_FLOCK
3111 Mono_Posix_ToFlock (struct flock *from, struct Mono_Posix_Flock *to)
3113 _cnm_return_val_if_overflow (gint64, from->l_start, -1);
3114 _cnm_return_val_if_overflow (gint64, from->l_len, -1);
3115 _cnm_return_val_if_overflow (int, from->l_pid, -1);
3117 memset (to, 0, sizeof(*to));
3119 if (Mono_Posix_ToLockType (from->l_type, &to->l_type) != 0) {
3120 return -1;
3122 if (Mono_Posix_ToSeekFlags (from->l_whence, &to->l_whence) != 0) {
3123 return -1;
3125 to->l_start = from->l_start;
3126 to->l_len = from->l_len;
3127 to->l_pid = from->l_pid;
3129 return 0;
3131 #endif /* ndef HAVE_STRUCT_FLOCK */
3134 #ifdef HAVE_STRUCT_IOVEC
3136 Mono_Posix_FromIovec (struct Mono_Posix_Iovec *from, struct iovec *to)
3138 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3140 memset (to, 0, sizeof(*to));
3142 to->iov_base = from->iov_base;
3143 to->iov_len = from->iov_len;
3145 return 0;
3147 #endif /* ndef HAVE_STRUCT_IOVEC */
3150 #ifdef HAVE_STRUCT_IOVEC
3152 Mono_Posix_ToIovec (struct iovec *from, struct Mono_Posix_Iovec *to)
3154 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3156 memset (to, 0, sizeof(*to));
3158 to->iov_base = from->iov_base;
3159 to->iov_len = from->iov_len;
3161 return 0;
3163 #endif /* ndef HAVE_STRUCT_IOVEC */
3166 #ifdef HAVE_STRUCT_LINGER
3168 Mono_Posix_FromLinger (struct Mono_Posix_Linger *from, struct linger *to)
3170 _cnm_return_val_if_overflow (int, from->l_onoff, -1);
3171 _cnm_return_val_if_overflow (int, from->l_linger, -1);
3173 memset (to, 0, sizeof(*to));
3175 to->l_onoff = from->l_onoff;
3176 to->l_linger = from->l_linger;
3178 return 0;
3180 #endif /* ndef HAVE_STRUCT_LINGER */
3183 #ifdef HAVE_STRUCT_LINGER
3185 Mono_Posix_ToLinger (struct linger *from, struct Mono_Posix_Linger *to)
3187 _cnm_return_val_if_overflow (int, from->l_onoff, -1);
3188 _cnm_return_val_if_overflow (int, from->l_linger, -1);
3190 memset (to, 0, sizeof(*to));
3192 to->l_onoff = from->l_onoff;
3193 to->l_linger = from->l_linger;
3195 return 0;
3197 #endif /* ndef HAVE_STRUCT_LINGER */
3200 int Mono_Posix_FromLockType (short x, short *r)
3202 *r = 0;
3203 if (x == Mono_Posix_LockType_F_RDLCK)
3204 #ifdef F_RDLCK
3205 {*r = F_RDLCK; return 0;}
3206 #else /* def F_RDLCK */
3207 {errno = EINVAL; return -1;}
3208 #endif /* ndef F_RDLCK */
3209 if (x == Mono_Posix_LockType_F_UNLCK)
3210 #ifdef F_UNLCK
3211 {*r = F_UNLCK; return 0;}
3212 #else /* def F_UNLCK */
3213 {errno = EINVAL; return -1;}
3214 #endif /* ndef F_UNLCK */
3215 if (x == Mono_Posix_LockType_F_WRLCK)
3216 #ifdef F_WRLCK
3217 {*r = F_WRLCK; return 0;}
3218 #else /* def F_WRLCK */
3219 {errno = EINVAL; return -1;}
3220 #endif /* ndef F_WRLCK */
3221 if (x == 0)
3222 return 0;
3223 errno = EINVAL; return -1;
3226 int Mono_Posix_ToLockType (short x, short *r)
3228 *r = 0;
3229 if (x == 0)
3230 return 0;
3231 #ifdef F_RDLCK
3232 if (x == F_RDLCK)
3233 {*r = Mono_Posix_LockType_F_RDLCK; return 0;}
3234 #endif /* ndef F_RDLCK */
3235 #ifdef F_UNLCK
3236 if (x == F_UNLCK)
3237 {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
3238 #endif /* ndef F_UNLCK */
3239 #ifdef F_WRLCK
3240 if (x == F_WRLCK)
3241 {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
3242 #endif /* ndef F_WRLCK */
3243 errno = EINVAL; return -1;
3246 int Mono_Posix_FromLockfCommand (int x, int *r)
3248 *r = 0;
3249 if (x == Mono_Posix_LockfCommand_F_LOCK)
3250 #ifdef F_LOCK
3251 {*r = F_LOCK; return 0;}
3252 #else /* def F_LOCK */
3253 {errno = EINVAL; return -1;}
3254 #endif /* ndef F_LOCK */
3255 if (x == Mono_Posix_LockfCommand_F_TEST)
3256 #ifdef F_TEST
3257 {*r = F_TEST; return 0;}
3258 #else /* def F_TEST */
3259 {errno = EINVAL; return -1;}
3260 #endif /* ndef F_TEST */
3261 if (x == Mono_Posix_LockfCommand_F_TLOCK)
3262 #ifdef F_TLOCK
3263 {*r = F_TLOCK; return 0;}
3264 #else /* def F_TLOCK */
3265 {errno = EINVAL; return -1;}
3266 #endif /* ndef F_TLOCK */
3267 if (x == Mono_Posix_LockfCommand_F_ULOCK)
3268 #ifdef F_ULOCK
3269 {*r = F_ULOCK; return 0;}
3270 #else /* def F_ULOCK */
3271 {errno = EINVAL; return -1;}
3272 #endif /* ndef F_ULOCK */
3273 if (x == 0)
3274 return 0;
3275 errno = EINVAL; return -1;
3278 int Mono_Posix_ToLockfCommand (int x, int *r)
3280 *r = 0;
3281 if (x == 0)
3282 return 0;
3283 #ifdef F_LOCK
3284 if (x == F_LOCK)
3285 {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
3286 #endif /* ndef F_LOCK */
3287 #ifdef F_TEST
3288 if (x == F_TEST)
3289 {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
3290 #endif /* ndef F_TEST */
3291 #ifdef F_TLOCK
3292 if (x == F_TLOCK)
3293 {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
3294 #endif /* ndef F_TLOCK */
3295 #ifdef F_ULOCK
3296 if (x == F_ULOCK)
3297 {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
3298 #endif /* ndef F_ULOCK */
3299 errno = EINVAL; return -1;
3302 int Mono_Posix_FromMessageFlags (int x, int *r)
3304 *r = 0;
3305 if ((x & Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC) == Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC)
3306 #ifdef MSG_CMSG_CLOEXEC
3307 *r |= MSG_CMSG_CLOEXEC;
3308 #else /* def MSG_CMSG_CLOEXEC */
3309 {errno = EINVAL; return -1;}
3310 #endif /* ndef MSG_CMSG_CLOEXEC */
3311 if ((x & Mono_Posix_MessageFlags_MSG_CONFIRM) == Mono_Posix_MessageFlags_MSG_CONFIRM)
3312 #ifdef MSG_CONFIRM
3313 *r |= MSG_CONFIRM;
3314 #else /* def MSG_CONFIRM */
3315 {errno = EINVAL; return -1;}
3316 #endif /* ndef MSG_CONFIRM */
3317 if ((x & Mono_Posix_MessageFlags_MSG_CTRUNC) == Mono_Posix_MessageFlags_MSG_CTRUNC)
3318 #ifdef MSG_CTRUNC
3319 *r |= MSG_CTRUNC;
3320 #else /* def MSG_CTRUNC */
3321 {errno = EINVAL; return -1;}
3322 #endif /* ndef MSG_CTRUNC */
3323 if ((x & Mono_Posix_MessageFlags_MSG_DONTROUTE) == Mono_Posix_MessageFlags_MSG_DONTROUTE)
3324 #ifdef MSG_DONTROUTE
3325 *r |= MSG_DONTROUTE;
3326 #else /* def MSG_DONTROUTE */
3327 {errno = EINVAL; return -1;}
3328 #endif /* ndef MSG_DONTROUTE */
3329 if ((x & Mono_Posix_MessageFlags_MSG_DONTWAIT) == Mono_Posix_MessageFlags_MSG_DONTWAIT)
3330 #ifdef MSG_DONTWAIT
3331 *r |= MSG_DONTWAIT;
3332 #else /* def MSG_DONTWAIT */
3333 {errno = EINVAL; return -1;}
3334 #endif /* ndef MSG_DONTWAIT */
3335 if ((x & Mono_Posix_MessageFlags_MSG_EOR) == Mono_Posix_MessageFlags_MSG_EOR)
3336 #ifdef MSG_EOR
3337 *r |= MSG_EOR;
3338 #else /* def MSG_EOR */
3339 {errno = EINVAL; return -1;}
3340 #endif /* ndef MSG_EOR */
3341 if ((x & Mono_Posix_MessageFlags_MSG_ERRQUEUE) == Mono_Posix_MessageFlags_MSG_ERRQUEUE)
3342 #ifdef MSG_ERRQUEUE
3343 *r |= MSG_ERRQUEUE;
3344 #else /* def MSG_ERRQUEUE */
3345 {errno = EINVAL; return -1;}
3346 #endif /* ndef MSG_ERRQUEUE */
3347 if ((x & Mono_Posix_MessageFlags_MSG_FASTOPEN) == Mono_Posix_MessageFlags_MSG_FASTOPEN)
3348 #ifdef MSG_FASTOPEN
3349 *r |= MSG_FASTOPEN;
3350 #else /* def MSG_FASTOPEN */
3351 {errno = EINVAL; return -1;}
3352 #endif /* ndef MSG_FASTOPEN */
3353 if ((x & Mono_Posix_MessageFlags_MSG_FIN) == Mono_Posix_MessageFlags_MSG_FIN)
3354 #ifdef MSG_FIN
3355 *r |= MSG_FIN;
3356 #else /* def MSG_FIN */
3357 {errno = EINVAL; return -1;}
3358 #endif /* ndef MSG_FIN */
3359 if ((x & Mono_Posix_MessageFlags_MSG_MORE) == Mono_Posix_MessageFlags_MSG_MORE)
3360 #ifdef MSG_MORE
3361 *r |= MSG_MORE;
3362 #else /* def MSG_MORE */
3363 {errno = EINVAL; return -1;}
3364 #endif /* ndef MSG_MORE */
3365 if ((x & Mono_Posix_MessageFlags_MSG_NOSIGNAL) == Mono_Posix_MessageFlags_MSG_NOSIGNAL)
3366 #ifdef MSG_NOSIGNAL
3367 *r |= MSG_NOSIGNAL;
3368 #else /* def MSG_NOSIGNAL */
3369 {errno = EINVAL; return -1;}
3370 #endif /* ndef MSG_NOSIGNAL */
3371 if ((x & Mono_Posix_MessageFlags_MSG_OOB) == Mono_Posix_MessageFlags_MSG_OOB)
3372 #ifdef MSG_OOB
3373 *r |= MSG_OOB;
3374 #else /* def MSG_OOB */
3375 {errno = EINVAL; return -1;}
3376 #endif /* ndef MSG_OOB */
3377 if ((x & Mono_Posix_MessageFlags_MSG_PEEK) == Mono_Posix_MessageFlags_MSG_PEEK)
3378 #ifdef MSG_PEEK
3379 *r |= MSG_PEEK;
3380 #else /* def MSG_PEEK */
3381 {errno = EINVAL; return -1;}
3382 #endif /* ndef MSG_PEEK */
3383 if ((x & Mono_Posix_MessageFlags_MSG_PROXY) == Mono_Posix_MessageFlags_MSG_PROXY)
3384 #ifdef MSG_PROXY
3385 *r |= MSG_PROXY;
3386 #else /* def MSG_PROXY */
3387 {errno = EINVAL; return -1;}
3388 #endif /* ndef MSG_PROXY */
3389 if ((x & Mono_Posix_MessageFlags_MSG_RST) == Mono_Posix_MessageFlags_MSG_RST)
3390 #ifdef MSG_RST
3391 *r |= MSG_RST;
3392 #else /* def MSG_RST */
3393 {errno = EINVAL; return -1;}
3394 #endif /* ndef MSG_RST */
3395 if ((x & Mono_Posix_MessageFlags_MSG_SYN) == Mono_Posix_MessageFlags_MSG_SYN)
3396 #ifdef MSG_SYN
3397 *r |= MSG_SYN;
3398 #else /* def MSG_SYN */
3399 {errno = EINVAL; return -1;}
3400 #endif /* ndef MSG_SYN */
3401 if ((x & Mono_Posix_MessageFlags_MSG_TRUNC) == Mono_Posix_MessageFlags_MSG_TRUNC)
3402 #ifdef MSG_TRUNC
3403 *r |= MSG_TRUNC;
3404 #else /* def MSG_TRUNC */
3405 {errno = EINVAL; return -1;}
3406 #endif /* ndef MSG_TRUNC */
3407 if ((x & Mono_Posix_MessageFlags_MSG_WAITALL) == Mono_Posix_MessageFlags_MSG_WAITALL)
3408 #ifdef MSG_WAITALL
3409 *r |= MSG_WAITALL;
3410 #else /* def MSG_WAITALL */
3411 {errno = EINVAL; return -1;}
3412 #endif /* ndef MSG_WAITALL */
3413 if ((x & Mono_Posix_MessageFlags_MSG_WAITFORONE) == Mono_Posix_MessageFlags_MSG_WAITFORONE)
3414 #ifdef MSG_WAITFORONE
3415 *r |= MSG_WAITFORONE;
3416 #else /* def MSG_WAITFORONE */
3417 {errno = EINVAL; return -1;}
3418 #endif /* ndef MSG_WAITFORONE */
3419 if (x == 0)
3420 return 0;
3421 return 0;
3424 int Mono_Posix_ToMessageFlags (int x, int *r)
3426 *r = 0;
3427 if (x == 0)
3428 return 0;
3429 #ifdef MSG_CMSG_CLOEXEC
3430 if ((x & MSG_CMSG_CLOEXEC) == MSG_CMSG_CLOEXEC)
3431 *r |= Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC;
3432 #endif /* ndef MSG_CMSG_CLOEXEC */
3433 #ifdef MSG_CONFIRM
3434 if ((x & MSG_CONFIRM) == MSG_CONFIRM)
3435 *r |= Mono_Posix_MessageFlags_MSG_CONFIRM;
3436 #endif /* ndef MSG_CONFIRM */
3437 #ifdef MSG_CTRUNC
3438 if ((x & MSG_CTRUNC) == MSG_CTRUNC)
3439 *r |= Mono_Posix_MessageFlags_MSG_CTRUNC;
3440 #endif /* ndef MSG_CTRUNC */
3441 #ifdef MSG_DONTROUTE
3442 if ((x & MSG_DONTROUTE) == MSG_DONTROUTE)
3443 *r |= Mono_Posix_MessageFlags_MSG_DONTROUTE;
3444 #endif /* ndef MSG_DONTROUTE */
3445 #ifdef MSG_DONTWAIT
3446 if ((x & MSG_DONTWAIT) == MSG_DONTWAIT)
3447 *r |= Mono_Posix_MessageFlags_MSG_DONTWAIT;
3448 #endif /* ndef MSG_DONTWAIT */
3449 #ifdef MSG_EOR
3450 if ((x & MSG_EOR) == MSG_EOR)
3451 *r |= Mono_Posix_MessageFlags_MSG_EOR;
3452 #endif /* ndef MSG_EOR */
3453 #ifdef MSG_ERRQUEUE
3454 if ((x & MSG_ERRQUEUE) == MSG_ERRQUEUE)
3455 *r |= Mono_Posix_MessageFlags_MSG_ERRQUEUE;
3456 #endif /* ndef MSG_ERRQUEUE */
3457 #ifdef MSG_FASTOPEN
3458 if ((x & MSG_FASTOPEN) == MSG_FASTOPEN)
3459 *r |= Mono_Posix_MessageFlags_MSG_FASTOPEN;
3460 #endif /* ndef MSG_FASTOPEN */
3461 #ifdef MSG_FIN
3462 if ((x & MSG_FIN) == MSG_FIN)
3463 *r |= Mono_Posix_MessageFlags_MSG_FIN;
3464 #endif /* ndef MSG_FIN */
3465 #ifdef MSG_MORE
3466 if ((x & MSG_MORE) == MSG_MORE)
3467 *r |= Mono_Posix_MessageFlags_MSG_MORE;
3468 #endif /* ndef MSG_MORE */
3469 #ifdef MSG_NOSIGNAL
3470 if ((x & MSG_NOSIGNAL) == MSG_NOSIGNAL)
3471 *r |= Mono_Posix_MessageFlags_MSG_NOSIGNAL;
3472 #endif /* ndef MSG_NOSIGNAL */
3473 #ifdef MSG_OOB
3474 if ((x & MSG_OOB) == MSG_OOB)
3475 *r |= Mono_Posix_MessageFlags_MSG_OOB;
3476 #endif /* ndef MSG_OOB */
3477 #ifdef MSG_PEEK
3478 if ((x & MSG_PEEK) == MSG_PEEK)
3479 *r |= Mono_Posix_MessageFlags_MSG_PEEK;
3480 #endif /* ndef MSG_PEEK */
3481 #ifdef MSG_PROXY
3482 if ((x & MSG_PROXY) == MSG_PROXY)
3483 *r |= Mono_Posix_MessageFlags_MSG_PROXY;
3484 #endif /* ndef MSG_PROXY */
3485 #ifdef MSG_RST
3486 if ((x & MSG_RST) == MSG_RST)
3487 *r |= Mono_Posix_MessageFlags_MSG_RST;
3488 #endif /* ndef MSG_RST */
3489 #ifdef MSG_SYN
3490 if ((x & MSG_SYN) == MSG_SYN)
3491 *r |= Mono_Posix_MessageFlags_MSG_SYN;
3492 #endif /* ndef MSG_SYN */
3493 #ifdef MSG_TRUNC
3494 if ((x & MSG_TRUNC) == MSG_TRUNC)
3495 *r |= Mono_Posix_MessageFlags_MSG_TRUNC;
3496 #endif /* ndef MSG_TRUNC */
3497 #ifdef MSG_WAITALL
3498 if ((x & MSG_WAITALL) == MSG_WAITALL)
3499 *r |= Mono_Posix_MessageFlags_MSG_WAITALL;
3500 #endif /* ndef MSG_WAITALL */
3501 #ifdef MSG_WAITFORONE
3502 if ((x & MSG_WAITFORONE) == MSG_WAITFORONE)
3503 *r |= Mono_Posix_MessageFlags_MSG_WAITFORONE;
3504 #endif /* ndef MSG_WAITFORONE */
3505 return 0;
3508 int Mono_Posix_FromMlockallFlags (int x, int *r)
3510 *r = 0;
3511 if ((x & Mono_Posix_MlockallFlags_MCL_CURRENT) == Mono_Posix_MlockallFlags_MCL_CURRENT)
3512 #ifdef MCL_CURRENT
3513 *r |= MCL_CURRENT;
3514 #else /* def MCL_CURRENT */
3515 {errno = EINVAL; return -1;}
3516 #endif /* ndef MCL_CURRENT */
3517 if ((x & Mono_Posix_MlockallFlags_MCL_FUTURE) == Mono_Posix_MlockallFlags_MCL_FUTURE)
3518 #ifdef MCL_FUTURE
3519 *r |= MCL_FUTURE;
3520 #else /* def MCL_FUTURE */
3521 {errno = EINVAL; return -1;}
3522 #endif /* ndef MCL_FUTURE */
3523 if (x == 0)
3524 return 0;
3525 return 0;
3528 int Mono_Posix_ToMlockallFlags (int x, int *r)
3530 *r = 0;
3531 if (x == 0)
3532 return 0;
3533 #ifdef MCL_CURRENT
3534 if ((x & MCL_CURRENT) == MCL_CURRENT)
3535 *r |= Mono_Posix_MlockallFlags_MCL_CURRENT;
3536 #endif /* ndef MCL_CURRENT */
3537 #ifdef MCL_FUTURE
3538 if ((x & MCL_FUTURE) == MCL_FUTURE)
3539 *r |= Mono_Posix_MlockallFlags_MCL_FUTURE;
3540 #endif /* ndef MCL_FUTURE */
3541 return 0;
3544 int Mono_Posix_FromMmapFlags (int x, int *r)
3546 *r = 0;
3547 if ((x & Mono_Posix_MmapFlags_MAP_ANON) == Mono_Posix_MmapFlags_MAP_ANON)
3548 #ifdef MAP_ANON
3549 *r |= MAP_ANON;
3550 #else /* def MAP_ANON */
3551 {errno = EINVAL; return -1;}
3552 #endif /* ndef MAP_ANON */
3553 if ((x & Mono_Posix_MmapFlags_MAP_ANONYMOUS) == Mono_Posix_MmapFlags_MAP_ANONYMOUS)
3554 #ifdef MAP_ANONYMOUS
3555 *r |= MAP_ANONYMOUS;
3556 #else /* def MAP_ANONYMOUS */
3557 {errno = EINVAL; return -1;}
3558 #endif /* ndef MAP_ANONYMOUS */
3559 if ((x & Mono_Posix_MmapFlags_MAP_DENYWRITE) == Mono_Posix_MmapFlags_MAP_DENYWRITE)
3560 #ifdef MAP_DENYWRITE
3561 *r |= MAP_DENYWRITE;
3562 #else /* def MAP_DENYWRITE */
3563 {errno = EINVAL; return -1;}
3564 #endif /* ndef MAP_DENYWRITE */
3565 if ((x & Mono_Posix_MmapFlags_MAP_EXECUTABLE) == Mono_Posix_MmapFlags_MAP_EXECUTABLE)
3566 #ifdef MAP_EXECUTABLE
3567 *r |= MAP_EXECUTABLE;
3568 #else /* def MAP_EXECUTABLE */
3569 {errno = EINVAL; return -1;}
3570 #endif /* ndef MAP_EXECUTABLE */
3571 if ((x & Mono_Posix_MmapFlags_MAP_FILE) == Mono_Posix_MmapFlags_MAP_FILE)
3572 #ifdef MAP_FILE
3573 *r |= MAP_FILE;
3574 #else /* def MAP_FILE */
3575 {errno = EINVAL; return -1;}
3576 #endif /* ndef MAP_FILE */
3577 if ((x & Mono_Posix_MmapFlags_MAP_FIXED) == Mono_Posix_MmapFlags_MAP_FIXED)
3578 #ifdef MAP_FIXED
3579 *r |= MAP_FIXED;
3580 #else /* def MAP_FIXED */
3581 {errno = EINVAL; return -1;}
3582 #endif /* ndef MAP_FIXED */
3583 if ((x & Mono_Posix_MmapFlags_MAP_GROWSDOWN) == Mono_Posix_MmapFlags_MAP_GROWSDOWN)
3584 #ifdef MAP_GROWSDOWN
3585 *r |= MAP_GROWSDOWN;
3586 #else /* def MAP_GROWSDOWN */
3587 {errno = EINVAL; return -1;}
3588 #endif /* ndef MAP_GROWSDOWN */
3589 if ((x & Mono_Posix_MmapFlags_MAP_LOCKED) == Mono_Posix_MmapFlags_MAP_LOCKED)
3590 #ifdef MAP_LOCKED
3591 *r |= MAP_LOCKED;
3592 #else /* def MAP_LOCKED */
3593 {errno = EINVAL; return -1;}
3594 #endif /* ndef MAP_LOCKED */
3595 if ((x & Mono_Posix_MmapFlags_MAP_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK)
3596 #ifdef MAP_NONBLOCK
3597 *r |= MAP_NONBLOCK;
3598 #else /* def MAP_NONBLOCK */
3599 {errno = EINVAL; return -1;}
3600 #endif /* ndef MAP_NONBLOCK */
3601 if ((x & Mono_Posix_MmapFlags_MAP_NORESERVE) == Mono_Posix_MmapFlags_MAP_NORESERVE)
3602 #ifdef MAP_NORESERVE
3603 *r |= MAP_NORESERVE;
3604 #else /* def MAP_NORESERVE */
3605 {errno = EINVAL; return -1;}
3606 #endif /* ndef MAP_NORESERVE */
3607 if ((x & Mono_Posix_MmapFlags_MAP_POPULATE) == Mono_Posix_MmapFlags_MAP_POPULATE)
3608 #ifdef MAP_POPULATE
3609 *r |= MAP_POPULATE;
3610 #else /* def MAP_POPULATE */
3611 {errno = EINVAL; return -1;}
3612 #endif /* ndef MAP_POPULATE */
3613 if ((x & Mono_Posix_MmapFlags_MAP_PRIVATE) == Mono_Posix_MmapFlags_MAP_PRIVATE)
3614 #ifdef MAP_PRIVATE
3615 *r |= MAP_PRIVATE;
3616 #else /* def MAP_PRIVATE */
3617 {errno = EINVAL; return -1;}
3618 #endif /* ndef MAP_PRIVATE */
3619 if ((x & Mono_Posix_MmapFlags_MAP_SHARED) == Mono_Posix_MmapFlags_MAP_SHARED)
3620 #ifdef MAP_SHARED
3621 *r |= MAP_SHARED;
3622 #else /* def MAP_SHARED */
3623 {errno = EINVAL; return -1;}
3624 #endif /* ndef MAP_SHARED */
3625 if ((x & Mono_Posix_MmapFlags_MAP_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE)
3626 #ifdef MAP_TYPE
3627 *r |= MAP_TYPE;
3628 #else /* def MAP_TYPE */
3629 {errno = EINVAL; return -1;}
3630 #endif /* ndef MAP_TYPE */
3631 if (x == 0)
3632 return 0;
3633 return 0;
3636 int Mono_Posix_ToMmapFlags (int x, int *r)
3638 *r = 0;
3639 if (x == 0)
3640 return 0;
3641 #ifdef MAP_ANON
3642 if ((x & MAP_ANON) == MAP_ANON)
3643 *r |= Mono_Posix_MmapFlags_MAP_ANON;
3644 #endif /* ndef MAP_ANON */
3645 #ifdef MAP_ANONYMOUS
3646 if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
3647 *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
3648 #endif /* ndef MAP_ANONYMOUS */
3649 #ifdef MAP_DENYWRITE
3650 if ((x & MAP_DENYWRITE) == MAP_DENYWRITE)
3651 *r |= Mono_Posix_MmapFlags_MAP_DENYWRITE;
3652 #endif /* ndef MAP_DENYWRITE */
3653 #ifdef MAP_EXECUTABLE
3654 if ((x & MAP_EXECUTABLE) == MAP_EXECUTABLE)
3655 *r |= Mono_Posix_MmapFlags_MAP_EXECUTABLE;
3656 #endif /* ndef MAP_EXECUTABLE */
3657 #ifdef MAP_FILE
3658 if ((x & MAP_FILE) == MAP_FILE)
3659 *r |= Mono_Posix_MmapFlags_MAP_FILE;
3660 #endif /* ndef MAP_FILE */
3661 #ifdef MAP_FIXED
3662 if ((x & MAP_FIXED) == MAP_FIXED)
3663 *r |= Mono_Posix_MmapFlags_MAP_FIXED;
3664 #endif /* ndef MAP_FIXED */
3665 #ifdef MAP_GROWSDOWN
3666 if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
3667 *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
3668 #endif /* ndef MAP_GROWSDOWN */
3669 #ifdef MAP_LOCKED
3670 if ((x & MAP_LOCKED) == MAP_LOCKED)
3671 *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
3672 #endif /* ndef MAP_LOCKED */
3673 #ifdef MAP_NONBLOCK
3674 if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
3675 *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
3676 #endif /* ndef MAP_NONBLOCK */
3677 #ifdef MAP_NORESERVE
3678 if ((x & MAP_NORESERVE) == MAP_NORESERVE)
3679 *r |= Mono_Posix_MmapFlags_MAP_NORESERVE;
3680 #endif /* ndef MAP_NORESERVE */
3681 #ifdef MAP_POPULATE
3682 if ((x & MAP_POPULATE) == MAP_POPULATE)
3683 *r |= Mono_Posix_MmapFlags_MAP_POPULATE;
3684 #endif /* ndef MAP_POPULATE */
3685 #ifdef MAP_PRIVATE
3686 if ((x & MAP_PRIVATE) == MAP_PRIVATE)
3687 *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
3688 #endif /* ndef MAP_PRIVATE */
3689 #ifdef MAP_SHARED
3690 if ((x & MAP_SHARED) == MAP_SHARED)
3691 *r |= Mono_Posix_MmapFlags_MAP_SHARED;
3692 #endif /* ndef MAP_SHARED */
3693 #ifdef MAP_TYPE
3694 if ((x & MAP_TYPE) == MAP_TYPE)
3695 *r |= Mono_Posix_MmapFlags_MAP_TYPE;
3696 #endif /* ndef MAP_TYPE */
3697 return 0;
3700 int Mono_Posix_FromMmapProts (int x, int *r)
3702 *r = 0;
3703 if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
3704 #ifdef PROT_EXEC
3705 *r |= PROT_EXEC;
3706 #else /* def PROT_EXEC */
3707 {errno = EINVAL; return -1;}
3708 #endif /* ndef PROT_EXEC */
3709 if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
3710 #ifdef PROT_GROWSDOWN
3711 *r |= PROT_GROWSDOWN;
3712 #else /* def PROT_GROWSDOWN */
3713 {errno = EINVAL; return -1;}
3714 #endif /* ndef PROT_GROWSDOWN */
3715 if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
3716 #ifdef PROT_GROWSUP
3717 *r |= PROT_GROWSUP;
3718 #else /* def PROT_GROWSUP */
3719 {errno = EINVAL; return -1;}
3720 #endif /* ndef PROT_GROWSUP */
3721 if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
3722 #ifdef PROT_NONE
3723 *r |= PROT_NONE;
3724 #else /* def PROT_NONE */
3725 {errno = EINVAL; return -1;}
3726 #endif /* ndef PROT_NONE */
3727 if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
3728 #ifdef PROT_READ
3729 *r |= PROT_READ;
3730 #else /* def PROT_READ */
3731 {errno = EINVAL; return -1;}
3732 #endif /* ndef PROT_READ */
3733 if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
3734 #ifdef PROT_WRITE
3735 *r |= PROT_WRITE;
3736 #else /* def PROT_WRITE */
3737 {errno = EINVAL; return -1;}
3738 #endif /* ndef PROT_WRITE */
3739 if (x == 0)
3740 return 0;
3741 return 0;
3744 int Mono_Posix_ToMmapProts (int x, int *r)
3746 *r = 0;
3747 if (x == 0)
3748 return 0;
3749 #ifdef PROT_EXEC
3750 if ((x & PROT_EXEC) == PROT_EXEC)
3751 *r |= Mono_Posix_MmapProts_PROT_EXEC;
3752 #endif /* ndef PROT_EXEC */
3753 #ifdef PROT_GROWSDOWN
3754 if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
3755 *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
3756 #endif /* ndef PROT_GROWSDOWN */
3757 #ifdef PROT_GROWSUP
3758 if ((x & PROT_GROWSUP) == PROT_GROWSUP)
3759 *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
3760 #endif /* ndef PROT_GROWSUP */
3761 #ifdef PROT_NONE
3762 if ((x & PROT_NONE) == PROT_NONE)
3763 *r |= Mono_Posix_MmapProts_PROT_NONE;
3764 #endif /* ndef PROT_NONE */
3765 #ifdef PROT_READ
3766 if ((x & PROT_READ) == PROT_READ)
3767 *r |= Mono_Posix_MmapProts_PROT_READ;
3768 #endif /* ndef PROT_READ */
3769 #ifdef PROT_WRITE
3770 if ((x & PROT_WRITE) == PROT_WRITE)
3771 *r |= Mono_Posix_MmapProts_PROT_WRITE;
3772 #endif /* ndef PROT_WRITE */
3773 return 0;
3776 int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
3778 *r = 0;
3779 if ((x & Mono_Posix_MountFlags_ST_APPEND) == Mono_Posix_MountFlags_ST_APPEND)
3780 #ifdef ST_APPEND
3781 *r |= ST_APPEND;
3782 #else /* def ST_APPEND */
3783 {errno = EINVAL; return -1;}
3784 #endif /* ndef ST_APPEND */
3785 if ((x & Mono_Posix_MountFlags_ST_BIND) == Mono_Posix_MountFlags_ST_BIND)
3786 #ifdef ST_BIND
3787 *r |= ST_BIND;
3788 #else /* def ST_BIND */
3789 {errno = EINVAL; return -1;}
3790 #endif /* ndef ST_BIND */
3791 if ((x & Mono_Posix_MountFlags_ST_IMMUTABLE) == Mono_Posix_MountFlags_ST_IMMUTABLE)
3792 #ifdef ST_IMMUTABLE
3793 *r |= ST_IMMUTABLE;
3794 #else /* def ST_IMMUTABLE */
3795 {errno = EINVAL; return -1;}
3796 #endif /* ndef ST_IMMUTABLE */
3797 if ((x & Mono_Posix_MountFlags_ST_MANDLOCK) == Mono_Posix_MountFlags_ST_MANDLOCK)
3798 #ifdef ST_MANDLOCK
3799 *r |= ST_MANDLOCK;
3800 #else /* def ST_MANDLOCK */
3801 {errno = EINVAL; return -1;}
3802 #endif /* ndef ST_MANDLOCK */
3803 if ((x & Mono_Posix_MountFlags_ST_NOATIME) == Mono_Posix_MountFlags_ST_NOATIME)
3804 #ifdef ST_NOATIME
3805 *r |= ST_NOATIME;
3806 #else /* def ST_NOATIME */
3807 {errno = EINVAL; return -1;}
3808 #endif /* ndef ST_NOATIME */
3809 if ((x & Mono_Posix_MountFlags_ST_NODEV) == Mono_Posix_MountFlags_ST_NODEV)
3810 #ifdef ST_NODEV
3811 *r |= ST_NODEV;
3812 #else /* def ST_NODEV */
3813 {errno = EINVAL; return -1;}
3814 #endif /* ndef ST_NODEV */
3815 if ((x & Mono_Posix_MountFlags_ST_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME)
3816 #ifdef ST_NODIRATIME
3817 *r |= ST_NODIRATIME;
3818 #else /* def ST_NODIRATIME */
3819 {errno = EINVAL; return -1;}
3820 #endif /* ndef ST_NODIRATIME */
3821 if ((x & Mono_Posix_MountFlags_ST_NOEXEC) == Mono_Posix_MountFlags_ST_NOEXEC)
3822 #ifdef ST_NOEXEC
3823 *r |= ST_NOEXEC;
3824 #else /* def ST_NOEXEC */
3825 {errno = EINVAL; return -1;}
3826 #endif /* ndef ST_NOEXEC */
3827 if ((x & Mono_Posix_MountFlags_ST_NOSUID) == Mono_Posix_MountFlags_ST_NOSUID)
3828 #ifdef ST_NOSUID
3829 *r |= ST_NOSUID;
3830 #else /* def ST_NOSUID */
3831 {errno = EINVAL; return -1;}
3832 #endif /* ndef ST_NOSUID */
3833 if ((x & Mono_Posix_MountFlags_ST_RDONLY) == Mono_Posix_MountFlags_ST_RDONLY)
3834 #ifdef ST_RDONLY
3835 *r |= ST_RDONLY;
3836 #else /* def ST_RDONLY */
3837 {errno = EINVAL; return -1;}
3838 #endif /* ndef ST_RDONLY */
3839 if ((x & Mono_Posix_MountFlags_ST_REMOUNT) == Mono_Posix_MountFlags_ST_REMOUNT)
3840 #ifdef ST_REMOUNT
3841 *r |= ST_REMOUNT;
3842 #else /* def ST_REMOUNT */
3843 {errno = EINVAL; return -1;}
3844 #endif /* ndef ST_REMOUNT */
3845 if ((x & Mono_Posix_MountFlags_ST_SYNCHRONOUS) == Mono_Posix_MountFlags_ST_SYNCHRONOUS)
3846 #ifdef ST_SYNCHRONOUS
3847 *r |= ST_SYNCHRONOUS;
3848 #else /* def ST_SYNCHRONOUS */
3849 {errno = EINVAL; return -1;}
3850 #endif /* ndef ST_SYNCHRONOUS */
3851 if ((x & Mono_Posix_MountFlags_ST_WRITE) == Mono_Posix_MountFlags_ST_WRITE)
3852 #ifdef ST_WRITE
3853 *r |= ST_WRITE;
3854 #else /* def ST_WRITE */
3855 {errno = EINVAL; return -1;}
3856 #endif /* ndef ST_WRITE */
3857 if (x == 0)
3858 return 0;
3859 return 0;
3862 int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
3864 *r = 0;
3865 if (x == 0)
3866 return 0;
3867 #ifdef ST_APPEND
3868 if ((x & ST_APPEND) == ST_APPEND)
3869 *r |= Mono_Posix_MountFlags_ST_APPEND;
3870 #endif /* ndef ST_APPEND */
3871 #ifdef ST_BIND
3872 if ((x & ST_BIND) == ST_BIND)
3873 *r |= Mono_Posix_MountFlags_ST_BIND;
3874 #endif /* ndef ST_BIND */
3875 #ifdef ST_IMMUTABLE
3876 if ((x & ST_IMMUTABLE) == ST_IMMUTABLE)
3877 *r |= Mono_Posix_MountFlags_ST_IMMUTABLE;
3878 #endif /* ndef ST_IMMUTABLE */
3879 #ifdef ST_MANDLOCK
3880 if ((x & ST_MANDLOCK) == ST_MANDLOCK)
3881 *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
3882 #endif /* ndef ST_MANDLOCK */
3883 #ifdef ST_NOATIME
3884 if ((x & ST_NOATIME) == ST_NOATIME)
3885 *r |= Mono_Posix_MountFlags_ST_NOATIME;
3886 #endif /* ndef ST_NOATIME */
3887 #ifdef ST_NODEV
3888 if ((x & ST_NODEV) == ST_NODEV)
3889 *r |= Mono_Posix_MountFlags_ST_NODEV;
3890 #endif /* ndef ST_NODEV */
3891 #ifdef ST_NODIRATIME
3892 if ((x & ST_NODIRATIME) == ST_NODIRATIME)
3893 *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
3894 #endif /* ndef ST_NODIRATIME */
3895 #ifdef ST_NOEXEC
3896 if ((x & ST_NOEXEC) == ST_NOEXEC)
3897 *r |= Mono_Posix_MountFlags_ST_NOEXEC;
3898 #endif /* ndef ST_NOEXEC */
3899 #ifdef ST_NOSUID
3900 if ((x & ST_NOSUID) == ST_NOSUID)
3901 *r |= Mono_Posix_MountFlags_ST_NOSUID;
3902 #endif /* ndef ST_NOSUID */
3903 #ifdef ST_RDONLY
3904 if ((x & ST_RDONLY) == ST_RDONLY)
3905 *r |= Mono_Posix_MountFlags_ST_RDONLY;
3906 #endif /* ndef ST_RDONLY */
3907 #ifdef ST_REMOUNT
3908 if ((x & ST_REMOUNT) == ST_REMOUNT)
3909 *r |= Mono_Posix_MountFlags_ST_REMOUNT;
3910 #endif /* ndef ST_REMOUNT */
3911 #ifdef ST_SYNCHRONOUS
3912 if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
3913 *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
3914 #endif /* ndef ST_SYNCHRONOUS */
3915 #ifdef ST_WRITE
3916 if ((x & ST_WRITE) == ST_WRITE)
3917 *r |= Mono_Posix_MountFlags_ST_WRITE;
3918 #endif /* ndef ST_WRITE */
3919 return 0;
3922 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
3924 *r = 0;
3925 #ifndef __NetBSD__
3926 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3927 #ifdef MREMAP_MAYMOVE
3928 *r |= MREMAP_MAYMOVE;
3929 #else /* def MREMAP_MAYMOVE */
3930 {errno = EINVAL; return -1;}
3931 #endif /* ndef MREMAP_MAYMOVE */
3932 #else /* def __NetBSD__ */
3933 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) != Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3934 *r = MAP_FIXED;
3935 #endif /* def __NetBSD__ */
3936 if (x == 0)
3937 return 0;
3938 return 0;
3941 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
3943 *r = 0;
3944 #ifndef __NetBSD__
3945 if (x == 0)
3946 return 0;
3947 #ifdef MREMAP_MAYMOVE
3948 if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
3949 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3950 #endif /* ndef MREMAP_MAYMOVE */
3951 #else /* def __NetBSD__ */
3952 if ((x & MAP_FIXED) != MAP_FIXED)
3953 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3954 #endif
3955 return 0;
3958 int Mono_Posix_FromMsyncFlags (int x, int *r)
3960 *r = 0;
3961 if ((x & Mono_Posix_MsyncFlags_MS_ASYNC) == Mono_Posix_MsyncFlags_MS_ASYNC)
3962 #ifdef MS_ASYNC
3963 *r |= MS_ASYNC;
3964 #else /* def MS_ASYNC */
3965 {errno = EINVAL; return -1;}
3966 #endif /* ndef MS_ASYNC */
3967 if ((x & Mono_Posix_MsyncFlags_MS_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE)
3968 #ifdef MS_INVALIDATE
3969 *r |= MS_INVALIDATE;
3970 #else /* def MS_INVALIDATE */
3971 {errno = EINVAL; return -1;}
3972 #endif /* ndef MS_INVALIDATE */
3973 if ((x & Mono_Posix_MsyncFlags_MS_SYNC) == Mono_Posix_MsyncFlags_MS_SYNC)
3974 #ifdef MS_SYNC
3975 *r |= MS_SYNC;
3976 #else /* def MS_SYNC */
3977 {errno = EINVAL; return -1;}
3978 #endif /* ndef MS_SYNC */
3979 if (x == 0)
3980 return 0;
3981 return 0;
3984 int Mono_Posix_ToMsyncFlags (int x, int *r)
3986 *r = 0;
3987 if (x == 0)
3988 return 0;
3989 #ifdef MS_ASYNC
3990 if ((x & MS_ASYNC) == MS_ASYNC)
3991 *r |= Mono_Posix_MsyncFlags_MS_ASYNC;
3992 #endif /* ndef MS_ASYNC */
3993 #ifdef MS_INVALIDATE
3994 if ((x & MS_INVALIDATE) == MS_INVALIDATE)
3995 *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
3996 #endif /* ndef MS_INVALIDATE */
3997 #ifdef MS_SYNC
3998 if ((x & MS_SYNC) == MS_SYNC)
3999 *r |= Mono_Posix_MsyncFlags_MS_SYNC;
4000 #endif /* ndef MS_SYNC */
4001 return 0;
4004 int Mono_Posix_FromOpenFlags (int x, int *r)
4006 *r = 0;
4007 if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND)
4008 #ifdef O_APPEND
4009 *r |= O_APPEND;
4010 #else /* def O_APPEND */
4011 {errno = EINVAL; return -1;}
4012 #endif /* ndef O_APPEND */
4013 if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC)
4014 #ifdef O_ASYNC
4015 *r |= O_ASYNC;
4016 #else /* def O_ASYNC */
4017 {errno = EINVAL; return -1;}
4018 #endif /* ndef O_ASYNC */
4019 if ((x & Mono_Posix_OpenFlags_O_CLOEXEC) == Mono_Posix_OpenFlags_O_CLOEXEC)
4020 #ifdef O_CLOEXEC
4021 *r |= O_CLOEXEC;
4022 #else /* def O_CLOEXEC */
4023 {errno = EINVAL; return -1;}
4024 #endif /* ndef O_CLOEXEC */
4025 if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT)
4026 #ifdef O_CREAT
4027 *r |= O_CREAT;
4028 #else /* def O_CREAT */
4029 {errno = EINVAL; return -1;}
4030 #endif /* ndef O_CREAT */
4031 if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT)
4032 #ifdef O_DIRECT
4033 *r |= O_DIRECT;
4034 #else /* def O_DIRECT */
4035 {errno = EINVAL; return -1;}
4036 #endif /* ndef O_DIRECT */
4037 if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY)
4038 #ifdef O_DIRECTORY
4039 *r |= O_DIRECTORY;
4040 #else /* def O_DIRECTORY */
4041 {errno = EINVAL; return -1;}
4042 #endif /* ndef O_DIRECTORY */
4043 if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL)
4044 #ifdef O_EXCL
4045 *r |= O_EXCL;
4046 #else /* def O_EXCL */
4047 {errno = EINVAL; return -1;}
4048 #endif /* ndef O_EXCL */
4049 if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
4050 #ifdef O_LARGEFILE
4051 *r |= O_LARGEFILE;
4052 #else /* def O_LARGEFILE */
4053 {errno = EINVAL; return -1;}
4054 #endif /* ndef O_LARGEFILE */
4055 if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY)
4056 #ifdef O_NOCTTY
4057 *r |= O_NOCTTY;
4058 #else /* def O_NOCTTY */
4059 {errno = EINVAL; return -1;}
4060 #endif /* ndef O_NOCTTY */
4061 if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW)
4062 #ifdef O_NOFOLLOW
4063 *r |= O_NOFOLLOW;
4064 #else /* def O_NOFOLLOW */
4065 {errno = EINVAL; return -1;}
4066 #endif /* ndef O_NOFOLLOW */
4067 if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK)
4068 #ifdef O_NONBLOCK
4069 *r |= O_NONBLOCK;
4070 #else /* def O_NONBLOCK */
4071 {errno = EINVAL; return -1;}
4072 #endif /* ndef O_NONBLOCK */
4073 if ((x & Mono_Posix_OpenFlags_O_PATH) == Mono_Posix_OpenFlags_O_PATH)
4074 #ifdef O_PATH
4075 *r |= O_PATH;
4076 #else /* def O_PATH */
4077 {errno = EINVAL; return -1;}
4078 #endif /* ndef O_PATH */
4079 if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY)
4080 #ifdef O_RDONLY
4081 *r |= O_RDONLY;
4082 #else /* def O_RDONLY */
4083 {errno = EINVAL; return -1;}
4084 #endif /* ndef O_RDONLY */
4085 if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR)
4086 #ifdef O_RDWR
4087 *r |= O_RDWR;
4088 #else /* def O_RDWR */
4089 {errno = EINVAL; return -1;}
4090 #endif /* ndef O_RDWR */
4091 if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC)
4092 #ifdef O_SYNC
4093 *r |= O_SYNC;
4094 #else /* def O_SYNC */
4095 {errno = EINVAL; return -1;}
4096 #endif /* ndef O_SYNC */
4097 if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC)
4098 #ifdef O_TRUNC
4099 *r |= O_TRUNC;
4100 #else /* def O_TRUNC */
4101 {errno = EINVAL; return -1;}
4102 #endif /* ndef O_TRUNC */
4103 if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
4104 #ifdef O_WRONLY
4105 *r |= O_WRONLY;
4106 #else /* def O_WRONLY */
4107 {errno = EINVAL; return -1;}
4108 #endif /* ndef O_WRONLY */
4109 if (x == 0)
4110 return 0;
4111 return 0;
4114 int Mono_Posix_ToOpenFlags (int x, int *r)
4116 *r = 0;
4117 if (x == 0)
4118 return 0;
4119 #ifdef O_APPEND
4120 if ((x & O_APPEND) == O_APPEND)
4121 *r |= Mono_Posix_OpenFlags_O_APPEND;
4122 #endif /* ndef O_APPEND */
4123 #ifdef O_ASYNC
4124 if ((x & O_ASYNC) == O_ASYNC)
4125 *r |= Mono_Posix_OpenFlags_O_ASYNC;
4126 #endif /* ndef O_ASYNC */
4127 #ifdef O_CLOEXEC
4128 if ((x & O_CLOEXEC) == O_CLOEXEC)
4129 *r |= Mono_Posix_OpenFlags_O_CLOEXEC;
4130 #endif /* ndef O_CLOEXEC */
4131 #ifdef O_CREAT
4132 if ((x & O_CREAT) == O_CREAT)
4133 *r |= Mono_Posix_OpenFlags_O_CREAT;
4134 #endif /* ndef O_CREAT */
4135 #ifdef O_DIRECT
4136 if ((x & O_DIRECT) == O_DIRECT)
4137 *r |= Mono_Posix_OpenFlags_O_DIRECT;
4138 #endif /* ndef O_DIRECT */
4139 #ifdef O_DIRECTORY
4140 if ((x & O_DIRECTORY) == O_DIRECTORY)
4141 *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
4142 #endif /* ndef O_DIRECTORY */
4143 #ifdef O_EXCL
4144 if ((x & O_EXCL) == O_EXCL)
4145 *r |= Mono_Posix_OpenFlags_O_EXCL;
4146 #endif /* ndef O_EXCL */
4147 #ifdef O_LARGEFILE
4148 if ((x & O_LARGEFILE) == O_LARGEFILE)
4149 *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
4150 #endif /* ndef O_LARGEFILE */
4151 #ifdef O_NOCTTY
4152 if ((x & O_NOCTTY) == O_NOCTTY)
4153 *r |= Mono_Posix_OpenFlags_O_NOCTTY;
4154 #endif /* ndef O_NOCTTY */
4155 #ifdef O_NOFOLLOW
4156 if ((x & O_NOFOLLOW) == O_NOFOLLOW)
4157 *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
4158 #endif /* ndef O_NOFOLLOW */
4159 #ifdef O_NONBLOCK
4160 if ((x & O_NONBLOCK) == O_NONBLOCK)
4161 *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
4162 #endif /* ndef O_NONBLOCK */
4163 #ifdef O_PATH
4164 if ((x & O_PATH) == O_PATH)
4165 *r |= Mono_Posix_OpenFlags_O_PATH;
4166 #endif /* ndef O_PATH */
4167 #ifdef O_RDONLY
4168 if ((x & O_RDONLY) == O_RDONLY)
4169 *r |= Mono_Posix_OpenFlags_O_RDONLY;
4170 #endif /* ndef O_RDONLY */
4171 #ifdef O_RDWR
4172 if ((x & O_RDWR) == O_RDWR)
4173 *r |= Mono_Posix_OpenFlags_O_RDWR;
4174 #endif /* ndef O_RDWR */
4175 #ifdef O_SYNC
4176 if ((x & O_SYNC) == O_SYNC)
4177 *r |= Mono_Posix_OpenFlags_O_SYNC;
4178 #endif /* ndef O_SYNC */
4179 #ifdef O_TRUNC
4180 if ((x & O_TRUNC) == O_TRUNC)
4181 *r |= Mono_Posix_OpenFlags_O_TRUNC;
4182 #endif /* ndef O_TRUNC */
4183 #ifdef O_WRONLY
4184 if ((x & O_WRONLY) == O_WRONLY)
4185 *r |= Mono_Posix_OpenFlags_O_WRONLY;
4186 #endif /* ndef O_WRONLY */
4187 return 0;
4190 int Mono_Posix_FromPathconfName (int x, int *r)
4192 *r = 0;
4193 if (x == Mono_Posix_PathconfName__PC_2_SYMLINKS)
4194 #ifdef _PC_2_SYMLINKS
4195 {*r = _PC_2_SYMLINKS; return 0;}
4196 #else /* def _PC_2_SYMLINKS */
4197 {errno = EINVAL; return -1;}
4198 #endif /* ndef _PC_2_SYMLINKS */
4199 if (x == Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN)
4200 #ifdef _PC_ALLOC_SIZE_MIN
4201 {*r = _PC_ALLOC_SIZE_MIN; return 0;}
4202 #else /* def _PC_ALLOC_SIZE_MIN */
4203 {errno = EINVAL; return -1;}
4204 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4205 if (x == Mono_Posix_PathconfName__PC_ASYNC_IO)
4206 #ifdef _PC_ASYNC_IO
4207 {*r = _PC_ASYNC_IO; return 0;}
4208 #else /* def _PC_ASYNC_IO */
4209 {errno = EINVAL; return -1;}
4210 #endif /* ndef _PC_ASYNC_IO */
4211 if (x == Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED)
4212 #ifdef _PC_CHOWN_RESTRICTED
4213 {*r = _PC_CHOWN_RESTRICTED; return 0;}
4214 #else /* def _PC_CHOWN_RESTRICTED */
4215 {errno = EINVAL; return -1;}
4216 #endif /* ndef _PC_CHOWN_RESTRICTED */
4217 if (x == Mono_Posix_PathconfName__PC_FILESIZEBITS)
4218 #ifdef _PC_FILESIZEBITS
4219 {*r = _PC_FILESIZEBITS; return 0;}
4220 #else /* def _PC_FILESIZEBITS */
4221 {errno = EINVAL; return -1;}
4222 #endif /* ndef _PC_FILESIZEBITS */
4223 if (x == Mono_Posix_PathconfName__PC_LINK_MAX)
4224 #ifdef _PC_LINK_MAX
4225 {*r = _PC_LINK_MAX; return 0;}
4226 #else /* def _PC_LINK_MAX */
4227 {errno = EINVAL; return -1;}
4228 #endif /* ndef _PC_LINK_MAX */
4229 if (x == Mono_Posix_PathconfName__PC_MAX_CANON)
4230 #ifdef _PC_MAX_CANON
4231 {*r = _PC_MAX_CANON; return 0;}
4232 #else /* def _PC_MAX_CANON */
4233 {errno = EINVAL; return -1;}
4234 #endif /* ndef _PC_MAX_CANON */
4235 if (x == Mono_Posix_PathconfName__PC_MAX_INPUT)
4236 #ifdef _PC_MAX_INPUT
4237 {*r = _PC_MAX_INPUT; return 0;}
4238 #else /* def _PC_MAX_INPUT */
4239 {errno = EINVAL; return -1;}
4240 #endif /* ndef _PC_MAX_INPUT */
4241 if (x == Mono_Posix_PathconfName__PC_NAME_MAX)
4242 #ifdef _PC_NAME_MAX
4243 {*r = _PC_NAME_MAX; return 0;}
4244 #else /* def _PC_NAME_MAX */
4245 {errno = EINVAL; return -1;}
4246 #endif /* ndef _PC_NAME_MAX */
4247 if (x == Mono_Posix_PathconfName__PC_NO_TRUNC)
4248 #ifdef _PC_NO_TRUNC
4249 {*r = _PC_NO_TRUNC; return 0;}
4250 #else /* def _PC_NO_TRUNC */
4251 {errno = EINVAL; return -1;}
4252 #endif /* ndef _PC_NO_TRUNC */
4253 if (x == Mono_Posix_PathconfName__PC_PATH_MAX)
4254 #ifdef _PC_PATH_MAX
4255 {*r = _PC_PATH_MAX; return 0;}
4256 #else /* def _PC_PATH_MAX */
4257 {errno = EINVAL; return -1;}
4258 #endif /* ndef _PC_PATH_MAX */
4259 if (x == Mono_Posix_PathconfName__PC_PIPE_BUF)
4260 #ifdef _PC_PIPE_BUF
4261 {*r = _PC_PIPE_BUF; return 0;}
4262 #else /* def _PC_PIPE_BUF */
4263 {errno = EINVAL; return -1;}
4264 #endif /* ndef _PC_PIPE_BUF */
4265 if (x == Mono_Posix_PathconfName__PC_PRIO_IO)
4266 #ifdef _PC_PRIO_IO
4267 {*r = _PC_PRIO_IO; return 0;}
4268 #else /* def _PC_PRIO_IO */
4269 {errno = EINVAL; return -1;}
4270 #endif /* ndef _PC_PRIO_IO */
4271 if (x == Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE)
4272 #ifdef _PC_REC_INCR_XFER_SIZE
4273 {*r = _PC_REC_INCR_XFER_SIZE; return 0;}
4274 #else /* def _PC_REC_INCR_XFER_SIZE */
4275 {errno = EINVAL; return -1;}
4276 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4277 if (x == Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE)
4278 #ifdef _PC_REC_MAX_XFER_SIZE
4279 {*r = _PC_REC_MAX_XFER_SIZE; return 0;}
4280 #else /* def _PC_REC_MAX_XFER_SIZE */
4281 {errno = EINVAL; return -1;}
4282 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4283 if (x == Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE)
4284 #ifdef _PC_REC_MIN_XFER_SIZE
4285 {*r = _PC_REC_MIN_XFER_SIZE; return 0;}
4286 #else /* def _PC_REC_MIN_XFER_SIZE */
4287 {errno = EINVAL; return -1;}
4288 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4289 if (x == Mono_Posix_PathconfName__PC_REC_XFER_ALIGN)
4290 #ifdef _PC_REC_XFER_ALIGN
4291 {*r = _PC_REC_XFER_ALIGN; return 0;}
4292 #else /* def _PC_REC_XFER_ALIGN */
4293 {errno = EINVAL; return -1;}
4294 #endif /* ndef _PC_REC_XFER_ALIGN */
4295 if (x == Mono_Posix_PathconfName__PC_SOCK_MAXBUF)
4296 #ifdef _PC_SOCK_MAXBUF
4297 {*r = _PC_SOCK_MAXBUF; return 0;}
4298 #else /* def _PC_SOCK_MAXBUF */
4299 {errno = EINVAL; return -1;}
4300 #endif /* ndef _PC_SOCK_MAXBUF */
4301 if (x == Mono_Posix_PathconfName__PC_SYMLINK_MAX)
4302 #ifdef _PC_SYMLINK_MAX
4303 {*r = _PC_SYMLINK_MAX; return 0;}
4304 #else /* def _PC_SYMLINK_MAX */
4305 {errno = EINVAL; return -1;}
4306 #endif /* ndef _PC_SYMLINK_MAX */
4307 if (x == Mono_Posix_PathconfName__PC_SYNC_IO)
4308 #ifdef _PC_SYNC_IO
4309 {*r = _PC_SYNC_IO; return 0;}
4310 #else /* def _PC_SYNC_IO */
4311 {errno = EINVAL; return -1;}
4312 #endif /* ndef _PC_SYNC_IO */
4313 if (x == Mono_Posix_PathconfName__PC_VDISABLE)
4314 #ifdef _PC_VDISABLE
4315 {*r = _PC_VDISABLE; return 0;}
4316 #else /* def _PC_VDISABLE */
4317 {errno = EINVAL; return -1;}
4318 #endif /* ndef _PC_VDISABLE */
4319 if (x == 0)
4320 return 0;
4321 errno = EINVAL; return -1;
4324 int Mono_Posix_ToPathconfName (int x, int *r)
4326 *r = 0;
4327 if (x == 0)
4328 return 0;
4329 #ifdef _PC_2_SYMLINKS
4330 if (x == _PC_2_SYMLINKS)
4331 {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
4332 #endif /* ndef _PC_2_SYMLINKS */
4333 #ifdef _PC_ALLOC_SIZE_MIN
4334 if (x == _PC_ALLOC_SIZE_MIN)
4335 {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
4336 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4337 #ifdef _PC_ASYNC_IO
4338 if (x == _PC_ASYNC_IO)
4339 {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
4340 #endif /* ndef _PC_ASYNC_IO */
4341 #ifdef _PC_CHOWN_RESTRICTED
4342 if (x == _PC_CHOWN_RESTRICTED)
4343 {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
4344 #endif /* ndef _PC_CHOWN_RESTRICTED */
4345 #ifdef _PC_FILESIZEBITS
4346 if (x == _PC_FILESIZEBITS)
4347 {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
4348 #endif /* ndef _PC_FILESIZEBITS */
4349 #ifdef _PC_LINK_MAX
4350 if (x == _PC_LINK_MAX)
4351 {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
4352 #endif /* ndef _PC_LINK_MAX */
4353 #ifdef _PC_MAX_CANON
4354 if (x == _PC_MAX_CANON)
4355 {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
4356 #endif /* ndef _PC_MAX_CANON */
4357 #ifdef _PC_MAX_INPUT
4358 if (x == _PC_MAX_INPUT)
4359 {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
4360 #endif /* ndef _PC_MAX_INPUT */
4361 #ifdef _PC_NAME_MAX
4362 if (x == _PC_NAME_MAX)
4363 {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
4364 #endif /* ndef _PC_NAME_MAX */
4365 #ifdef _PC_NO_TRUNC
4366 if (x == _PC_NO_TRUNC)
4367 {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
4368 #endif /* ndef _PC_NO_TRUNC */
4369 #ifdef _PC_PATH_MAX
4370 if (x == _PC_PATH_MAX)
4371 {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
4372 #endif /* ndef _PC_PATH_MAX */
4373 #ifdef _PC_PIPE_BUF
4374 if (x == _PC_PIPE_BUF)
4375 {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
4376 #endif /* ndef _PC_PIPE_BUF */
4377 #ifdef _PC_PRIO_IO
4378 if (x == _PC_PRIO_IO)
4379 {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
4380 #endif /* ndef _PC_PRIO_IO */
4381 #ifdef _PC_REC_INCR_XFER_SIZE
4382 if (x == _PC_REC_INCR_XFER_SIZE)
4383 {*r = Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE; return 0;}
4384 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4385 #ifdef _PC_REC_MAX_XFER_SIZE
4386 if (x == _PC_REC_MAX_XFER_SIZE)
4387 {*r = Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE; return 0;}
4388 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4389 #ifdef _PC_REC_MIN_XFER_SIZE
4390 if (x == _PC_REC_MIN_XFER_SIZE)
4391 {*r = Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE; return 0;}
4392 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4393 #ifdef _PC_REC_XFER_ALIGN
4394 if (x == _PC_REC_XFER_ALIGN)
4395 {*r = Mono_Posix_PathconfName__PC_REC_XFER_ALIGN; return 0;}
4396 #endif /* ndef _PC_REC_XFER_ALIGN */
4397 #ifdef _PC_SOCK_MAXBUF
4398 if (x == _PC_SOCK_MAXBUF)
4399 {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
4400 #endif /* ndef _PC_SOCK_MAXBUF */
4401 #ifdef _PC_SYMLINK_MAX
4402 if (x == _PC_SYMLINK_MAX)
4403 {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
4404 #endif /* ndef _PC_SYMLINK_MAX */
4405 #ifdef _PC_SYNC_IO
4406 if (x == _PC_SYNC_IO)
4407 {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
4408 #endif /* ndef _PC_SYNC_IO */
4409 #ifdef _PC_VDISABLE
4410 if (x == _PC_VDISABLE)
4411 {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
4412 #endif /* ndef _PC_VDISABLE */
4413 errno = EINVAL; return -1;
4416 int Mono_Posix_FromPollEvents (short x, short *r)
4418 *r = 0;
4419 if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR)
4420 #ifdef POLLERR
4421 *r |= POLLERR;
4422 #else /* def POLLERR */
4423 {errno = EINVAL; return -1;}
4424 #endif /* ndef POLLERR */
4425 if ((x & Mono_Posix_PollEvents_POLLHUP) == Mono_Posix_PollEvents_POLLHUP)
4426 #ifdef POLLHUP
4427 *r |= POLLHUP;
4428 #else /* def POLLHUP */
4429 {errno = EINVAL; return -1;}
4430 #endif /* ndef POLLHUP */
4431 if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN)
4432 #ifdef POLLIN
4433 *r |= POLLIN;
4434 #else /* def POLLIN */
4435 {errno = EINVAL; return -1;}
4436 #endif /* ndef POLLIN */
4437 if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL)
4438 #ifdef POLLNVAL
4439 *r |= POLLNVAL;
4440 #else /* def POLLNVAL */
4441 {errno = EINVAL; return -1;}
4442 #endif /* ndef POLLNVAL */
4443 if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
4444 #ifdef POLLOUT
4445 *r |= POLLOUT;
4446 #else /* def POLLOUT */
4447 {errno = EINVAL; return -1;}
4448 #endif /* ndef POLLOUT */
4449 if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI)
4450 #ifdef POLLPRI
4451 *r |= POLLPRI;
4452 #else /* def POLLPRI */
4453 {errno = EINVAL; return -1;}
4454 #endif /* ndef POLLPRI */
4455 if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
4456 #ifdef POLLRDBAND
4457 *r |= POLLRDBAND;
4458 #else /* def POLLRDBAND */
4459 {errno = EINVAL; return -1;}
4460 #endif /* ndef POLLRDBAND */
4461 if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM)
4462 #ifdef POLLRDNORM
4463 *r |= POLLRDNORM;
4464 #else /* def POLLRDNORM */
4465 {errno = EINVAL; return -1;}
4466 #endif /* ndef POLLRDNORM */
4467 if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
4468 #ifdef POLLWRBAND
4469 *r |= POLLWRBAND;
4470 #else /* def POLLWRBAND */
4471 {errno = EINVAL; return -1;}
4472 #endif /* ndef POLLWRBAND */
4473 if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
4474 #ifdef POLLWRNORM
4475 *r |= POLLWRNORM;
4476 #else /* def POLLWRNORM */
4477 {errno = EINVAL; return -1;}
4478 #endif /* ndef POLLWRNORM */
4479 if (x == 0)
4480 return 0;
4481 return 0;
4484 int Mono_Posix_ToPollEvents (short x, short *r)
4486 *r = 0;
4487 if (x == 0)
4488 return 0;
4489 #ifdef POLLERR
4490 if ((x & POLLERR) == POLLERR)
4491 *r |= Mono_Posix_PollEvents_POLLERR;
4492 #endif /* ndef POLLERR */
4493 #ifdef POLLHUP
4494 if ((x & POLLHUP) == POLLHUP)
4495 *r |= Mono_Posix_PollEvents_POLLHUP;
4496 #endif /* ndef POLLHUP */
4497 #ifdef POLLIN
4498 if ((x & POLLIN) == POLLIN)
4499 *r |= Mono_Posix_PollEvents_POLLIN;
4500 #endif /* ndef POLLIN */
4501 #ifdef POLLNVAL
4502 if ((x & POLLNVAL) == POLLNVAL)
4503 *r |= Mono_Posix_PollEvents_POLLNVAL;
4504 #endif /* ndef POLLNVAL */
4505 #ifdef POLLOUT
4506 if ((x & POLLOUT) == POLLOUT)
4507 *r |= Mono_Posix_PollEvents_POLLOUT;
4508 #endif /* ndef POLLOUT */
4509 #ifdef POLLPRI
4510 if ((x & POLLPRI) == POLLPRI)
4511 *r |= Mono_Posix_PollEvents_POLLPRI;
4512 #endif /* ndef POLLPRI */
4513 #ifdef POLLRDBAND
4514 if ((x & POLLRDBAND) == POLLRDBAND)
4515 *r |= Mono_Posix_PollEvents_POLLRDBAND;
4516 #endif /* ndef POLLRDBAND */
4517 #ifdef POLLRDNORM
4518 if ((x & POLLRDNORM) == POLLRDNORM)
4519 *r |= Mono_Posix_PollEvents_POLLRDNORM;
4520 #endif /* ndef POLLRDNORM */
4521 #ifdef POLLWRBAND
4522 if ((x & POLLWRBAND) == POLLWRBAND)
4523 *r |= Mono_Posix_PollEvents_POLLWRBAND;
4524 #endif /* ndef POLLWRBAND */
4525 #ifdef POLLWRNORM
4526 if ((x & POLLWRNORM) == POLLWRNORM)
4527 *r |= Mono_Posix_PollEvents_POLLWRNORM;
4528 #endif /* ndef POLLWRNORM */
4529 return 0;
4532 #ifdef HAVE_STRUCT_POLLFD
4534 Mono_Posix_FromPollfd (struct Mono_Posix_Pollfd *from, struct pollfd *to)
4536 _cnm_return_val_if_overflow (int, from->fd, -1);
4538 memset (to, 0, sizeof(*to));
4540 to->fd = from->fd;
4541 if (Mono_Posix_FromPollEvents (from->events, &to->events) != 0) {
4542 return -1;
4544 if (Mono_Posix_FromPollEvents (from->revents, &to->revents) != 0) {
4545 return -1;
4548 return 0;
4550 #endif /* ndef HAVE_STRUCT_POLLFD */
4553 #ifdef HAVE_STRUCT_POLLFD
4555 Mono_Posix_ToPollfd (struct pollfd *from, struct Mono_Posix_Pollfd *to)
4557 _cnm_return_val_if_overflow (int, from->fd, -1);
4559 memset (to, 0, sizeof(*to));
4561 to->fd = from->fd;
4562 if (Mono_Posix_ToPollEvents (from->events, &to->events) != 0) {
4563 return -1;
4565 if (Mono_Posix_ToPollEvents (from->revents, &to->revents) != 0) {
4566 return -1;
4569 return 0;
4571 #endif /* ndef HAVE_STRUCT_POLLFD */
4574 int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
4576 *r = 0;
4577 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
4578 #ifdef POSIX_FADV_DONTNEED
4579 {*r = POSIX_FADV_DONTNEED; return 0;}
4580 #else /* def POSIX_FADV_DONTNEED */
4581 {errno = EINVAL; return -1;}
4582 #endif /* ndef POSIX_FADV_DONTNEED */
4583 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
4584 #ifdef POSIX_FADV_NOREUSE
4585 {*r = POSIX_FADV_NOREUSE; return 0;}
4586 #else /* def POSIX_FADV_NOREUSE */
4587 {errno = EINVAL; return -1;}
4588 #endif /* ndef POSIX_FADV_NOREUSE */
4589 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
4590 #ifdef POSIX_FADV_NORMAL
4591 {*r = POSIX_FADV_NORMAL; return 0;}
4592 #else /* def POSIX_FADV_NORMAL */
4593 {errno = EINVAL; return -1;}
4594 #endif /* ndef POSIX_FADV_NORMAL */
4595 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
4596 #ifdef POSIX_FADV_RANDOM
4597 {*r = POSIX_FADV_RANDOM; return 0;}
4598 #else /* def POSIX_FADV_RANDOM */
4599 {errno = EINVAL; return -1;}
4600 #endif /* ndef POSIX_FADV_RANDOM */
4601 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
4602 #ifdef POSIX_FADV_SEQUENTIAL
4603 {*r = POSIX_FADV_SEQUENTIAL; return 0;}
4604 #else /* def POSIX_FADV_SEQUENTIAL */
4605 {errno = EINVAL; return -1;}
4606 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4607 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
4608 #ifdef POSIX_FADV_WILLNEED
4609 {*r = POSIX_FADV_WILLNEED; return 0;}
4610 #else /* def POSIX_FADV_WILLNEED */
4611 {errno = EINVAL; return -1;}
4612 #endif /* ndef POSIX_FADV_WILLNEED */
4613 if (x == 0)
4614 return 0;
4615 errno = EINVAL; return -1;
4618 int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
4620 *r = 0;
4621 if (x == 0)
4622 return 0;
4623 #ifdef POSIX_FADV_DONTNEED
4624 if (x == POSIX_FADV_DONTNEED)
4625 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
4626 #endif /* ndef POSIX_FADV_DONTNEED */
4627 #ifdef POSIX_FADV_NOREUSE
4628 if (x == POSIX_FADV_NOREUSE)
4629 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
4630 #endif /* ndef POSIX_FADV_NOREUSE */
4631 #ifdef POSIX_FADV_NORMAL
4632 if (x == POSIX_FADV_NORMAL)
4633 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
4634 #endif /* ndef POSIX_FADV_NORMAL */
4635 #ifdef POSIX_FADV_RANDOM
4636 if (x == POSIX_FADV_RANDOM)
4637 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
4638 #endif /* ndef POSIX_FADV_RANDOM */
4639 #ifdef POSIX_FADV_SEQUENTIAL
4640 if (x == POSIX_FADV_SEQUENTIAL)
4641 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
4642 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4643 #ifdef POSIX_FADV_WILLNEED
4644 if (x == POSIX_FADV_WILLNEED)
4645 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
4646 #endif /* ndef POSIX_FADV_WILLNEED */
4647 errno = EINVAL; return -1;
4650 int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
4652 *r = 0;
4653 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
4654 #ifdef POSIX_MADV_DONTNEED
4655 {*r = POSIX_MADV_DONTNEED; return 0;}
4656 #else /* def POSIX_MADV_DONTNEED */
4657 {errno = EINVAL; return -1;}
4658 #endif /* ndef POSIX_MADV_DONTNEED */
4659 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
4660 #ifdef POSIX_MADV_NORMAL
4661 {*r = POSIX_MADV_NORMAL; return 0;}
4662 #else /* def POSIX_MADV_NORMAL */
4663 {errno = EINVAL; return -1;}
4664 #endif /* ndef POSIX_MADV_NORMAL */
4665 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
4666 #ifdef POSIX_MADV_RANDOM
4667 {*r = POSIX_MADV_RANDOM; return 0;}
4668 #else /* def POSIX_MADV_RANDOM */
4669 {errno = EINVAL; return -1;}
4670 #endif /* ndef POSIX_MADV_RANDOM */
4671 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
4672 #ifdef POSIX_MADV_SEQUENTIAL
4673 {*r = POSIX_MADV_SEQUENTIAL; return 0;}
4674 #else /* def POSIX_MADV_SEQUENTIAL */
4675 {errno = EINVAL; return -1;}
4676 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4677 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
4678 #ifdef POSIX_MADV_WILLNEED
4679 {*r = POSIX_MADV_WILLNEED; return 0;}
4680 #else /* def POSIX_MADV_WILLNEED */
4681 {errno = EINVAL; return -1;}
4682 #endif /* ndef POSIX_MADV_WILLNEED */
4683 if (x == 0)
4684 return 0;
4685 errno = EINVAL; return -1;
4688 int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
4690 *r = 0;
4691 if (x == 0)
4692 return 0;
4693 #ifdef POSIX_MADV_DONTNEED
4694 if (x == POSIX_MADV_DONTNEED)
4695 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
4696 #endif /* ndef POSIX_MADV_DONTNEED */
4697 #ifdef POSIX_MADV_NORMAL
4698 if (x == POSIX_MADV_NORMAL)
4699 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
4700 #endif /* ndef POSIX_MADV_NORMAL */
4701 #ifdef POSIX_MADV_RANDOM
4702 if (x == POSIX_MADV_RANDOM)
4703 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
4704 #endif /* ndef POSIX_MADV_RANDOM */
4705 #ifdef POSIX_MADV_SEQUENTIAL
4706 if (x == POSIX_MADV_SEQUENTIAL)
4707 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
4708 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4709 #ifdef POSIX_MADV_WILLNEED
4710 if (x == POSIX_MADV_WILLNEED)
4711 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
4712 #endif /* ndef POSIX_MADV_WILLNEED */
4713 errno = EINVAL; return -1;
4716 int Mono_Posix_FromSeekFlags (short x, short *r)
4718 *r = 0;
4719 #ifdef L_INCR
4720 if (x == Mono_Posix_SeekFlags_L_INCR)
4721 {*r = L_INCR; return 0;}
4722 #endif /* def L_INCR */
4723 #ifdef L_SET
4724 if (x == Mono_Posix_SeekFlags_L_SET)
4725 {*r = L_SET; return 0;}
4726 #endif /* def L_SET */
4727 #ifdef L_XTND
4728 if (x == Mono_Posix_SeekFlags_L_XTND)
4729 {*r = L_XTND; return 0;}
4730 #endif /* def L_XTND */
4731 #ifdef SEEK_CUR
4732 if (x == Mono_Posix_SeekFlags_SEEK_CUR)
4733 {*r = SEEK_CUR; return 0;}
4734 #endif /* def SEEK_CUR */
4735 #ifdef SEEK_END
4736 if (x == Mono_Posix_SeekFlags_SEEK_END)
4737 {*r = SEEK_END; return 0;}
4738 #endif /* def SEEK_END */
4739 #ifdef SEEK_SET
4740 if (x == Mono_Posix_SeekFlags_SEEK_SET)
4741 {*r = SEEK_SET; return 0;}
4742 #endif /* def SEEK_SET */
4743 errno = EINVAL; return -1;
4746 int Mono_Posix_ToSeekFlags (short x, short *r)
4748 *r = 0;
4749 #ifdef L_INCR
4750 if (x == L_INCR)
4751 {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
4752 #endif /* ndef L_INCR */
4753 #ifdef L_SET
4754 if (x == L_SET)
4755 {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
4756 #endif /* ndef L_SET */
4757 #ifdef L_XTND
4758 if (x == L_XTND)
4759 {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
4760 #endif /* ndef L_XTND */
4761 #ifdef SEEK_CUR
4762 if (x == SEEK_CUR)
4763 {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
4764 #endif /* ndef SEEK_CUR */
4765 #ifdef SEEK_END
4766 if (x == SEEK_END)
4767 {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
4768 #endif /* ndef SEEK_END */
4769 #ifdef SEEK_SET
4770 if (x == SEEK_SET)
4771 {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
4772 #endif /* ndef SEEK_SET */
4773 errno = EINVAL; return -1;
4776 int Mono_Posix_FromShutdownOption (int x, int *r)
4778 *r = 0;
4779 if (x == Mono_Posix_ShutdownOption_SHUT_RD)
4780 #ifdef SHUT_RD
4781 {*r = SHUT_RD; return 0;}
4782 #else /* def SHUT_RD */
4783 {errno = EINVAL; return -1;}
4784 #endif /* ndef SHUT_RD */
4785 if (x == Mono_Posix_ShutdownOption_SHUT_RDWR)
4786 #ifdef SHUT_RDWR
4787 {*r = SHUT_RDWR; return 0;}
4788 #else /* def SHUT_RDWR */
4789 {errno = EINVAL; return -1;}
4790 #endif /* ndef SHUT_RDWR */
4791 if (x == Mono_Posix_ShutdownOption_SHUT_WR)
4792 #ifdef SHUT_WR
4793 {*r = SHUT_WR; return 0;}
4794 #else /* def SHUT_WR */
4795 {errno = EINVAL; return -1;}
4796 #endif /* ndef SHUT_WR */
4797 if (x == 0)
4798 return 0;
4799 errno = EINVAL; return -1;
4802 int Mono_Posix_ToShutdownOption (int x, int *r)
4804 *r = 0;
4805 if (x == 0)
4806 return 0;
4807 #ifdef SHUT_RD
4808 if (x == SHUT_RD)
4809 {*r = Mono_Posix_ShutdownOption_SHUT_RD; return 0;}
4810 #endif /* ndef SHUT_RD */
4811 #ifdef SHUT_RDWR
4812 if (x == SHUT_RDWR)
4813 {*r = Mono_Posix_ShutdownOption_SHUT_RDWR; return 0;}
4814 #endif /* ndef SHUT_RDWR */
4815 #ifdef SHUT_WR
4816 if (x == SHUT_WR)
4817 {*r = Mono_Posix_ShutdownOption_SHUT_WR; return 0;}
4818 #endif /* ndef SHUT_WR */
4819 errno = EINVAL; return -1;
4822 int Mono_Posix_FromSignum (int x, int *r)
4824 *r = 0;
4825 if (x == Mono_Posix_Signum_SIGABRT)
4826 #ifdef SIGABRT
4827 {*r = SIGABRT; return 0;}
4828 #else /* def SIGABRT */
4829 {errno = EINVAL; return -1;}
4830 #endif /* ndef SIGABRT */
4831 if (x == Mono_Posix_Signum_SIGALRM)
4832 #ifdef SIGALRM
4833 {*r = SIGALRM; return 0;}
4834 #else /* def SIGALRM */
4835 {errno = EINVAL; return -1;}
4836 #endif /* ndef SIGALRM */
4837 if (x == Mono_Posix_Signum_SIGBUS)
4838 #ifdef SIGBUS
4839 {*r = SIGBUS; return 0;}
4840 #else /* def SIGBUS */
4841 {errno = EINVAL; return -1;}
4842 #endif /* ndef SIGBUS */
4843 if (x == Mono_Posix_Signum_SIGCHLD)
4844 #ifdef SIGCHLD
4845 {*r = SIGCHLD; return 0;}
4846 #else /* def SIGCHLD */
4847 {errno = EINVAL; return -1;}
4848 #endif /* ndef SIGCHLD */
4849 if (x == Mono_Posix_Signum_SIGCLD)
4850 #ifdef SIGCLD
4851 {*r = SIGCLD; return 0;}
4852 #else /* def SIGCLD */
4853 {errno = EINVAL; return -1;}
4854 #endif /* ndef SIGCLD */
4855 if (x == Mono_Posix_Signum_SIGCONT)
4856 #ifdef SIGCONT
4857 {*r = SIGCONT; return 0;}
4858 #else /* def SIGCONT */
4859 {errno = EINVAL; return -1;}
4860 #endif /* ndef SIGCONT */
4861 if (x == Mono_Posix_Signum_SIGFPE)
4862 #ifdef SIGFPE
4863 {*r = SIGFPE; return 0;}
4864 #else /* def SIGFPE */
4865 {errno = EINVAL; return -1;}
4866 #endif /* ndef SIGFPE */
4867 if (x == Mono_Posix_Signum_SIGHUP)
4868 #ifdef SIGHUP
4869 {*r = SIGHUP; return 0;}
4870 #else /* def SIGHUP */
4871 {errno = EINVAL; return -1;}
4872 #endif /* ndef SIGHUP */
4873 if (x == Mono_Posix_Signum_SIGILL)
4874 #ifdef SIGILL
4875 {*r = SIGILL; return 0;}
4876 #else /* def SIGILL */
4877 {errno = EINVAL; return -1;}
4878 #endif /* ndef SIGILL */
4879 if (x == Mono_Posix_Signum_SIGINT)
4880 #ifdef SIGINT
4881 {*r = SIGINT; return 0;}
4882 #else /* def SIGINT */
4883 {errno = EINVAL; return -1;}
4884 #endif /* ndef SIGINT */
4885 if (x == Mono_Posix_Signum_SIGIO)
4886 #ifdef SIGIO
4887 {*r = SIGIO; return 0;}
4888 #else /* def SIGIO */
4889 {errno = EINVAL; return -1;}
4890 #endif /* ndef SIGIO */
4891 if (x == Mono_Posix_Signum_SIGIOT)
4892 #ifdef SIGIOT
4893 {*r = SIGIOT; return 0;}
4894 #else /* def SIGIOT */
4895 {errno = EINVAL; return -1;}
4896 #endif /* ndef SIGIOT */
4897 if (x == Mono_Posix_Signum_SIGKILL)
4898 #ifdef SIGKILL
4899 {*r = SIGKILL; return 0;}
4900 #else /* def SIGKILL */
4901 {errno = EINVAL; return -1;}
4902 #endif /* ndef SIGKILL */
4903 if (x == Mono_Posix_Signum_SIGPIPE)
4904 #ifdef SIGPIPE
4905 {*r = SIGPIPE; return 0;}
4906 #else /* def SIGPIPE */
4907 {errno = EINVAL; return -1;}
4908 #endif /* ndef SIGPIPE */
4909 if (x == Mono_Posix_Signum_SIGPOLL)
4910 #ifdef SIGPOLL
4911 {*r = SIGPOLL; return 0;}
4912 #else /* def SIGPOLL */
4913 {errno = EINVAL; return -1;}
4914 #endif /* ndef SIGPOLL */
4915 if (x == Mono_Posix_Signum_SIGPROF)
4916 #ifdef SIGPROF
4917 {*r = SIGPROF; return 0;}
4918 #else /* def SIGPROF */
4919 {errno = EINVAL; return -1;}
4920 #endif /* ndef SIGPROF */
4921 if (x == Mono_Posix_Signum_SIGPWR)
4922 #ifdef SIGPWR
4923 {*r = SIGPWR; return 0;}
4924 #else /* def SIGPWR */
4925 {errno = EINVAL; return -1;}
4926 #endif /* ndef SIGPWR */
4927 if (x == Mono_Posix_Signum_SIGQUIT)
4928 #ifdef SIGQUIT
4929 {*r = SIGQUIT; return 0;}
4930 #else /* def SIGQUIT */
4931 {errno = EINVAL; return -1;}
4932 #endif /* ndef SIGQUIT */
4933 if (x == Mono_Posix_Signum_SIGSEGV)
4934 #ifdef SIGSEGV
4935 {*r = SIGSEGV; return 0;}
4936 #else /* def SIGSEGV */
4937 {errno = EINVAL; return -1;}
4938 #endif /* ndef SIGSEGV */
4939 if (x == Mono_Posix_Signum_SIGSTKFLT)
4940 #ifdef SIGSTKFLT
4941 {*r = SIGSTKFLT; return 0;}
4942 #else /* def SIGSTKFLT */
4943 {errno = EINVAL; return -1;}
4944 #endif /* ndef SIGSTKFLT */
4945 if (x == Mono_Posix_Signum_SIGSTOP)
4946 #ifdef SIGSTOP
4947 {*r = SIGSTOP; return 0;}
4948 #else /* def SIGSTOP */
4949 {errno = EINVAL; return -1;}
4950 #endif /* ndef SIGSTOP */
4951 if (x == Mono_Posix_Signum_SIGSYS)
4952 #ifdef SIGSYS
4953 {*r = SIGSYS; return 0;}
4954 #else /* def SIGSYS */
4955 {errno = EINVAL; return -1;}
4956 #endif /* ndef SIGSYS */
4957 if (x == Mono_Posix_Signum_SIGTERM)
4958 #ifdef SIGTERM
4959 {*r = SIGTERM; return 0;}
4960 #else /* def SIGTERM */
4961 {errno = EINVAL; return -1;}
4962 #endif /* ndef SIGTERM */
4963 if (x == Mono_Posix_Signum_SIGTRAP)
4964 #ifdef SIGTRAP
4965 {*r = SIGTRAP; return 0;}
4966 #else /* def SIGTRAP */
4967 {errno = EINVAL; return -1;}
4968 #endif /* ndef SIGTRAP */
4969 if (x == Mono_Posix_Signum_SIGTSTP)
4970 #ifdef SIGTSTP
4971 {*r = SIGTSTP; return 0;}
4972 #else /* def SIGTSTP */
4973 {errno = EINVAL; return -1;}
4974 #endif /* ndef SIGTSTP */
4975 if (x == Mono_Posix_Signum_SIGTTIN)
4976 #ifdef SIGTTIN
4977 {*r = SIGTTIN; return 0;}
4978 #else /* def SIGTTIN */
4979 {errno = EINVAL; return -1;}
4980 #endif /* ndef SIGTTIN */
4981 if (x == Mono_Posix_Signum_SIGTTOU)
4982 #ifdef SIGTTOU
4983 {*r = SIGTTOU; return 0;}
4984 #else /* def SIGTTOU */
4985 {errno = EINVAL; return -1;}
4986 #endif /* ndef SIGTTOU */
4987 if (x == Mono_Posix_Signum_SIGUNUSED)
4988 #ifdef SIGUNUSED
4989 {*r = SIGUNUSED; return 0;}
4990 #else /* def SIGUNUSED */
4991 {errno = EINVAL; return -1;}
4992 #endif /* ndef SIGUNUSED */
4993 if (x == Mono_Posix_Signum_SIGURG)
4994 #ifdef SIGURG
4995 {*r = SIGURG; return 0;}
4996 #else /* def SIGURG */
4997 {errno = EINVAL; return -1;}
4998 #endif /* ndef SIGURG */
4999 if (x == Mono_Posix_Signum_SIGUSR1)
5000 #ifdef SIGUSR1
5001 {*r = SIGUSR1; return 0;}
5002 #else /* def SIGUSR1 */
5003 {errno = EINVAL; return -1;}
5004 #endif /* ndef SIGUSR1 */
5005 if (x == Mono_Posix_Signum_SIGUSR2)
5006 #ifdef SIGUSR2
5007 {*r = SIGUSR2; return 0;}
5008 #else /* def SIGUSR2 */
5009 {errno = EINVAL; return -1;}
5010 #endif /* ndef SIGUSR2 */
5011 if (x == Mono_Posix_Signum_SIGVTALRM)
5012 #ifdef SIGVTALRM
5013 {*r = SIGVTALRM; return 0;}
5014 #else /* def SIGVTALRM */
5015 {errno = EINVAL; return -1;}
5016 #endif /* ndef SIGVTALRM */
5017 if (x == Mono_Posix_Signum_SIGWINCH)
5018 #ifdef SIGWINCH
5019 {*r = SIGWINCH; return 0;}
5020 #else /* def SIGWINCH */
5021 {errno = EINVAL; return -1;}
5022 #endif /* ndef SIGWINCH */
5023 if (x == Mono_Posix_Signum_SIGXCPU)
5024 #ifdef SIGXCPU
5025 {*r = SIGXCPU; return 0;}
5026 #else /* def SIGXCPU */
5027 {errno = EINVAL; return -1;}
5028 #endif /* ndef SIGXCPU */
5029 if (x == Mono_Posix_Signum_SIGXFSZ)
5030 #ifdef SIGXFSZ
5031 {*r = SIGXFSZ; return 0;}
5032 #else /* def SIGXFSZ */
5033 {errno = EINVAL; return -1;}
5034 #endif /* ndef SIGXFSZ */
5035 if (x == 0)
5036 return 0;
5037 errno = EINVAL; return -1;
5040 int Mono_Posix_ToSignum (int x, int *r)
5042 *r = 0;
5043 if (x == 0)
5044 return 0;
5045 #ifdef SIGABRT
5046 if (x == SIGABRT)
5047 {*r = Mono_Posix_Signum_SIGABRT; return 0;}
5048 #endif /* ndef SIGABRT */
5049 #ifdef SIGALRM
5050 if (x == SIGALRM)
5051 {*r = Mono_Posix_Signum_SIGALRM; return 0;}
5052 #endif /* ndef SIGALRM */
5053 #ifdef SIGBUS
5054 if (x == SIGBUS)
5055 {*r = Mono_Posix_Signum_SIGBUS; return 0;}
5056 #endif /* ndef SIGBUS */
5057 #ifdef SIGCHLD
5058 if (x == SIGCHLD)
5059 {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
5060 #endif /* ndef SIGCHLD */
5061 #ifdef SIGCLD
5062 if (x == SIGCLD)
5063 {*r = Mono_Posix_Signum_SIGCLD; return 0;}
5064 #endif /* ndef SIGCLD */
5065 #ifdef SIGCONT
5066 if (x == SIGCONT)
5067 {*r = Mono_Posix_Signum_SIGCONT; return 0;}
5068 #endif /* ndef SIGCONT */
5069 #ifdef SIGFPE
5070 if (x == SIGFPE)
5071 {*r = Mono_Posix_Signum_SIGFPE; return 0;}
5072 #endif /* ndef SIGFPE */
5073 #ifdef SIGHUP
5074 if (x == SIGHUP)
5075 {*r = Mono_Posix_Signum_SIGHUP; return 0;}
5076 #endif /* ndef SIGHUP */
5077 #ifdef SIGILL
5078 if (x == SIGILL)
5079 {*r = Mono_Posix_Signum_SIGILL; return 0;}
5080 #endif /* ndef SIGILL */
5081 #ifdef SIGINT
5082 if (x == SIGINT)
5083 {*r = Mono_Posix_Signum_SIGINT; return 0;}
5084 #endif /* ndef SIGINT */
5085 #ifdef SIGIO
5086 if (x == SIGIO)
5087 {*r = Mono_Posix_Signum_SIGIO; return 0;}
5088 #endif /* ndef SIGIO */
5089 #ifdef SIGIOT
5090 if (x == SIGIOT)
5091 {*r = Mono_Posix_Signum_SIGIOT; return 0;}
5092 #endif /* ndef SIGIOT */
5093 #ifdef SIGKILL
5094 if (x == SIGKILL)
5095 {*r = Mono_Posix_Signum_SIGKILL; return 0;}
5096 #endif /* ndef SIGKILL */
5097 #ifdef SIGPIPE
5098 if (x == SIGPIPE)
5099 {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
5100 #endif /* ndef SIGPIPE */
5101 #ifdef SIGPOLL
5102 if (x == SIGPOLL)
5103 {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
5104 #endif /* ndef SIGPOLL */
5105 #ifdef SIGPROF
5106 if (x == SIGPROF)
5107 {*r = Mono_Posix_Signum_SIGPROF; return 0;}
5108 #endif /* ndef SIGPROF */
5109 #ifdef SIGPWR
5110 if (x == SIGPWR)
5111 {*r = Mono_Posix_Signum_SIGPWR; return 0;}
5112 #endif /* ndef SIGPWR */
5113 #ifdef SIGQUIT
5114 if (x == SIGQUIT)
5115 {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
5116 #endif /* ndef SIGQUIT */
5117 #ifdef SIGSEGV
5118 if (x == SIGSEGV)
5119 {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
5120 #endif /* ndef SIGSEGV */
5121 #ifdef SIGSTKFLT
5122 if (x == SIGSTKFLT)
5123 {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
5124 #endif /* ndef SIGSTKFLT */
5125 #ifdef SIGSTOP
5126 if (x == SIGSTOP)
5127 {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
5128 #endif /* ndef SIGSTOP */
5129 #ifdef SIGSYS
5130 if (x == SIGSYS)
5131 {*r = Mono_Posix_Signum_SIGSYS; return 0;}
5132 #endif /* ndef SIGSYS */
5133 #ifdef SIGTERM
5134 if (x == SIGTERM)
5135 {*r = Mono_Posix_Signum_SIGTERM; return 0;}
5136 #endif /* ndef SIGTERM */
5137 #ifdef SIGTRAP
5138 if (x == SIGTRAP)
5139 {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
5140 #endif /* ndef SIGTRAP */
5141 #ifdef SIGTSTP
5142 if (x == SIGTSTP)
5143 {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
5144 #endif /* ndef SIGTSTP */
5145 #ifdef SIGTTIN
5146 if (x == SIGTTIN)
5147 {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
5148 #endif /* ndef SIGTTIN */
5149 #ifdef SIGTTOU
5150 if (x == SIGTTOU)
5151 {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
5152 #endif /* ndef SIGTTOU */
5153 #ifdef SIGUNUSED
5154 if (x == SIGUNUSED)
5155 {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
5156 #endif /* ndef SIGUNUSED */
5157 #ifdef SIGURG
5158 if (x == SIGURG)
5159 {*r = Mono_Posix_Signum_SIGURG; return 0;}
5160 #endif /* ndef SIGURG */
5161 #ifdef SIGUSR1
5162 if (x == SIGUSR1)
5163 {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
5164 #endif /* ndef SIGUSR1 */
5165 #ifdef SIGUSR2
5166 if (x == SIGUSR2)
5167 {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
5168 #endif /* ndef SIGUSR2 */
5169 #ifdef SIGVTALRM
5170 if (x == SIGVTALRM)
5171 {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
5172 #endif /* ndef SIGVTALRM */
5173 #ifdef SIGWINCH
5174 if (x == SIGWINCH)
5175 {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
5176 #endif /* ndef SIGWINCH */
5177 #ifdef SIGXCPU
5178 if (x == SIGXCPU)
5179 {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
5180 #endif /* ndef SIGXCPU */
5181 #ifdef SIGXFSZ
5182 if (x == SIGXFSZ)
5183 {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
5184 #endif /* ndef SIGXFSZ */
5185 errno = EINVAL; return -1;
5188 #ifdef HAVE_STRUCT_SOCKADDR_IN
5190 Mono_Posix_FromSockaddrIn (struct Mono_Posix_SockaddrIn *from, struct sockaddr_in *to)
5192 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5194 memset (to, 0, sizeof(*to));
5196 to->sin_port = from->sin_port;
5197 if (Mono_Posix_FromInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5198 return -1;
5201 return 0;
5203 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5206 #ifdef HAVE_STRUCT_SOCKADDR_IN
5208 Mono_Posix_ToSockaddrIn (struct sockaddr_in *from, struct Mono_Posix_SockaddrIn *to)
5210 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5212 memset (to, 0, sizeof(*to));
5214 to->sin_port = from->sin_port;
5215 if (Mono_Posix_ToInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5216 return -1;
5219 return 0;
5221 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5224 #ifdef HAVE_STRUCT_SOCKADDR_IN6
5226 Mono_Posix_FromSockaddrIn6 (struct Mono_Posix_SockaddrIn6 *from, struct sockaddr_in6 *to)
5228 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5229 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5230 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5232 memset (to, 0, sizeof(*to));
5234 to->sin6_port = from->sin6_port;
5235 to->sin6_flowinfo = from->sin6_flowinfo;
5236 if (Mono_Posix_FromIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5237 return -1;
5239 to->sin6_scope_id = from->sin6_scope_id;
5241 return 0;
5243 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5246 #ifdef HAVE_STRUCT_SOCKADDR_IN6
5248 Mono_Posix_ToSockaddrIn6 (struct sockaddr_in6 *from, struct Mono_Posix_SockaddrIn6 *to)
5250 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5251 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5252 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5254 memset (to, 0, sizeof(*to));
5256 to->sin6_port = from->sin6_port;
5257 to->sin6_flowinfo = from->sin6_flowinfo;
5258 if (Mono_Posix_ToIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5259 return -1;
5261 to->sin6_scope_id = from->sin6_scope_id;
5263 return 0;
5265 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5268 int Mono_Posix_FromSockaddrType (int x, int *r)
5270 *r = 0;
5271 if (x == Mono_Posix_SockaddrType_Invalid)
5272 #ifdef Invalid
5273 {*r = Invalid; return 0;}
5274 #else /* def Invalid */
5275 {errno = EINVAL; return -1;}
5276 #endif /* ndef Invalid */
5277 if (x == Mono_Posix_SockaddrType_MustBeWrapped)
5278 #ifdef MustBeWrapped
5279 {*r = MustBeWrapped; return 0;}
5280 #else /* def MustBeWrapped */
5281 {errno = EINVAL; return -1;}
5282 #endif /* ndef MustBeWrapped */
5283 if (x == Mono_Posix_SockaddrType_Sockaddr)
5284 #ifdef Sockaddr
5285 {*r = Sockaddr; return 0;}
5286 #else /* def Sockaddr */
5287 {errno = EINVAL; return -1;}
5288 #endif /* ndef Sockaddr */
5289 if (x == Mono_Posix_SockaddrType_SockaddrIn)
5290 #ifdef SockaddrIn
5291 {*r = SockaddrIn; return 0;}
5292 #else /* def SockaddrIn */
5293 {errno = EINVAL; return -1;}
5294 #endif /* ndef SockaddrIn */
5295 if (x == Mono_Posix_SockaddrType_SockaddrIn6)
5296 #ifdef SockaddrIn6
5297 {*r = SockaddrIn6; return 0;}
5298 #else /* def SockaddrIn6 */
5299 {errno = EINVAL; return -1;}
5300 #endif /* ndef SockaddrIn6 */
5301 if (x == Mono_Posix_SockaddrType_SockaddrStorage)
5302 #ifdef SockaddrStorage
5303 {*r = SockaddrStorage; return 0;}
5304 #else /* def SockaddrStorage */
5305 {errno = EINVAL; return -1;}
5306 #endif /* ndef SockaddrStorage */
5307 if (x == Mono_Posix_SockaddrType_SockaddrUn)
5308 #ifdef SockaddrUn
5309 {*r = SockaddrUn; return 0;}
5310 #else /* def SockaddrUn */
5311 {errno = EINVAL; return -1;}
5312 #endif /* ndef SockaddrUn */
5313 if (x == 0)
5314 return 0;
5315 errno = EINVAL; return -1;
5318 int Mono_Posix_ToSockaddrType (int x, int *r)
5320 *r = 0;
5321 if (x == 0)
5322 return 0;
5323 #ifdef Invalid
5324 if (x == Invalid)
5325 {*r = Mono_Posix_SockaddrType_Invalid; return 0;}
5326 #endif /* ndef Invalid */
5327 #ifdef MustBeWrapped
5328 if (x == MustBeWrapped)
5329 {*r = Mono_Posix_SockaddrType_MustBeWrapped; return 0;}
5330 #endif /* ndef MustBeWrapped */
5331 #ifdef Sockaddr
5332 if (x == Sockaddr)
5333 {*r = Mono_Posix_SockaddrType_Sockaddr; return 0;}
5334 #endif /* ndef Sockaddr */
5335 #ifdef SockaddrIn
5336 if (x == SockaddrIn)
5337 {*r = Mono_Posix_SockaddrType_SockaddrIn; return 0;}
5338 #endif /* ndef SockaddrIn */
5339 #ifdef SockaddrIn6
5340 if (x == SockaddrIn6)
5341 {*r = Mono_Posix_SockaddrType_SockaddrIn6; return 0;}
5342 #endif /* ndef SockaddrIn6 */
5343 #ifdef SockaddrStorage
5344 if (x == SockaddrStorage)
5345 {*r = Mono_Posix_SockaddrType_SockaddrStorage; return 0;}
5346 #endif /* ndef SockaddrStorage */
5347 #ifdef SockaddrUn
5348 if (x == SockaddrUn)
5349 {*r = Mono_Posix_SockaddrType_SockaddrUn; return 0;}
5350 #endif /* ndef SockaddrUn */
5351 errno = EINVAL; return -1;
5354 int Mono_Posix_FromSysconfName (int x, int *r)
5356 *r = 0;
5357 if (x == Mono_Posix_SysconfName__SC_2_CHAR_TERM)
5358 #ifdef _SC_2_CHAR_TERM
5359 {*r = _SC_2_CHAR_TERM; return 0;}
5360 #else /* def _SC_2_CHAR_TERM */
5361 {errno = EINVAL; return -1;}
5362 #endif /* ndef _SC_2_CHAR_TERM */
5363 if (x == Mono_Posix_SysconfName__SC_2_C_BIND)
5364 #ifdef _SC_2_C_BIND
5365 {*r = _SC_2_C_BIND; return 0;}
5366 #else /* def _SC_2_C_BIND */
5367 {errno = EINVAL; return -1;}
5368 #endif /* ndef _SC_2_C_BIND */
5369 if (x == Mono_Posix_SysconfName__SC_2_C_DEV)
5370 #ifdef _SC_2_C_DEV
5371 {*r = _SC_2_C_DEV; return 0;}
5372 #else /* def _SC_2_C_DEV */
5373 {errno = EINVAL; return -1;}
5374 #endif /* ndef _SC_2_C_DEV */
5375 if (x == Mono_Posix_SysconfName__SC_2_C_VERSION)
5376 #ifdef _SC_2_C_VERSION
5377 {*r = _SC_2_C_VERSION; return 0;}
5378 #else /* def _SC_2_C_VERSION */
5379 {errno = EINVAL; return -1;}
5380 #endif /* ndef _SC_2_C_VERSION */
5381 if (x == Mono_Posix_SysconfName__SC_2_FORT_DEV)
5382 #ifdef _SC_2_FORT_DEV
5383 {*r = _SC_2_FORT_DEV; return 0;}
5384 #else /* def _SC_2_FORT_DEV */
5385 {errno = EINVAL; return -1;}
5386 #endif /* ndef _SC_2_FORT_DEV */
5387 if (x == Mono_Posix_SysconfName__SC_2_FORT_RUN)
5388 #ifdef _SC_2_FORT_RUN
5389 {*r = _SC_2_FORT_RUN; return 0;}
5390 #else /* def _SC_2_FORT_RUN */
5391 {errno = EINVAL; return -1;}
5392 #endif /* ndef _SC_2_FORT_RUN */
5393 if (x == Mono_Posix_SysconfName__SC_2_LOCALEDEF)
5394 #ifdef _SC_2_LOCALEDEF
5395 {*r = _SC_2_LOCALEDEF; return 0;}
5396 #else /* def _SC_2_LOCALEDEF */
5397 {errno = EINVAL; return -1;}
5398 #endif /* ndef _SC_2_LOCALEDEF */
5399 if (x == Mono_Posix_SysconfName__SC_2_PBS)
5400 #ifdef _SC_2_PBS
5401 {*r = _SC_2_PBS; return 0;}
5402 #else /* def _SC_2_PBS */
5403 {errno = EINVAL; return -1;}
5404 #endif /* ndef _SC_2_PBS */
5405 if (x == Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING)
5406 #ifdef _SC_2_PBS_ACCOUNTING
5407 {*r = _SC_2_PBS_ACCOUNTING; return 0;}
5408 #else /* def _SC_2_PBS_ACCOUNTING */
5409 {errno = EINVAL; return -1;}
5410 #endif /* ndef _SC_2_PBS_ACCOUNTING */
5411 if (x == Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT)
5412 #ifdef _SC_2_PBS_CHECKPOINT
5413 {*r = _SC_2_PBS_CHECKPOINT; return 0;}
5414 #else /* def _SC_2_PBS_CHECKPOINT */
5415 {errno = EINVAL; return -1;}
5416 #endif /* ndef _SC_2_PBS_CHECKPOINT */
5417 if (x == Mono_Posix_SysconfName__SC_2_PBS_LOCATE)
5418 #ifdef _SC_2_PBS_LOCATE
5419 {*r = _SC_2_PBS_LOCATE; return 0;}
5420 #else /* def _SC_2_PBS_LOCATE */
5421 {errno = EINVAL; return -1;}
5422 #endif /* ndef _SC_2_PBS_LOCATE */
5423 if (x == Mono_Posix_SysconfName__SC_2_PBS_MESSAGE)
5424 #ifdef _SC_2_PBS_MESSAGE
5425 {*r = _SC_2_PBS_MESSAGE; return 0;}
5426 #else /* def _SC_2_PBS_MESSAGE */
5427 {errno = EINVAL; return -1;}
5428 #endif /* ndef _SC_2_PBS_MESSAGE */
5429 if (x == Mono_Posix_SysconfName__SC_2_PBS_TRACK)
5430 #ifdef _SC_2_PBS_TRACK
5431 {*r = _SC_2_PBS_TRACK; return 0;}
5432 #else /* def _SC_2_PBS_TRACK */
5433 {errno = EINVAL; return -1;}
5434 #endif /* ndef _SC_2_PBS_TRACK */
5435 if (x == Mono_Posix_SysconfName__SC_2_SW_DEV)
5436 #ifdef _SC_2_SW_DEV
5437 {*r = _SC_2_SW_DEV; return 0;}
5438 #else /* def _SC_2_SW_DEV */
5439 {errno = EINVAL; return -1;}
5440 #endif /* ndef _SC_2_SW_DEV */
5441 if (x == Mono_Posix_SysconfName__SC_2_UPE)
5442 #ifdef _SC_2_UPE
5443 {*r = _SC_2_UPE; return 0;}
5444 #else /* def _SC_2_UPE */
5445 {errno = EINVAL; return -1;}
5446 #endif /* ndef _SC_2_UPE */
5447 if (x == Mono_Posix_SysconfName__SC_2_VERSION)
5448 #ifdef _SC_2_VERSION
5449 {*r = _SC_2_VERSION; return 0;}
5450 #else /* def _SC_2_VERSION */
5451 {errno = EINVAL; return -1;}
5452 #endif /* ndef _SC_2_VERSION */
5453 if (x == Mono_Posix_SysconfName__SC_ADVISORY_INFO)
5454 #ifdef _SC_ADVISORY_INFO
5455 {*r = _SC_ADVISORY_INFO; return 0;}
5456 #else /* def _SC_ADVISORY_INFO */
5457 {errno = EINVAL; return -1;}
5458 #endif /* ndef _SC_ADVISORY_INFO */
5459 if (x == Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX)
5460 #ifdef _SC_AIO_LISTIO_MAX
5461 {*r = _SC_AIO_LISTIO_MAX; return 0;}
5462 #else /* def _SC_AIO_LISTIO_MAX */
5463 {errno = EINVAL; return -1;}
5464 #endif /* ndef _SC_AIO_LISTIO_MAX */
5465 if (x == Mono_Posix_SysconfName__SC_AIO_MAX)
5466 #ifdef _SC_AIO_MAX
5467 {*r = _SC_AIO_MAX; return 0;}
5468 #else /* def _SC_AIO_MAX */
5469 {errno = EINVAL; return -1;}
5470 #endif /* ndef _SC_AIO_MAX */
5471 if (x == Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX)
5472 #ifdef _SC_AIO_PRIO_DELTA_MAX
5473 {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
5474 #else /* def _SC_AIO_PRIO_DELTA_MAX */
5475 {errno = EINVAL; return -1;}
5476 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
5477 if (x == Mono_Posix_SysconfName__SC_ARG_MAX)
5478 #ifdef _SC_ARG_MAX
5479 {*r = _SC_ARG_MAX; return 0;}
5480 #else /* def _SC_ARG_MAX */
5481 {errno = EINVAL; return -1;}
5482 #endif /* ndef _SC_ARG_MAX */
5483 if (x == Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO)
5484 #ifdef _SC_ASYNCHRONOUS_IO
5485 {*r = _SC_ASYNCHRONOUS_IO; return 0;}
5486 #else /* def _SC_ASYNCHRONOUS_IO */
5487 {errno = EINVAL; return -1;}
5488 #endif /* ndef _SC_ASYNCHRONOUS_IO */
5489 if (x == Mono_Posix_SysconfName__SC_ATEXIT_MAX)
5490 #ifdef _SC_ATEXIT_MAX
5491 {*r = _SC_ATEXIT_MAX; return 0;}
5492 #else /* def _SC_ATEXIT_MAX */
5493 {errno = EINVAL; return -1;}
5494 #endif /* ndef _SC_ATEXIT_MAX */
5495 if (x == Mono_Posix_SysconfName__SC_AVPHYS_PAGES)
5496 #ifdef _SC_AVPHYS_PAGES
5497 {*r = _SC_AVPHYS_PAGES; return 0;}
5498 #else /* def _SC_AVPHYS_PAGES */
5499 {errno = EINVAL; return -1;}
5500 #endif /* ndef _SC_AVPHYS_PAGES */
5501 if (x == Mono_Posix_SysconfName__SC_BARRIERS)
5502 #ifdef _SC_BARRIERS
5503 {*r = _SC_BARRIERS; return 0;}
5504 #else /* def _SC_BARRIERS */
5505 {errno = EINVAL; return -1;}
5506 #endif /* ndef _SC_BARRIERS */
5507 if (x == Mono_Posix_SysconfName__SC_BASE)
5508 #ifdef _SC_BASE
5509 {*r = _SC_BASE; return 0;}
5510 #else /* def _SC_BASE */
5511 {errno = EINVAL; return -1;}
5512 #endif /* ndef _SC_BASE */
5513 if (x == Mono_Posix_SysconfName__SC_BC_BASE_MAX)
5514 #ifdef _SC_BC_BASE_MAX
5515 {*r = _SC_BC_BASE_MAX; return 0;}
5516 #else /* def _SC_BC_BASE_MAX */
5517 {errno = EINVAL; return -1;}
5518 #endif /* ndef _SC_BC_BASE_MAX */
5519 if (x == Mono_Posix_SysconfName__SC_BC_DIM_MAX)
5520 #ifdef _SC_BC_DIM_MAX
5521 {*r = _SC_BC_DIM_MAX; return 0;}
5522 #else /* def _SC_BC_DIM_MAX */
5523 {errno = EINVAL; return -1;}
5524 #endif /* ndef _SC_BC_DIM_MAX */
5525 if (x == Mono_Posix_SysconfName__SC_BC_SCALE_MAX)
5526 #ifdef _SC_BC_SCALE_MAX
5527 {*r = _SC_BC_SCALE_MAX; return 0;}
5528 #else /* def _SC_BC_SCALE_MAX */
5529 {errno = EINVAL; return -1;}
5530 #endif /* ndef _SC_BC_SCALE_MAX */
5531 if (x == Mono_Posix_SysconfName__SC_BC_STRING_MAX)
5532 #ifdef _SC_BC_STRING_MAX
5533 {*r = _SC_BC_STRING_MAX; return 0;}
5534 #else /* def _SC_BC_STRING_MAX */
5535 {errno = EINVAL; return -1;}
5536 #endif /* ndef _SC_BC_STRING_MAX */
5537 if (x == Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX)
5538 #ifdef _SC_CHARCLASS_NAME_MAX
5539 {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
5540 #else /* def _SC_CHARCLASS_NAME_MAX */
5541 {errno = EINVAL; return -1;}
5542 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
5543 if (x == Mono_Posix_SysconfName__SC_CHAR_BIT)
5544 #ifdef _SC_CHAR_BIT
5545 {*r = _SC_CHAR_BIT; return 0;}
5546 #else /* def _SC_CHAR_BIT */
5547 {errno = EINVAL; return -1;}
5548 #endif /* ndef _SC_CHAR_BIT */
5549 if (x == Mono_Posix_SysconfName__SC_CHAR_MAX)
5550 #ifdef _SC_CHAR_MAX
5551 {*r = _SC_CHAR_MAX; return 0;}
5552 #else /* def _SC_CHAR_MAX */
5553 {errno = EINVAL; return -1;}
5554 #endif /* ndef _SC_CHAR_MAX */
5555 if (x == Mono_Posix_SysconfName__SC_CHAR_MIN)
5556 #ifdef _SC_CHAR_MIN
5557 {*r = _SC_CHAR_MIN; return 0;}
5558 #else /* def _SC_CHAR_MIN */
5559 {errno = EINVAL; return -1;}
5560 #endif /* ndef _SC_CHAR_MIN */
5561 if (x == Mono_Posix_SysconfName__SC_CHILD_MAX)
5562 #ifdef _SC_CHILD_MAX
5563 {*r = _SC_CHILD_MAX; return 0;}
5564 #else /* def _SC_CHILD_MAX */
5565 {errno = EINVAL; return -1;}
5566 #endif /* ndef _SC_CHILD_MAX */
5567 if (x == Mono_Posix_SysconfName__SC_CLK_TCK)
5568 #ifdef _SC_CLK_TCK
5569 {*r = _SC_CLK_TCK; return 0;}
5570 #else /* def _SC_CLK_TCK */
5571 {errno = EINVAL; return -1;}
5572 #endif /* ndef _SC_CLK_TCK */
5573 if (x == Mono_Posix_SysconfName__SC_CLOCK_SELECTION)
5574 #ifdef _SC_CLOCK_SELECTION
5575 {*r = _SC_CLOCK_SELECTION; return 0;}
5576 #else /* def _SC_CLOCK_SELECTION */
5577 {errno = EINVAL; return -1;}
5578 #endif /* ndef _SC_CLOCK_SELECTION */
5579 if (x == Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX)
5580 #ifdef _SC_COLL_WEIGHTS_MAX
5581 {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
5582 #else /* def _SC_COLL_WEIGHTS_MAX */
5583 {errno = EINVAL; return -1;}
5584 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
5585 if (x == Mono_Posix_SysconfName__SC_CPUTIME)
5586 #ifdef _SC_CPUTIME
5587 {*r = _SC_CPUTIME; return 0;}
5588 #else /* def _SC_CPUTIME */
5589 {errno = EINVAL; return -1;}
5590 #endif /* ndef _SC_CPUTIME */
5591 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT)
5592 #ifdef _SC_C_LANG_SUPPORT
5593 {*r = _SC_C_LANG_SUPPORT; return 0;}
5594 #else /* def _SC_C_LANG_SUPPORT */
5595 {errno = EINVAL; return -1;}
5596 #endif /* ndef _SC_C_LANG_SUPPORT */
5597 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R)
5598 #ifdef _SC_C_LANG_SUPPORT_R
5599 {*r = _SC_C_LANG_SUPPORT_R; return 0;}
5600 #else /* def _SC_C_LANG_SUPPORT_R */
5601 {errno = EINVAL; return -1;}
5602 #endif /* ndef _SC_C_LANG_SUPPORT_R */
5603 if (x == Mono_Posix_SysconfName__SC_DELAYTIMER_MAX)
5604 #ifdef _SC_DELAYTIMER_MAX
5605 {*r = _SC_DELAYTIMER_MAX; return 0;}
5606 #else /* def _SC_DELAYTIMER_MAX */
5607 {errno = EINVAL; return -1;}
5608 #endif /* ndef _SC_DELAYTIMER_MAX */
5609 if (x == Mono_Posix_SysconfName__SC_DEVICE_IO)
5610 #ifdef _SC_DEVICE_IO
5611 {*r = _SC_DEVICE_IO; return 0;}
5612 #else /* def _SC_DEVICE_IO */
5613 {errno = EINVAL; return -1;}
5614 #endif /* ndef _SC_DEVICE_IO */
5615 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC)
5616 #ifdef _SC_DEVICE_SPECIFIC
5617 {*r = _SC_DEVICE_SPECIFIC; return 0;}
5618 #else /* def _SC_DEVICE_SPECIFIC */
5619 {errno = EINVAL; return -1;}
5620 #endif /* ndef _SC_DEVICE_SPECIFIC */
5621 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R)
5622 #ifdef _SC_DEVICE_SPECIFIC_R
5623 {*r = _SC_DEVICE_SPECIFIC_R; return 0;}
5624 #else /* def _SC_DEVICE_SPECIFIC_R */
5625 {errno = EINVAL; return -1;}
5626 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
5627 if (x == Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX)
5628 #ifdef _SC_EQUIV_CLASS_MAX
5629 {*r = _SC_EQUIV_CLASS_MAX; return 0;}
5630 #else /* def _SC_EQUIV_CLASS_MAX */
5631 {errno = EINVAL; return -1;}
5632 #endif /* ndef _SC_EQUIV_CLASS_MAX */
5633 if (x == Mono_Posix_SysconfName__SC_EXPR_NEST_MAX)
5634 #ifdef _SC_EXPR_NEST_MAX
5635 {*r = _SC_EXPR_NEST_MAX; return 0;}
5636 #else /* def _SC_EXPR_NEST_MAX */
5637 {errno = EINVAL; return -1;}
5638 #endif /* ndef _SC_EXPR_NEST_MAX */
5639 if (x == Mono_Posix_SysconfName__SC_FD_MGMT)
5640 #ifdef _SC_FD_MGMT
5641 {*r = _SC_FD_MGMT; return 0;}
5642 #else /* def _SC_FD_MGMT */
5643 {errno = EINVAL; return -1;}
5644 #endif /* ndef _SC_FD_MGMT */
5645 if (x == Mono_Posix_SysconfName__SC_FIFO)
5646 #ifdef _SC_FIFO
5647 {*r = _SC_FIFO; return 0;}
5648 #else /* def _SC_FIFO */
5649 {errno = EINVAL; return -1;}
5650 #endif /* ndef _SC_FIFO */
5651 if (x == Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES)
5652 #ifdef _SC_FILE_ATTRIBUTES
5653 {*r = _SC_FILE_ATTRIBUTES; return 0;}
5654 #else /* def _SC_FILE_ATTRIBUTES */
5655 {errno = EINVAL; return -1;}
5656 #endif /* ndef _SC_FILE_ATTRIBUTES */
5657 if (x == Mono_Posix_SysconfName__SC_FILE_LOCKING)
5658 #ifdef _SC_FILE_LOCKING
5659 {*r = _SC_FILE_LOCKING; return 0;}
5660 #else /* def _SC_FILE_LOCKING */
5661 {errno = EINVAL; return -1;}
5662 #endif /* ndef _SC_FILE_LOCKING */
5663 if (x == Mono_Posix_SysconfName__SC_FILE_SYSTEM)
5664 #ifdef _SC_FILE_SYSTEM
5665 {*r = _SC_FILE_SYSTEM; return 0;}
5666 #else /* def _SC_FILE_SYSTEM */
5667 {errno = EINVAL; return -1;}
5668 #endif /* ndef _SC_FILE_SYSTEM */
5669 if (x == Mono_Posix_SysconfName__SC_FSYNC)
5670 #ifdef _SC_FSYNC
5671 {*r = _SC_FSYNC; return 0;}
5672 #else /* def _SC_FSYNC */
5673 {errno = EINVAL; return -1;}
5674 #endif /* ndef _SC_FSYNC */
5675 if (x == Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX)
5676 #ifdef _SC_GETGR_R_SIZE_MAX
5677 {*r = _SC_GETGR_R_SIZE_MAX; return 0;}
5678 #else /* def _SC_GETGR_R_SIZE_MAX */
5679 {errno = EINVAL; return -1;}
5680 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
5681 if (x == Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX)
5682 #ifdef _SC_GETPW_R_SIZE_MAX
5683 {*r = _SC_GETPW_R_SIZE_MAX; return 0;}
5684 #else /* def _SC_GETPW_R_SIZE_MAX */
5685 {errno = EINVAL; return -1;}
5686 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
5687 if (x == Mono_Posix_SysconfName__SC_HOST_NAME_MAX)
5688 #ifdef _SC_HOST_NAME_MAX
5689 {*r = _SC_HOST_NAME_MAX; return 0;}
5690 #else /* def _SC_HOST_NAME_MAX */
5691 {errno = EINVAL; return -1;}
5692 #endif /* ndef _SC_HOST_NAME_MAX */
5693 if (x == Mono_Posix_SysconfName__SC_INT_MAX)
5694 #ifdef _SC_INT_MAX
5695 {*r = _SC_INT_MAX; return 0;}
5696 #else /* def _SC_INT_MAX */
5697 {errno = EINVAL; return -1;}
5698 #endif /* ndef _SC_INT_MAX */
5699 if (x == Mono_Posix_SysconfName__SC_INT_MIN)
5700 #ifdef _SC_INT_MIN
5701 {*r = _SC_INT_MIN; return 0;}
5702 #else /* def _SC_INT_MIN */
5703 {errno = EINVAL; return -1;}
5704 #endif /* ndef _SC_INT_MIN */
5705 if (x == Mono_Posix_SysconfName__SC_IOV_MAX)
5706 #ifdef _SC_IOV_MAX
5707 {*r = _SC_IOV_MAX; return 0;}
5708 #else /* def _SC_IOV_MAX */
5709 {errno = EINVAL; return -1;}
5710 #endif /* ndef _SC_IOV_MAX */
5711 if (x == Mono_Posix_SysconfName__SC_JOB_CONTROL)
5712 #ifdef _SC_JOB_CONTROL
5713 {*r = _SC_JOB_CONTROL; return 0;}
5714 #else /* def _SC_JOB_CONTROL */
5715 {errno = EINVAL; return -1;}
5716 #endif /* ndef _SC_JOB_CONTROL */
5717 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC)
5718 #ifdef _SC_LEVEL1_DCACHE_ASSOC
5719 {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;}
5720 #else /* def _SC_LEVEL1_DCACHE_ASSOC */
5721 {errno = EINVAL; return -1;}
5722 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
5723 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE)
5724 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
5725 {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;}
5726 #else /* def _SC_LEVEL1_DCACHE_LINESIZE */
5727 {errno = EINVAL; return -1;}
5728 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
5729 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE)
5730 #ifdef _SC_LEVEL1_DCACHE_SIZE
5731 {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;}
5732 #else /* def _SC_LEVEL1_DCACHE_SIZE */
5733 {errno = EINVAL; return -1;}
5734 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
5735 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC)
5736 #ifdef _SC_LEVEL1_ICACHE_ASSOC
5737 {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;}
5738 #else /* def _SC_LEVEL1_ICACHE_ASSOC */
5739 {errno = EINVAL; return -1;}
5740 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
5741 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE)
5742 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
5743 {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;}
5744 #else /* def _SC_LEVEL1_ICACHE_LINESIZE */
5745 {errno = EINVAL; return -1;}
5746 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
5747 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE)
5748 #ifdef _SC_LEVEL1_ICACHE_SIZE
5749 {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;}
5750 #else /* def _SC_LEVEL1_ICACHE_SIZE */
5751 {errno = EINVAL; return -1;}
5752 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
5753 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC)
5754 #ifdef _SC_LEVEL2_CACHE_ASSOC
5755 {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;}
5756 #else /* def _SC_LEVEL2_CACHE_ASSOC */
5757 {errno = EINVAL; return -1;}
5758 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
5759 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE)
5760 #ifdef _SC_LEVEL2_CACHE_LINESIZE
5761 {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;}
5762 #else /* def _SC_LEVEL2_CACHE_LINESIZE */
5763 {errno = EINVAL; return -1;}
5764 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
5765 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE)
5766 #ifdef _SC_LEVEL2_CACHE_SIZE
5767 {*r = _SC_LEVEL2_CACHE_SIZE; return 0;}
5768 #else /* def _SC_LEVEL2_CACHE_SIZE */
5769 {errno = EINVAL; return -1;}
5770 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
5771 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC)
5772 #ifdef _SC_LEVEL3_CACHE_ASSOC
5773 {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;}
5774 #else /* def _SC_LEVEL3_CACHE_ASSOC */
5775 {errno = EINVAL; return -1;}
5776 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
5777 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE)
5778 #ifdef _SC_LEVEL3_CACHE_LINESIZE
5779 {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;}
5780 #else /* def _SC_LEVEL3_CACHE_LINESIZE */
5781 {errno = EINVAL; return -1;}
5782 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
5783 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE)
5784 #ifdef _SC_LEVEL3_CACHE_SIZE
5785 {*r = _SC_LEVEL3_CACHE_SIZE; return 0;}
5786 #else /* def _SC_LEVEL3_CACHE_SIZE */
5787 {errno = EINVAL; return -1;}
5788 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
5789 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC)
5790 #ifdef _SC_LEVEL4_CACHE_ASSOC
5791 {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;}
5792 #else /* def _SC_LEVEL4_CACHE_ASSOC */
5793 {errno = EINVAL; return -1;}
5794 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
5795 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE)
5796 #ifdef _SC_LEVEL4_CACHE_LINESIZE
5797 {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;}
5798 #else /* def _SC_LEVEL4_CACHE_LINESIZE */
5799 {errno = EINVAL; return -1;}
5800 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
5801 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE)
5802 #ifdef _SC_LEVEL4_CACHE_SIZE
5803 {*r = _SC_LEVEL4_CACHE_SIZE; return 0;}
5804 #else /* def _SC_LEVEL4_CACHE_SIZE */
5805 {errno = EINVAL; return -1;}
5806 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
5807 if (x == Mono_Posix_SysconfName__SC_LINE_MAX)
5808 #ifdef _SC_LINE_MAX
5809 {*r = _SC_LINE_MAX; return 0;}
5810 #else /* def _SC_LINE_MAX */
5811 {errno = EINVAL; return -1;}
5812 #endif /* ndef _SC_LINE_MAX */
5813 if (x == Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX)
5814 #ifdef _SC_LOGIN_NAME_MAX
5815 {*r = _SC_LOGIN_NAME_MAX; return 0;}
5816 #else /* def _SC_LOGIN_NAME_MAX */
5817 {errno = EINVAL; return -1;}
5818 #endif /* ndef _SC_LOGIN_NAME_MAX */
5819 if (x == Mono_Posix_SysconfName__SC_LONG_BIT)
5820 #ifdef _SC_LONG_BIT
5821 {*r = _SC_LONG_BIT; return 0;}
5822 #else /* def _SC_LONG_BIT */
5823 {errno = EINVAL; return -1;}
5824 #endif /* ndef _SC_LONG_BIT */
5825 if (x == Mono_Posix_SysconfName__SC_MAPPED_FILES)
5826 #ifdef _SC_MAPPED_FILES
5827 {*r = _SC_MAPPED_FILES; return 0;}
5828 #else /* def _SC_MAPPED_FILES */
5829 {errno = EINVAL; return -1;}
5830 #endif /* ndef _SC_MAPPED_FILES */
5831 if (x == Mono_Posix_SysconfName__SC_MB_LEN_MAX)
5832 #ifdef _SC_MB_LEN_MAX
5833 {*r = _SC_MB_LEN_MAX; return 0;}
5834 #else /* def _SC_MB_LEN_MAX */
5835 {errno = EINVAL; return -1;}
5836 #endif /* ndef _SC_MB_LEN_MAX */
5837 if (x == Mono_Posix_SysconfName__SC_MEMLOCK)
5838 #ifdef _SC_MEMLOCK
5839 {*r = _SC_MEMLOCK; return 0;}
5840 #else /* def _SC_MEMLOCK */
5841 {errno = EINVAL; return -1;}
5842 #endif /* ndef _SC_MEMLOCK */
5843 if (x == Mono_Posix_SysconfName__SC_MEMLOCK_RANGE)
5844 #ifdef _SC_MEMLOCK_RANGE
5845 {*r = _SC_MEMLOCK_RANGE; return 0;}
5846 #else /* def _SC_MEMLOCK_RANGE */
5847 {errno = EINVAL; return -1;}
5848 #endif /* ndef _SC_MEMLOCK_RANGE */
5849 if (x == Mono_Posix_SysconfName__SC_MEMORY_PROTECTION)
5850 #ifdef _SC_MEMORY_PROTECTION
5851 {*r = _SC_MEMORY_PROTECTION; return 0;}
5852 #else /* def _SC_MEMORY_PROTECTION */
5853 {errno = EINVAL; return -1;}
5854 #endif /* ndef _SC_MEMORY_PROTECTION */
5855 if (x == Mono_Posix_SysconfName__SC_MESSAGE_PASSING)
5856 #ifdef _SC_MESSAGE_PASSING
5857 {*r = _SC_MESSAGE_PASSING; return 0;}
5858 #else /* def _SC_MESSAGE_PASSING */
5859 {errno = EINVAL; return -1;}
5860 #endif /* ndef _SC_MESSAGE_PASSING */
5861 if (x == Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK)
5862 #ifdef _SC_MONOTONIC_CLOCK
5863 {*r = _SC_MONOTONIC_CLOCK; return 0;}
5864 #else /* def _SC_MONOTONIC_CLOCK */
5865 {errno = EINVAL; return -1;}
5866 #endif /* ndef _SC_MONOTONIC_CLOCK */
5867 if (x == Mono_Posix_SysconfName__SC_MQ_OPEN_MAX)
5868 #ifdef _SC_MQ_OPEN_MAX
5869 {*r = _SC_MQ_OPEN_MAX; return 0;}
5870 #else /* def _SC_MQ_OPEN_MAX */
5871 {errno = EINVAL; return -1;}
5872 #endif /* ndef _SC_MQ_OPEN_MAX */
5873 if (x == Mono_Posix_SysconfName__SC_MQ_PRIO_MAX)
5874 #ifdef _SC_MQ_PRIO_MAX
5875 {*r = _SC_MQ_PRIO_MAX; return 0;}
5876 #else /* def _SC_MQ_PRIO_MAX */
5877 {errno = EINVAL; return -1;}
5878 #endif /* ndef _SC_MQ_PRIO_MAX */
5879 if (x == Mono_Posix_SysconfName__SC_MULTI_PROCESS)
5880 #ifdef _SC_MULTI_PROCESS
5881 {*r = _SC_MULTI_PROCESS; return 0;}
5882 #else /* def _SC_MULTI_PROCESS */
5883 {errno = EINVAL; return -1;}
5884 #endif /* ndef _SC_MULTI_PROCESS */
5885 if (x == Mono_Posix_SysconfName__SC_NETWORKING)
5886 #ifdef _SC_NETWORKING
5887 {*r = _SC_NETWORKING; return 0;}
5888 #else /* def _SC_NETWORKING */
5889 {errno = EINVAL; return -1;}
5890 #endif /* ndef _SC_NETWORKING */
5891 if (x == Mono_Posix_SysconfName__SC_NGROUPS_MAX)
5892 #ifdef _SC_NGROUPS_MAX
5893 {*r = _SC_NGROUPS_MAX; return 0;}
5894 #else /* def _SC_NGROUPS_MAX */
5895 {errno = EINVAL; return -1;}
5896 #endif /* ndef _SC_NGROUPS_MAX */
5897 if (x == Mono_Posix_SysconfName__SC_NL_ARGMAX)
5898 #ifdef _SC_NL_ARGMAX
5899 {*r = _SC_NL_ARGMAX; return 0;}
5900 #else /* def _SC_NL_ARGMAX */
5901 {errno = EINVAL; return -1;}
5902 #endif /* ndef _SC_NL_ARGMAX */
5903 if (x == Mono_Posix_SysconfName__SC_NL_LANGMAX)
5904 #ifdef _SC_NL_LANGMAX
5905 {*r = _SC_NL_LANGMAX; return 0;}
5906 #else /* def _SC_NL_LANGMAX */
5907 {errno = EINVAL; return -1;}
5908 #endif /* ndef _SC_NL_LANGMAX */
5909 if (x == Mono_Posix_SysconfName__SC_NL_MSGMAX)
5910 #ifdef _SC_NL_MSGMAX
5911 {*r = _SC_NL_MSGMAX; return 0;}
5912 #else /* def _SC_NL_MSGMAX */
5913 {errno = EINVAL; return -1;}
5914 #endif /* ndef _SC_NL_MSGMAX */
5915 if (x == Mono_Posix_SysconfName__SC_NL_NMAX)
5916 #ifdef _SC_NL_NMAX
5917 {*r = _SC_NL_NMAX; return 0;}
5918 #else /* def _SC_NL_NMAX */
5919 {errno = EINVAL; return -1;}
5920 #endif /* ndef _SC_NL_NMAX */
5921 if (x == Mono_Posix_SysconfName__SC_NL_SETMAX)
5922 #ifdef _SC_NL_SETMAX
5923 {*r = _SC_NL_SETMAX; return 0;}
5924 #else /* def _SC_NL_SETMAX */
5925 {errno = EINVAL; return -1;}
5926 #endif /* ndef _SC_NL_SETMAX */
5927 if (x == Mono_Posix_SysconfName__SC_NL_TEXTMAX)
5928 #ifdef _SC_NL_TEXTMAX
5929 {*r = _SC_NL_TEXTMAX; return 0;}
5930 #else /* def _SC_NL_TEXTMAX */
5931 {errno = EINVAL; return -1;}
5932 #endif /* ndef _SC_NL_TEXTMAX */
5933 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_CONF)
5934 #ifdef _SC_NPROCESSORS_CONF
5935 {*r = _SC_NPROCESSORS_CONF; return 0;}
5936 #else /* def _SC_NPROCESSORS_CONF */
5937 {errno = EINVAL; return -1;}
5938 #endif /* ndef _SC_NPROCESSORS_CONF */
5939 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN)
5940 #ifdef _SC_NPROCESSORS_ONLN
5941 {*r = _SC_NPROCESSORS_ONLN; return 0;}
5942 #else /* def _SC_NPROCESSORS_ONLN */
5943 {errno = EINVAL; return -1;}
5944 #endif /* ndef _SC_NPROCESSORS_ONLN */
5945 if (x == Mono_Posix_SysconfName__SC_NZERO)
5946 #ifdef _SC_NZERO
5947 {*r = _SC_NZERO; return 0;}
5948 #else /* def _SC_NZERO */
5949 {errno = EINVAL; return -1;}
5950 #endif /* ndef _SC_NZERO */
5951 if (x == Mono_Posix_SysconfName__SC_OPEN_MAX)
5952 #ifdef _SC_OPEN_MAX
5953 {*r = _SC_OPEN_MAX; return 0;}
5954 #else /* def _SC_OPEN_MAX */
5955 {errno = EINVAL; return -1;}
5956 #endif /* ndef _SC_OPEN_MAX */
5957 if (x == Mono_Posix_SysconfName__SC_PAGESIZE)
5958 #ifdef _SC_PAGESIZE
5959 {*r = _SC_PAGESIZE; return 0;}
5960 #else /* def _SC_PAGESIZE */
5961 {errno = EINVAL; return -1;}
5962 #endif /* ndef _SC_PAGESIZE */
5963 if (x == Mono_Posix_SysconfName__SC_PASS_MAX)
5964 #ifdef _SC_PASS_MAX
5965 {*r = _SC_PASS_MAX; return 0;}
5966 #else /* def _SC_PASS_MAX */
5967 {errno = EINVAL; return -1;}
5968 #endif /* ndef _SC_PASS_MAX */
5969 if (x == Mono_Posix_SysconfName__SC_PHYS_PAGES)
5970 #ifdef _SC_PHYS_PAGES
5971 {*r = _SC_PHYS_PAGES; return 0;}
5972 #else /* def _SC_PHYS_PAGES */
5973 {errno = EINVAL; return -1;}
5974 #endif /* ndef _SC_PHYS_PAGES */
5975 if (x == Mono_Posix_SysconfName__SC_PII)
5976 #ifdef _SC_PII
5977 {*r = _SC_PII; return 0;}
5978 #else /* def _SC_PII */
5979 {errno = EINVAL; return -1;}
5980 #endif /* ndef _SC_PII */
5981 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET)
5982 #ifdef _SC_PII_INTERNET
5983 {*r = _SC_PII_INTERNET; return 0;}
5984 #else /* def _SC_PII_INTERNET */
5985 {errno = EINVAL; return -1;}
5986 #endif /* ndef _SC_PII_INTERNET */
5987 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM)
5988 #ifdef _SC_PII_INTERNET_DGRAM
5989 {*r = _SC_PII_INTERNET_DGRAM; return 0;}
5990 #else /* def _SC_PII_INTERNET_DGRAM */
5991 {errno = EINVAL; return -1;}
5992 #endif /* ndef _SC_PII_INTERNET_DGRAM */
5993 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM)
5994 #ifdef _SC_PII_INTERNET_STREAM
5995 {*r = _SC_PII_INTERNET_STREAM; return 0;}
5996 #else /* def _SC_PII_INTERNET_STREAM */
5997 {errno = EINVAL; return -1;}
5998 #endif /* ndef _SC_PII_INTERNET_STREAM */
5999 if (x == Mono_Posix_SysconfName__SC_PII_OSI)
6000 #ifdef _SC_PII_OSI
6001 {*r = _SC_PII_OSI; return 0;}
6002 #else /* def _SC_PII_OSI */
6003 {errno = EINVAL; return -1;}
6004 #endif /* ndef _SC_PII_OSI */
6005 if (x == Mono_Posix_SysconfName__SC_PII_OSI_CLTS)
6006 #ifdef _SC_PII_OSI_CLTS
6007 {*r = _SC_PII_OSI_CLTS; return 0;}
6008 #else /* def _SC_PII_OSI_CLTS */
6009 {errno = EINVAL; return -1;}
6010 #endif /* ndef _SC_PII_OSI_CLTS */
6011 if (x == Mono_Posix_SysconfName__SC_PII_OSI_COTS)
6012 #ifdef _SC_PII_OSI_COTS
6013 {*r = _SC_PII_OSI_COTS; return 0;}
6014 #else /* def _SC_PII_OSI_COTS */
6015 {errno = EINVAL; return -1;}
6016 #endif /* ndef _SC_PII_OSI_COTS */
6017 if (x == Mono_Posix_SysconfName__SC_PII_OSI_M)
6018 #ifdef _SC_PII_OSI_M
6019 {*r = _SC_PII_OSI_M; return 0;}
6020 #else /* def _SC_PII_OSI_M */
6021 {errno = EINVAL; return -1;}
6022 #endif /* ndef _SC_PII_OSI_M */
6023 if (x == Mono_Posix_SysconfName__SC_PII_SOCKET)
6024 #ifdef _SC_PII_SOCKET
6025 {*r = _SC_PII_SOCKET; return 0;}
6026 #else /* def _SC_PII_SOCKET */
6027 {errno = EINVAL; return -1;}
6028 #endif /* ndef _SC_PII_SOCKET */
6029 if (x == Mono_Posix_SysconfName__SC_PII_XTI)
6030 #ifdef _SC_PII_XTI
6031 {*r = _SC_PII_XTI; return 0;}
6032 #else /* def _SC_PII_XTI */
6033 {errno = EINVAL; return -1;}
6034 #endif /* ndef _SC_PII_XTI */
6035 if (x == Mono_Posix_SysconfName__SC_PIPE)
6036 #ifdef _SC_PIPE
6037 {*r = _SC_PIPE; return 0;}
6038 #else /* def _SC_PIPE */
6039 {errno = EINVAL; return -1;}
6040 #endif /* ndef _SC_PIPE */
6041 if (x == Mono_Posix_SysconfName__SC_POLL)
6042 #ifdef _SC_POLL
6043 {*r = _SC_POLL; return 0;}
6044 #else /* def _SC_POLL */
6045 {errno = EINVAL; return -1;}
6046 #endif /* ndef _SC_POLL */
6047 if (x == Mono_Posix_SysconfName__SC_PRIORITIZED_IO)
6048 #ifdef _SC_PRIORITIZED_IO
6049 {*r = _SC_PRIORITIZED_IO; return 0;}
6050 #else /* def _SC_PRIORITIZED_IO */
6051 {errno = EINVAL; return -1;}
6052 #endif /* ndef _SC_PRIORITIZED_IO */
6053 if (x == Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING)
6054 #ifdef _SC_PRIORITY_SCHEDULING
6055 {*r = _SC_PRIORITY_SCHEDULING; return 0;}
6056 #else /* def _SC_PRIORITY_SCHEDULING */
6057 {errno = EINVAL; return -1;}
6058 #endif /* ndef _SC_PRIORITY_SCHEDULING */
6059 if (x == Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS)
6060 #ifdef _SC_READER_WRITER_LOCKS
6061 {*r = _SC_READER_WRITER_LOCKS; return 0;}
6062 #else /* def _SC_READER_WRITER_LOCKS */
6063 {errno = EINVAL; return -1;}
6064 #endif /* ndef _SC_READER_WRITER_LOCKS */
6065 if (x == Mono_Posix_SysconfName__SC_REALTIME_SIGNALS)
6066 #ifdef _SC_REALTIME_SIGNALS
6067 {*r = _SC_REALTIME_SIGNALS; return 0;}
6068 #else /* def _SC_REALTIME_SIGNALS */
6069 {errno = EINVAL; return -1;}
6070 #endif /* ndef _SC_REALTIME_SIGNALS */
6071 if (x == Mono_Posix_SysconfName__SC_REGEXP)
6072 #ifdef _SC_REGEXP
6073 {*r = _SC_REGEXP; return 0;}
6074 #else /* def _SC_REGEXP */
6075 {errno = EINVAL; return -1;}
6076 #endif /* ndef _SC_REGEXP */
6077 if (x == Mono_Posix_SysconfName__SC_REGEX_VERSION)
6078 #ifdef _SC_REGEX_VERSION
6079 {*r = _SC_REGEX_VERSION; return 0;}
6080 #else /* def _SC_REGEX_VERSION */
6081 {errno = EINVAL; return -1;}
6082 #endif /* ndef _SC_REGEX_VERSION */
6083 if (x == Mono_Posix_SysconfName__SC_RE_DUP_MAX)
6084 #ifdef _SC_RE_DUP_MAX
6085 {*r = _SC_RE_DUP_MAX; return 0;}
6086 #else /* def _SC_RE_DUP_MAX */
6087 {errno = EINVAL; return -1;}
6088 #endif /* ndef _SC_RE_DUP_MAX */
6089 if (x == Mono_Posix_SysconfName__SC_RTSIG_MAX)
6090 #ifdef _SC_RTSIG_MAX
6091 {*r = _SC_RTSIG_MAX; return 0;}
6092 #else /* def _SC_RTSIG_MAX */
6093 {errno = EINVAL; return -1;}
6094 #endif /* ndef _SC_RTSIG_MAX */
6095 if (x == Mono_Posix_SysconfName__SC_SAVED_IDS)
6096 #ifdef _SC_SAVED_IDS
6097 {*r = _SC_SAVED_IDS; return 0;}
6098 #else /* def _SC_SAVED_IDS */
6099 {errno = EINVAL; return -1;}
6100 #endif /* ndef _SC_SAVED_IDS */
6101 if (x == Mono_Posix_SysconfName__SC_SCHAR_MAX)
6102 #ifdef _SC_SCHAR_MAX
6103 {*r = _SC_SCHAR_MAX; return 0;}
6104 #else /* def _SC_SCHAR_MAX */
6105 {errno = EINVAL; return -1;}
6106 #endif /* ndef _SC_SCHAR_MAX */
6107 if (x == Mono_Posix_SysconfName__SC_SCHAR_MIN)
6108 #ifdef _SC_SCHAR_MIN
6109 {*r = _SC_SCHAR_MIN; return 0;}
6110 #else /* def _SC_SCHAR_MIN */
6111 {errno = EINVAL; return -1;}
6112 #endif /* ndef _SC_SCHAR_MIN */
6113 if (x == Mono_Posix_SysconfName__SC_SELECT)
6114 #ifdef _SC_SELECT
6115 {*r = _SC_SELECT; return 0;}
6116 #else /* def _SC_SELECT */
6117 {errno = EINVAL; return -1;}
6118 #endif /* ndef _SC_SELECT */
6119 if (x == Mono_Posix_SysconfName__SC_SEMAPHORES)
6120 #ifdef _SC_SEMAPHORES
6121 {*r = _SC_SEMAPHORES; return 0;}
6122 #else /* def _SC_SEMAPHORES */
6123 {errno = EINVAL; return -1;}
6124 #endif /* ndef _SC_SEMAPHORES */
6125 if (x == Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX)
6126 #ifdef _SC_SEM_NSEMS_MAX
6127 {*r = _SC_SEM_NSEMS_MAX; return 0;}
6128 #else /* def _SC_SEM_NSEMS_MAX */
6129 {errno = EINVAL; return -1;}
6130 #endif /* ndef _SC_SEM_NSEMS_MAX */
6131 if (x == Mono_Posix_SysconfName__SC_SEM_VALUE_MAX)
6132 #ifdef _SC_SEM_VALUE_MAX
6133 {*r = _SC_SEM_VALUE_MAX; return 0;}
6134 #else /* def _SC_SEM_VALUE_MAX */
6135 {errno = EINVAL; return -1;}
6136 #endif /* ndef _SC_SEM_VALUE_MAX */
6137 if (x == Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS)
6138 #ifdef _SC_SHARED_MEMORY_OBJECTS
6139 {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
6140 #else /* def _SC_SHARED_MEMORY_OBJECTS */
6141 {errno = EINVAL; return -1;}
6142 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
6143 if (x == Mono_Posix_SysconfName__SC_SHELL)
6144 #ifdef _SC_SHELL
6145 {*r = _SC_SHELL; return 0;}
6146 #else /* def _SC_SHELL */
6147 {errno = EINVAL; return -1;}
6148 #endif /* ndef _SC_SHELL */
6149 if (x == Mono_Posix_SysconfName__SC_SHRT_MAX)
6150 #ifdef _SC_SHRT_MAX
6151 {*r = _SC_SHRT_MAX; return 0;}
6152 #else /* def _SC_SHRT_MAX */
6153 {errno = EINVAL; return -1;}
6154 #endif /* ndef _SC_SHRT_MAX */
6155 if (x == Mono_Posix_SysconfName__SC_SHRT_MIN)
6156 #ifdef _SC_SHRT_MIN
6157 {*r = _SC_SHRT_MIN; return 0;}
6158 #else /* def _SC_SHRT_MIN */
6159 {errno = EINVAL; return -1;}
6160 #endif /* ndef _SC_SHRT_MIN */
6161 if (x == Mono_Posix_SysconfName__SC_SIGNALS)
6162 #ifdef _SC_SIGNALS
6163 {*r = _SC_SIGNALS; return 0;}
6164 #else /* def _SC_SIGNALS */
6165 {errno = EINVAL; return -1;}
6166 #endif /* ndef _SC_SIGNALS */
6167 if (x == Mono_Posix_SysconfName__SC_SIGQUEUE_MAX)
6168 #ifdef _SC_SIGQUEUE_MAX
6169 {*r = _SC_SIGQUEUE_MAX; return 0;}
6170 #else /* def _SC_SIGQUEUE_MAX */
6171 {errno = EINVAL; return -1;}
6172 #endif /* ndef _SC_SIGQUEUE_MAX */
6173 if (x == Mono_Posix_SysconfName__SC_SINGLE_PROCESS)
6174 #ifdef _SC_SINGLE_PROCESS
6175 {*r = _SC_SINGLE_PROCESS; return 0;}
6176 #else /* def _SC_SINGLE_PROCESS */
6177 {errno = EINVAL; return -1;}
6178 #endif /* ndef _SC_SINGLE_PROCESS */
6179 if (x == Mono_Posix_SysconfName__SC_SPAWN)
6180 #ifdef _SC_SPAWN
6181 {*r = _SC_SPAWN; return 0;}
6182 #else /* def _SC_SPAWN */
6183 {errno = EINVAL; return -1;}
6184 #endif /* ndef _SC_SPAWN */
6185 if (x == Mono_Posix_SysconfName__SC_SPIN_LOCKS)
6186 #ifdef _SC_SPIN_LOCKS
6187 {*r = _SC_SPIN_LOCKS; return 0;}
6188 #else /* def _SC_SPIN_LOCKS */
6189 {errno = EINVAL; return -1;}
6190 #endif /* ndef _SC_SPIN_LOCKS */
6191 if (x == Mono_Posix_SysconfName__SC_SPORADIC_SERVER)
6192 #ifdef _SC_SPORADIC_SERVER
6193 {*r = _SC_SPORADIC_SERVER; return 0;}
6194 #else /* def _SC_SPORADIC_SERVER */
6195 {errno = EINVAL; return -1;}
6196 #endif /* ndef _SC_SPORADIC_SERVER */
6197 if (x == Mono_Posix_SysconfName__SC_SSIZE_MAX)
6198 #ifdef _SC_SSIZE_MAX
6199 {*r = _SC_SSIZE_MAX; return 0;}
6200 #else /* def _SC_SSIZE_MAX */
6201 {errno = EINVAL; return -1;}
6202 #endif /* ndef _SC_SSIZE_MAX */
6203 if (x == Mono_Posix_SysconfName__SC_STREAMS)
6204 #ifdef _SC_STREAMS
6205 {*r = _SC_STREAMS; return 0;}
6206 #else /* def _SC_STREAMS */
6207 {errno = EINVAL; return -1;}
6208 #endif /* ndef _SC_STREAMS */
6209 if (x == Mono_Posix_SysconfName__SC_STREAM_MAX)
6210 #ifdef _SC_STREAM_MAX
6211 {*r = _SC_STREAM_MAX; return 0;}
6212 #else /* def _SC_STREAM_MAX */
6213 {errno = EINVAL; return -1;}
6214 #endif /* ndef _SC_STREAM_MAX */
6215 if (x == Mono_Posix_SysconfName__SC_SYMLOOP_MAX)
6216 #ifdef _SC_SYMLOOP_MAX
6217 {*r = _SC_SYMLOOP_MAX; return 0;}
6218 #else /* def _SC_SYMLOOP_MAX */
6219 {errno = EINVAL; return -1;}
6220 #endif /* ndef _SC_SYMLOOP_MAX */
6221 if (x == Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO)
6222 #ifdef _SC_SYNCHRONIZED_IO
6223 {*r = _SC_SYNCHRONIZED_IO; return 0;}
6224 #else /* def _SC_SYNCHRONIZED_IO */
6225 {errno = EINVAL; return -1;}
6226 #endif /* ndef _SC_SYNCHRONIZED_IO */
6227 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE)
6228 #ifdef _SC_SYSTEM_DATABASE
6229 {*r = _SC_SYSTEM_DATABASE; return 0;}
6230 #else /* def _SC_SYSTEM_DATABASE */
6231 {errno = EINVAL; return -1;}
6232 #endif /* ndef _SC_SYSTEM_DATABASE */
6233 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R)
6234 #ifdef _SC_SYSTEM_DATABASE_R
6235 {*r = _SC_SYSTEM_DATABASE_R; return 0;}
6236 #else /* def _SC_SYSTEM_DATABASE_R */
6237 {errno = EINVAL; return -1;}
6238 #endif /* ndef _SC_SYSTEM_DATABASE_R */
6239 if (x == Mono_Posix_SysconfName__SC_THREADS)
6240 #ifdef _SC_THREADS
6241 {*r = _SC_THREADS; return 0;}
6242 #else /* def _SC_THREADS */
6243 {errno = EINVAL; return -1;}
6244 #endif /* ndef _SC_THREADS */
6245 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR)
6246 #ifdef _SC_THREAD_ATTR_STACKADDR
6247 {*r = _SC_THREAD_ATTR_STACKADDR; return 0;}
6248 #else /* def _SC_THREAD_ATTR_STACKADDR */
6249 {errno = EINVAL; return -1;}
6250 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
6251 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE)
6252 #ifdef _SC_THREAD_ATTR_STACKSIZE
6253 {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;}
6254 #else /* def _SC_THREAD_ATTR_STACKSIZE */
6255 {errno = EINVAL; return -1;}
6256 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
6257 if (x == Mono_Posix_SysconfName__SC_THREAD_CPUTIME)
6258 #ifdef _SC_THREAD_CPUTIME
6259 {*r = _SC_THREAD_CPUTIME; return 0;}
6260 #else /* def _SC_THREAD_CPUTIME */
6261 {errno = EINVAL; return -1;}
6262 #endif /* ndef _SC_THREAD_CPUTIME */
6263 if (x == Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS)
6264 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
6265 {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
6266 #else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */
6267 {errno = EINVAL; return -1;}
6268 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
6269 if (x == Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX)
6270 #ifdef _SC_THREAD_KEYS_MAX
6271 {*r = _SC_THREAD_KEYS_MAX; return 0;}
6272 #else /* def _SC_THREAD_KEYS_MAX */
6273 {errno = EINVAL; return -1;}
6274 #endif /* ndef _SC_THREAD_KEYS_MAX */
6275 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING)
6276 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
6277 {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;}
6278 #else /* def _SC_THREAD_PRIORITY_SCHEDULING */
6279 {errno = EINVAL; return -1;}
6280 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
6281 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT)
6282 #ifdef _SC_THREAD_PRIO_INHERIT
6283 {*r = _SC_THREAD_PRIO_INHERIT; return 0;}
6284 #else /* def _SC_THREAD_PRIO_INHERIT */
6285 {errno = EINVAL; return -1;}
6286 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
6287 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT)
6288 #ifdef _SC_THREAD_PRIO_PROTECT
6289 {*r = _SC_THREAD_PRIO_PROTECT; return 0;}
6290 #else /* def _SC_THREAD_PRIO_PROTECT */
6291 {errno = EINVAL; return -1;}
6292 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
6293 if (x == Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED)
6294 #ifdef _SC_THREAD_PROCESS_SHARED
6295 {*r = _SC_THREAD_PROCESS_SHARED; return 0;}
6296 #else /* def _SC_THREAD_PROCESS_SHARED */
6297 {errno = EINVAL; return -1;}
6298 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
6299 if (x == Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS)
6300 #ifdef _SC_THREAD_SAFE_FUNCTIONS
6301 {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;}
6302 #else /* def _SC_THREAD_SAFE_FUNCTIONS */
6303 {errno = EINVAL; return -1;}
6304 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
6305 if (x == Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER)
6306 #ifdef _SC_THREAD_SPORADIC_SERVER
6307 {*r = _SC_THREAD_SPORADIC_SERVER; return 0;}
6308 #else /* def _SC_THREAD_SPORADIC_SERVER */
6309 {errno = EINVAL; return -1;}
6310 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
6311 if (x == Mono_Posix_SysconfName__SC_THREAD_STACK_MIN)
6312 #ifdef _SC_THREAD_STACK_MIN
6313 {*r = _SC_THREAD_STACK_MIN; return 0;}
6314 #else /* def _SC_THREAD_STACK_MIN */
6315 {errno = EINVAL; return -1;}
6316 #endif /* ndef _SC_THREAD_STACK_MIN */
6317 if (x == Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX)
6318 #ifdef _SC_THREAD_THREADS_MAX
6319 {*r = _SC_THREAD_THREADS_MAX; return 0;}
6320 #else /* def _SC_THREAD_THREADS_MAX */
6321 {errno = EINVAL; return -1;}
6322 #endif /* ndef _SC_THREAD_THREADS_MAX */
6323 if (x == Mono_Posix_SysconfName__SC_TIMEOUTS)
6324 #ifdef _SC_TIMEOUTS
6325 {*r = _SC_TIMEOUTS; return 0;}
6326 #else /* def _SC_TIMEOUTS */
6327 {errno = EINVAL; return -1;}
6328 #endif /* ndef _SC_TIMEOUTS */
6329 if (x == Mono_Posix_SysconfName__SC_TIMERS)
6330 #ifdef _SC_TIMERS
6331 {*r = _SC_TIMERS; return 0;}
6332 #else /* def _SC_TIMERS */
6333 {errno = EINVAL; return -1;}
6334 #endif /* ndef _SC_TIMERS */
6335 if (x == Mono_Posix_SysconfName__SC_TIMER_MAX)
6336 #ifdef _SC_TIMER_MAX
6337 {*r = _SC_TIMER_MAX; return 0;}
6338 #else /* def _SC_TIMER_MAX */
6339 {errno = EINVAL; return -1;}
6340 #endif /* ndef _SC_TIMER_MAX */
6341 if (x == Mono_Posix_SysconfName__SC_TRACE)
6342 #ifdef _SC_TRACE
6343 {*r = _SC_TRACE; return 0;}
6344 #else /* def _SC_TRACE */
6345 {errno = EINVAL; return -1;}
6346 #endif /* ndef _SC_TRACE */
6347 if (x == Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER)
6348 #ifdef _SC_TRACE_EVENT_FILTER
6349 {*r = _SC_TRACE_EVENT_FILTER; return 0;}
6350 #else /* def _SC_TRACE_EVENT_FILTER */
6351 {errno = EINVAL; return -1;}
6352 #endif /* ndef _SC_TRACE_EVENT_FILTER */
6353 if (x == Mono_Posix_SysconfName__SC_TRACE_INHERIT)
6354 #ifdef _SC_TRACE_INHERIT
6355 {*r = _SC_TRACE_INHERIT; return 0;}
6356 #else /* def _SC_TRACE_INHERIT */
6357 {errno = EINVAL; return -1;}
6358 #endif /* ndef _SC_TRACE_INHERIT */
6359 if (x == Mono_Posix_SysconfName__SC_TRACE_LOG)
6360 #ifdef _SC_TRACE_LOG
6361 {*r = _SC_TRACE_LOG; return 0;}
6362 #else /* def _SC_TRACE_LOG */
6363 {errno = EINVAL; return -1;}
6364 #endif /* ndef _SC_TRACE_LOG */
6365 if (x == Mono_Posix_SysconfName__SC_TTY_NAME_MAX)
6366 #ifdef _SC_TTY_NAME_MAX
6367 {*r = _SC_TTY_NAME_MAX; return 0;}
6368 #else /* def _SC_TTY_NAME_MAX */
6369 {errno = EINVAL; return -1;}
6370 #endif /* ndef _SC_TTY_NAME_MAX */
6371 if (x == Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS)
6372 #ifdef _SC_TYPED_MEMORY_OBJECTS
6373 {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;}
6374 #else /* def _SC_TYPED_MEMORY_OBJECTS */
6375 {errno = EINVAL; return -1;}
6376 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
6377 if (x == Mono_Posix_SysconfName__SC_TZNAME_MAX)
6378 #ifdef _SC_TZNAME_MAX
6379 {*r = _SC_TZNAME_MAX; return 0;}
6380 #else /* def _SC_TZNAME_MAX */
6381 {errno = EINVAL; return -1;}
6382 #endif /* ndef _SC_TZNAME_MAX */
6383 if (x == Mono_Posix_SysconfName__SC_T_IOV_MAX)
6384 #ifdef _SC_T_IOV_MAX
6385 {*r = _SC_T_IOV_MAX; return 0;}
6386 #else /* def _SC_T_IOV_MAX */
6387 {errno = EINVAL; return -1;}
6388 #endif /* ndef _SC_T_IOV_MAX */
6389 if (x == Mono_Posix_SysconfName__SC_UCHAR_MAX)
6390 #ifdef _SC_UCHAR_MAX
6391 {*r = _SC_UCHAR_MAX; return 0;}
6392 #else /* def _SC_UCHAR_MAX */
6393 {errno = EINVAL; return -1;}
6394 #endif /* ndef _SC_UCHAR_MAX */
6395 if (x == Mono_Posix_SysconfName__SC_UINT_MAX)
6396 #ifdef _SC_UINT_MAX
6397 {*r = _SC_UINT_MAX; return 0;}
6398 #else /* def _SC_UINT_MAX */
6399 {errno = EINVAL; return -1;}
6400 #endif /* ndef _SC_UINT_MAX */
6401 if (x == Mono_Posix_SysconfName__SC_UIO_MAXIOV)
6402 #ifdef _SC_UIO_MAXIOV
6403 {*r = _SC_UIO_MAXIOV; return 0;}
6404 #else /* def _SC_UIO_MAXIOV */
6405 {errno = EINVAL; return -1;}
6406 #endif /* ndef _SC_UIO_MAXIOV */
6407 if (x == Mono_Posix_SysconfName__SC_ULONG_MAX)
6408 #ifdef _SC_ULONG_MAX
6409 {*r = _SC_ULONG_MAX; return 0;}
6410 #else /* def _SC_ULONG_MAX */
6411 {errno = EINVAL; return -1;}
6412 #endif /* ndef _SC_ULONG_MAX */
6413 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS)
6414 #ifdef _SC_USER_GROUPS
6415 {*r = _SC_USER_GROUPS; return 0;}
6416 #else /* def _SC_USER_GROUPS */
6417 {errno = EINVAL; return -1;}
6418 #endif /* ndef _SC_USER_GROUPS */
6419 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS_R)
6420 #ifdef _SC_USER_GROUPS_R
6421 {*r = _SC_USER_GROUPS_R; return 0;}
6422 #else /* def _SC_USER_GROUPS_R */
6423 {errno = EINVAL; return -1;}
6424 #endif /* ndef _SC_USER_GROUPS_R */
6425 if (x == Mono_Posix_SysconfName__SC_USHRT_MAX)
6426 #ifdef _SC_USHRT_MAX
6427 {*r = _SC_USHRT_MAX; return 0;}
6428 #else /* def _SC_USHRT_MAX */
6429 {errno = EINVAL; return -1;}
6430 #endif /* ndef _SC_USHRT_MAX */
6431 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFF32)
6432 #ifdef _SC_V6_ILP32_OFF32
6433 {*r = _SC_V6_ILP32_OFF32; return 0;}
6434 #else /* def _SC_V6_ILP32_OFF32 */
6435 {errno = EINVAL; return -1;}
6436 #endif /* ndef _SC_V6_ILP32_OFF32 */
6437 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG)
6438 #ifdef _SC_V6_ILP32_OFFBIG
6439 {*r = _SC_V6_ILP32_OFFBIG; return 0;}
6440 #else /* def _SC_V6_ILP32_OFFBIG */
6441 {errno = EINVAL; return -1;}
6442 #endif /* ndef _SC_V6_ILP32_OFFBIG */
6443 if (x == Mono_Posix_SysconfName__SC_V6_LP64_OFF64)
6444 #ifdef _SC_V6_LP64_OFF64
6445 {*r = _SC_V6_LP64_OFF64; return 0;}
6446 #else /* def _SC_V6_LP64_OFF64 */
6447 {errno = EINVAL; return -1;}
6448 #endif /* ndef _SC_V6_LP64_OFF64 */
6449 if (x == Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG)
6450 #ifdef _SC_V6_LPBIG_OFFBIG
6451 {*r = _SC_V6_LPBIG_OFFBIG; return 0;}
6452 #else /* def _SC_V6_LPBIG_OFFBIG */
6453 {errno = EINVAL; return -1;}
6454 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
6455 if (x == Mono_Posix_SysconfName__SC_VERSION)
6456 #ifdef _SC_VERSION
6457 {*r = _SC_VERSION; return 0;}
6458 #else /* def _SC_VERSION */
6459 {errno = EINVAL; return -1;}
6460 #endif /* ndef _SC_VERSION */
6461 if (x == Mono_Posix_SysconfName__SC_WORD_BIT)
6462 #ifdef _SC_WORD_BIT
6463 {*r = _SC_WORD_BIT; return 0;}
6464 #else /* def _SC_WORD_BIT */
6465 {errno = EINVAL; return -1;}
6466 #endif /* ndef _SC_WORD_BIT */
6467 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32)
6468 #ifdef _SC_XBS5_ILP32_OFF32
6469 {*r = _SC_XBS5_ILP32_OFF32; return 0;}
6470 #else /* def _SC_XBS5_ILP32_OFF32 */
6471 {errno = EINVAL; return -1;}
6472 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
6473 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG)
6474 #ifdef _SC_XBS5_ILP32_OFFBIG
6475 {*r = _SC_XBS5_ILP32_OFFBIG; return 0;}
6476 #else /* def _SC_XBS5_ILP32_OFFBIG */
6477 {errno = EINVAL; return -1;}
6478 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
6479 if (x == Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64)
6480 #ifdef _SC_XBS5_LP64_OFF64
6481 {*r = _SC_XBS5_LP64_OFF64; return 0;}
6482 #else /* def _SC_XBS5_LP64_OFF64 */
6483 {errno = EINVAL; return -1;}
6484 #endif /* ndef _SC_XBS5_LP64_OFF64 */
6485 if (x == Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG)
6486 #ifdef _SC_XBS5_LPBIG_OFFBIG
6487 {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;}
6488 #else /* def _SC_XBS5_LPBIG_OFFBIG */
6489 {errno = EINVAL; return -1;}
6490 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
6491 if (x == Mono_Posix_SysconfName__SC_XOPEN_CRYPT)
6492 #ifdef _SC_XOPEN_CRYPT
6493 {*r = _SC_XOPEN_CRYPT; return 0;}
6494 #else /* def _SC_XOPEN_CRYPT */
6495 {errno = EINVAL; return -1;}
6496 #endif /* ndef _SC_XOPEN_CRYPT */
6497 if (x == Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N)
6498 #ifdef _SC_XOPEN_ENH_I18N
6499 {*r = _SC_XOPEN_ENH_I18N; return 0;}
6500 #else /* def _SC_XOPEN_ENH_I18N */
6501 {errno = EINVAL; return -1;}
6502 #endif /* ndef _SC_XOPEN_ENH_I18N */
6503 if (x == Mono_Posix_SysconfName__SC_XOPEN_LEGACY)
6504 #ifdef _SC_XOPEN_LEGACY
6505 {*r = _SC_XOPEN_LEGACY; return 0;}
6506 #else /* def _SC_XOPEN_LEGACY */
6507 {errno = EINVAL; return -1;}
6508 #endif /* ndef _SC_XOPEN_LEGACY */
6509 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME)
6510 #ifdef _SC_XOPEN_REALTIME
6511 {*r = _SC_XOPEN_REALTIME; return 0;}
6512 #else /* def _SC_XOPEN_REALTIME */
6513 {errno = EINVAL; return -1;}
6514 #endif /* ndef _SC_XOPEN_REALTIME */
6515 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS)
6516 #ifdef _SC_XOPEN_REALTIME_THREADS
6517 {*r = _SC_XOPEN_REALTIME_THREADS; return 0;}
6518 #else /* def _SC_XOPEN_REALTIME_THREADS */
6519 {errno = EINVAL; return -1;}
6520 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6521 if (x == Mono_Posix_SysconfName__SC_XOPEN_SHM)
6522 #ifdef _SC_XOPEN_SHM
6523 {*r = _SC_XOPEN_SHM; return 0;}
6524 #else /* def _SC_XOPEN_SHM */
6525 {errno = EINVAL; return -1;}
6526 #endif /* ndef _SC_XOPEN_SHM */
6527 if (x == Mono_Posix_SysconfName__SC_XOPEN_UNIX)
6528 #ifdef _SC_XOPEN_UNIX
6529 {*r = _SC_XOPEN_UNIX; return 0;}
6530 #else /* def _SC_XOPEN_UNIX */
6531 {errno = EINVAL; return -1;}
6532 #endif /* ndef _SC_XOPEN_UNIX */
6533 if (x == Mono_Posix_SysconfName__SC_XOPEN_VERSION)
6534 #ifdef _SC_XOPEN_VERSION
6535 {*r = _SC_XOPEN_VERSION; return 0;}
6536 #else /* def _SC_XOPEN_VERSION */
6537 {errno = EINVAL; return -1;}
6538 #endif /* ndef _SC_XOPEN_VERSION */
6539 if (x == Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION)
6540 #ifdef _SC_XOPEN_XCU_VERSION
6541 {*r = _SC_XOPEN_XCU_VERSION; return 0;}
6542 #else /* def _SC_XOPEN_XCU_VERSION */
6543 {errno = EINVAL; return -1;}
6544 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6545 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG2)
6546 #ifdef _SC_XOPEN_XPG2
6547 {*r = _SC_XOPEN_XPG2; return 0;}
6548 #else /* def _SC_XOPEN_XPG2 */
6549 {errno = EINVAL; return -1;}
6550 #endif /* ndef _SC_XOPEN_XPG2 */
6551 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG3)
6552 #ifdef _SC_XOPEN_XPG3
6553 {*r = _SC_XOPEN_XPG3; return 0;}
6554 #else /* def _SC_XOPEN_XPG3 */
6555 {errno = EINVAL; return -1;}
6556 #endif /* ndef _SC_XOPEN_XPG3 */
6557 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG4)
6558 #ifdef _SC_XOPEN_XPG4
6559 {*r = _SC_XOPEN_XPG4; return 0;}
6560 #else /* def _SC_XOPEN_XPG4 */
6561 {errno = EINVAL; return -1;}
6562 #endif /* ndef _SC_XOPEN_XPG4 */
6563 if (x == 0)
6564 return 0;
6565 errno = EINVAL; return -1;
6568 int Mono_Posix_ToSysconfName (int x, int *r)
6570 *r = 0;
6571 if (x == 0)
6572 return 0;
6573 #ifdef _SC_2_CHAR_TERM
6574 if (x == _SC_2_CHAR_TERM)
6575 {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
6576 #endif /* ndef _SC_2_CHAR_TERM */
6577 #ifdef _SC_2_C_BIND
6578 if (x == _SC_2_C_BIND)
6579 {*r = Mono_Posix_SysconfName__SC_2_C_BIND; return 0;}
6580 #endif /* ndef _SC_2_C_BIND */
6581 #ifdef _SC_2_C_DEV
6582 if (x == _SC_2_C_DEV)
6583 {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
6584 #endif /* ndef _SC_2_C_DEV */
6585 #ifdef _SC_2_C_VERSION
6586 if (x == _SC_2_C_VERSION)
6587 {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
6588 #endif /* ndef _SC_2_C_VERSION */
6589 #ifdef _SC_2_FORT_DEV
6590 if (x == _SC_2_FORT_DEV)
6591 {*r = Mono_Posix_SysconfName__SC_2_FORT_DEV; return 0;}
6592 #endif /* ndef _SC_2_FORT_DEV */
6593 #ifdef _SC_2_FORT_RUN
6594 if (x == _SC_2_FORT_RUN)
6595 {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
6596 #endif /* ndef _SC_2_FORT_RUN */
6597 #ifdef _SC_2_LOCALEDEF
6598 if (x == _SC_2_LOCALEDEF)
6599 {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
6600 #endif /* ndef _SC_2_LOCALEDEF */
6601 #ifdef _SC_2_PBS
6602 if (x == _SC_2_PBS)
6603 {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
6604 #endif /* ndef _SC_2_PBS */
6605 #ifdef _SC_2_PBS_ACCOUNTING
6606 if (x == _SC_2_PBS_ACCOUNTING)
6607 {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
6608 #endif /* ndef _SC_2_PBS_ACCOUNTING */
6609 #ifdef _SC_2_PBS_CHECKPOINT
6610 if (x == _SC_2_PBS_CHECKPOINT)
6611 {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
6612 #endif /* ndef _SC_2_PBS_CHECKPOINT */
6613 #ifdef _SC_2_PBS_LOCATE
6614 if (x == _SC_2_PBS_LOCATE)
6615 {*r = Mono_Posix_SysconfName__SC_2_PBS_LOCATE; return 0;}
6616 #endif /* ndef _SC_2_PBS_LOCATE */
6617 #ifdef _SC_2_PBS_MESSAGE
6618 if (x == _SC_2_PBS_MESSAGE)
6619 {*r = Mono_Posix_SysconfName__SC_2_PBS_MESSAGE; return 0;}
6620 #endif /* ndef _SC_2_PBS_MESSAGE */
6621 #ifdef _SC_2_PBS_TRACK
6622 if (x == _SC_2_PBS_TRACK)
6623 {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
6624 #endif /* ndef _SC_2_PBS_TRACK */
6625 #ifdef _SC_2_SW_DEV
6626 if (x == _SC_2_SW_DEV)
6627 {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
6628 #endif /* ndef _SC_2_SW_DEV */
6629 #ifdef _SC_2_UPE
6630 if (x == _SC_2_UPE)
6631 {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
6632 #endif /* ndef _SC_2_UPE */
6633 #ifdef _SC_2_VERSION
6634 if (x == _SC_2_VERSION)
6635 {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
6636 #endif /* ndef _SC_2_VERSION */
6637 #ifdef _SC_ADVISORY_INFO
6638 if (x == _SC_ADVISORY_INFO)
6639 {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
6640 #endif /* ndef _SC_ADVISORY_INFO */
6641 #ifdef _SC_AIO_LISTIO_MAX
6642 if (x == _SC_AIO_LISTIO_MAX)
6643 {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
6644 #endif /* ndef _SC_AIO_LISTIO_MAX */
6645 #ifdef _SC_AIO_MAX
6646 if (x == _SC_AIO_MAX)
6647 {*r = Mono_Posix_SysconfName__SC_AIO_MAX; return 0;}
6648 #endif /* ndef _SC_AIO_MAX */
6649 #ifdef _SC_AIO_PRIO_DELTA_MAX
6650 if (x == _SC_AIO_PRIO_DELTA_MAX)
6651 {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
6652 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
6653 #ifdef _SC_ARG_MAX
6654 if (x == _SC_ARG_MAX)
6655 {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
6656 #endif /* ndef _SC_ARG_MAX */
6657 #ifdef _SC_ASYNCHRONOUS_IO
6658 if (x == _SC_ASYNCHRONOUS_IO)
6659 {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
6660 #endif /* ndef _SC_ASYNCHRONOUS_IO */
6661 #ifdef _SC_ATEXIT_MAX
6662 if (x == _SC_ATEXIT_MAX)
6663 {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
6664 #endif /* ndef _SC_ATEXIT_MAX */
6665 #ifdef _SC_AVPHYS_PAGES
6666 if (x == _SC_AVPHYS_PAGES)
6667 {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
6668 #endif /* ndef _SC_AVPHYS_PAGES */
6669 #ifdef _SC_BARRIERS
6670 if (x == _SC_BARRIERS)
6671 {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
6672 #endif /* ndef _SC_BARRIERS */
6673 #ifdef _SC_BASE
6674 if (x == _SC_BASE)
6675 {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
6676 #endif /* ndef _SC_BASE */
6677 #ifdef _SC_BC_BASE_MAX
6678 if (x == _SC_BC_BASE_MAX)
6679 {*r = Mono_Posix_SysconfName__SC_BC_BASE_MAX; return 0;}
6680 #endif /* ndef _SC_BC_BASE_MAX */
6681 #ifdef _SC_BC_DIM_MAX
6682 if (x == _SC_BC_DIM_MAX)
6683 {*r = Mono_Posix_SysconfName__SC_BC_DIM_MAX; return 0;}
6684 #endif /* ndef _SC_BC_DIM_MAX */
6685 #ifdef _SC_BC_SCALE_MAX
6686 if (x == _SC_BC_SCALE_MAX)
6687 {*r = Mono_Posix_SysconfName__SC_BC_SCALE_MAX; return 0;}
6688 #endif /* ndef _SC_BC_SCALE_MAX */
6689 #ifdef _SC_BC_STRING_MAX
6690 if (x == _SC_BC_STRING_MAX)
6691 {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
6692 #endif /* ndef _SC_BC_STRING_MAX */
6693 #ifdef _SC_CHARCLASS_NAME_MAX
6694 if (x == _SC_CHARCLASS_NAME_MAX)
6695 {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
6696 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
6697 #ifdef _SC_CHAR_BIT
6698 if (x == _SC_CHAR_BIT)
6699 {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
6700 #endif /* ndef _SC_CHAR_BIT */
6701 #ifdef _SC_CHAR_MAX
6702 if (x == _SC_CHAR_MAX)
6703 {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
6704 #endif /* ndef _SC_CHAR_MAX */
6705 #ifdef _SC_CHAR_MIN
6706 if (x == _SC_CHAR_MIN)
6707 {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
6708 #endif /* ndef _SC_CHAR_MIN */
6709 #ifdef _SC_CHILD_MAX
6710 if (x == _SC_CHILD_MAX)
6711 {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
6712 #endif /* ndef _SC_CHILD_MAX */
6713 #ifdef _SC_CLK_TCK
6714 if (x == _SC_CLK_TCK)
6715 {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
6716 #endif /* ndef _SC_CLK_TCK */
6717 #ifdef _SC_CLOCK_SELECTION
6718 if (x == _SC_CLOCK_SELECTION)
6719 {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
6720 #endif /* ndef _SC_CLOCK_SELECTION */
6721 #ifdef _SC_COLL_WEIGHTS_MAX
6722 if (x == _SC_COLL_WEIGHTS_MAX)
6723 {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
6724 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
6725 #ifdef _SC_CPUTIME
6726 if (x == _SC_CPUTIME)
6727 {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
6728 #endif /* ndef _SC_CPUTIME */
6729 #ifdef _SC_C_LANG_SUPPORT
6730 if (x == _SC_C_LANG_SUPPORT)
6731 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT; return 0;}
6732 #endif /* ndef _SC_C_LANG_SUPPORT */
6733 #ifdef _SC_C_LANG_SUPPORT_R
6734 if (x == _SC_C_LANG_SUPPORT_R)
6735 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
6736 #endif /* ndef _SC_C_LANG_SUPPORT_R */
6737 #ifdef _SC_DELAYTIMER_MAX
6738 if (x == _SC_DELAYTIMER_MAX)
6739 {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
6740 #endif /* ndef _SC_DELAYTIMER_MAX */
6741 #ifdef _SC_DEVICE_IO
6742 if (x == _SC_DEVICE_IO)
6743 {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
6744 #endif /* ndef _SC_DEVICE_IO */
6745 #ifdef _SC_DEVICE_SPECIFIC
6746 if (x == _SC_DEVICE_SPECIFIC)
6747 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
6748 #endif /* ndef _SC_DEVICE_SPECIFIC */
6749 #ifdef _SC_DEVICE_SPECIFIC_R
6750 if (x == _SC_DEVICE_SPECIFIC_R)
6751 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
6752 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
6753 #ifdef _SC_EQUIV_CLASS_MAX
6754 if (x == _SC_EQUIV_CLASS_MAX)
6755 {*r = Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX; return 0;}
6756 #endif /* ndef _SC_EQUIV_CLASS_MAX */
6757 #ifdef _SC_EXPR_NEST_MAX
6758 if (x == _SC_EXPR_NEST_MAX)
6759 {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
6760 #endif /* ndef _SC_EXPR_NEST_MAX */
6761 #ifdef _SC_FD_MGMT
6762 if (x == _SC_FD_MGMT)
6763 {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
6764 #endif /* ndef _SC_FD_MGMT */
6765 #ifdef _SC_FIFO
6766 if (x == _SC_FIFO)
6767 {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
6768 #endif /* ndef _SC_FIFO */
6769 #ifdef _SC_FILE_ATTRIBUTES
6770 if (x == _SC_FILE_ATTRIBUTES)
6771 {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
6772 #endif /* ndef _SC_FILE_ATTRIBUTES */
6773 #ifdef _SC_FILE_LOCKING
6774 if (x == _SC_FILE_LOCKING)
6775 {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
6776 #endif /* ndef _SC_FILE_LOCKING */
6777 #ifdef _SC_FILE_SYSTEM
6778 if (x == _SC_FILE_SYSTEM)
6779 {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
6780 #endif /* ndef _SC_FILE_SYSTEM */
6781 #ifdef _SC_FSYNC
6782 if (x == _SC_FSYNC)
6783 {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
6784 #endif /* ndef _SC_FSYNC */
6785 #ifdef _SC_GETGR_R_SIZE_MAX
6786 if (x == _SC_GETGR_R_SIZE_MAX)
6787 {*r = Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX; return 0;}
6788 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
6789 #ifdef _SC_GETPW_R_SIZE_MAX
6790 if (x == _SC_GETPW_R_SIZE_MAX)
6791 {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
6792 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
6793 #ifdef _SC_HOST_NAME_MAX
6794 if (x == _SC_HOST_NAME_MAX)
6795 {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
6796 #endif /* ndef _SC_HOST_NAME_MAX */
6797 #ifdef _SC_INT_MAX
6798 if (x == _SC_INT_MAX)
6799 {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
6800 #endif /* ndef _SC_INT_MAX */
6801 #ifdef _SC_INT_MIN
6802 if (x == _SC_INT_MIN)
6803 {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
6804 #endif /* ndef _SC_INT_MIN */
6805 #ifdef _SC_IOV_MAX
6806 if (x == _SC_IOV_MAX)
6807 {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
6808 #endif /* ndef _SC_IOV_MAX */
6809 #ifdef _SC_JOB_CONTROL
6810 if (x == _SC_JOB_CONTROL)
6811 {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
6812 #endif /* ndef _SC_JOB_CONTROL */
6813 #ifdef _SC_LEVEL1_DCACHE_ASSOC
6814 if (x == _SC_LEVEL1_DCACHE_ASSOC)
6815 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC; return 0;}
6816 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
6817 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
6818 if (x == _SC_LEVEL1_DCACHE_LINESIZE)
6819 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
6820 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
6821 #ifdef _SC_LEVEL1_DCACHE_SIZE
6822 if (x == _SC_LEVEL1_DCACHE_SIZE)
6823 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
6824 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
6825 #ifdef _SC_LEVEL1_ICACHE_ASSOC
6826 if (x == _SC_LEVEL1_ICACHE_ASSOC)
6827 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC; return 0;}
6828 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
6829 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
6830 if (x == _SC_LEVEL1_ICACHE_LINESIZE)
6831 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
6832 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
6833 #ifdef _SC_LEVEL1_ICACHE_SIZE
6834 if (x == _SC_LEVEL1_ICACHE_SIZE)
6835 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
6836 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
6837 #ifdef _SC_LEVEL2_CACHE_ASSOC
6838 if (x == _SC_LEVEL2_CACHE_ASSOC)
6839 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC; return 0;}
6840 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
6841 #ifdef _SC_LEVEL2_CACHE_LINESIZE
6842 if (x == _SC_LEVEL2_CACHE_LINESIZE)
6843 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
6844 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
6845 #ifdef _SC_LEVEL2_CACHE_SIZE
6846 if (x == _SC_LEVEL2_CACHE_SIZE)
6847 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
6848 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
6849 #ifdef _SC_LEVEL3_CACHE_ASSOC
6850 if (x == _SC_LEVEL3_CACHE_ASSOC)
6851 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC; return 0;}
6852 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
6853 #ifdef _SC_LEVEL3_CACHE_LINESIZE
6854 if (x == _SC_LEVEL3_CACHE_LINESIZE)
6855 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
6856 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
6857 #ifdef _SC_LEVEL3_CACHE_SIZE
6858 if (x == _SC_LEVEL3_CACHE_SIZE)
6859 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
6860 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
6861 #ifdef _SC_LEVEL4_CACHE_ASSOC
6862 if (x == _SC_LEVEL4_CACHE_ASSOC)
6863 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC; return 0;}
6864 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
6865 #ifdef _SC_LEVEL4_CACHE_LINESIZE
6866 if (x == _SC_LEVEL4_CACHE_LINESIZE)
6867 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
6868 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
6869 #ifdef _SC_LEVEL4_CACHE_SIZE
6870 if (x == _SC_LEVEL4_CACHE_SIZE)
6871 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
6872 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
6873 #ifdef _SC_LINE_MAX
6874 if (x == _SC_LINE_MAX)
6875 {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
6876 #endif /* ndef _SC_LINE_MAX */
6877 #ifdef _SC_LOGIN_NAME_MAX
6878 if (x == _SC_LOGIN_NAME_MAX)
6879 {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
6880 #endif /* ndef _SC_LOGIN_NAME_MAX */
6881 #ifdef _SC_LONG_BIT
6882 if (x == _SC_LONG_BIT)
6883 {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
6884 #endif /* ndef _SC_LONG_BIT */
6885 #ifdef _SC_MAPPED_FILES
6886 if (x == _SC_MAPPED_FILES)
6887 {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
6888 #endif /* ndef _SC_MAPPED_FILES */
6889 #ifdef _SC_MB_LEN_MAX
6890 if (x == _SC_MB_LEN_MAX)
6891 {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
6892 #endif /* ndef _SC_MB_LEN_MAX */
6893 #ifdef _SC_MEMLOCK
6894 if (x == _SC_MEMLOCK)
6895 {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
6896 #endif /* ndef _SC_MEMLOCK */
6897 #ifdef _SC_MEMLOCK_RANGE
6898 if (x == _SC_MEMLOCK_RANGE)
6899 {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
6900 #endif /* ndef _SC_MEMLOCK_RANGE */
6901 #ifdef _SC_MEMORY_PROTECTION
6902 if (x == _SC_MEMORY_PROTECTION)
6903 {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
6904 #endif /* ndef _SC_MEMORY_PROTECTION */
6905 #ifdef _SC_MESSAGE_PASSING
6906 if (x == _SC_MESSAGE_PASSING)
6907 {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
6908 #endif /* ndef _SC_MESSAGE_PASSING */
6909 #ifdef _SC_MONOTONIC_CLOCK
6910 if (x == _SC_MONOTONIC_CLOCK)
6911 {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
6912 #endif /* ndef _SC_MONOTONIC_CLOCK */
6913 #ifdef _SC_MQ_OPEN_MAX
6914 if (x == _SC_MQ_OPEN_MAX)
6915 {*r = Mono_Posix_SysconfName__SC_MQ_OPEN_MAX; return 0;}
6916 #endif /* ndef _SC_MQ_OPEN_MAX */
6917 #ifdef _SC_MQ_PRIO_MAX
6918 if (x == _SC_MQ_PRIO_MAX)
6919 {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
6920 #endif /* ndef _SC_MQ_PRIO_MAX */
6921 #ifdef _SC_MULTI_PROCESS
6922 if (x == _SC_MULTI_PROCESS)
6923 {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
6924 #endif /* ndef _SC_MULTI_PROCESS */
6925 #ifdef _SC_NETWORKING
6926 if (x == _SC_NETWORKING)
6927 {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
6928 #endif /* ndef _SC_NETWORKING */
6929 #ifdef _SC_NGROUPS_MAX
6930 if (x == _SC_NGROUPS_MAX)
6931 {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
6932 #endif /* ndef _SC_NGROUPS_MAX */
6933 #ifdef _SC_NL_ARGMAX
6934 if (x == _SC_NL_ARGMAX)
6935 {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
6936 #endif /* ndef _SC_NL_ARGMAX */
6937 #ifdef _SC_NL_LANGMAX
6938 if (x == _SC_NL_LANGMAX)
6939 {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
6940 #endif /* ndef _SC_NL_LANGMAX */
6941 #ifdef _SC_NL_MSGMAX
6942 if (x == _SC_NL_MSGMAX)
6943 {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
6944 #endif /* ndef _SC_NL_MSGMAX */
6945 #ifdef _SC_NL_NMAX
6946 if (x == _SC_NL_NMAX)
6947 {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
6948 #endif /* ndef _SC_NL_NMAX */
6949 #ifdef _SC_NL_SETMAX
6950 if (x == _SC_NL_SETMAX)
6951 {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
6952 #endif /* ndef _SC_NL_SETMAX */
6953 #ifdef _SC_NL_TEXTMAX
6954 if (x == _SC_NL_TEXTMAX)
6955 {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
6956 #endif /* ndef _SC_NL_TEXTMAX */
6957 #ifdef _SC_NPROCESSORS_CONF
6958 if (x == _SC_NPROCESSORS_CONF)
6959 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
6960 #endif /* ndef _SC_NPROCESSORS_CONF */
6961 #ifdef _SC_NPROCESSORS_ONLN
6962 if (x == _SC_NPROCESSORS_ONLN)
6963 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
6964 #endif /* ndef _SC_NPROCESSORS_ONLN */
6965 #ifdef _SC_NZERO
6966 if (x == _SC_NZERO)
6967 {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
6968 #endif /* ndef _SC_NZERO */
6969 #ifdef _SC_OPEN_MAX
6970 if (x == _SC_OPEN_MAX)
6971 {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
6972 #endif /* ndef _SC_OPEN_MAX */
6973 #ifdef _SC_PAGESIZE
6974 if (x == _SC_PAGESIZE)
6975 {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
6976 #endif /* ndef _SC_PAGESIZE */
6977 #ifdef _SC_PASS_MAX
6978 if (x == _SC_PASS_MAX)
6979 {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
6980 #endif /* ndef _SC_PASS_MAX */
6981 #ifdef _SC_PHYS_PAGES
6982 if (x == _SC_PHYS_PAGES)
6983 {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
6984 #endif /* ndef _SC_PHYS_PAGES */
6985 #ifdef _SC_PII
6986 if (x == _SC_PII)
6987 {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
6988 #endif /* ndef _SC_PII */
6989 #ifdef _SC_PII_INTERNET
6990 if (x == _SC_PII_INTERNET)
6991 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
6992 #endif /* ndef _SC_PII_INTERNET */
6993 #ifdef _SC_PII_INTERNET_DGRAM
6994 if (x == _SC_PII_INTERNET_DGRAM)
6995 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
6996 #endif /* ndef _SC_PII_INTERNET_DGRAM */
6997 #ifdef _SC_PII_INTERNET_STREAM
6998 if (x == _SC_PII_INTERNET_STREAM)
6999 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
7000 #endif /* ndef _SC_PII_INTERNET_STREAM */
7001 #ifdef _SC_PII_OSI
7002 if (x == _SC_PII_OSI)
7003 {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
7004 #endif /* ndef _SC_PII_OSI */
7005 #ifdef _SC_PII_OSI_CLTS
7006 if (x == _SC_PII_OSI_CLTS)
7007 {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
7008 #endif /* ndef _SC_PII_OSI_CLTS */
7009 #ifdef _SC_PII_OSI_COTS
7010 if (x == _SC_PII_OSI_COTS)
7011 {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
7012 #endif /* ndef _SC_PII_OSI_COTS */
7013 #ifdef _SC_PII_OSI_M
7014 if (x == _SC_PII_OSI_M)
7015 {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
7016 #endif /* ndef _SC_PII_OSI_M */
7017 #ifdef _SC_PII_SOCKET
7018 if (x == _SC_PII_SOCKET)
7019 {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
7020 #endif /* ndef _SC_PII_SOCKET */
7021 #ifdef _SC_PII_XTI
7022 if (x == _SC_PII_XTI)
7023 {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
7024 #endif /* ndef _SC_PII_XTI */
7025 #ifdef _SC_PIPE
7026 if (x == _SC_PIPE)
7027 {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
7028 #endif /* ndef _SC_PIPE */
7029 #ifdef _SC_POLL
7030 if (x == _SC_POLL)
7031 {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
7032 #endif /* ndef _SC_POLL */
7033 #ifdef _SC_PRIORITIZED_IO
7034 if (x == _SC_PRIORITIZED_IO)
7035 {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
7036 #endif /* ndef _SC_PRIORITIZED_IO */
7037 #ifdef _SC_PRIORITY_SCHEDULING
7038 if (x == _SC_PRIORITY_SCHEDULING)
7039 {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
7040 #endif /* ndef _SC_PRIORITY_SCHEDULING */
7041 #ifdef _SC_READER_WRITER_LOCKS
7042 if (x == _SC_READER_WRITER_LOCKS)
7043 {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
7044 #endif /* ndef _SC_READER_WRITER_LOCKS */
7045 #ifdef _SC_REALTIME_SIGNALS
7046 if (x == _SC_REALTIME_SIGNALS)
7047 {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
7048 #endif /* ndef _SC_REALTIME_SIGNALS */
7049 #ifdef _SC_REGEXP
7050 if (x == _SC_REGEXP)
7051 {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
7052 #endif /* ndef _SC_REGEXP */
7053 #ifdef _SC_REGEX_VERSION
7054 if (x == _SC_REGEX_VERSION)
7055 {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
7056 #endif /* ndef _SC_REGEX_VERSION */
7057 #ifdef _SC_RE_DUP_MAX
7058 if (x == _SC_RE_DUP_MAX)
7059 {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
7060 #endif /* ndef _SC_RE_DUP_MAX */
7061 #ifdef _SC_RTSIG_MAX
7062 if (x == _SC_RTSIG_MAX)
7063 {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
7064 #endif /* ndef _SC_RTSIG_MAX */
7065 #ifdef _SC_SAVED_IDS
7066 if (x == _SC_SAVED_IDS)
7067 {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
7068 #endif /* ndef _SC_SAVED_IDS */
7069 #ifdef _SC_SCHAR_MAX
7070 if (x == _SC_SCHAR_MAX)
7071 {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
7072 #endif /* ndef _SC_SCHAR_MAX */
7073 #ifdef _SC_SCHAR_MIN
7074 if (x == _SC_SCHAR_MIN)
7075 {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
7076 #endif /* ndef _SC_SCHAR_MIN */
7077 #ifdef _SC_SELECT
7078 if (x == _SC_SELECT)
7079 {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
7080 #endif /* ndef _SC_SELECT */
7081 #ifdef _SC_SEMAPHORES
7082 if (x == _SC_SEMAPHORES)
7083 {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
7084 #endif /* ndef _SC_SEMAPHORES */
7085 #ifdef _SC_SEM_NSEMS_MAX
7086 if (x == _SC_SEM_NSEMS_MAX)
7087 {*r = Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX; return 0;}
7088 #endif /* ndef _SC_SEM_NSEMS_MAX */
7089 #ifdef _SC_SEM_VALUE_MAX
7090 if (x == _SC_SEM_VALUE_MAX)
7091 {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
7092 #endif /* ndef _SC_SEM_VALUE_MAX */
7093 #ifdef _SC_SHARED_MEMORY_OBJECTS
7094 if (x == _SC_SHARED_MEMORY_OBJECTS)
7095 {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
7096 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
7097 #ifdef _SC_SHELL
7098 if (x == _SC_SHELL)
7099 {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
7100 #endif /* ndef _SC_SHELL */
7101 #ifdef _SC_SHRT_MAX
7102 if (x == _SC_SHRT_MAX)
7103 {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
7104 #endif /* ndef _SC_SHRT_MAX */
7105 #ifdef _SC_SHRT_MIN
7106 if (x == _SC_SHRT_MIN)
7107 {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
7108 #endif /* ndef _SC_SHRT_MIN */
7109 #ifdef _SC_SIGNALS
7110 if (x == _SC_SIGNALS)
7111 {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
7112 #endif /* ndef _SC_SIGNALS */
7113 #ifdef _SC_SIGQUEUE_MAX
7114 if (x == _SC_SIGQUEUE_MAX)
7115 {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
7116 #endif /* ndef _SC_SIGQUEUE_MAX */
7117 #ifdef _SC_SINGLE_PROCESS
7118 if (x == _SC_SINGLE_PROCESS)
7119 {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
7120 #endif /* ndef _SC_SINGLE_PROCESS */
7121 #ifdef _SC_SPAWN
7122 if (x == _SC_SPAWN)
7123 {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
7124 #endif /* ndef _SC_SPAWN */
7125 #ifdef _SC_SPIN_LOCKS
7126 if (x == _SC_SPIN_LOCKS)
7127 {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
7128 #endif /* ndef _SC_SPIN_LOCKS */
7129 #ifdef _SC_SPORADIC_SERVER
7130 if (x == _SC_SPORADIC_SERVER)
7131 {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
7132 #endif /* ndef _SC_SPORADIC_SERVER */
7133 #ifdef _SC_SSIZE_MAX
7134 if (x == _SC_SSIZE_MAX)
7135 {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
7136 #endif /* ndef _SC_SSIZE_MAX */
7137 #ifdef _SC_STREAMS
7138 if (x == _SC_STREAMS)
7139 {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
7140 #endif /* ndef _SC_STREAMS */
7141 #ifdef _SC_STREAM_MAX
7142 if (x == _SC_STREAM_MAX)
7143 {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
7144 #endif /* ndef _SC_STREAM_MAX */
7145 #ifdef _SC_SYMLOOP_MAX
7146 if (x == _SC_SYMLOOP_MAX)
7147 {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
7148 #endif /* ndef _SC_SYMLOOP_MAX */
7149 #ifdef _SC_SYNCHRONIZED_IO
7150 if (x == _SC_SYNCHRONIZED_IO)
7151 {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
7152 #endif /* ndef _SC_SYNCHRONIZED_IO */
7153 #ifdef _SC_SYSTEM_DATABASE
7154 if (x == _SC_SYSTEM_DATABASE)
7155 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
7156 #endif /* ndef _SC_SYSTEM_DATABASE */
7157 #ifdef _SC_SYSTEM_DATABASE_R
7158 if (x == _SC_SYSTEM_DATABASE_R)
7159 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
7160 #endif /* ndef _SC_SYSTEM_DATABASE_R */
7161 #ifdef _SC_THREADS
7162 if (x == _SC_THREADS)
7163 {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
7164 #endif /* ndef _SC_THREADS */
7165 #ifdef _SC_THREAD_ATTR_STACKADDR
7166 if (x == _SC_THREAD_ATTR_STACKADDR)
7167 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR; return 0;}
7168 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
7169 #ifdef _SC_THREAD_ATTR_STACKSIZE
7170 if (x == _SC_THREAD_ATTR_STACKSIZE)
7171 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
7172 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
7173 #ifdef _SC_THREAD_CPUTIME
7174 if (x == _SC_THREAD_CPUTIME)
7175 {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
7176 #endif /* ndef _SC_THREAD_CPUTIME */
7177 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
7178 if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
7179 {*r = Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
7180 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
7181 #ifdef _SC_THREAD_KEYS_MAX
7182 if (x == _SC_THREAD_KEYS_MAX)
7183 {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
7184 #endif /* ndef _SC_THREAD_KEYS_MAX */
7185 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
7186 if (x == _SC_THREAD_PRIORITY_SCHEDULING)
7187 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
7188 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
7189 #ifdef _SC_THREAD_PRIO_INHERIT
7190 if (x == _SC_THREAD_PRIO_INHERIT)
7191 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT; return 0;}
7192 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
7193 #ifdef _SC_THREAD_PRIO_PROTECT
7194 if (x == _SC_THREAD_PRIO_PROTECT)
7195 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT; return 0;}
7196 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
7197 #ifdef _SC_THREAD_PROCESS_SHARED
7198 if (x == _SC_THREAD_PROCESS_SHARED)
7199 {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
7200 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
7201 #ifdef _SC_THREAD_SAFE_FUNCTIONS
7202 if (x == _SC_THREAD_SAFE_FUNCTIONS)
7203 {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
7204 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
7205 #ifdef _SC_THREAD_SPORADIC_SERVER
7206 if (x == _SC_THREAD_SPORADIC_SERVER)
7207 {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
7208 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
7209 #ifdef _SC_THREAD_STACK_MIN
7210 if (x == _SC_THREAD_STACK_MIN)
7211 {*r = Mono_Posix_SysconfName__SC_THREAD_STACK_MIN; return 0;}
7212 #endif /* ndef _SC_THREAD_STACK_MIN */
7213 #ifdef _SC_THREAD_THREADS_MAX
7214 if (x == _SC_THREAD_THREADS_MAX)
7215 {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
7216 #endif /* ndef _SC_THREAD_THREADS_MAX */
7217 #ifdef _SC_TIMEOUTS
7218 if (x == _SC_TIMEOUTS)
7219 {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
7220 #endif /* ndef _SC_TIMEOUTS */
7221 #ifdef _SC_TIMERS
7222 if (x == _SC_TIMERS)
7223 {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
7224 #endif /* ndef _SC_TIMERS */
7225 #ifdef _SC_TIMER_MAX
7226 if (x == _SC_TIMER_MAX)
7227 {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
7228 #endif /* ndef _SC_TIMER_MAX */
7229 #ifdef _SC_TRACE
7230 if (x == _SC_TRACE)
7231 {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
7232 #endif /* ndef _SC_TRACE */
7233 #ifdef _SC_TRACE_EVENT_FILTER
7234 if (x == _SC_TRACE_EVENT_FILTER)
7235 {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
7236 #endif /* ndef _SC_TRACE_EVENT_FILTER */
7237 #ifdef _SC_TRACE_INHERIT
7238 if (x == _SC_TRACE_INHERIT)
7239 {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
7240 #endif /* ndef _SC_TRACE_INHERIT */
7241 #ifdef _SC_TRACE_LOG
7242 if (x == _SC_TRACE_LOG)
7243 {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
7244 #endif /* ndef _SC_TRACE_LOG */
7245 #ifdef _SC_TTY_NAME_MAX
7246 if (x == _SC_TTY_NAME_MAX)
7247 {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
7248 #endif /* ndef _SC_TTY_NAME_MAX */
7249 #ifdef _SC_TYPED_MEMORY_OBJECTS
7250 if (x == _SC_TYPED_MEMORY_OBJECTS)
7251 {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
7252 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
7253 #ifdef _SC_TZNAME_MAX
7254 if (x == _SC_TZNAME_MAX)
7255 {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
7256 #endif /* ndef _SC_TZNAME_MAX */
7257 #ifdef _SC_T_IOV_MAX
7258 if (x == _SC_T_IOV_MAX)
7259 {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
7260 #endif /* ndef _SC_T_IOV_MAX */
7261 #ifdef _SC_UCHAR_MAX
7262 if (x == _SC_UCHAR_MAX)
7263 {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
7264 #endif /* ndef _SC_UCHAR_MAX */
7265 #ifdef _SC_UINT_MAX
7266 if (x == _SC_UINT_MAX)
7267 {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
7268 #endif /* ndef _SC_UINT_MAX */
7269 #ifdef _SC_UIO_MAXIOV
7270 if (x == _SC_UIO_MAXIOV)
7271 {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
7272 #endif /* ndef _SC_UIO_MAXIOV */
7273 #ifdef _SC_ULONG_MAX
7274 if (x == _SC_ULONG_MAX)
7275 {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
7276 #endif /* ndef _SC_ULONG_MAX */
7277 #ifdef _SC_USER_GROUPS
7278 if (x == _SC_USER_GROUPS)
7279 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
7280 #endif /* ndef _SC_USER_GROUPS */
7281 #ifdef _SC_USER_GROUPS_R
7282 if (x == _SC_USER_GROUPS_R)
7283 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
7284 #endif /* ndef _SC_USER_GROUPS_R */
7285 #ifdef _SC_USHRT_MAX
7286 if (x == _SC_USHRT_MAX)
7287 {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
7288 #endif /* ndef _SC_USHRT_MAX */
7289 #ifdef _SC_V6_ILP32_OFF32
7290 if (x == _SC_V6_ILP32_OFF32)
7291 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFF32; return 0;}
7292 #endif /* ndef _SC_V6_ILP32_OFF32 */
7293 #ifdef _SC_V6_ILP32_OFFBIG
7294 if (x == _SC_V6_ILP32_OFFBIG)
7295 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG; return 0;}
7296 #endif /* ndef _SC_V6_ILP32_OFFBIG */
7297 #ifdef _SC_V6_LP64_OFF64
7298 if (x == _SC_V6_LP64_OFF64)
7299 {*r = Mono_Posix_SysconfName__SC_V6_LP64_OFF64; return 0;}
7300 #endif /* ndef _SC_V6_LP64_OFF64 */
7301 #ifdef _SC_V6_LPBIG_OFFBIG
7302 if (x == _SC_V6_LPBIG_OFFBIG)
7303 {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
7304 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
7305 #ifdef _SC_VERSION
7306 if (x == _SC_VERSION)
7307 {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
7308 #endif /* ndef _SC_VERSION */
7309 #ifdef _SC_WORD_BIT
7310 if (x == _SC_WORD_BIT)
7311 {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
7312 #endif /* ndef _SC_WORD_BIT */
7313 #ifdef _SC_XBS5_ILP32_OFF32
7314 if (x == _SC_XBS5_ILP32_OFF32)
7315 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32; return 0;}
7316 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
7317 #ifdef _SC_XBS5_ILP32_OFFBIG
7318 if (x == _SC_XBS5_ILP32_OFFBIG)
7319 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG; return 0;}
7320 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
7321 #ifdef _SC_XBS5_LP64_OFF64
7322 if (x == _SC_XBS5_LP64_OFF64)
7323 {*r = Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64; return 0;}
7324 #endif /* ndef _SC_XBS5_LP64_OFF64 */
7325 #ifdef _SC_XBS5_LPBIG_OFFBIG
7326 if (x == _SC_XBS5_LPBIG_OFFBIG)
7327 {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
7328 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
7329 #ifdef _SC_XOPEN_CRYPT
7330 if (x == _SC_XOPEN_CRYPT)
7331 {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
7332 #endif /* ndef _SC_XOPEN_CRYPT */
7333 #ifdef _SC_XOPEN_ENH_I18N
7334 if (x == _SC_XOPEN_ENH_I18N)
7335 {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
7336 #endif /* ndef _SC_XOPEN_ENH_I18N */
7337 #ifdef _SC_XOPEN_LEGACY
7338 if (x == _SC_XOPEN_LEGACY)
7339 {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
7340 #endif /* ndef _SC_XOPEN_LEGACY */
7341 #ifdef _SC_XOPEN_REALTIME
7342 if (x == _SC_XOPEN_REALTIME)
7343 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
7344 #endif /* ndef _SC_XOPEN_REALTIME */
7345 #ifdef _SC_XOPEN_REALTIME_THREADS
7346 if (x == _SC_XOPEN_REALTIME_THREADS)
7347 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
7348 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
7349 #ifdef _SC_XOPEN_SHM
7350 if (x == _SC_XOPEN_SHM)
7351 {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
7352 #endif /* ndef _SC_XOPEN_SHM */
7353 #ifdef _SC_XOPEN_UNIX
7354 if (x == _SC_XOPEN_UNIX)
7355 {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
7356 #endif /* ndef _SC_XOPEN_UNIX */
7357 #ifdef _SC_XOPEN_VERSION
7358 if (x == _SC_XOPEN_VERSION)
7359 {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
7360 #endif /* ndef _SC_XOPEN_VERSION */
7361 #ifdef _SC_XOPEN_XCU_VERSION
7362 if (x == _SC_XOPEN_XCU_VERSION)
7363 {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
7364 #endif /* ndef _SC_XOPEN_XCU_VERSION */
7365 #ifdef _SC_XOPEN_XPG2
7366 if (x == _SC_XOPEN_XPG2)
7367 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
7368 #endif /* ndef _SC_XOPEN_XPG2 */
7369 #ifdef _SC_XOPEN_XPG3
7370 if (x == _SC_XOPEN_XPG3)
7371 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
7372 #endif /* ndef _SC_XOPEN_XPG3 */
7373 #ifdef _SC_XOPEN_XPG4
7374 if (x == _SC_XOPEN_XPG4)
7375 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
7376 #endif /* ndef _SC_XOPEN_XPG4 */
7377 errno = EINVAL; return -1;
7380 int Mono_Posix_FromSyslogFacility (int x, int *r)
7382 *r = 0;
7383 if (x == Mono_Posix_SyslogFacility_LOG_AUTH)
7384 #ifdef LOG_AUTH
7385 {*r = LOG_AUTH; return 0;}
7386 #else /* def LOG_AUTH */
7387 {errno = EINVAL; return -1;}
7388 #endif /* ndef LOG_AUTH */
7389 if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
7390 #ifdef LOG_AUTHPRIV
7391 {*r = LOG_AUTHPRIV; return 0;}
7392 #else /* def LOG_AUTHPRIV */
7393 {errno = EINVAL; return -1;}
7394 #endif /* ndef LOG_AUTHPRIV */
7395 if (x == Mono_Posix_SyslogFacility_LOG_CRON)
7396 #ifdef LOG_CRON
7397 {*r = LOG_CRON; return 0;}
7398 #else /* def LOG_CRON */
7399 {errno = EINVAL; return -1;}
7400 #endif /* ndef LOG_CRON */
7401 if (x == Mono_Posix_SyslogFacility_LOG_DAEMON)
7402 #ifdef LOG_DAEMON
7403 {*r = LOG_DAEMON; return 0;}
7404 #else /* def LOG_DAEMON */
7405 {errno = EINVAL; return -1;}
7406 #endif /* ndef LOG_DAEMON */
7407 if (x == Mono_Posix_SyslogFacility_LOG_FTP)
7408 #ifdef LOG_FTP
7409 {*r = LOG_FTP; return 0;}
7410 #else /* def LOG_FTP */
7411 {errno = EINVAL; return -1;}
7412 #endif /* ndef LOG_FTP */
7413 if (x == Mono_Posix_SyslogFacility_LOG_KERN)
7414 #ifdef LOG_KERN
7415 {*r = LOG_KERN; return 0;}
7416 #else /* def LOG_KERN */
7417 {errno = EINVAL; return -1;}
7418 #endif /* ndef LOG_KERN */
7419 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0)
7420 #ifdef LOG_LOCAL0
7421 {*r = LOG_LOCAL0; return 0;}
7422 #else /* def LOG_LOCAL0 */
7423 {errno = EINVAL; return -1;}
7424 #endif /* ndef LOG_LOCAL0 */
7425 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1)
7426 #ifdef LOG_LOCAL1
7427 {*r = LOG_LOCAL1; return 0;}
7428 #else /* def LOG_LOCAL1 */
7429 {errno = EINVAL; return -1;}
7430 #endif /* ndef LOG_LOCAL1 */
7431 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2)
7432 #ifdef LOG_LOCAL2
7433 {*r = LOG_LOCAL2; return 0;}
7434 #else /* def LOG_LOCAL2 */
7435 {errno = EINVAL; return -1;}
7436 #endif /* ndef LOG_LOCAL2 */
7437 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3)
7438 #ifdef LOG_LOCAL3
7439 {*r = LOG_LOCAL3; return 0;}
7440 #else /* def LOG_LOCAL3 */
7441 {errno = EINVAL; return -1;}
7442 #endif /* ndef LOG_LOCAL3 */
7443 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4)
7444 #ifdef LOG_LOCAL4
7445 {*r = LOG_LOCAL4; return 0;}
7446 #else /* def LOG_LOCAL4 */
7447 {errno = EINVAL; return -1;}
7448 #endif /* ndef LOG_LOCAL4 */
7449 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5)
7450 #ifdef LOG_LOCAL5
7451 {*r = LOG_LOCAL5; return 0;}
7452 #else /* def LOG_LOCAL5 */
7453 {errno = EINVAL; return -1;}
7454 #endif /* ndef LOG_LOCAL5 */
7455 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6)
7456 #ifdef LOG_LOCAL6
7457 {*r = LOG_LOCAL6; return 0;}
7458 #else /* def LOG_LOCAL6 */
7459 {errno = EINVAL; return -1;}
7460 #endif /* ndef LOG_LOCAL6 */
7461 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7)
7462 #ifdef LOG_LOCAL7
7463 {*r = LOG_LOCAL7; return 0;}
7464 #else /* def LOG_LOCAL7 */
7465 {errno = EINVAL; return -1;}
7466 #endif /* ndef LOG_LOCAL7 */
7467 if (x == Mono_Posix_SyslogFacility_LOG_LPR)
7468 #ifdef LOG_LPR
7469 {*r = LOG_LPR; return 0;}
7470 #else /* def LOG_LPR */
7471 {errno = EINVAL; return -1;}
7472 #endif /* ndef LOG_LPR */
7473 if (x == Mono_Posix_SyslogFacility_LOG_MAIL)
7474 #ifdef LOG_MAIL
7475 {*r = LOG_MAIL; return 0;}
7476 #else /* def LOG_MAIL */
7477 {errno = EINVAL; return -1;}
7478 #endif /* ndef LOG_MAIL */
7479 if (x == Mono_Posix_SyslogFacility_LOG_NEWS)
7480 #ifdef LOG_NEWS
7481 {*r = LOG_NEWS; return 0;}
7482 #else /* def LOG_NEWS */
7483 {errno = EINVAL; return -1;}
7484 #endif /* ndef LOG_NEWS */
7485 if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG)
7486 #ifdef LOG_SYSLOG
7487 {*r = LOG_SYSLOG; return 0;}
7488 #else /* def LOG_SYSLOG */
7489 {errno = EINVAL; return -1;}
7490 #endif /* ndef LOG_SYSLOG */
7491 if (x == Mono_Posix_SyslogFacility_LOG_USER)
7492 #ifdef LOG_USER
7493 {*r = LOG_USER; return 0;}
7494 #else /* def LOG_USER */
7495 {errno = EINVAL; return -1;}
7496 #endif /* ndef LOG_USER */
7497 if (x == Mono_Posix_SyslogFacility_LOG_UUCP)
7498 #ifdef LOG_UUCP
7499 {*r = LOG_UUCP; return 0;}
7500 #else /* def LOG_UUCP */
7501 {errno = EINVAL; return -1;}
7502 #endif /* ndef LOG_UUCP */
7503 if (x == 0)
7504 return 0;
7505 errno = EINVAL; return -1;
7508 int Mono_Posix_ToSyslogFacility (int x, int *r)
7510 *r = 0;
7511 if (x == 0)
7512 return 0;
7513 #ifdef LOG_AUTH
7514 if (x == LOG_AUTH)
7515 {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
7516 #endif /* ndef LOG_AUTH */
7517 #ifdef LOG_AUTHPRIV
7518 if (x == LOG_AUTHPRIV)
7519 {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
7520 #endif /* ndef LOG_AUTHPRIV */
7521 #ifdef LOG_CRON
7522 if (x == LOG_CRON)
7523 {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
7524 #endif /* ndef LOG_CRON */
7525 #ifdef LOG_DAEMON
7526 if (x == LOG_DAEMON)
7527 {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
7528 #endif /* ndef LOG_DAEMON */
7529 #ifdef LOG_FTP
7530 if (x == LOG_FTP)
7531 {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
7532 #endif /* ndef LOG_FTP */
7533 #ifdef LOG_KERN
7534 if (x == LOG_KERN)
7535 {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
7536 #endif /* ndef LOG_KERN */
7537 #ifdef LOG_LOCAL0
7538 if (x == LOG_LOCAL0)
7539 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;}
7540 #endif /* ndef LOG_LOCAL0 */
7541 #ifdef LOG_LOCAL1
7542 if (x == LOG_LOCAL1)
7543 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;}
7544 #endif /* ndef LOG_LOCAL1 */
7545 #ifdef LOG_LOCAL2
7546 if (x == LOG_LOCAL2)
7547 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;}
7548 #endif /* ndef LOG_LOCAL2 */
7549 #ifdef LOG_LOCAL3
7550 if (x == LOG_LOCAL3)
7551 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;}
7552 #endif /* ndef LOG_LOCAL3 */
7553 #ifdef LOG_LOCAL4
7554 if (x == LOG_LOCAL4)
7555 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;}
7556 #endif /* ndef LOG_LOCAL4 */
7557 #ifdef LOG_LOCAL5
7558 if (x == LOG_LOCAL5)
7559 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;}
7560 #endif /* ndef LOG_LOCAL5 */
7561 #ifdef LOG_LOCAL6
7562 if (x == LOG_LOCAL6)
7563 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;}
7564 #endif /* ndef LOG_LOCAL6 */
7565 #ifdef LOG_LOCAL7
7566 if (x == LOG_LOCAL7)
7567 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;}
7568 #endif /* ndef LOG_LOCAL7 */
7569 #ifdef LOG_LPR
7570 if (x == LOG_LPR)
7571 {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
7572 #endif /* ndef LOG_LPR */
7573 #ifdef LOG_MAIL
7574 if (x == LOG_MAIL)
7575 {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
7576 #endif /* ndef LOG_MAIL */
7577 #ifdef LOG_NEWS
7578 if (x == LOG_NEWS)
7579 {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
7580 #endif /* ndef LOG_NEWS */
7581 #ifdef LOG_SYSLOG
7582 if (x == LOG_SYSLOG)
7583 {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
7584 #endif /* ndef LOG_SYSLOG */
7585 #ifdef LOG_USER
7586 if (x == LOG_USER)
7587 {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
7588 #endif /* ndef LOG_USER */
7589 #ifdef LOG_UUCP
7590 if (x == LOG_UUCP)
7591 {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
7592 #endif /* ndef LOG_UUCP */
7593 errno = EINVAL; return -1;
7596 int Mono_Posix_FromSyslogLevel (int x, int *r)
7598 *r = 0;
7599 if (x == Mono_Posix_SyslogLevel_LOG_ALERT)
7600 #ifdef LOG_ALERT
7601 {*r = LOG_ALERT; return 0;}
7602 #else /* def LOG_ALERT */
7603 {errno = EINVAL; return -1;}
7604 #endif /* ndef LOG_ALERT */
7605 if (x == Mono_Posix_SyslogLevel_LOG_CRIT)
7606 #ifdef LOG_CRIT
7607 {*r = LOG_CRIT; return 0;}
7608 #else /* def LOG_CRIT */
7609 {errno = EINVAL; return -1;}
7610 #endif /* ndef LOG_CRIT */
7611 if (x == Mono_Posix_SyslogLevel_LOG_DEBUG)
7612 #ifdef LOG_DEBUG
7613 {*r = LOG_DEBUG; return 0;}
7614 #else /* def LOG_DEBUG */
7615 {errno = EINVAL; return -1;}
7616 #endif /* ndef LOG_DEBUG */
7617 if (x == Mono_Posix_SyslogLevel_LOG_EMERG)
7618 #ifdef LOG_EMERG
7619 {*r = LOG_EMERG; return 0;}
7620 #else /* def LOG_EMERG */
7621 {errno = EINVAL; return -1;}
7622 #endif /* ndef LOG_EMERG */
7623 if (x == Mono_Posix_SyslogLevel_LOG_ERR)
7624 #ifdef LOG_ERR
7625 {*r = LOG_ERR; return 0;}
7626 #else /* def LOG_ERR */
7627 {errno = EINVAL; return -1;}
7628 #endif /* ndef LOG_ERR */
7629 if (x == Mono_Posix_SyslogLevel_LOG_INFO)
7630 #ifdef LOG_INFO
7631 {*r = LOG_INFO; return 0;}
7632 #else /* def LOG_INFO */
7633 {errno = EINVAL; return -1;}
7634 #endif /* ndef LOG_INFO */
7635 if (x == Mono_Posix_SyslogLevel_LOG_NOTICE)
7636 #ifdef LOG_NOTICE
7637 {*r = LOG_NOTICE; return 0;}
7638 #else /* def LOG_NOTICE */
7639 {errno = EINVAL; return -1;}
7640 #endif /* ndef LOG_NOTICE */
7641 if (x == Mono_Posix_SyslogLevel_LOG_WARNING)
7642 #ifdef LOG_WARNING
7643 {*r = LOG_WARNING; return 0;}
7644 #else /* def LOG_WARNING */
7645 {errno = EINVAL; return -1;}
7646 #endif /* ndef LOG_WARNING */
7647 if (x == 0)
7648 return 0;
7649 errno = EINVAL; return -1;
7652 int Mono_Posix_ToSyslogLevel (int x, int *r)
7654 *r = 0;
7655 if (x == 0)
7656 return 0;
7657 #ifdef LOG_ALERT
7658 if (x == LOG_ALERT)
7659 {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;}
7660 #endif /* ndef LOG_ALERT */
7661 #ifdef LOG_CRIT
7662 if (x == LOG_CRIT)
7663 {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;}
7664 #endif /* ndef LOG_CRIT */
7665 #ifdef LOG_DEBUG
7666 if (x == LOG_DEBUG)
7667 {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
7668 #endif /* ndef LOG_DEBUG */
7669 #ifdef LOG_EMERG
7670 if (x == LOG_EMERG)
7671 {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
7672 #endif /* ndef LOG_EMERG */
7673 #ifdef LOG_ERR
7674 if (x == LOG_ERR)
7675 {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
7676 #endif /* ndef LOG_ERR */
7677 #ifdef LOG_INFO
7678 if (x == LOG_INFO)
7679 {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
7680 #endif /* ndef LOG_INFO */
7681 #ifdef LOG_NOTICE
7682 if (x == LOG_NOTICE)
7683 {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
7684 #endif /* ndef LOG_NOTICE */
7685 #ifdef LOG_WARNING
7686 if (x == LOG_WARNING)
7687 {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
7688 #endif /* ndef LOG_WARNING */
7689 errno = EINVAL; return -1;
7692 int Mono_Posix_FromSyslogOptions (int x, int *r)
7694 *r = 0;
7695 if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
7696 #ifdef LOG_CONS
7697 *r |= LOG_CONS;
7698 #else /* def LOG_CONS */
7699 {errno = EINVAL; return -1;}
7700 #endif /* ndef LOG_CONS */
7701 if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
7702 #ifdef LOG_NDELAY
7703 *r |= LOG_NDELAY;
7704 #else /* def LOG_NDELAY */
7705 {errno = EINVAL; return -1;}
7706 #endif /* ndef LOG_NDELAY */
7707 if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
7708 #ifdef LOG_NOWAIT
7709 *r |= LOG_NOWAIT;
7710 #else /* def LOG_NOWAIT */
7711 {errno = EINVAL; return -1;}
7712 #endif /* ndef LOG_NOWAIT */
7713 if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
7714 #ifdef LOG_ODELAY
7715 *r |= LOG_ODELAY;
7716 #else /* def LOG_ODELAY */
7717 {errno = EINVAL; return -1;}
7718 #endif /* ndef LOG_ODELAY */
7719 if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
7720 #ifdef LOG_PERROR
7721 *r |= LOG_PERROR;
7722 #else /* def LOG_PERROR */
7723 {errno = EINVAL; return -1;}
7724 #endif /* ndef LOG_PERROR */
7725 if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
7726 #ifdef LOG_PID
7727 *r |= LOG_PID;
7728 #else /* def LOG_PID */
7729 {errno = EINVAL; return -1;}
7730 #endif /* ndef LOG_PID */
7731 if (x == 0)
7732 return 0;
7733 return 0;
7736 int Mono_Posix_ToSyslogOptions (int x, int *r)
7738 *r = 0;
7739 if (x == 0)
7740 return 0;
7741 #ifdef LOG_CONS
7742 if ((x & LOG_CONS) == LOG_CONS)
7743 *r |= Mono_Posix_SyslogOptions_LOG_CONS;
7744 #endif /* ndef LOG_CONS */
7745 #ifdef LOG_NDELAY
7746 if ((x & LOG_NDELAY) == LOG_NDELAY)
7747 *r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
7748 #endif /* ndef LOG_NDELAY */
7749 #ifdef LOG_NOWAIT
7750 if ((x & LOG_NOWAIT) == LOG_NOWAIT)
7751 *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
7752 #endif /* ndef LOG_NOWAIT */
7753 #ifdef LOG_ODELAY
7754 if ((x & LOG_ODELAY) == LOG_ODELAY)
7755 *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
7756 #endif /* ndef LOG_ODELAY */
7757 #ifdef LOG_PERROR
7758 if ((x & LOG_PERROR) == LOG_PERROR)
7759 *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
7760 #endif /* ndef LOG_PERROR */
7761 #ifdef LOG_PID
7762 if ((x & LOG_PID) == LOG_PID)
7763 *r |= Mono_Posix_SyslogOptions_LOG_PID;
7764 #endif /* ndef LOG_PID */
7765 return 0;
7768 #ifdef HAVE_STRUCT_TIMESPEC
7770 Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
7772 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7773 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7775 memset (to, 0, sizeof(*to));
7777 to->tv_sec = from->tv_sec;
7778 to->tv_nsec = from->tv_nsec;
7780 return 0;
7782 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7785 #ifdef HAVE_STRUCT_TIMESPEC
7787 Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
7789 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7790 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7792 memset (to, 0, sizeof(*to));
7794 to->tv_sec = from->tv_sec;
7795 to->tv_nsec = from->tv_nsec;
7797 return 0;
7799 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7802 #ifdef HAVE_STRUCT_TIMEVAL
7804 Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
7806 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7807 _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
7809 memset (to, 0, sizeof(*to));
7811 to->tv_sec = from->tv_sec;
7812 to->tv_usec = from->tv_usec;
7814 return 0;
7816 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7819 #ifdef HAVE_STRUCT_TIMEVAL
7821 Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
7823 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7824 _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
7826 memset (to, 0, sizeof(*to));
7828 to->tv_sec = from->tv_sec;
7829 to->tv_usec = from->tv_usec;
7831 return 0;
7833 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7836 #ifdef HAVE_STRUCT_TIMEZONE
7838 Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
7840 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7841 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7843 memset (to, 0, sizeof(*to));
7845 to->tz_minuteswest = from->tz_minuteswest;
7846 to->tz_dsttime = from->tz_dsttime;
7848 return 0;
7850 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7853 #ifdef HAVE_STRUCT_TIMEZONE
7855 Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
7857 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7858 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7860 memset (to, 0, sizeof(*to));
7862 to->tz_minuteswest = from->tz_minuteswest;
7863 to->tz_dsttime = from->tz_dsttime;
7865 return 0;
7867 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7870 int Mono_Posix_FromUnixAddressFamily (int x, int *r)
7872 *r = 0;
7873 if (x == Mono_Posix_UnixAddressFamily_AF_ALG)
7874 #ifdef AF_ALG
7875 {*r = AF_ALG; return 0;}
7876 #else /* def AF_ALG */
7877 {errno = EINVAL; return -1;}
7878 #endif /* ndef AF_ALG */
7879 if (x == Mono_Posix_UnixAddressFamily_AF_APPLETALK)
7880 #ifdef AF_APPLETALK
7881 {*r = AF_APPLETALK; return 0;}
7882 #else /* def AF_APPLETALK */
7883 {errno = EINVAL; return -1;}
7884 #endif /* ndef AF_APPLETALK */
7885 if (x == Mono_Posix_UnixAddressFamily_AF_ASH)
7886 #ifdef AF_ASH
7887 {*r = AF_ASH; return 0;}
7888 #else /* def AF_ASH */
7889 {errno = EINVAL; return -1;}
7890 #endif /* ndef AF_ASH */
7891 if (x == Mono_Posix_UnixAddressFamily_AF_ATMPVC)
7892 #ifdef AF_ATMPVC
7893 {*r = AF_ATMPVC; return 0;}
7894 #else /* def AF_ATMPVC */
7895 {errno = EINVAL; return -1;}
7896 #endif /* ndef AF_ATMPVC */
7897 if (x == Mono_Posix_UnixAddressFamily_AF_ATMSVC)
7898 #ifdef AF_ATMSVC
7899 {*r = AF_ATMSVC; return 0;}
7900 #else /* def AF_ATMSVC */
7901 {errno = EINVAL; return -1;}
7902 #endif /* ndef AF_ATMSVC */
7903 if (x == Mono_Posix_UnixAddressFamily_AF_AX25)
7904 #ifdef AF_AX25
7905 {*r = AF_AX25; return 0;}
7906 #else /* def AF_AX25 */
7907 {errno = EINVAL; return -1;}
7908 #endif /* ndef AF_AX25 */
7909 if (x == Mono_Posix_UnixAddressFamily_AF_BLUETOOTH)
7910 #ifdef AF_BLUETOOTH
7911 {*r = AF_BLUETOOTH; return 0;}
7912 #else /* def AF_BLUETOOTH */
7913 {errno = EINVAL; return -1;}
7914 #endif /* ndef AF_BLUETOOTH */
7915 if (x == Mono_Posix_UnixAddressFamily_AF_BRIDGE)
7916 #ifdef AF_BRIDGE
7917 {*r = AF_BRIDGE; return 0;}
7918 #else /* def AF_BRIDGE */
7919 {errno = EINVAL; return -1;}
7920 #endif /* ndef AF_BRIDGE */
7921 if (x == Mono_Posix_UnixAddressFamily_AF_CAIF)
7922 #ifdef AF_CAIF
7923 {*r = AF_CAIF; return 0;}
7924 #else /* def AF_CAIF */
7925 {errno = EINVAL; return -1;}
7926 #endif /* ndef AF_CAIF */
7927 if (x == Mono_Posix_UnixAddressFamily_AF_CAN)
7928 #ifdef AF_CAN
7929 {*r = AF_CAN; return 0;}
7930 #else /* def AF_CAN */
7931 {errno = EINVAL; return -1;}
7932 #endif /* ndef AF_CAN */
7933 if (x == Mono_Posix_UnixAddressFamily_AF_DECnet)
7934 #ifdef AF_DECnet
7935 {*r = AF_DECnet; return 0;}
7936 #else /* def AF_DECnet */
7937 {errno = EINVAL; return -1;}
7938 #endif /* ndef AF_DECnet */
7939 if (x == Mono_Posix_UnixAddressFamily_AF_ECONET)
7940 #ifdef AF_ECONET
7941 {*r = AF_ECONET; return 0;}
7942 #else /* def AF_ECONET */
7943 {errno = EINVAL; return -1;}
7944 #endif /* ndef AF_ECONET */
7945 if (x == Mono_Posix_UnixAddressFamily_AF_IEEE802154)
7946 #ifdef AF_IEEE802154
7947 {*r = AF_IEEE802154; return 0;}
7948 #else /* def AF_IEEE802154 */
7949 {errno = EINVAL; return -1;}
7950 #endif /* ndef AF_IEEE802154 */
7951 if (x == Mono_Posix_UnixAddressFamily_AF_INET)
7952 #ifdef AF_INET
7953 {*r = AF_INET; return 0;}
7954 #else /* def AF_INET */
7955 {errno = EINVAL; return -1;}
7956 #endif /* ndef AF_INET */
7957 if (x == Mono_Posix_UnixAddressFamily_AF_INET6)
7958 #ifdef AF_INET6
7959 {*r = AF_INET6; return 0;}
7960 #else /* def AF_INET6 */
7961 {errno = EINVAL; return -1;}
7962 #endif /* ndef AF_INET6 */
7963 if (x == Mono_Posix_UnixAddressFamily_AF_IPX)
7964 #ifdef AF_IPX
7965 {*r = AF_IPX; return 0;}
7966 #else /* def AF_IPX */
7967 {errno = EINVAL; return -1;}
7968 #endif /* ndef AF_IPX */
7969 if (x == Mono_Posix_UnixAddressFamily_AF_IRDA)
7970 #ifdef AF_IRDA
7971 {*r = AF_IRDA; return 0;}
7972 #else /* def AF_IRDA */
7973 {errno = EINVAL; return -1;}
7974 #endif /* ndef AF_IRDA */
7975 if (x == Mono_Posix_UnixAddressFamily_AF_ISDN)
7976 #ifdef AF_ISDN
7977 {*r = AF_ISDN; return 0;}
7978 #else /* def AF_ISDN */
7979 {errno = EINVAL; return -1;}
7980 #endif /* ndef AF_ISDN */
7981 if (x == Mono_Posix_UnixAddressFamily_AF_IUCV)
7982 #ifdef AF_IUCV
7983 {*r = AF_IUCV; return 0;}
7984 #else /* def AF_IUCV */
7985 {errno = EINVAL; return -1;}
7986 #endif /* ndef AF_IUCV */
7987 if (x == Mono_Posix_UnixAddressFamily_AF_KEY)
7988 #ifdef AF_KEY
7989 {*r = AF_KEY; return 0;}
7990 #else /* def AF_KEY */
7991 {errno = EINVAL; return -1;}
7992 #endif /* ndef AF_KEY */
7993 if (x == Mono_Posix_UnixAddressFamily_AF_LLC)
7994 #ifdef AF_LLC
7995 {*r = AF_LLC; return 0;}
7996 #else /* def AF_LLC */
7997 {errno = EINVAL; return -1;}
7998 #endif /* ndef AF_LLC */
7999 if (x == Mono_Posix_UnixAddressFamily_AF_NETBEUI)
8000 #ifdef AF_NETBEUI
8001 {*r = AF_NETBEUI; return 0;}
8002 #else /* def AF_NETBEUI */
8003 {errno = EINVAL; return -1;}
8004 #endif /* ndef AF_NETBEUI */
8005 if (x == Mono_Posix_UnixAddressFamily_AF_NETLINK)
8006 #ifdef AF_NETLINK
8007 {*r = AF_NETLINK; return 0;}
8008 #else /* def AF_NETLINK */
8009 {errno = EINVAL; return -1;}
8010 #endif /* ndef AF_NETLINK */
8011 if (x == Mono_Posix_UnixAddressFamily_AF_NETROM)
8012 #ifdef AF_NETROM
8013 {*r = AF_NETROM; return 0;}
8014 #else /* def AF_NETROM */
8015 {errno = EINVAL; return -1;}
8016 #endif /* ndef AF_NETROM */
8017 if (x == Mono_Posix_UnixAddressFamily_AF_NFC)
8018 #ifdef AF_NFC
8019 {*r = AF_NFC; return 0;}
8020 #else /* def AF_NFC */
8021 {errno = EINVAL; return -1;}
8022 #endif /* ndef AF_NFC */
8023 if (x == Mono_Posix_UnixAddressFamily_AF_PACKET)
8024 #ifdef AF_PACKET
8025 {*r = AF_PACKET; return 0;}
8026 #else /* def AF_PACKET */
8027 {errno = EINVAL; return -1;}
8028 #endif /* ndef AF_PACKET */
8029 if (x == Mono_Posix_UnixAddressFamily_AF_PHONET)
8030 #ifdef AF_PHONET
8031 {*r = AF_PHONET; return 0;}
8032 #else /* def AF_PHONET */
8033 {errno = EINVAL; return -1;}
8034 #endif /* ndef AF_PHONET */
8035 if (x == Mono_Posix_UnixAddressFamily_AF_PPPOX)
8036 #ifdef AF_PPPOX
8037 {*r = AF_PPPOX; return 0;}
8038 #else /* def AF_PPPOX */
8039 {errno = EINVAL; return -1;}
8040 #endif /* ndef AF_PPPOX */
8041 if (x == Mono_Posix_UnixAddressFamily_AF_RDS)
8042 #ifdef AF_RDS
8043 {*r = AF_RDS; return 0;}
8044 #else /* def AF_RDS */
8045 {errno = EINVAL; return -1;}
8046 #endif /* ndef AF_RDS */
8047 if (x == Mono_Posix_UnixAddressFamily_AF_ROSE)
8048 #ifdef AF_ROSE
8049 {*r = AF_ROSE; return 0;}
8050 #else /* def AF_ROSE */
8051 {errno = EINVAL; return -1;}
8052 #endif /* ndef AF_ROSE */
8053 if (x == Mono_Posix_UnixAddressFamily_AF_RXRPC)
8054 #ifdef AF_RXRPC
8055 {*r = AF_RXRPC; return 0;}
8056 #else /* def AF_RXRPC */
8057 {errno = EINVAL; return -1;}
8058 #endif /* ndef AF_RXRPC */
8059 if (x == Mono_Posix_UnixAddressFamily_AF_SECURITY)
8060 #ifdef AF_SECURITY
8061 {*r = AF_SECURITY; return 0;}
8062 #else /* def AF_SECURITY */
8063 {errno = EINVAL; return -1;}
8064 #endif /* ndef AF_SECURITY */
8065 if (x == Mono_Posix_UnixAddressFamily_AF_SNA)
8066 #ifdef AF_SNA
8067 {*r = AF_SNA; return 0;}
8068 #else /* def AF_SNA */
8069 {errno = EINVAL; return -1;}
8070 #endif /* ndef AF_SNA */
8071 if (x == Mono_Posix_UnixAddressFamily_AF_TIPC)
8072 #ifdef AF_TIPC
8073 {*r = AF_TIPC; return 0;}
8074 #else /* def AF_TIPC */
8075 {errno = EINVAL; return -1;}
8076 #endif /* ndef AF_TIPC */
8077 if (x == Mono_Posix_UnixAddressFamily_AF_UNIX)
8078 #ifdef AF_UNIX
8079 {*r = AF_UNIX; return 0;}
8080 #else /* def AF_UNIX */
8081 {errno = EINVAL; return -1;}
8082 #endif /* ndef AF_UNIX */
8083 if (x == Mono_Posix_UnixAddressFamily_AF_UNSPEC)
8084 #ifdef AF_UNSPEC
8085 {*r = AF_UNSPEC; return 0;}
8086 #else /* def AF_UNSPEC */
8087 {errno = EINVAL; return -1;}
8088 #endif /* ndef AF_UNSPEC */
8089 if (x == Mono_Posix_UnixAddressFamily_AF_VSOCK)
8090 #ifdef AF_VSOCK
8091 {*r = AF_VSOCK; return 0;}
8092 #else /* def AF_VSOCK */
8093 {errno = EINVAL; return -1;}
8094 #endif /* ndef AF_VSOCK */
8095 if (x == Mono_Posix_UnixAddressFamily_AF_WANPIPE)
8096 #ifdef AF_WANPIPE
8097 {*r = AF_WANPIPE; return 0;}
8098 #else /* def AF_WANPIPE */
8099 {errno = EINVAL; return -1;}
8100 #endif /* ndef AF_WANPIPE */
8101 if (x == Mono_Posix_UnixAddressFamily_AF_X25)
8102 #ifdef AF_X25
8103 {*r = AF_X25; return 0;}
8104 #else /* def AF_X25 */
8105 {errno = EINVAL; return -1;}
8106 #endif /* ndef AF_X25 */
8107 if (x == Mono_Posix_UnixAddressFamily_Unknown)
8108 #ifdef Unknown
8109 {*r = Unknown; return 0;}
8110 #else /* def Unknown */
8111 {errno = EINVAL; return -1;}
8112 #endif /* ndef Unknown */
8113 if (x == 0)
8114 return 0;
8115 errno = EINVAL; return -1;
8118 int Mono_Posix_ToUnixAddressFamily (int x, int *r)
8120 *r = 0;
8121 if (x == 0)
8122 return 0;
8123 #ifdef AF_ALG
8124 if (x == AF_ALG)
8125 {*r = Mono_Posix_UnixAddressFamily_AF_ALG; return 0;}
8126 #endif /* ndef AF_ALG */
8127 #ifdef AF_APPLETALK
8128 if (x == AF_APPLETALK)
8129 {*r = Mono_Posix_UnixAddressFamily_AF_APPLETALK; return 0;}
8130 #endif /* ndef AF_APPLETALK */
8131 #ifdef AF_ASH
8132 if (x == AF_ASH)
8133 {*r = Mono_Posix_UnixAddressFamily_AF_ASH; return 0;}
8134 #endif /* ndef AF_ASH */
8135 #ifdef AF_ATMPVC
8136 if (x == AF_ATMPVC)
8137 {*r = Mono_Posix_UnixAddressFamily_AF_ATMPVC; return 0;}
8138 #endif /* ndef AF_ATMPVC */
8139 #ifdef AF_ATMSVC
8140 if (x == AF_ATMSVC)
8141 {*r = Mono_Posix_UnixAddressFamily_AF_ATMSVC; return 0;}
8142 #endif /* ndef AF_ATMSVC */
8143 #ifdef AF_AX25
8144 if (x == AF_AX25)
8145 {*r = Mono_Posix_UnixAddressFamily_AF_AX25; return 0;}
8146 #endif /* ndef AF_AX25 */
8147 #ifdef AF_BLUETOOTH
8148 if (x == AF_BLUETOOTH)
8149 {*r = Mono_Posix_UnixAddressFamily_AF_BLUETOOTH; return 0;}
8150 #endif /* ndef AF_BLUETOOTH */
8151 #ifdef AF_BRIDGE
8152 if (x == AF_BRIDGE)
8153 {*r = Mono_Posix_UnixAddressFamily_AF_BRIDGE; return 0;}
8154 #endif /* ndef AF_BRIDGE */
8155 #ifdef AF_CAIF
8156 if (x == AF_CAIF)
8157 {*r = Mono_Posix_UnixAddressFamily_AF_CAIF; return 0;}
8158 #endif /* ndef AF_CAIF */
8159 #ifdef AF_CAN
8160 if (x == AF_CAN)
8161 {*r = Mono_Posix_UnixAddressFamily_AF_CAN; return 0;}
8162 #endif /* ndef AF_CAN */
8163 #ifdef AF_DECnet
8164 if (x == AF_DECnet)
8165 {*r = Mono_Posix_UnixAddressFamily_AF_DECnet; return 0;}
8166 #endif /* ndef AF_DECnet */
8167 #ifdef AF_ECONET
8168 if (x == AF_ECONET)
8169 {*r = Mono_Posix_UnixAddressFamily_AF_ECONET; return 0;}
8170 #endif /* ndef AF_ECONET */
8171 #ifdef AF_IEEE802154
8172 if (x == AF_IEEE802154)
8173 {*r = Mono_Posix_UnixAddressFamily_AF_IEEE802154; return 0;}
8174 #endif /* ndef AF_IEEE802154 */
8175 #ifdef AF_INET
8176 if (x == AF_INET)
8177 {*r = Mono_Posix_UnixAddressFamily_AF_INET; return 0;}
8178 #endif /* ndef AF_INET */
8179 #ifdef AF_INET6
8180 if (x == AF_INET6)
8181 {*r = Mono_Posix_UnixAddressFamily_AF_INET6; return 0;}
8182 #endif /* ndef AF_INET6 */
8183 #ifdef AF_IPX
8184 if (x == AF_IPX)
8185 {*r = Mono_Posix_UnixAddressFamily_AF_IPX; return 0;}
8186 #endif /* ndef AF_IPX */
8187 #ifdef AF_IRDA
8188 if (x == AF_IRDA)
8189 {*r = Mono_Posix_UnixAddressFamily_AF_IRDA; return 0;}
8190 #endif /* ndef AF_IRDA */
8191 #ifdef AF_ISDN
8192 if (x == AF_ISDN)
8193 {*r = Mono_Posix_UnixAddressFamily_AF_ISDN; return 0;}
8194 #endif /* ndef AF_ISDN */
8195 #ifdef AF_IUCV
8196 if (x == AF_IUCV)
8197 {*r = Mono_Posix_UnixAddressFamily_AF_IUCV; return 0;}
8198 #endif /* ndef AF_IUCV */
8199 #ifdef AF_KEY
8200 if (x == AF_KEY)
8201 {*r = Mono_Posix_UnixAddressFamily_AF_KEY; return 0;}
8202 #endif /* ndef AF_KEY */
8203 #ifdef AF_LLC
8204 if (x == AF_LLC)
8205 {*r = Mono_Posix_UnixAddressFamily_AF_LLC; return 0;}
8206 #endif /* ndef AF_LLC */
8207 #ifdef AF_NETBEUI
8208 if (x == AF_NETBEUI)
8209 {*r = Mono_Posix_UnixAddressFamily_AF_NETBEUI; return 0;}
8210 #endif /* ndef AF_NETBEUI */
8211 #ifdef AF_NETLINK
8212 if (x == AF_NETLINK)
8213 {*r = Mono_Posix_UnixAddressFamily_AF_NETLINK; return 0;}
8214 #endif /* ndef AF_NETLINK */
8215 #ifdef AF_NETROM
8216 if (x == AF_NETROM)
8217 {*r = Mono_Posix_UnixAddressFamily_AF_NETROM; return 0;}
8218 #endif /* ndef AF_NETROM */
8219 #ifdef AF_NFC
8220 if (x == AF_NFC)
8221 {*r = Mono_Posix_UnixAddressFamily_AF_NFC; return 0;}
8222 #endif /* ndef AF_NFC */
8223 #ifdef AF_PACKET
8224 if (x == AF_PACKET)
8225 {*r = Mono_Posix_UnixAddressFamily_AF_PACKET; return 0;}
8226 #endif /* ndef AF_PACKET */
8227 #ifdef AF_PHONET
8228 if (x == AF_PHONET)
8229 {*r = Mono_Posix_UnixAddressFamily_AF_PHONET; return 0;}
8230 #endif /* ndef AF_PHONET */
8231 #ifdef AF_PPPOX
8232 if (x == AF_PPPOX)
8233 {*r = Mono_Posix_UnixAddressFamily_AF_PPPOX; return 0;}
8234 #endif /* ndef AF_PPPOX */
8235 #ifdef AF_RDS
8236 if (x == AF_RDS)
8237 {*r = Mono_Posix_UnixAddressFamily_AF_RDS; return 0;}
8238 #endif /* ndef AF_RDS */
8239 #ifdef AF_ROSE
8240 if (x == AF_ROSE)
8241 {*r = Mono_Posix_UnixAddressFamily_AF_ROSE; return 0;}
8242 #endif /* ndef AF_ROSE */
8243 #ifdef AF_RXRPC
8244 if (x == AF_RXRPC)
8245 {*r = Mono_Posix_UnixAddressFamily_AF_RXRPC; return 0;}
8246 #endif /* ndef AF_RXRPC */
8247 #ifdef AF_SECURITY
8248 if (x == AF_SECURITY)
8249 {*r = Mono_Posix_UnixAddressFamily_AF_SECURITY; return 0;}
8250 #endif /* ndef AF_SECURITY */
8251 #ifdef AF_SNA
8252 if (x == AF_SNA)
8253 {*r = Mono_Posix_UnixAddressFamily_AF_SNA; return 0;}
8254 #endif /* ndef AF_SNA */
8255 #ifdef AF_TIPC
8256 if (x == AF_TIPC)
8257 {*r = Mono_Posix_UnixAddressFamily_AF_TIPC; return 0;}
8258 #endif /* ndef AF_TIPC */
8259 #ifdef AF_UNIX
8260 if (x == AF_UNIX)
8261 {*r = Mono_Posix_UnixAddressFamily_AF_UNIX; return 0;}
8262 #endif /* ndef AF_UNIX */
8263 #ifdef AF_UNSPEC
8264 if (x == AF_UNSPEC)
8265 {*r = Mono_Posix_UnixAddressFamily_AF_UNSPEC; return 0;}
8266 #endif /* ndef AF_UNSPEC */
8267 #ifdef AF_VSOCK
8268 if (x == AF_VSOCK)
8269 {*r = Mono_Posix_UnixAddressFamily_AF_VSOCK; return 0;}
8270 #endif /* ndef AF_VSOCK */
8271 #ifdef AF_WANPIPE
8272 if (x == AF_WANPIPE)
8273 {*r = Mono_Posix_UnixAddressFamily_AF_WANPIPE; return 0;}
8274 #endif /* ndef AF_WANPIPE */
8275 #ifdef AF_X25
8276 if (x == AF_X25)
8277 {*r = Mono_Posix_UnixAddressFamily_AF_X25; return 0;}
8278 #endif /* ndef AF_X25 */
8279 #ifdef Unknown
8280 if (x == Unknown)
8281 {*r = Mono_Posix_UnixAddressFamily_Unknown; return 0;}
8282 #endif /* ndef Unknown */
8283 errno = EINVAL; return -1;
8286 int Mono_Posix_FromUnixSocketControlMessage (int x, int *r)
8288 *r = 0;
8289 if (x == Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS)
8290 #ifdef SCM_CREDENTIALS
8291 {*r = SCM_CREDENTIALS; return 0;}
8292 #else /* def SCM_CREDENTIALS */
8293 {errno = EINVAL; return -1;}
8294 #endif /* ndef SCM_CREDENTIALS */
8295 if (x == Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS)
8296 #ifdef SCM_RIGHTS
8297 {*r = SCM_RIGHTS; return 0;}
8298 #else /* def SCM_RIGHTS */
8299 {errno = EINVAL; return -1;}
8300 #endif /* ndef SCM_RIGHTS */
8301 if (x == 0)
8302 return 0;
8303 errno = EINVAL; return -1;
8306 int Mono_Posix_ToUnixSocketControlMessage (int x, int *r)
8308 *r = 0;
8309 if (x == 0)
8310 return 0;
8311 #ifdef SCM_CREDENTIALS
8312 if (x == SCM_CREDENTIALS)
8313 {*r = Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS; return 0;}
8314 #endif /* ndef SCM_CREDENTIALS */
8315 #ifdef SCM_RIGHTS
8316 if (x == SCM_RIGHTS)
8317 {*r = Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS; return 0;}
8318 #endif /* ndef SCM_RIGHTS */
8319 errno = EINVAL; return -1;
8322 int Mono_Posix_FromUnixSocketFlags (int x, int *r)
8324 *r = 0;
8325 if ((x & Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC) == Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC)
8326 #ifdef SOCK_CLOEXEC
8327 *r |= SOCK_CLOEXEC;
8328 #else /* def SOCK_CLOEXEC */
8329 {errno = EINVAL; return -1;}
8330 #endif /* ndef SOCK_CLOEXEC */
8331 if ((x & Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK) == Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK)
8332 #ifdef SOCK_NONBLOCK
8333 *r |= SOCK_NONBLOCK;
8334 #else /* def SOCK_NONBLOCK */
8335 {errno = EINVAL; return -1;}
8336 #endif /* ndef SOCK_NONBLOCK */
8337 if (x == 0)
8338 return 0;
8339 return 0;
8342 int Mono_Posix_ToUnixSocketFlags (int x, int *r)
8344 *r = 0;
8345 if (x == 0)
8346 return 0;
8347 #ifdef SOCK_CLOEXEC
8348 if ((x & SOCK_CLOEXEC) == SOCK_CLOEXEC)
8349 *r |= Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC;
8350 #endif /* ndef SOCK_CLOEXEC */
8351 #ifdef SOCK_NONBLOCK
8352 if ((x & SOCK_NONBLOCK) == SOCK_NONBLOCK)
8353 *r |= Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK;
8354 #endif /* ndef SOCK_NONBLOCK */
8355 return 0;
8358 int Mono_Posix_FromUnixSocketOptionName (int x, int *r)
8360 *r = 0;
8361 if (x == Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN)
8362 #ifdef SO_ACCEPTCONN
8363 {*r = SO_ACCEPTCONN; return 0;}
8364 #else /* def SO_ACCEPTCONN */
8365 {errno = EINVAL; return -1;}
8366 #endif /* ndef SO_ACCEPTCONN */
8367 if (x == Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER)
8368 #ifdef SO_ATTACH_FILTER
8369 {*r = SO_ATTACH_FILTER; return 0;}
8370 #else /* def SO_ATTACH_FILTER */
8371 {errno = EINVAL; return -1;}
8372 #endif /* ndef SO_ATTACH_FILTER */
8373 if (x == Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE)
8374 #ifdef SO_BINDTODEVICE
8375 {*r = SO_BINDTODEVICE; return 0;}
8376 #else /* def SO_BINDTODEVICE */
8377 {errno = EINVAL; return -1;}
8378 #endif /* ndef SO_BINDTODEVICE */
8379 if (x == Mono_Posix_UnixSocketOptionName_SO_BROADCAST)
8380 #ifdef SO_BROADCAST
8381 {*r = SO_BROADCAST; return 0;}
8382 #else /* def SO_BROADCAST */
8383 {errno = EINVAL; return -1;}
8384 #endif /* ndef SO_BROADCAST */
8385 if (x == Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT)
8386 #ifdef SO_BSDCOMPAT
8387 {*r = SO_BSDCOMPAT; return 0;}
8388 #else /* def SO_BSDCOMPAT */
8389 {errno = EINVAL; return -1;}
8390 #endif /* ndef SO_BSDCOMPAT */
8391 if (x == Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL)
8392 #ifdef SO_BUSY_POLL
8393 {*r = SO_BUSY_POLL; return 0;}
8394 #else /* def SO_BUSY_POLL */
8395 {errno = EINVAL; return -1;}
8396 #endif /* ndef SO_BUSY_POLL */
8397 if (x == Mono_Posix_UnixSocketOptionName_SO_DEBUG)
8398 #ifdef SO_DEBUG
8399 {*r = SO_DEBUG; return 0;}
8400 #else /* def SO_DEBUG */
8401 {errno = EINVAL; return -1;}
8402 #endif /* ndef SO_DEBUG */
8403 if (x == Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER)
8404 #ifdef SO_DETACH_FILTER
8405 {*r = SO_DETACH_FILTER; return 0;}
8406 #else /* def SO_DETACH_FILTER */
8407 {errno = EINVAL; return -1;}
8408 #endif /* ndef SO_DETACH_FILTER */
8409 if (x == Mono_Posix_UnixSocketOptionName_SO_DOMAIN)
8410 #ifdef SO_DOMAIN
8411 {*r = SO_DOMAIN; return 0;}
8412 #else /* def SO_DOMAIN */
8413 {errno = EINVAL; return -1;}
8414 #endif /* ndef SO_DOMAIN */
8415 if (x == Mono_Posix_UnixSocketOptionName_SO_DONTROUTE)
8416 #ifdef SO_DONTROUTE
8417 {*r = SO_DONTROUTE; return 0;}
8418 #else /* def SO_DONTROUTE */
8419 {errno = EINVAL; return -1;}
8420 #endif /* ndef SO_DONTROUTE */
8421 if (x == Mono_Posix_UnixSocketOptionName_SO_ERROR)
8422 #ifdef SO_ERROR
8423 {*r = SO_ERROR; return 0;}
8424 #else /* def SO_ERROR */
8425 {errno = EINVAL; return -1;}
8426 #endif /* ndef SO_ERROR */
8427 if (x == Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE)
8428 #ifdef SO_KEEPALIVE
8429 {*r = SO_KEEPALIVE; return 0;}
8430 #else /* def SO_KEEPALIVE */
8431 {errno = EINVAL; return -1;}
8432 #endif /* ndef SO_KEEPALIVE */
8433 if (x == Mono_Posix_UnixSocketOptionName_SO_LINGER)
8434 #ifdef SO_LINGER
8435 {*r = SO_LINGER; return 0;}
8436 #else /* def SO_LINGER */
8437 {errno = EINVAL; return -1;}
8438 #endif /* ndef SO_LINGER */
8439 if (x == Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER)
8440 #ifdef SO_LOCK_FILTER
8441 {*r = SO_LOCK_FILTER; return 0;}
8442 #else /* def SO_LOCK_FILTER */
8443 {errno = EINVAL; return -1;}
8444 #endif /* ndef SO_LOCK_FILTER */
8445 if (x == Mono_Posix_UnixSocketOptionName_SO_MARK)
8446 #ifdef SO_MARK
8447 {*r = SO_MARK; return 0;}
8448 #else /* def SO_MARK */
8449 {errno = EINVAL; return -1;}
8450 #endif /* ndef SO_MARK */
8451 if (x == Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE)
8452 #ifdef SO_MAX_PACING_RATE
8453 {*r = SO_MAX_PACING_RATE; return 0;}
8454 #else /* def SO_MAX_PACING_RATE */
8455 {errno = EINVAL; return -1;}
8456 #endif /* ndef SO_MAX_PACING_RATE */
8457 if (x == Mono_Posix_UnixSocketOptionName_SO_NOFCS)
8458 #ifdef SO_NOFCS
8459 {*r = SO_NOFCS; return 0;}
8460 #else /* def SO_NOFCS */
8461 {errno = EINVAL; return -1;}
8462 #endif /* ndef SO_NOFCS */
8463 if (x == Mono_Posix_UnixSocketOptionName_SO_NO_CHECK)
8464 #ifdef SO_NO_CHECK
8465 {*r = SO_NO_CHECK; return 0;}
8466 #else /* def SO_NO_CHECK */
8467 {errno = EINVAL; return -1;}
8468 #endif /* ndef SO_NO_CHECK */
8469 if (x == Mono_Posix_UnixSocketOptionName_SO_OOBINLINE)
8470 #ifdef SO_OOBINLINE
8471 {*r = SO_OOBINLINE; return 0;}
8472 #else /* def SO_OOBINLINE */
8473 {errno = EINVAL; return -1;}
8474 #endif /* ndef SO_OOBINLINE */
8475 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSCRED)
8476 #ifdef SO_PASSCRED
8477 {*r = SO_PASSCRED; return 0;}
8478 #else /* def SO_PASSCRED */
8479 {errno = EINVAL; return -1;}
8480 #endif /* ndef SO_PASSCRED */
8481 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSSEC)
8482 #ifdef SO_PASSSEC
8483 {*r = SO_PASSSEC; return 0;}
8484 #else /* def SO_PASSSEC */
8485 {errno = EINVAL; return -1;}
8486 #endif /* ndef SO_PASSSEC */
8487 if (x == Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF)
8488 #ifdef SO_PEEK_OFF
8489 {*r = SO_PEEK_OFF; return 0;}
8490 #else /* def SO_PEEK_OFF */
8491 {errno = EINVAL; return -1;}
8492 #endif /* ndef SO_PEEK_OFF */
8493 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERCRED)
8494 #ifdef SO_PEERCRED
8495 {*r = SO_PEERCRED; return 0;}
8496 #else /* def SO_PEERCRED */
8497 {errno = EINVAL; return -1;}
8498 #endif /* ndef SO_PEERCRED */
8499 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERNAME)
8500 #ifdef SO_PEERNAME
8501 {*r = SO_PEERNAME; return 0;}
8502 #else /* def SO_PEERNAME */
8503 {errno = EINVAL; return -1;}
8504 #endif /* ndef SO_PEERNAME */
8505 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERSEC)
8506 #ifdef SO_PEERSEC
8507 {*r = SO_PEERSEC; return 0;}
8508 #else /* def SO_PEERSEC */
8509 {errno = EINVAL; return -1;}
8510 #endif /* ndef SO_PEERSEC */
8511 if (x == Mono_Posix_UnixSocketOptionName_SO_PRIORITY)
8512 #ifdef SO_PRIORITY
8513 {*r = SO_PRIORITY; return 0;}
8514 #else /* def SO_PRIORITY */
8515 {errno = EINVAL; return -1;}
8516 #endif /* ndef SO_PRIORITY */
8517 if (x == Mono_Posix_UnixSocketOptionName_SO_PROTOCOL)
8518 #ifdef SO_PROTOCOL
8519 {*r = SO_PROTOCOL; return 0;}
8520 #else /* def SO_PROTOCOL */
8521 {errno = EINVAL; return -1;}
8522 #endif /* ndef SO_PROTOCOL */
8523 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUF)
8524 #ifdef SO_RCVBUF
8525 {*r = SO_RCVBUF; return 0;}
8526 #else /* def SO_RCVBUF */
8527 {errno = EINVAL; return -1;}
8528 #endif /* ndef SO_RCVBUF */
8529 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE)
8530 #ifdef SO_RCVBUFFORCE
8531 {*r = SO_RCVBUFFORCE; return 0;}
8532 #else /* def SO_RCVBUFFORCE */
8533 {errno = EINVAL; return -1;}
8534 #endif /* ndef SO_RCVBUFFORCE */
8535 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT)
8536 #ifdef SO_RCVLOWAT
8537 {*r = SO_RCVLOWAT; return 0;}
8538 #else /* def SO_RCVLOWAT */
8539 {errno = EINVAL; return -1;}
8540 #endif /* ndef SO_RCVLOWAT */
8541 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO)
8542 #ifdef SO_RCVTIMEO
8543 {*r = SO_RCVTIMEO; return 0;}
8544 #else /* def SO_RCVTIMEO */
8545 {errno = EINVAL; return -1;}
8546 #endif /* ndef SO_RCVTIMEO */
8547 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEADDR)
8548 #ifdef SO_REUSEADDR
8549 {*r = SO_REUSEADDR; return 0;}
8550 #else /* def SO_REUSEADDR */
8551 {errno = EINVAL; return -1;}
8552 #endif /* ndef SO_REUSEADDR */
8553 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEPORT)
8554 #ifdef SO_REUSEPORT
8555 {*r = SO_REUSEPORT; return 0;}
8556 #else /* def SO_REUSEPORT */
8557 {errno = EINVAL; return -1;}
8558 #endif /* ndef SO_REUSEPORT */
8559 if (x == Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL)
8560 #ifdef SO_RXQ_OVFL
8561 {*r = SO_RXQ_OVFL; return 0;}
8562 #else /* def SO_RXQ_OVFL */
8563 {errno = EINVAL; return -1;}
8564 #endif /* ndef SO_RXQ_OVFL */
8565 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION)
8566 #ifdef SO_SECURITY_AUTHENTICATION
8567 {*r = SO_SECURITY_AUTHENTICATION; return 0;}
8568 #else /* def SO_SECURITY_AUTHENTICATION */
8569 {errno = EINVAL; return -1;}
8570 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8571 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK)
8572 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8573 {*r = SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8574 #else /* def SO_SECURITY_ENCRYPTION_NETWORK */
8575 {errno = EINVAL; return -1;}
8576 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8577 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT)
8578 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8579 {*r = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8580 #else /* def SO_SECURITY_ENCRYPTION_TRANSPORT */
8581 {errno = EINVAL; return -1;}
8582 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8583 if (x == Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE)
8584 #ifdef SO_SELECT_ERR_QUEUE
8585 {*r = SO_SELECT_ERR_QUEUE; return 0;}
8586 #else /* def SO_SELECT_ERR_QUEUE */
8587 {errno = EINVAL; return -1;}
8588 #endif /* ndef SO_SELECT_ERR_QUEUE */
8589 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUF)
8590 #ifdef SO_SNDBUF
8591 {*r = SO_SNDBUF; return 0;}
8592 #else /* def SO_SNDBUF */
8593 {errno = EINVAL; return -1;}
8594 #endif /* ndef SO_SNDBUF */
8595 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE)
8596 #ifdef SO_SNDBUFFORCE
8597 {*r = SO_SNDBUFFORCE; return 0;}
8598 #else /* def SO_SNDBUFFORCE */
8599 {errno = EINVAL; return -1;}
8600 #endif /* ndef SO_SNDBUFFORCE */
8601 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT)
8602 #ifdef SO_SNDLOWAT
8603 {*r = SO_SNDLOWAT; return 0;}
8604 #else /* def SO_SNDLOWAT */
8605 {errno = EINVAL; return -1;}
8606 #endif /* ndef SO_SNDLOWAT */
8607 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO)
8608 #ifdef SO_SNDTIMEO
8609 {*r = SO_SNDTIMEO; return 0;}
8610 #else /* def SO_SNDTIMEO */
8611 {errno = EINVAL; return -1;}
8612 #endif /* ndef SO_SNDTIMEO */
8613 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP)
8614 #ifdef SO_TIMESTAMP
8615 {*r = SO_TIMESTAMP; return 0;}
8616 #else /* def SO_TIMESTAMP */
8617 {errno = EINVAL; return -1;}
8618 #endif /* ndef SO_TIMESTAMP */
8619 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING)
8620 #ifdef SO_TIMESTAMPING
8621 {*r = SO_TIMESTAMPING; return 0;}
8622 #else /* def SO_TIMESTAMPING */
8623 {errno = EINVAL; return -1;}
8624 #endif /* ndef SO_TIMESTAMPING */
8625 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS)
8626 #ifdef SO_TIMESTAMPNS
8627 {*r = SO_TIMESTAMPNS; return 0;}
8628 #else /* def SO_TIMESTAMPNS */
8629 {errno = EINVAL; return -1;}
8630 #endif /* ndef SO_TIMESTAMPNS */
8631 if (x == Mono_Posix_UnixSocketOptionName_SO_TYPE)
8632 #ifdef SO_TYPE
8633 {*r = SO_TYPE; return 0;}
8634 #else /* def SO_TYPE */
8635 {errno = EINVAL; return -1;}
8636 #endif /* ndef SO_TYPE */
8637 if (x == Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS)
8638 #ifdef SO_WIFI_STATUS
8639 {*r = SO_WIFI_STATUS; return 0;}
8640 #else /* def SO_WIFI_STATUS */
8641 {errno = EINVAL; return -1;}
8642 #endif /* ndef SO_WIFI_STATUS */
8643 if (x == 0)
8644 return 0;
8645 errno = EINVAL; return -1;
8648 int Mono_Posix_ToUnixSocketOptionName (int x, int *r)
8650 *r = 0;
8651 if (x == 0)
8652 return 0;
8653 #ifdef SO_ACCEPTCONN
8654 if (x == SO_ACCEPTCONN)
8655 {*r = Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN; return 0;}
8656 #endif /* ndef SO_ACCEPTCONN */
8657 #ifdef SO_ATTACH_FILTER
8658 if (x == SO_ATTACH_FILTER)
8659 {*r = Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER; return 0;}
8660 #endif /* ndef SO_ATTACH_FILTER */
8661 #ifdef SO_BINDTODEVICE
8662 if (x == SO_BINDTODEVICE)
8663 {*r = Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE; return 0;}
8664 #endif /* ndef SO_BINDTODEVICE */
8665 #ifdef SO_BROADCAST
8666 if (x == SO_BROADCAST)
8667 {*r = Mono_Posix_UnixSocketOptionName_SO_BROADCAST; return 0;}
8668 #endif /* ndef SO_BROADCAST */
8669 #ifdef SO_BSDCOMPAT
8670 if (x == SO_BSDCOMPAT)
8671 {*r = Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT; return 0;}
8672 #endif /* ndef SO_BSDCOMPAT */
8673 #ifdef SO_BUSY_POLL
8674 if (x == SO_BUSY_POLL)
8675 {*r = Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL; return 0;}
8676 #endif /* ndef SO_BUSY_POLL */
8677 #ifdef SO_DEBUG
8678 if (x == SO_DEBUG)
8679 {*r = Mono_Posix_UnixSocketOptionName_SO_DEBUG; return 0;}
8680 #endif /* ndef SO_DEBUG */
8681 #ifdef SO_DETACH_FILTER
8682 if (x == SO_DETACH_FILTER)
8683 {*r = Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER; return 0;}
8684 #endif /* ndef SO_DETACH_FILTER */
8685 #ifdef SO_DOMAIN
8686 if (x == SO_DOMAIN)
8687 {*r = Mono_Posix_UnixSocketOptionName_SO_DOMAIN; return 0;}
8688 #endif /* ndef SO_DOMAIN */
8689 #ifdef SO_DONTROUTE
8690 if (x == SO_DONTROUTE)
8691 {*r = Mono_Posix_UnixSocketOptionName_SO_DONTROUTE; return 0;}
8692 #endif /* ndef SO_DONTROUTE */
8693 #ifdef SO_ERROR
8694 if (x == SO_ERROR)
8695 {*r = Mono_Posix_UnixSocketOptionName_SO_ERROR; return 0;}
8696 #endif /* ndef SO_ERROR */
8697 #ifdef SO_KEEPALIVE
8698 if (x == SO_KEEPALIVE)
8699 {*r = Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE; return 0;}
8700 #endif /* ndef SO_KEEPALIVE */
8701 #ifdef SO_LINGER
8702 if (x == SO_LINGER)
8703 {*r = Mono_Posix_UnixSocketOptionName_SO_LINGER; return 0;}
8704 #endif /* ndef SO_LINGER */
8705 #ifdef SO_LOCK_FILTER
8706 if (x == SO_LOCK_FILTER)
8707 {*r = Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER; return 0;}
8708 #endif /* ndef SO_LOCK_FILTER */
8709 #ifdef SO_MARK
8710 if (x == SO_MARK)
8711 {*r = Mono_Posix_UnixSocketOptionName_SO_MARK; return 0;}
8712 #endif /* ndef SO_MARK */
8713 #ifdef SO_MAX_PACING_RATE
8714 if (x == SO_MAX_PACING_RATE)
8715 {*r = Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE; return 0;}
8716 #endif /* ndef SO_MAX_PACING_RATE */
8717 #ifdef SO_NOFCS
8718 if (x == SO_NOFCS)
8719 {*r = Mono_Posix_UnixSocketOptionName_SO_NOFCS; return 0;}
8720 #endif /* ndef SO_NOFCS */
8721 #ifdef SO_NO_CHECK
8722 if (x == SO_NO_CHECK)
8723 {*r = Mono_Posix_UnixSocketOptionName_SO_NO_CHECK; return 0;}
8724 #endif /* ndef SO_NO_CHECK */
8725 #ifdef SO_OOBINLINE
8726 if (x == SO_OOBINLINE)
8727 {*r = Mono_Posix_UnixSocketOptionName_SO_OOBINLINE; return 0;}
8728 #endif /* ndef SO_OOBINLINE */
8729 #ifdef SO_PASSCRED
8730 if (x == SO_PASSCRED)
8731 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSCRED; return 0;}
8732 #endif /* ndef SO_PASSCRED */
8733 #ifdef SO_PASSSEC
8734 if (x == SO_PASSSEC)
8735 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSSEC; return 0;}
8736 #endif /* ndef SO_PASSSEC */
8737 #ifdef SO_PEEK_OFF
8738 if (x == SO_PEEK_OFF)
8739 {*r = Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF; return 0;}
8740 #endif /* ndef SO_PEEK_OFF */
8741 #ifdef SO_PEERCRED
8742 if (x == SO_PEERCRED)
8743 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERCRED; return 0;}
8744 #endif /* ndef SO_PEERCRED */
8745 #ifdef SO_PEERNAME
8746 if (x == SO_PEERNAME)
8747 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERNAME; return 0;}
8748 #endif /* ndef SO_PEERNAME */
8749 #ifdef SO_PEERSEC
8750 if (x == SO_PEERSEC)
8751 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERSEC; return 0;}
8752 #endif /* ndef SO_PEERSEC */
8753 #ifdef SO_PRIORITY
8754 if (x == SO_PRIORITY)
8755 {*r = Mono_Posix_UnixSocketOptionName_SO_PRIORITY; return 0;}
8756 #endif /* ndef SO_PRIORITY */
8757 #ifdef SO_PROTOCOL
8758 if (x == SO_PROTOCOL)
8759 {*r = Mono_Posix_UnixSocketOptionName_SO_PROTOCOL; return 0;}
8760 #endif /* ndef SO_PROTOCOL */
8761 #ifdef SO_RCVBUF
8762 if (x == SO_RCVBUF)
8763 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUF; return 0;}
8764 #endif /* ndef SO_RCVBUF */
8765 #ifdef SO_RCVBUFFORCE
8766 if (x == SO_RCVBUFFORCE)
8767 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE; return 0;}
8768 #endif /* ndef SO_RCVBUFFORCE */
8769 #ifdef SO_RCVLOWAT
8770 if (x == SO_RCVLOWAT)
8771 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT; return 0;}
8772 #endif /* ndef SO_RCVLOWAT */
8773 #ifdef SO_RCVTIMEO
8774 if (x == SO_RCVTIMEO)
8775 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO; return 0;}
8776 #endif /* ndef SO_RCVTIMEO */
8777 #ifdef SO_REUSEADDR
8778 if (x == SO_REUSEADDR)
8779 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEADDR; return 0;}
8780 #endif /* ndef SO_REUSEADDR */
8781 #ifdef SO_REUSEPORT
8782 if (x == SO_REUSEPORT)
8783 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEPORT; return 0;}
8784 #endif /* ndef SO_REUSEPORT */
8785 #ifdef SO_RXQ_OVFL
8786 if (x == SO_RXQ_OVFL)
8787 {*r = Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL; return 0;}
8788 #endif /* ndef SO_RXQ_OVFL */
8789 #ifdef SO_SECURITY_AUTHENTICATION
8790 if (x == SO_SECURITY_AUTHENTICATION)
8791 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION; return 0;}
8792 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8793 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8794 if (x == SO_SECURITY_ENCRYPTION_NETWORK)
8795 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8796 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8797 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8798 if (x == SO_SECURITY_ENCRYPTION_TRANSPORT)
8799 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8800 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8801 #ifdef SO_SELECT_ERR_QUEUE
8802 if (x == SO_SELECT_ERR_QUEUE)
8803 {*r = Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE; return 0;}
8804 #endif /* ndef SO_SELECT_ERR_QUEUE */
8805 #ifdef SO_SNDBUF
8806 if (x == SO_SNDBUF)
8807 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUF; return 0;}
8808 #endif /* ndef SO_SNDBUF */
8809 #ifdef SO_SNDBUFFORCE
8810 if (x == SO_SNDBUFFORCE)
8811 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE; return 0;}
8812 #endif /* ndef SO_SNDBUFFORCE */
8813 #ifdef SO_SNDLOWAT
8814 if (x == SO_SNDLOWAT)
8815 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT; return 0;}
8816 #endif /* ndef SO_SNDLOWAT */
8817 #ifdef SO_SNDTIMEO
8818 if (x == SO_SNDTIMEO)
8819 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO; return 0;}
8820 #endif /* ndef SO_SNDTIMEO */
8821 #ifdef SO_TIMESTAMP
8822 if (x == SO_TIMESTAMP)
8823 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP; return 0;}
8824 #endif /* ndef SO_TIMESTAMP */
8825 #ifdef SO_TIMESTAMPING
8826 if (x == SO_TIMESTAMPING)
8827 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING; return 0;}
8828 #endif /* ndef SO_TIMESTAMPING */
8829 #ifdef SO_TIMESTAMPNS
8830 if (x == SO_TIMESTAMPNS)
8831 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS; return 0;}
8832 #endif /* ndef SO_TIMESTAMPNS */
8833 #ifdef SO_TYPE
8834 if (x == SO_TYPE)
8835 {*r = Mono_Posix_UnixSocketOptionName_SO_TYPE; return 0;}
8836 #endif /* ndef SO_TYPE */
8837 #ifdef SO_WIFI_STATUS
8838 if (x == SO_WIFI_STATUS)
8839 {*r = Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS; return 0;}
8840 #endif /* ndef SO_WIFI_STATUS */
8841 errno = EINVAL; return -1;
8844 int Mono_Posix_FromUnixSocketProtocol (int x, int *r)
8846 *r = 0;
8847 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_AH)
8848 #ifdef IPPROTO_AH
8849 {*r = IPPROTO_AH; return 0;}
8850 #else /* def IPPROTO_AH */
8851 {errno = EINVAL; return -1;}
8852 #endif /* ndef IPPROTO_AH */
8853 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH)
8854 #ifdef IPPROTO_BEETPH
8855 {*r = IPPROTO_BEETPH; return 0;}
8856 #else /* def IPPROTO_BEETPH */
8857 {errno = EINVAL; return -1;}
8858 #endif /* ndef IPPROTO_BEETPH */
8859 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_COMP)
8860 #ifdef IPPROTO_COMP
8861 {*r = IPPROTO_COMP; return 0;}
8862 #else /* def IPPROTO_COMP */
8863 {errno = EINVAL; return -1;}
8864 #endif /* ndef IPPROTO_COMP */
8865 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP)
8866 #ifdef IPPROTO_DCCP
8867 {*r = IPPROTO_DCCP; return 0;}
8868 #else /* def IPPROTO_DCCP */
8869 {errno = EINVAL; return -1;}
8870 #endif /* ndef IPPROTO_DCCP */
8871 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_EGP)
8872 #ifdef IPPROTO_EGP
8873 {*r = IPPROTO_EGP; return 0;}
8874 #else /* def IPPROTO_EGP */
8875 {errno = EINVAL; return -1;}
8876 #endif /* ndef IPPROTO_EGP */
8877 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP)
8878 #ifdef IPPROTO_ENCAP
8879 {*r = IPPROTO_ENCAP; return 0;}
8880 #else /* def IPPROTO_ENCAP */
8881 {errno = EINVAL; return -1;}
8882 #endif /* ndef IPPROTO_ENCAP */
8883 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ESP)
8884 #ifdef IPPROTO_ESP
8885 {*r = IPPROTO_ESP; return 0;}
8886 #else /* def IPPROTO_ESP */
8887 {errno = EINVAL; return -1;}
8888 #endif /* ndef IPPROTO_ESP */
8889 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_GRE)
8890 #ifdef IPPROTO_GRE
8891 {*r = IPPROTO_GRE; return 0;}
8892 #else /* def IPPROTO_GRE */
8893 {errno = EINVAL; return -1;}
8894 #endif /* ndef IPPROTO_GRE */
8895 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP)
8896 #ifdef IPPROTO_ICMP
8897 {*r = IPPROTO_ICMP; return 0;}
8898 #else /* def IPPROTO_ICMP */
8899 {errno = EINVAL; return -1;}
8900 #endif /* ndef IPPROTO_ICMP */
8901 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IDP)
8902 #ifdef IPPROTO_IDP
8903 {*r = IPPROTO_IDP; return 0;}
8904 #else /* def IPPROTO_IDP */
8905 {errno = EINVAL; return -1;}
8906 #endif /* ndef IPPROTO_IDP */
8907 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP)
8908 #ifdef IPPROTO_IGMP
8909 {*r = IPPROTO_IGMP; return 0;}
8910 #else /* def IPPROTO_IGMP */
8911 {errno = EINVAL; return -1;}
8912 #endif /* ndef IPPROTO_IGMP */
8913 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IP)
8914 #ifdef IPPROTO_IP
8915 {*r = IPPROTO_IP; return 0;}
8916 #else /* def IPPROTO_IP */
8917 {errno = EINVAL; return -1;}
8918 #endif /* ndef IPPROTO_IP */
8919 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP)
8920 #ifdef IPPROTO_IPIP
8921 {*r = IPPROTO_IPIP; return 0;}
8922 #else /* def IPPROTO_IPIP */
8923 {errno = EINVAL; return -1;}
8924 #endif /* ndef IPPROTO_IPIP */
8925 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6)
8926 #ifdef IPPROTO_IPV6
8927 {*r = IPPROTO_IPV6; return 0;}
8928 #else /* def IPPROTO_IPV6 */
8929 {errno = EINVAL; return -1;}
8930 #endif /* ndef IPPROTO_IPV6 */
8931 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_MTP)
8932 #ifdef IPPROTO_MTP
8933 {*r = IPPROTO_MTP; return 0;}
8934 #else /* def IPPROTO_MTP */
8935 {errno = EINVAL; return -1;}
8936 #endif /* ndef IPPROTO_MTP */
8937 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PIM)
8938 #ifdef IPPROTO_PIM
8939 {*r = IPPROTO_PIM; return 0;}
8940 #else /* def IPPROTO_PIM */
8941 {errno = EINVAL; return -1;}
8942 #endif /* ndef IPPROTO_PIM */
8943 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PUP)
8944 #ifdef IPPROTO_PUP
8945 {*r = IPPROTO_PUP; return 0;}
8946 #else /* def IPPROTO_PUP */
8947 {errno = EINVAL; return -1;}
8948 #endif /* ndef IPPROTO_PUP */
8949 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RAW)
8950 #ifdef IPPROTO_RAW
8951 {*r = IPPROTO_RAW; return 0;}
8952 #else /* def IPPROTO_RAW */
8953 {errno = EINVAL; return -1;}
8954 #endif /* ndef IPPROTO_RAW */
8955 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP)
8956 #ifdef IPPROTO_RSVP
8957 {*r = IPPROTO_RSVP; return 0;}
8958 #else /* def IPPROTO_RSVP */
8959 {errno = EINVAL; return -1;}
8960 #endif /* ndef IPPROTO_RSVP */
8961 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP)
8962 #ifdef IPPROTO_SCTP
8963 {*r = IPPROTO_SCTP; return 0;}
8964 #else /* def IPPROTO_SCTP */
8965 {errno = EINVAL; return -1;}
8966 #endif /* ndef IPPROTO_SCTP */
8967 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TCP)
8968 #ifdef IPPROTO_TCP
8969 {*r = IPPROTO_TCP; return 0;}
8970 #else /* def IPPROTO_TCP */
8971 {errno = EINVAL; return -1;}
8972 #endif /* ndef IPPROTO_TCP */
8973 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TP)
8974 #ifdef IPPROTO_TP
8975 {*r = IPPROTO_TP; return 0;}
8976 #else /* def IPPROTO_TP */
8977 {errno = EINVAL; return -1;}
8978 #endif /* ndef IPPROTO_TP */
8979 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDP)
8980 #ifdef IPPROTO_UDP
8981 {*r = IPPROTO_UDP; return 0;}
8982 #else /* def IPPROTO_UDP */
8983 {errno = EINVAL; return -1;}
8984 #endif /* ndef IPPROTO_UDP */
8985 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE)
8986 #ifdef IPPROTO_UDPLITE
8987 {*r = IPPROTO_UDPLITE; return 0;}
8988 #else /* def IPPROTO_UDPLITE */
8989 {errno = EINVAL; return -1;}
8990 #endif /* ndef IPPROTO_UDPLITE */
8991 if (x == Mono_Posix_UnixSocketProtocol_SOL_SOCKET)
8992 #ifdef SOL_SOCKET
8993 {*r = SOL_SOCKET; return 0;}
8994 #else /* def SOL_SOCKET */
8995 {errno = EINVAL; return -1;}
8996 #endif /* ndef SOL_SOCKET */
8997 if (x == 0)
8998 return 0;
8999 errno = EINVAL; return -1;
9002 int Mono_Posix_ToUnixSocketProtocol (int x, int *r)
9004 *r = 0;
9005 if (x == 0)
9006 return 0;
9007 #ifdef IPPROTO_AH
9008 if (x == IPPROTO_AH)
9009 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_AH; return 0;}
9010 #endif /* ndef IPPROTO_AH */
9011 #ifdef IPPROTO_BEETPH
9012 if (x == IPPROTO_BEETPH)
9013 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH; return 0;}
9014 #endif /* ndef IPPROTO_BEETPH */
9015 #ifdef IPPROTO_COMP
9016 if (x == IPPROTO_COMP)
9017 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_COMP; return 0;}
9018 #endif /* ndef IPPROTO_COMP */
9019 #ifdef IPPROTO_DCCP
9020 if (x == IPPROTO_DCCP)
9021 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP; return 0;}
9022 #endif /* ndef IPPROTO_DCCP */
9023 #ifdef IPPROTO_EGP
9024 if (x == IPPROTO_EGP)
9025 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_EGP; return 0;}
9026 #endif /* ndef IPPROTO_EGP */
9027 #ifdef IPPROTO_ENCAP
9028 if (x == IPPROTO_ENCAP)
9029 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP; return 0;}
9030 #endif /* ndef IPPROTO_ENCAP */
9031 #ifdef IPPROTO_ESP
9032 if (x == IPPROTO_ESP)
9033 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ESP; return 0;}
9034 #endif /* ndef IPPROTO_ESP */
9035 #ifdef IPPROTO_GRE
9036 if (x == IPPROTO_GRE)
9037 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_GRE; return 0;}
9038 #endif /* ndef IPPROTO_GRE */
9039 #ifdef IPPROTO_ICMP
9040 if (x == IPPROTO_ICMP)
9041 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP; return 0;}
9042 #endif /* ndef IPPROTO_ICMP */
9043 #ifdef IPPROTO_IDP
9044 if (x == IPPROTO_IDP)
9045 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IDP; return 0;}
9046 #endif /* ndef IPPROTO_IDP */
9047 #ifdef IPPROTO_IGMP
9048 if (x == IPPROTO_IGMP)
9049 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP; return 0;}
9050 #endif /* ndef IPPROTO_IGMP */
9051 #ifdef IPPROTO_IP
9052 if (x == IPPROTO_IP)
9053 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IP; return 0;}
9054 #endif /* ndef IPPROTO_IP */
9055 #ifdef IPPROTO_IPIP
9056 if (x == IPPROTO_IPIP)
9057 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP; return 0;}
9058 #endif /* ndef IPPROTO_IPIP */
9059 #ifdef IPPROTO_IPV6
9060 if (x == IPPROTO_IPV6)
9061 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6; return 0;}
9062 #endif /* ndef IPPROTO_IPV6 */
9063 #ifdef IPPROTO_MTP
9064 if (x == IPPROTO_MTP)
9065 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_MTP; return 0;}
9066 #endif /* ndef IPPROTO_MTP */
9067 #ifdef IPPROTO_PIM
9068 if (x == IPPROTO_PIM)
9069 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PIM; return 0;}
9070 #endif /* ndef IPPROTO_PIM */
9071 #ifdef IPPROTO_PUP
9072 if (x == IPPROTO_PUP)
9073 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PUP; return 0;}
9074 #endif /* ndef IPPROTO_PUP */
9075 #ifdef IPPROTO_RAW
9076 if (x == IPPROTO_RAW)
9077 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RAW; return 0;}
9078 #endif /* ndef IPPROTO_RAW */
9079 #ifdef IPPROTO_RSVP
9080 if (x == IPPROTO_RSVP)
9081 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP; return 0;}
9082 #endif /* ndef IPPROTO_RSVP */
9083 #ifdef IPPROTO_SCTP
9084 if (x == IPPROTO_SCTP)
9085 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP; return 0;}
9086 #endif /* ndef IPPROTO_SCTP */
9087 #ifdef IPPROTO_TCP
9088 if (x == IPPROTO_TCP)
9089 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TCP; return 0;}
9090 #endif /* ndef IPPROTO_TCP */
9091 #ifdef IPPROTO_TP
9092 if (x == IPPROTO_TP)
9093 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TP; return 0;}
9094 #endif /* ndef IPPROTO_TP */
9095 #ifdef IPPROTO_UDP
9096 if (x == IPPROTO_UDP)
9097 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDP; return 0;}
9098 #endif /* ndef IPPROTO_UDP */
9099 #ifdef IPPROTO_UDPLITE
9100 if (x == IPPROTO_UDPLITE)
9101 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE; return 0;}
9102 #endif /* ndef IPPROTO_UDPLITE */
9103 #ifdef SOL_SOCKET
9104 if (x == SOL_SOCKET)
9105 {*r = Mono_Posix_UnixSocketProtocol_SOL_SOCKET; return 0;}
9106 #endif /* ndef SOL_SOCKET */
9107 errno = EINVAL; return -1;
9110 int Mono_Posix_FromUnixSocketType (int x, int *r)
9112 *r = 0;
9113 if (x == Mono_Posix_UnixSocketType_SOCK_DCCP)
9114 #ifdef SOCK_DCCP
9115 {*r = SOCK_DCCP; return 0;}
9116 #else /* def SOCK_DCCP */
9117 {errno = EINVAL; return -1;}
9118 #endif /* ndef SOCK_DCCP */
9119 if (x == Mono_Posix_UnixSocketType_SOCK_DGRAM)
9120 #ifdef SOCK_DGRAM
9121 {*r = SOCK_DGRAM; return 0;}
9122 #else /* def SOCK_DGRAM */
9123 {errno = EINVAL; return -1;}
9124 #endif /* ndef SOCK_DGRAM */
9125 if (x == Mono_Posix_UnixSocketType_SOCK_PACKET)
9126 #ifdef SOCK_PACKET
9127 {*r = SOCK_PACKET; return 0;}
9128 #else /* def SOCK_PACKET */
9129 {errno = EINVAL; return -1;}
9130 #endif /* ndef SOCK_PACKET */
9131 if (x == Mono_Posix_UnixSocketType_SOCK_RAW)
9132 #ifdef SOCK_RAW
9133 {*r = SOCK_RAW; return 0;}
9134 #else /* def SOCK_RAW */
9135 {errno = EINVAL; return -1;}
9136 #endif /* ndef SOCK_RAW */
9137 if (x == Mono_Posix_UnixSocketType_SOCK_RDM)
9138 #ifdef SOCK_RDM
9139 {*r = SOCK_RDM; return 0;}
9140 #else /* def SOCK_RDM */
9141 {errno = EINVAL; return -1;}
9142 #endif /* ndef SOCK_RDM */
9143 if (x == Mono_Posix_UnixSocketType_SOCK_SEQPACKET)
9144 #ifdef SOCK_SEQPACKET
9145 {*r = SOCK_SEQPACKET; return 0;}
9146 #else /* def SOCK_SEQPACKET */
9147 {errno = EINVAL; return -1;}
9148 #endif /* ndef SOCK_SEQPACKET */
9149 if (x == Mono_Posix_UnixSocketType_SOCK_STREAM)
9150 #ifdef SOCK_STREAM
9151 {*r = SOCK_STREAM; return 0;}
9152 #else /* def SOCK_STREAM */
9153 {errno = EINVAL; return -1;}
9154 #endif /* ndef SOCK_STREAM */
9155 if (x == 0)
9156 return 0;
9157 errno = EINVAL; return -1;
9160 int Mono_Posix_ToUnixSocketType (int x, int *r)
9162 *r = 0;
9163 if (x == 0)
9164 return 0;
9165 #ifdef SOCK_DCCP
9166 if (x == SOCK_DCCP)
9167 {*r = Mono_Posix_UnixSocketType_SOCK_DCCP; return 0;}
9168 #endif /* ndef SOCK_DCCP */
9169 #ifdef SOCK_DGRAM
9170 if (x == SOCK_DGRAM)
9171 {*r = Mono_Posix_UnixSocketType_SOCK_DGRAM; return 0;}
9172 #endif /* ndef SOCK_DGRAM */
9173 #ifdef SOCK_PACKET
9174 if (x == SOCK_PACKET)
9175 {*r = Mono_Posix_UnixSocketType_SOCK_PACKET; return 0;}
9176 #endif /* ndef SOCK_PACKET */
9177 #ifdef SOCK_RAW
9178 if (x == SOCK_RAW)
9179 {*r = Mono_Posix_UnixSocketType_SOCK_RAW; return 0;}
9180 #endif /* ndef SOCK_RAW */
9181 #ifdef SOCK_RDM
9182 if (x == SOCK_RDM)
9183 {*r = Mono_Posix_UnixSocketType_SOCK_RDM; return 0;}
9184 #endif /* ndef SOCK_RDM */
9185 #ifdef SOCK_SEQPACKET
9186 if (x == SOCK_SEQPACKET)
9187 {*r = Mono_Posix_UnixSocketType_SOCK_SEQPACKET; return 0;}
9188 #endif /* ndef SOCK_SEQPACKET */
9189 #ifdef SOCK_STREAM
9190 if (x == SOCK_STREAM)
9191 {*r = Mono_Posix_UnixSocketType_SOCK_STREAM; return 0;}
9192 #endif /* ndef SOCK_STREAM */
9193 errno = EINVAL; return -1;
9196 #ifdef HAVE_STRUCT_UTIMBUF
9198 Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
9200 _cnm_return_val_if_overflow (time_t, from->actime, -1);
9201 _cnm_return_val_if_overflow (time_t, from->modtime, -1);
9203 memset (to, 0, sizeof(*to));
9205 to->actime = from->actime;
9206 to->modtime = from->modtime;
9208 return 0;
9210 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9213 #ifdef HAVE_STRUCT_UTIMBUF
9215 Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
9217 _cnm_return_val_if_overflow (gint64, from->actime, -1);
9218 _cnm_return_val_if_overflow (gint64, from->modtime, -1);
9220 memset (to, 0, sizeof(*to));
9222 to->actime = from->actime;
9223 to->modtime = from->modtime;
9225 return 0;
9227 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9230 int Mono_Posix_FromWaitOptions (int x, int *r)
9232 *r = 0;
9233 if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
9234 #ifdef WNOHANG
9235 *r |= WNOHANG;
9236 #else /* def WNOHANG */
9237 {errno = EINVAL; return -1;}
9238 #endif /* ndef WNOHANG */
9239 if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
9240 #ifdef WUNTRACED
9241 *r |= WUNTRACED;
9242 #else /* def WUNTRACED */
9243 {errno = EINVAL; return -1;}
9244 #endif /* ndef WUNTRACED */
9245 if (x == 0)
9246 return 0;
9247 return 0;
9250 int Mono_Posix_ToWaitOptions (int x, int *r)
9252 *r = 0;
9253 if (x == 0)
9254 return 0;
9255 #ifdef WNOHANG
9256 if ((x & WNOHANG) == WNOHANG)
9257 *r |= Mono_Posix_WaitOptions_WNOHANG;
9258 #endif /* ndef WNOHANG */
9259 #ifdef WUNTRACED
9260 if ((x & WUNTRACED) == WUNTRACED)
9261 *r |= Mono_Posix_WaitOptions_WUNTRACED;
9262 #endif /* ndef WUNTRACED */
9263 return 0;
9266 int Mono_Posix_FromXattrFlags (int x, int *r)
9268 *r = 0;
9269 if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO)
9270 #ifdef XATTR_AUTO
9271 *r |= XATTR_AUTO;
9272 #else /* def XATTR_AUTO */
9273 {errno = EINVAL; return -1;}
9274 #endif /* ndef XATTR_AUTO */
9275 if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE)
9276 #ifdef XATTR_CREATE
9277 *r |= XATTR_CREATE;
9278 #else /* def XATTR_CREATE */
9279 {errno = EINVAL; return -1;}
9280 #endif /* ndef XATTR_CREATE */
9281 if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE)
9282 #ifdef XATTR_REPLACE
9283 *r |= XATTR_REPLACE;
9284 #else /* def XATTR_REPLACE */
9285 {errno = EINVAL; return -1;}
9286 #endif /* ndef XATTR_REPLACE */
9287 if (x == 0)
9288 return 0;
9289 return 0;
9292 int Mono_Posix_ToXattrFlags (int x, int *r)
9294 *r = 0;
9295 if (x == 0)
9296 return 0;
9297 #ifdef XATTR_AUTO
9298 if ((x & XATTR_AUTO) == XATTR_AUTO)
9299 *r |= Mono_Posix_XattrFlags_XATTR_AUTO;
9300 #endif /* ndef XATTR_AUTO */
9301 #ifdef XATTR_CREATE
9302 if ((x & XATTR_CREATE) == XATTR_CREATE)
9303 *r |= Mono_Posix_XattrFlags_XATTR_CREATE;
9304 #endif /* ndef XATTR_CREATE */
9305 #ifdef XATTR_REPLACE
9306 if ((x & XATTR_REPLACE) == XATTR_REPLACE)
9307 *r |= Mono_Posix_XattrFlags_XATTR_REPLACE;
9308 #endif /* ndef XATTR_REPLACE */
9309 return 0;