[System] Don't throw NIE for ServicePoint.ConnectionLeaseTimeout and .ReceiveBufferSi...
[mono-project.git] / support / map.c
bloba0580964684a6c532f2f9378dd11e31005a21ee7
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 if (x == Mono_Posix_SeekFlags_L_INCR)
4720 #ifdef L_INCR
4721 {*r = L_INCR; return 0;}
4722 #else /* def L_INCR */
4723 {errno = EINVAL; return -1;}
4724 #endif /* ndef L_INCR */
4725 if (x == Mono_Posix_SeekFlags_L_SET)
4726 #ifdef L_SET
4727 {*r = L_SET; return 0;}
4728 #else /* def L_SET */
4729 {errno = EINVAL; return -1;}
4730 #endif /* ndef L_SET */
4731 if (x == Mono_Posix_SeekFlags_L_XTND)
4732 #ifdef L_XTND
4733 {*r = L_XTND; return 0;}
4734 #else /* def L_XTND */
4735 {errno = EINVAL; return -1;}
4736 #endif /* ndef L_XTND */
4737 if (x == Mono_Posix_SeekFlags_SEEK_CUR)
4738 #ifdef SEEK_CUR
4739 {*r = SEEK_CUR; return 0;}
4740 #else /* def SEEK_CUR */
4741 {errno = EINVAL; return -1;}
4742 #endif /* ndef SEEK_CUR */
4743 if (x == Mono_Posix_SeekFlags_SEEK_END)
4744 #ifdef SEEK_END
4745 {*r = SEEK_END; return 0;}
4746 #else /* def SEEK_END */
4747 {errno = EINVAL; return -1;}
4748 #endif /* ndef SEEK_END */
4749 if (x == Mono_Posix_SeekFlags_SEEK_SET)
4750 #ifdef SEEK_SET
4751 {*r = SEEK_SET; return 0;}
4752 #else /* def SEEK_SET */
4753 {errno = EINVAL; return -1;}
4754 #endif /* ndef SEEK_SET */
4755 if (x == 0)
4756 return 0;
4757 errno = EINVAL; return -1;
4760 int Mono_Posix_ToSeekFlags (short x, short *r)
4762 *r = 0;
4763 if (x == 0)
4764 return 0;
4765 #ifdef L_INCR
4766 if (x == L_INCR)
4767 {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
4768 #endif /* ndef L_INCR */
4769 #ifdef L_SET
4770 if (x == L_SET)
4771 {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
4772 #endif /* ndef L_SET */
4773 #ifdef L_XTND
4774 if (x == L_XTND)
4775 {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
4776 #endif /* ndef L_XTND */
4777 #ifdef SEEK_CUR
4778 if (x == SEEK_CUR)
4779 {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
4780 #endif /* ndef SEEK_CUR */
4781 #ifdef SEEK_END
4782 if (x == SEEK_END)
4783 {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
4784 #endif /* ndef SEEK_END */
4785 #ifdef SEEK_SET
4786 if (x == SEEK_SET)
4787 {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
4788 #endif /* ndef SEEK_SET */
4789 errno = EINVAL; return -1;
4792 int Mono_Posix_FromShutdownOption (int x, int *r)
4794 *r = 0;
4795 if (x == Mono_Posix_ShutdownOption_SHUT_RD)
4796 #ifdef SHUT_RD
4797 {*r = SHUT_RD; return 0;}
4798 #else /* def SHUT_RD */
4799 {errno = EINVAL; return -1;}
4800 #endif /* ndef SHUT_RD */
4801 if (x == Mono_Posix_ShutdownOption_SHUT_RDWR)
4802 #ifdef SHUT_RDWR
4803 {*r = SHUT_RDWR; return 0;}
4804 #else /* def SHUT_RDWR */
4805 {errno = EINVAL; return -1;}
4806 #endif /* ndef SHUT_RDWR */
4807 if (x == Mono_Posix_ShutdownOption_SHUT_WR)
4808 #ifdef SHUT_WR
4809 {*r = SHUT_WR; return 0;}
4810 #else /* def SHUT_WR */
4811 {errno = EINVAL; return -1;}
4812 #endif /* ndef SHUT_WR */
4813 if (x == 0)
4814 return 0;
4815 errno = EINVAL; return -1;
4818 int Mono_Posix_ToShutdownOption (int x, int *r)
4820 *r = 0;
4821 if (x == 0)
4822 return 0;
4823 #ifdef SHUT_RD
4824 if (x == SHUT_RD)
4825 {*r = Mono_Posix_ShutdownOption_SHUT_RD; return 0;}
4826 #endif /* ndef SHUT_RD */
4827 #ifdef SHUT_RDWR
4828 if (x == SHUT_RDWR)
4829 {*r = Mono_Posix_ShutdownOption_SHUT_RDWR; return 0;}
4830 #endif /* ndef SHUT_RDWR */
4831 #ifdef SHUT_WR
4832 if (x == SHUT_WR)
4833 {*r = Mono_Posix_ShutdownOption_SHUT_WR; return 0;}
4834 #endif /* ndef SHUT_WR */
4835 errno = EINVAL; return -1;
4838 int Mono_Posix_FromSignum (int x, int *r)
4840 *r = 0;
4841 if (x == Mono_Posix_Signum_SIGABRT)
4842 #ifdef SIGABRT
4843 {*r = SIGABRT; return 0;}
4844 #else /* def SIGABRT */
4845 {errno = EINVAL; return -1;}
4846 #endif /* ndef SIGABRT */
4847 if (x == Mono_Posix_Signum_SIGALRM)
4848 #ifdef SIGALRM
4849 {*r = SIGALRM; return 0;}
4850 #else /* def SIGALRM */
4851 {errno = EINVAL; return -1;}
4852 #endif /* ndef SIGALRM */
4853 if (x == Mono_Posix_Signum_SIGBUS)
4854 #ifdef SIGBUS
4855 {*r = SIGBUS; return 0;}
4856 #else /* def SIGBUS */
4857 {errno = EINVAL; return -1;}
4858 #endif /* ndef SIGBUS */
4859 if (x == Mono_Posix_Signum_SIGCHLD)
4860 #ifdef SIGCHLD
4861 {*r = SIGCHLD; return 0;}
4862 #else /* def SIGCHLD */
4863 {errno = EINVAL; return -1;}
4864 #endif /* ndef SIGCHLD */
4865 if (x == Mono_Posix_Signum_SIGCLD)
4866 #ifdef SIGCLD
4867 {*r = SIGCLD; return 0;}
4868 #else /* def SIGCLD */
4869 {errno = EINVAL; return -1;}
4870 #endif /* ndef SIGCLD */
4871 if (x == Mono_Posix_Signum_SIGCONT)
4872 #ifdef SIGCONT
4873 {*r = SIGCONT; return 0;}
4874 #else /* def SIGCONT */
4875 {errno = EINVAL; return -1;}
4876 #endif /* ndef SIGCONT */
4877 if (x == Mono_Posix_Signum_SIGFPE)
4878 #ifdef SIGFPE
4879 {*r = SIGFPE; return 0;}
4880 #else /* def SIGFPE */
4881 {errno = EINVAL; return -1;}
4882 #endif /* ndef SIGFPE */
4883 if (x == Mono_Posix_Signum_SIGHUP)
4884 #ifdef SIGHUP
4885 {*r = SIGHUP; return 0;}
4886 #else /* def SIGHUP */
4887 {errno = EINVAL; return -1;}
4888 #endif /* ndef SIGHUP */
4889 if (x == Mono_Posix_Signum_SIGILL)
4890 #ifdef SIGILL
4891 {*r = SIGILL; return 0;}
4892 #else /* def SIGILL */
4893 {errno = EINVAL; return -1;}
4894 #endif /* ndef SIGILL */
4895 if (x == Mono_Posix_Signum_SIGINT)
4896 #ifdef SIGINT
4897 {*r = SIGINT; return 0;}
4898 #else /* def SIGINT */
4899 {errno = EINVAL; return -1;}
4900 #endif /* ndef SIGINT */
4901 if (x == Mono_Posix_Signum_SIGIO)
4902 #ifdef SIGIO
4903 {*r = SIGIO; return 0;}
4904 #else /* def SIGIO */
4905 {errno = EINVAL; return -1;}
4906 #endif /* ndef SIGIO */
4907 if (x == Mono_Posix_Signum_SIGIOT)
4908 #ifdef SIGIOT
4909 {*r = SIGIOT; return 0;}
4910 #else /* def SIGIOT */
4911 {errno = EINVAL; return -1;}
4912 #endif /* ndef SIGIOT */
4913 if (x == Mono_Posix_Signum_SIGKILL)
4914 #ifdef SIGKILL
4915 {*r = SIGKILL; return 0;}
4916 #else /* def SIGKILL */
4917 {errno = EINVAL; return -1;}
4918 #endif /* ndef SIGKILL */
4919 if (x == Mono_Posix_Signum_SIGPIPE)
4920 #ifdef SIGPIPE
4921 {*r = SIGPIPE; return 0;}
4922 #else /* def SIGPIPE */
4923 {errno = EINVAL; return -1;}
4924 #endif /* ndef SIGPIPE */
4925 if (x == Mono_Posix_Signum_SIGPOLL)
4926 #ifdef SIGPOLL
4927 {*r = SIGPOLL; return 0;}
4928 #else /* def SIGPOLL */
4929 {errno = EINVAL; return -1;}
4930 #endif /* ndef SIGPOLL */
4931 if (x == Mono_Posix_Signum_SIGPROF)
4932 #ifdef SIGPROF
4933 {*r = SIGPROF; return 0;}
4934 #else /* def SIGPROF */
4935 {errno = EINVAL; return -1;}
4936 #endif /* ndef SIGPROF */
4937 if (x == Mono_Posix_Signum_SIGPWR)
4938 #ifdef SIGPWR
4939 {*r = SIGPWR; return 0;}
4940 #else /* def SIGPWR */
4941 {errno = EINVAL; return -1;}
4942 #endif /* ndef SIGPWR */
4943 if (x == Mono_Posix_Signum_SIGQUIT)
4944 #ifdef SIGQUIT
4945 {*r = SIGQUIT; return 0;}
4946 #else /* def SIGQUIT */
4947 {errno = EINVAL; return -1;}
4948 #endif /* ndef SIGQUIT */
4949 if (x == Mono_Posix_Signum_SIGSEGV)
4950 #ifdef SIGSEGV
4951 {*r = SIGSEGV; return 0;}
4952 #else /* def SIGSEGV */
4953 {errno = EINVAL; return -1;}
4954 #endif /* ndef SIGSEGV */
4955 if (x == Mono_Posix_Signum_SIGSTKFLT)
4956 #ifdef SIGSTKFLT
4957 {*r = SIGSTKFLT; return 0;}
4958 #else /* def SIGSTKFLT */
4959 {errno = EINVAL; return -1;}
4960 #endif /* ndef SIGSTKFLT */
4961 if (x == Mono_Posix_Signum_SIGSTOP)
4962 #ifdef SIGSTOP
4963 {*r = SIGSTOP; return 0;}
4964 #else /* def SIGSTOP */
4965 {errno = EINVAL; return -1;}
4966 #endif /* ndef SIGSTOP */
4967 if (x == Mono_Posix_Signum_SIGSYS)
4968 #ifdef SIGSYS
4969 {*r = SIGSYS; return 0;}
4970 #else /* def SIGSYS */
4971 {errno = EINVAL; return -1;}
4972 #endif /* ndef SIGSYS */
4973 if (x == Mono_Posix_Signum_SIGTERM)
4974 #ifdef SIGTERM
4975 {*r = SIGTERM; return 0;}
4976 #else /* def SIGTERM */
4977 {errno = EINVAL; return -1;}
4978 #endif /* ndef SIGTERM */
4979 if (x == Mono_Posix_Signum_SIGTRAP)
4980 #ifdef SIGTRAP
4981 {*r = SIGTRAP; return 0;}
4982 #else /* def SIGTRAP */
4983 {errno = EINVAL; return -1;}
4984 #endif /* ndef SIGTRAP */
4985 if (x == Mono_Posix_Signum_SIGTSTP)
4986 #ifdef SIGTSTP
4987 {*r = SIGTSTP; return 0;}
4988 #else /* def SIGTSTP */
4989 {errno = EINVAL; return -1;}
4990 #endif /* ndef SIGTSTP */
4991 if (x == Mono_Posix_Signum_SIGTTIN)
4992 #ifdef SIGTTIN
4993 {*r = SIGTTIN; return 0;}
4994 #else /* def SIGTTIN */
4995 {errno = EINVAL; return -1;}
4996 #endif /* ndef SIGTTIN */
4997 if (x == Mono_Posix_Signum_SIGTTOU)
4998 #ifdef SIGTTOU
4999 {*r = SIGTTOU; return 0;}
5000 #else /* def SIGTTOU */
5001 {errno = EINVAL; return -1;}
5002 #endif /* ndef SIGTTOU */
5003 if (x == Mono_Posix_Signum_SIGUNUSED)
5004 #ifdef SIGUNUSED
5005 {*r = SIGUNUSED; return 0;}
5006 #else /* def SIGUNUSED */
5007 {errno = EINVAL; return -1;}
5008 #endif /* ndef SIGUNUSED */
5009 if (x == Mono_Posix_Signum_SIGURG)
5010 #ifdef SIGURG
5011 {*r = SIGURG; return 0;}
5012 #else /* def SIGURG */
5013 {errno = EINVAL; return -1;}
5014 #endif /* ndef SIGURG */
5015 if (x == Mono_Posix_Signum_SIGUSR1)
5016 #ifdef SIGUSR1
5017 {*r = SIGUSR1; return 0;}
5018 #else /* def SIGUSR1 */
5019 {errno = EINVAL; return -1;}
5020 #endif /* ndef SIGUSR1 */
5021 if (x == Mono_Posix_Signum_SIGUSR2)
5022 #ifdef SIGUSR2
5023 {*r = SIGUSR2; return 0;}
5024 #else /* def SIGUSR2 */
5025 {errno = EINVAL; return -1;}
5026 #endif /* ndef SIGUSR2 */
5027 if (x == Mono_Posix_Signum_SIGVTALRM)
5028 #ifdef SIGVTALRM
5029 {*r = SIGVTALRM; return 0;}
5030 #else /* def SIGVTALRM */
5031 {errno = EINVAL; return -1;}
5032 #endif /* ndef SIGVTALRM */
5033 if (x == Mono_Posix_Signum_SIGWINCH)
5034 #ifdef SIGWINCH
5035 {*r = SIGWINCH; return 0;}
5036 #else /* def SIGWINCH */
5037 {errno = EINVAL; return -1;}
5038 #endif /* ndef SIGWINCH */
5039 if (x == Mono_Posix_Signum_SIGXCPU)
5040 #ifdef SIGXCPU
5041 {*r = SIGXCPU; return 0;}
5042 #else /* def SIGXCPU */
5043 {errno = EINVAL; return -1;}
5044 #endif /* ndef SIGXCPU */
5045 if (x == Mono_Posix_Signum_SIGXFSZ)
5046 #ifdef SIGXFSZ
5047 {*r = SIGXFSZ; return 0;}
5048 #else /* def SIGXFSZ */
5049 {errno = EINVAL; return -1;}
5050 #endif /* ndef SIGXFSZ */
5051 if (x == 0)
5052 return 0;
5053 errno = EINVAL; return -1;
5056 int Mono_Posix_ToSignum (int x, int *r)
5058 *r = 0;
5059 if (x == 0)
5060 return 0;
5061 #ifdef SIGABRT
5062 if (x == SIGABRT)
5063 {*r = Mono_Posix_Signum_SIGABRT; return 0;}
5064 #endif /* ndef SIGABRT */
5065 #ifdef SIGALRM
5066 if (x == SIGALRM)
5067 {*r = Mono_Posix_Signum_SIGALRM; return 0;}
5068 #endif /* ndef SIGALRM */
5069 #ifdef SIGBUS
5070 if (x == SIGBUS)
5071 {*r = Mono_Posix_Signum_SIGBUS; return 0;}
5072 #endif /* ndef SIGBUS */
5073 #ifdef SIGCHLD
5074 if (x == SIGCHLD)
5075 {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
5076 #endif /* ndef SIGCHLD */
5077 #ifdef SIGCLD
5078 if (x == SIGCLD)
5079 {*r = Mono_Posix_Signum_SIGCLD; return 0;}
5080 #endif /* ndef SIGCLD */
5081 #ifdef SIGCONT
5082 if (x == SIGCONT)
5083 {*r = Mono_Posix_Signum_SIGCONT; return 0;}
5084 #endif /* ndef SIGCONT */
5085 #ifdef SIGFPE
5086 if (x == SIGFPE)
5087 {*r = Mono_Posix_Signum_SIGFPE; return 0;}
5088 #endif /* ndef SIGFPE */
5089 #ifdef SIGHUP
5090 if (x == SIGHUP)
5091 {*r = Mono_Posix_Signum_SIGHUP; return 0;}
5092 #endif /* ndef SIGHUP */
5093 #ifdef SIGILL
5094 if (x == SIGILL)
5095 {*r = Mono_Posix_Signum_SIGILL; return 0;}
5096 #endif /* ndef SIGILL */
5097 #ifdef SIGINT
5098 if (x == SIGINT)
5099 {*r = Mono_Posix_Signum_SIGINT; return 0;}
5100 #endif /* ndef SIGINT */
5101 #ifdef SIGIO
5102 if (x == SIGIO)
5103 {*r = Mono_Posix_Signum_SIGIO; return 0;}
5104 #endif /* ndef SIGIO */
5105 #ifdef SIGIOT
5106 if (x == SIGIOT)
5107 {*r = Mono_Posix_Signum_SIGIOT; return 0;}
5108 #endif /* ndef SIGIOT */
5109 #ifdef SIGKILL
5110 if (x == SIGKILL)
5111 {*r = Mono_Posix_Signum_SIGKILL; return 0;}
5112 #endif /* ndef SIGKILL */
5113 #ifdef SIGPIPE
5114 if (x == SIGPIPE)
5115 {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
5116 #endif /* ndef SIGPIPE */
5117 #ifdef SIGPOLL
5118 if (x == SIGPOLL)
5119 {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
5120 #endif /* ndef SIGPOLL */
5121 #ifdef SIGPROF
5122 if (x == SIGPROF)
5123 {*r = Mono_Posix_Signum_SIGPROF; return 0;}
5124 #endif /* ndef SIGPROF */
5125 #ifdef SIGPWR
5126 if (x == SIGPWR)
5127 {*r = Mono_Posix_Signum_SIGPWR; return 0;}
5128 #endif /* ndef SIGPWR */
5129 #ifdef SIGQUIT
5130 if (x == SIGQUIT)
5131 {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
5132 #endif /* ndef SIGQUIT */
5133 #ifdef SIGSEGV
5134 if (x == SIGSEGV)
5135 {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
5136 #endif /* ndef SIGSEGV */
5137 #ifdef SIGSTKFLT
5138 if (x == SIGSTKFLT)
5139 {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
5140 #endif /* ndef SIGSTKFLT */
5141 #ifdef SIGSTOP
5142 if (x == SIGSTOP)
5143 {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
5144 #endif /* ndef SIGSTOP */
5145 #ifdef SIGSYS
5146 if (x == SIGSYS)
5147 {*r = Mono_Posix_Signum_SIGSYS; return 0;}
5148 #endif /* ndef SIGSYS */
5149 #ifdef SIGTERM
5150 if (x == SIGTERM)
5151 {*r = Mono_Posix_Signum_SIGTERM; return 0;}
5152 #endif /* ndef SIGTERM */
5153 #ifdef SIGTRAP
5154 if (x == SIGTRAP)
5155 {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
5156 #endif /* ndef SIGTRAP */
5157 #ifdef SIGTSTP
5158 if (x == SIGTSTP)
5159 {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
5160 #endif /* ndef SIGTSTP */
5161 #ifdef SIGTTIN
5162 if (x == SIGTTIN)
5163 {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
5164 #endif /* ndef SIGTTIN */
5165 #ifdef SIGTTOU
5166 if (x == SIGTTOU)
5167 {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
5168 #endif /* ndef SIGTTOU */
5169 #ifdef SIGUNUSED
5170 if (x == SIGUNUSED)
5171 {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
5172 #endif /* ndef SIGUNUSED */
5173 #ifdef SIGURG
5174 if (x == SIGURG)
5175 {*r = Mono_Posix_Signum_SIGURG; return 0;}
5176 #endif /* ndef SIGURG */
5177 #ifdef SIGUSR1
5178 if (x == SIGUSR1)
5179 {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
5180 #endif /* ndef SIGUSR1 */
5181 #ifdef SIGUSR2
5182 if (x == SIGUSR2)
5183 {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
5184 #endif /* ndef SIGUSR2 */
5185 #ifdef SIGVTALRM
5186 if (x == SIGVTALRM)
5187 {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
5188 #endif /* ndef SIGVTALRM */
5189 #ifdef SIGWINCH
5190 if (x == SIGWINCH)
5191 {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
5192 #endif /* ndef SIGWINCH */
5193 #ifdef SIGXCPU
5194 if (x == SIGXCPU)
5195 {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
5196 #endif /* ndef SIGXCPU */
5197 #ifdef SIGXFSZ
5198 if (x == SIGXFSZ)
5199 {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
5200 #endif /* ndef SIGXFSZ */
5201 errno = EINVAL; return -1;
5204 #ifdef HAVE_STRUCT_SOCKADDR_IN
5206 Mono_Posix_FromSockaddrIn (struct Mono_Posix_SockaddrIn *from, struct sockaddr_in *to)
5208 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5210 memset (to, 0, sizeof(*to));
5212 to->sin_port = from->sin_port;
5213 if (Mono_Posix_FromInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5214 return -1;
5217 return 0;
5219 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5222 #ifdef HAVE_STRUCT_SOCKADDR_IN
5224 Mono_Posix_ToSockaddrIn (struct sockaddr_in *from, struct Mono_Posix_SockaddrIn *to)
5226 _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
5228 memset (to, 0, sizeof(*to));
5230 to->sin_port = from->sin_port;
5231 if (Mono_Posix_ToInAddr (&from->sin_addr, &to->sin_addr) != 0) {
5232 return -1;
5235 return 0;
5237 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
5240 #if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
5242 Mono_Posix_FromSockaddrIn6 (struct Mono_Posix_SockaddrIn6 *from, struct sockaddr_in6 *to)
5244 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5245 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5246 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5248 memset (to, 0, sizeof(*to));
5250 to->sin6_port = from->sin6_port;
5251 to->sin6_flowinfo = from->sin6_flowinfo;
5252 if (Mono_Posix_FromIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5253 return -1;
5255 to->sin6_scope_id = from->sin6_scope_id;
5257 return 0;
5259 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5262 #if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
5264 Mono_Posix_ToSockaddrIn6 (struct sockaddr_in6 *from, struct Mono_Posix_SockaddrIn6 *to)
5266 _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
5267 _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
5268 _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
5270 memset (to, 0, sizeof(*to));
5272 to->sin6_port = from->sin6_port;
5273 to->sin6_flowinfo = from->sin6_flowinfo;
5274 if (Mono_Posix_ToIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
5275 return -1;
5277 to->sin6_scope_id = from->sin6_scope_id;
5279 return 0;
5281 #endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
5284 int Mono_Posix_FromSockaddrType (int x, int *r)
5286 *r = 0;
5287 if (x == Mono_Posix_SockaddrType_Invalid)
5288 #ifdef Invalid
5289 {*r = Invalid; return 0;}
5290 #else /* def Invalid */
5291 {errno = EINVAL; return -1;}
5292 #endif /* ndef Invalid */
5293 if (x == Mono_Posix_SockaddrType_MustBeWrapped)
5294 #ifdef MustBeWrapped
5295 {*r = MustBeWrapped; return 0;}
5296 #else /* def MustBeWrapped */
5297 {errno = EINVAL; return -1;}
5298 #endif /* ndef MustBeWrapped */
5299 if (x == Mono_Posix_SockaddrType_Sockaddr)
5300 #ifdef Sockaddr
5301 {*r = Sockaddr; return 0;}
5302 #else /* def Sockaddr */
5303 {errno = EINVAL; return -1;}
5304 #endif /* ndef Sockaddr */
5305 if (x == Mono_Posix_SockaddrType_SockaddrIn)
5306 #ifdef SockaddrIn
5307 {*r = SockaddrIn; return 0;}
5308 #else /* def SockaddrIn */
5309 {errno = EINVAL; return -1;}
5310 #endif /* ndef SockaddrIn */
5311 if (x == Mono_Posix_SockaddrType_SockaddrIn6)
5312 #ifdef SockaddrIn6
5313 {*r = SockaddrIn6; return 0;}
5314 #else /* def SockaddrIn6 */
5315 {errno = EINVAL; return -1;}
5316 #endif /* ndef SockaddrIn6 */
5317 if (x == Mono_Posix_SockaddrType_SockaddrStorage)
5318 #ifdef SockaddrStorage
5319 {*r = SockaddrStorage; return 0;}
5320 #else /* def SockaddrStorage */
5321 {errno = EINVAL; return -1;}
5322 #endif /* ndef SockaddrStorage */
5323 if (x == Mono_Posix_SockaddrType_SockaddrUn)
5324 #ifdef SockaddrUn
5325 {*r = SockaddrUn; return 0;}
5326 #else /* def SockaddrUn */
5327 {errno = EINVAL; return -1;}
5328 #endif /* ndef SockaddrUn */
5329 if (x == 0)
5330 return 0;
5331 errno = EINVAL; return -1;
5334 int Mono_Posix_ToSockaddrType (int x, int *r)
5336 *r = 0;
5337 if (x == 0)
5338 return 0;
5339 #ifdef Invalid
5340 if (x == Invalid)
5341 {*r = Mono_Posix_SockaddrType_Invalid; return 0;}
5342 #endif /* ndef Invalid */
5343 #ifdef MustBeWrapped
5344 if (x == MustBeWrapped)
5345 {*r = Mono_Posix_SockaddrType_MustBeWrapped; return 0;}
5346 #endif /* ndef MustBeWrapped */
5347 #ifdef Sockaddr
5348 if (x == Sockaddr)
5349 {*r = Mono_Posix_SockaddrType_Sockaddr; return 0;}
5350 #endif /* ndef Sockaddr */
5351 #ifdef SockaddrIn
5352 if (x == SockaddrIn)
5353 {*r = Mono_Posix_SockaddrType_SockaddrIn; return 0;}
5354 #endif /* ndef SockaddrIn */
5355 #ifdef SockaddrIn6
5356 if (x == SockaddrIn6)
5357 {*r = Mono_Posix_SockaddrType_SockaddrIn6; return 0;}
5358 #endif /* ndef SockaddrIn6 */
5359 #ifdef SockaddrStorage
5360 if (x == SockaddrStorage)
5361 {*r = Mono_Posix_SockaddrType_SockaddrStorage; return 0;}
5362 #endif /* ndef SockaddrStorage */
5363 #ifdef SockaddrUn
5364 if (x == SockaddrUn)
5365 {*r = Mono_Posix_SockaddrType_SockaddrUn; return 0;}
5366 #endif /* ndef SockaddrUn */
5367 errno = EINVAL; return -1;
5370 int Mono_Posix_FromSysconfName (int x, int *r)
5372 *r = 0;
5373 if (x == Mono_Posix_SysconfName__SC_2_CHAR_TERM)
5374 #ifdef _SC_2_CHAR_TERM
5375 {*r = _SC_2_CHAR_TERM; return 0;}
5376 #else /* def _SC_2_CHAR_TERM */
5377 {errno = EINVAL; return -1;}
5378 #endif /* ndef _SC_2_CHAR_TERM */
5379 if (x == Mono_Posix_SysconfName__SC_2_C_BIND)
5380 #ifdef _SC_2_C_BIND
5381 {*r = _SC_2_C_BIND; return 0;}
5382 #else /* def _SC_2_C_BIND */
5383 {errno = EINVAL; return -1;}
5384 #endif /* ndef _SC_2_C_BIND */
5385 if (x == Mono_Posix_SysconfName__SC_2_C_DEV)
5386 #ifdef _SC_2_C_DEV
5387 {*r = _SC_2_C_DEV; return 0;}
5388 #else /* def _SC_2_C_DEV */
5389 {errno = EINVAL; return -1;}
5390 #endif /* ndef _SC_2_C_DEV */
5391 if (x == Mono_Posix_SysconfName__SC_2_C_VERSION)
5392 #ifdef _SC_2_C_VERSION
5393 {*r = _SC_2_C_VERSION; return 0;}
5394 #else /* def _SC_2_C_VERSION */
5395 {errno = EINVAL; return -1;}
5396 #endif /* ndef _SC_2_C_VERSION */
5397 if (x == Mono_Posix_SysconfName__SC_2_FORT_DEV)
5398 #ifdef _SC_2_FORT_DEV
5399 {*r = _SC_2_FORT_DEV; return 0;}
5400 #else /* def _SC_2_FORT_DEV */
5401 {errno = EINVAL; return -1;}
5402 #endif /* ndef _SC_2_FORT_DEV */
5403 if (x == Mono_Posix_SysconfName__SC_2_FORT_RUN)
5404 #ifdef _SC_2_FORT_RUN
5405 {*r = _SC_2_FORT_RUN; return 0;}
5406 #else /* def _SC_2_FORT_RUN */
5407 {errno = EINVAL; return -1;}
5408 #endif /* ndef _SC_2_FORT_RUN */
5409 if (x == Mono_Posix_SysconfName__SC_2_LOCALEDEF)
5410 #ifdef _SC_2_LOCALEDEF
5411 {*r = _SC_2_LOCALEDEF; return 0;}
5412 #else /* def _SC_2_LOCALEDEF */
5413 {errno = EINVAL; return -1;}
5414 #endif /* ndef _SC_2_LOCALEDEF */
5415 if (x == Mono_Posix_SysconfName__SC_2_PBS)
5416 #ifdef _SC_2_PBS
5417 {*r = _SC_2_PBS; return 0;}
5418 #else /* def _SC_2_PBS */
5419 {errno = EINVAL; return -1;}
5420 #endif /* ndef _SC_2_PBS */
5421 if (x == Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING)
5422 #ifdef _SC_2_PBS_ACCOUNTING
5423 {*r = _SC_2_PBS_ACCOUNTING; return 0;}
5424 #else /* def _SC_2_PBS_ACCOUNTING */
5425 {errno = EINVAL; return -1;}
5426 #endif /* ndef _SC_2_PBS_ACCOUNTING */
5427 if (x == Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT)
5428 #ifdef _SC_2_PBS_CHECKPOINT
5429 {*r = _SC_2_PBS_CHECKPOINT; return 0;}
5430 #else /* def _SC_2_PBS_CHECKPOINT */
5431 {errno = EINVAL; return -1;}
5432 #endif /* ndef _SC_2_PBS_CHECKPOINT */
5433 if (x == Mono_Posix_SysconfName__SC_2_PBS_LOCATE)
5434 #ifdef _SC_2_PBS_LOCATE
5435 {*r = _SC_2_PBS_LOCATE; return 0;}
5436 #else /* def _SC_2_PBS_LOCATE */
5437 {errno = EINVAL; return -1;}
5438 #endif /* ndef _SC_2_PBS_LOCATE */
5439 if (x == Mono_Posix_SysconfName__SC_2_PBS_MESSAGE)
5440 #ifdef _SC_2_PBS_MESSAGE
5441 {*r = _SC_2_PBS_MESSAGE; return 0;}
5442 #else /* def _SC_2_PBS_MESSAGE */
5443 {errno = EINVAL; return -1;}
5444 #endif /* ndef _SC_2_PBS_MESSAGE */
5445 if (x == Mono_Posix_SysconfName__SC_2_PBS_TRACK)
5446 #ifdef _SC_2_PBS_TRACK
5447 {*r = _SC_2_PBS_TRACK; return 0;}
5448 #else /* def _SC_2_PBS_TRACK */
5449 {errno = EINVAL; return -1;}
5450 #endif /* ndef _SC_2_PBS_TRACK */
5451 if (x == Mono_Posix_SysconfName__SC_2_SW_DEV)
5452 #ifdef _SC_2_SW_DEV
5453 {*r = _SC_2_SW_DEV; return 0;}
5454 #else /* def _SC_2_SW_DEV */
5455 {errno = EINVAL; return -1;}
5456 #endif /* ndef _SC_2_SW_DEV */
5457 if (x == Mono_Posix_SysconfName__SC_2_UPE)
5458 #ifdef _SC_2_UPE
5459 {*r = _SC_2_UPE; return 0;}
5460 #else /* def _SC_2_UPE */
5461 {errno = EINVAL; return -1;}
5462 #endif /* ndef _SC_2_UPE */
5463 if (x == Mono_Posix_SysconfName__SC_2_VERSION)
5464 #ifdef _SC_2_VERSION
5465 {*r = _SC_2_VERSION; return 0;}
5466 #else /* def _SC_2_VERSION */
5467 {errno = EINVAL; return -1;}
5468 #endif /* ndef _SC_2_VERSION */
5469 if (x == Mono_Posix_SysconfName__SC_ADVISORY_INFO)
5470 #ifdef _SC_ADVISORY_INFO
5471 {*r = _SC_ADVISORY_INFO; return 0;}
5472 #else /* def _SC_ADVISORY_INFO */
5473 {errno = EINVAL; return -1;}
5474 #endif /* ndef _SC_ADVISORY_INFO */
5475 if (x == Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX)
5476 #ifdef _SC_AIO_LISTIO_MAX
5477 {*r = _SC_AIO_LISTIO_MAX; return 0;}
5478 #else /* def _SC_AIO_LISTIO_MAX */
5479 {errno = EINVAL; return -1;}
5480 #endif /* ndef _SC_AIO_LISTIO_MAX */
5481 if (x == Mono_Posix_SysconfName__SC_AIO_MAX)
5482 #ifdef _SC_AIO_MAX
5483 {*r = _SC_AIO_MAX; return 0;}
5484 #else /* def _SC_AIO_MAX */
5485 {errno = EINVAL; return -1;}
5486 #endif /* ndef _SC_AIO_MAX */
5487 if (x == Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX)
5488 #ifdef _SC_AIO_PRIO_DELTA_MAX
5489 {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
5490 #else /* def _SC_AIO_PRIO_DELTA_MAX */
5491 {errno = EINVAL; return -1;}
5492 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
5493 if (x == Mono_Posix_SysconfName__SC_ARG_MAX)
5494 #ifdef _SC_ARG_MAX
5495 {*r = _SC_ARG_MAX; return 0;}
5496 #else /* def _SC_ARG_MAX */
5497 {errno = EINVAL; return -1;}
5498 #endif /* ndef _SC_ARG_MAX */
5499 if (x == Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO)
5500 #ifdef _SC_ASYNCHRONOUS_IO
5501 {*r = _SC_ASYNCHRONOUS_IO; return 0;}
5502 #else /* def _SC_ASYNCHRONOUS_IO */
5503 {errno = EINVAL; return -1;}
5504 #endif /* ndef _SC_ASYNCHRONOUS_IO */
5505 if (x == Mono_Posix_SysconfName__SC_ATEXIT_MAX)
5506 #ifdef _SC_ATEXIT_MAX
5507 {*r = _SC_ATEXIT_MAX; return 0;}
5508 #else /* def _SC_ATEXIT_MAX */
5509 {errno = EINVAL; return -1;}
5510 #endif /* ndef _SC_ATEXIT_MAX */
5511 if (x == Mono_Posix_SysconfName__SC_AVPHYS_PAGES)
5512 #ifdef _SC_AVPHYS_PAGES
5513 {*r = _SC_AVPHYS_PAGES; return 0;}
5514 #else /* def _SC_AVPHYS_PAGES */
5515 {errno = EINVAL; return -1;}
5516 #endif /* ndef _SC_AVPHYS_PAGES */
5517 if (x == Mono_Posix_SysconfName__SC_BARRIERS)
5518 #ifdef _SC_BARRIERS
5519 {*r = _SC_BARRIERS; return 0;}
5520 #else /* def _SC_BARRIERS */
5521 {errno = EINVAL; return -1;}
5522 #endif /* ndef _SC_BARRIERS */
5523 if (x == Mono_Posix_SysconfName__SC_BASE)
5524 #ifdef _SC_BASE
5525 {*r = _SC_BASE; return 0;}
5526 #else /* def _SC_BASE */
5527 {errno = EINVAL; return -1;}
5528 #endif /* ndef _SC_BASE */
5529 if (x == Mono_Posix_SysconfName__SC_BC_BASE_MAX)
5530 #ifdef _SC_BC_BASE_MAX
5531 {*r = _SC_BC_BASE_MAX; return 0;}
5532 #else /* def _SC_BC_BASE_MAX */
5533 {errno = EINVAL; return -1;}
5534 #endif /* ndef _SC_BC_BASE_MAX */
5535 if (x == Mono_Posix_SysconfName__SC_BC_DIM_MAX)
5536 #ifdef _SC_BC_DIM_MAX
5537 {*r = _SC_BC_DIM_MAX; return 0;}
5538 #else /* def _SC_BC_DIM_MAX */
5539 {errno = EINVAL; return -1;}
5540 #endif /* ndef _SC_BC_DIM_MAX */
5541 if (x == Mono_Posix_SysconfName__SC_BC_SCALE_MAX)
5542 #ifdef _SC_BC_SCALE_MAX
5543 {*r = _SC_BC_SCALE_MAX; return 0;}
5544 #else /* def _SC_BC_SCALE_MAX */
5545 {errno = EINVAL; return -1;}
5546 #endif /* ndef _SC_BC_SCALE_MAX */
5547 if (x == Mono_Posix_SysconfName__SC_BC_STRING_MAX)
5548 #ifdef _SC_BC_STRING_MAX
5549 {*r = _SC_BC_STRING_MAX; return 0;}
5550 #else /* def _SC_BC_STRING_MAX */
5551 {errno = EINVAL; return -1;}
5552 #endif /* ndef _SC_BC_STRING_MAX */
5553 if (x == Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX)
5554 #ifdef _SC_CHARCLASS_NAME_MAX
5555 {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
5556 #else /* def _SC_CHARCLASS_NAME_MAX */
5557 {errno = EINVAL; return -1;}
5558 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
5559 if (x == Mono_Posix_SysconfName__SC_CHAR_BIT)
5560 #ifdef _SC_CHAR_BIT
5561 {*r = _SC_CHAR_BIT; return 0;}
5562 #else /* def _SC_CHAR_BIT */
5563 {errno = EINVAL; return -1;}
5564 #endif /* ndef _SC_CHAR_BIT */
5565 if (x == Mono_Posix_SysconfName__SC_CHAR_MAX)
5566 #ifdef _SC_CHAR_MAX
5567 {*r = _SC_CHAR_MAX; return 0;}
5568 #else /* def _SC_CHAR_MAX */
5569 {errno = EINVAL; return -1;}
5570 #endif /* ndef _SC_CHAR_MAX */
5571 if (x == Mono_Posix_SysconfName__SC_CHAR_MIN)
5572 #ifdef _SC_CHAR_MIN
5573 {*r = _SC_CHAR_MIN; return 0;}
5574 #else /* def _SC_CHAR_MIN */
5575 {errno = EINVAL; return -1;}
5576 #endif /* ndef _SC_CHAR_MIN */
5577 if (x == Mono_Posix_SysconfName__SC_CHILD_MAX)
5578 #ifdef _SC_CHILD_MAX
5579 {*r = _SC_CHILD_MAX; return 0;}
5580 #else /* def _SC_CHILD_MAX */
5581 {errno = EINVAL; return -1;}
5582 #endif /* ndef _SC_CHILD_MAX */
5583 if (x == Mono_Posix_SysconfName__SC_CLK_TCK)
5584 #ifdef _SC_CLK_TCK
5585 {*r = _SC_CLK_TCK; return 0;}
5586 #else /* def _SC_CLK_TCK */
5587 {errno = EINVAL; return -1;}
5588 #endif /* ndef _SC_CLK_TCK */
5589 if (x == Mono_Posix_SysconfName__SC_CLOCK_SELECTION)
5590 #ifdef _SC_CLOCK_SELECTION
5591 {*r = _SC_CLOCK_SELECTION; return 0;}
5592 #else /* def _SC_CLOCK_SELECTION */
5593 {errno = EINVAL; return -1;}
5594 #endif /* ndef _SC_CLOCK_SELECTION */
5595 if (x == Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX)
5596 #ifdef _SC_COLL_WEIGHTS_MAX
5597 {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
5598 #else /* def _SC_COLL_WEIGHTS_MAX */
5599 {errno = EINVAL; return -1;}
5600 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
5601 if (x == Mono_Posix_SysconfName__SC_CPUTIME)
5602 #ifdef _SC_CPUTIME
5603 {*r = _SC_CPUTIME; return 0;}
5604 #else /* def _SC_CPUTIME */
5605 {errno = EINVAL; return -1;}
5606 #endif /* ndef _SC_CPUTIME */
5607 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT)
5608 #ifdef _SC_C_LANG_SUPPORT
5609 {*r = _SC_C_LANG_SUPPORT; return 0;}
5610 #else /* def _SC_C_LANG_SUPPORT */
5611 {errno = EINVAL; return -1;}
5612 #endif /* ndef _SC_C_LANG_SUPPORT */
5613 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R)
5614 #ifdef _SC_C_LANG_SUPPORT_R
5615 {*r = _SC_C_LANG_SUPPORT_R; return 0;}
5616 #else /* def _SC_C_LANG_SUPPORT_R */
5617 {errno = EINVAL; return -1;}
5618 #endif /* ndef _SC_C_LANG_SUPPORT_R */
5619 if (x == Mono_Posix_SysconfName__SC_DELAYTIMER_MAX)
5620 #ifdef _SC_DELAYTIMER_MAX
5621 {*r = _SC_DELAYTIMER_MAX; return 0;}
5622 #else /* def _SC_DELAYTIMER_MAX */
5623 {errno = EINVAL; return -1;}
5624 #endif /* ndef _SC_DELAYTIMER_MAX */
5625 if (x == Mono_Posix_SysconfName__SC_DEVICE_IO)
5626 #ifdef _SC_DEVICE_IO
5627 {*r = _SC_DEVICE_IO; return 0;}
5628 #else /* def _SC_DEVICE_IO */
5629 {errno = EINVAL; return -1;}
5630 #endif /* ndef _SC_DEVICE_IO */
5631 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC)
5632 #ifdef _SC_DEVICE_SPECIFIC
5633 {*r = _SC_DEVICE_SPECIFIC; return 0;}
5634 #else /* def _SC_DEVICE_SPECIFIC */
5635 {errno = EINVAL; return -1;}
5636 #endif /* ndef _SC_DEVICE_SPECIFIC */
5637 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R)
5638 #ifdef _SC_DEVICE_SPECIFIC_R
5639 {*r = _SC_DEVICE_SPECIFIC_R; return 0;}
5640 #else /* def _SC_DEVICE_SPECIFIC_R */
5641 {errno = EINVAL; return -1;}
5642 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
5643 if (x == Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX)
5644 #ifdef _SC_EQUIV_CLASS_MAX
5645 {*r = _SC_EQUIV_CLASS_MAX; return 0;}
5646 #else /* def _SC_EQUIV_CLASS_MAX */
5647 {errno = EINVAL; return -1;}
5648 #endif /* ndef _SC_EQUIV_CLASS_MAX */
5649 if (x == Mono_Posix_SysconfName__SC_EXPR_NEST_MAX)
5650 #ifdef _SC_EXPR_NEST_MAX
5651 {*r = _SC_EXPR_NEST_MAX; return 0;}
5652 #else /* def _SC_EXPR_NEST_MAX */
5653 {errno = EINVAL; return -1;}
5654 #endif /* ndef _SC_EXPR_NEST_MAX */
5655 if (x == Mono_Posix_SysconfName__SC_FD_MGMT)
5656 #ifdef _SC_FD_MGMT
5657 {*r = _SC_FD_MGMT; return 0;}
5658 #else /* def _SC_FD_MGMT */
5659 {errno = EINVAL; return -1;}
5660 #endif /* ndef _SC_FD_MGMT */
5661 if (x == Mono_Posix_SysconfName__SC_FIFO)
5662 #ifdef _SC_FIFO
5663 {*r = _SC_FIFO; return 0;}
5664 #else /* def _SC_FIFO */
5665 {errno = EINVAL; return -1;}
5666 #endif /* ndef _SC_FIFO */
5667 if (x == Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES)
5668 #ifdef _SC_FILE_ATTRIBUTES
5669 {*r = _SC_FILE_ATTRIBUTES; return 0;}
5670 #else /* def _SC_FILE_ATTRIBUTES */
5671 {errno = EINVAL; return -1;}
5672 #endif /* ndef _SC_FILE_ATTRIBUTES */
5673 if (x == Mono_Posix_SysconfName__SC_FILE_LOCKING)
5674 #ifdef _SC_FILE_LOCKING
5675 {*r = _SC_FILE_LOCKING; return 0;}
5676 #else /* def _SC_FILE_LOCKING */
5677 {errno = EINVAL; return -1;}
5678 #endif /* ndef _SC_FILE_LOCKING */
5679 if (x == Mono_Posix_SysconfName__SC_FILE_SYSTEM)
5680 #ifdef _SC_FILE_SYSTEM
5681 {*r = _SC_FILE_SYSTEM; return 0;}
5682 #else /* def _SC_FILE_SYSTEM */
5683 {errno = EINVAL; return -1;}
5684 #endif /* ndef _SC_FILE_SYSTEM */
5685 if (x == Mono_Posix_SysconfName__SC_FSYNC)
5686 #ifdef _SC_FSYNC
5687 {*r = _SC_FSYNC; return 0;}
5688 #else /* def _SC_FSYNC */
5689 {errno = EINVAL; return -1;}
5690 #endif /* ndef _SC_FSYNC */
5691 if (x == Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX)
5692 #ifdef _SC_GETGR_R_SIZE_MAX
5693 {*r = _SC_GETGR_R_SIZE_MAX; return 0;}
5694 #else /* def _SC_GETGR_R_SIZE_MAX */
5695 {errno = EINVAL; return -1;}
5696 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
5697 if (x == Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX)
5698 #ifdef _SC_GETPW_R_SIZE_MAX
5699 {*r = _SC_GETPW_R_SIZE_MAX; return 0;}
5700 #else /* def _SC_GETPW_R_SIZE_MAX */
5701 {errno = EINVAL; return -1;}
5702 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
5703 if (x == Mono_Posix_SysconfName__SC_HOST_NAME_MAX)
5704 #ifdef _SC_HOST_NAME_MAX
5705 {*r = _SC_HOST_NAME_MAX; return 0;}
5706 #else /* def _SC_HOST_NAME_MAX */
5707 {errno = EINVAL; return -1;}
5708 #endif /* ndef _SC_HOST_NAME_MAX */
5709 if (x == Mono_Posix_SysconfName__SC_INT_MAX)
5710 #ifdef _SC_INT_MAX
5711 {*r = _SC_INT_MAX; return 0;}
5712 #else /* def _SC_INT_MAX */
5713 {errno = EINVAL; return -1;}
5714 #endif /* ndef _SC_INT_MAX */
5715 if (x == Mono_Posix_SysconfName__SC_INT_MIN)
5716 #ifdef _SC_INT_MIN
5717 {*r = _SC_INT_MIN; return 0;}
5718 #else /* def _SC_INT_MIN */
5719 {errno = EINVAL; return -1;}
5720 #endif /* ndef _SC_INT_MIN */
5721 if (x == Mono_Posix_SysconfName__SC_IOV_MAX)
5722 #ifdef _SC_IOV_MAX
5723 {*r = _SC_IOV_MAX; return 0;}
5724 #else /* def _SC_IOV_MAX */
5725 {errno = EINVAL; return -1;}
5726 #endif /* ndef _SC_IOV_MAX */
5727 if (x == Mono_Posix_SysconfName__SC_JOB_CONTROL)
5728 #ifdef _SC_JOB_CONTROL
5729 {*r = _SC_JOB_CONTROL; return 0;}
5730 #else /* def _SC_JOB_CONTROL */
5731 {errno = EINVAL; return -1;}
5732 #endif /* ndef _SC_JOB_CONTROL */
5733 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC)
5734 #ifdef _SC_LEVEL1_DCACHE_ASSOC
5735 {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;}
5736 #else /* def _SC_LEVEL1_DCACHE_ASSOC */
5737 {errno = EINVAL; return -1;}
5738 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
5739 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE)
5740 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
5741 {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;}
5742 #else /* def _SC_LEVEL1_DCACHE_LINESIZE */
5743 {errno = EINVAL; return -1;}
5744 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
5745 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE)
5746 #ifdef _SC_LEVEL1_DCACHE_SIZE
5747 {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;}
5748 #else /* def _SC_LEVEL1_DCACHE_SIZE */
5749 {errno = EINVAL; return -1;}
5750 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
5751 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC)
5752 #ifdef _SC_LEVEL1_ICACHE_ASSOC
5753 {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;}
5754 #else /* def _SC_LEVEL1_ICACHE_ASSOC */
5755 {errno = EINVAL; return -1;}
5756 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
5757 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE)
5758 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
5759 {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;}
5760 #else /* def _SC_LEVEL1_ICACHE_LINESIZE */
5761 {errno = EINVAL; return -1;}
5762 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
5763 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE)
5764 #ifdef _SC_LEVEL1_ICACHE_SIZE
5765 {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;}
5766 #else /* def _SC_LEVEL1_ICACHE_SIZE */
5767 {errno = EINVAL; return -1;}
5768 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
5769 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC)
5770 #ifdef _SC_LEVEL2_CACHE_ASSOC
5771 {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;}
5772 #else /* def _SC_LEVEL2_CACHE_ASSOC */
5773 {errno = EINVAL; return -1;}
5774 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
5775 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE)
5776 #ifdef _SC_LEVEL2_CACHE_LINESIZE
5777 {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;}
5778 #else /* def _SC_LEVEL2_CACHE_LINESIZE */
5779 {errno = EINVAL; return -1;}
5780 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
5781 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE)
5782 #ifdef _SC_LEVEL2_CACHE_SIZE
5783 {*r = _SC_LEVEL2_CACHE_SIZE; return 0;}
5784 #else /* def _SC_LEVEL2_CACHE_SIZE */
5785 {errno = EINVAL; return -1;}
5786 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
5787 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC)
5788 #ifdef _SC_LEVEL3_CACHE_ASSOC
5789 {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;}
5790 #else /* def _SC_LEVEL3_CACHE_ASSOC */
5791 {errno = EINVAL; return -1;}
5792 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
5793 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE)
5794 #ifdef _SC_LEVEL3_CACHE_LINESIZE
5795 {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;}
5796 #else /* def _SC_LEVEL3_CACHE_LINESIZE */
5797 {errno = EINVAL; return -1;}
5798 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
5799 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE)
5800 #ifdef _SC_LEVEL3_CACHE_SIZE
5801 {*r = _SC_LEVEL3_CACHE_SIZE; return 0;}
5802 #else /* def _SC_LEVEL3_CACHE_SIZE */
5803 {errno = EINVAL; return -1;}
5804 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
5805 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC)
5806 #ifdef _SC_LEVEL4_CACHE_ASSOC
5807 {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;}
5808 #else /* def _SC_LEVEL4_CACHE_ASSOC */
5809 {errno = EINVAL; return -1;}
5810 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
5811 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE)
5812 #ifdef _SC_LEVEL4_CACHE_LINESIZE
5813 {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;}
5814 #else /* def _SC_LEVEL4_CACHE_LINESIZE */
5815 {errno = EINVAL; return -1;}
5816 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
5817 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE)
5818 #ifdef _SC_LEVEL4_CACHE_SIZE
5819 {*r = _SC_LEVEL4_CACHE_SIZE; return 0;}
5820 #else /* def _SC_LEVEL4_CACHE_SIZE */
5821 {errno = EINVAL; return -1;}
5822 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
5823 if (x == Mono_Posix_SysconfName__SC_LINE_MAX)
5824 #ifdef _SC_LINE_MAX
5825 {*r = _SC_LINE_MAX; return 0;}
5826 #else /* def _SC_LINE_MAX */
5827 {errno = EINVAL; return -1;}
5828 #endif /* ndef _SC_LINE_MAX */
5829 if (x == Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX)
5830 #ifdef _SC_LOGIN_NAME_MAX
5831 {*r = _SC_LOGIN_NAME_MAX; return 0;}
5832 #else /* def _SC_LOGIN_NAME_MAX */
5833 {errno = EINVAL; return -1;}
5834 #endif /* ndef _SC_LOGIN_NAME_MAX */
5835 if (x == Mono_Posix_SysconfName__SC_LONG_BIT)
5836 #ifdef _SC_LONG_BIT
5837 {*r = _SC_LONG_BIT; return 0;}
5838 #else /* def _SC_LONG_BIT */
5839 {errno = EINVAL; return -1;}
5840 #endif /* ndef _SC_LONG_BIT */
5841 if (x == Mono_Posix_SysconfName__SC_MAPPED_FILES)
5842 #ifdef _SC_MAPPED_FILES
5843 {*r = _SC_MAPPED_FILES; return 0;}
5844 #else /* def _SC_MAPPED_FILES */
5845 {errno = EINVAL; return -1;}
5846 #endif /* ndef _SC_MAPPED_FILES */
5847 if (x == Mono_Posix_SysconfName__SC_MB_LEN_MAX)
5848 #ifdef _SC_MB_LEN_MAX
5849 {*r = _SC_MB_LEN_MAX; return 0;}
5850 #else /* def _SC_MB_LEN_MAX */
5851 {errno = EINVAL; return -1;}
5852 #endif /* ndef _SC_MB_LEN_MAX */
5853 if (x == Mono_Posix_SysconfName__SC_MEMLOCK)
5854 #ifdef _SC_MEMLOCK
5855 {*r = _SC_MEMLOCK; return 0;}
5856 #else /* def _SC_MEMLOCK */
5857 {errno = EINVAL; return -1;}
5858 #endif /* ndef _SC_MEMLOCK */
5859 if (x == Mono_Posix_SysconfName__SC_MEMLOCK_RANGE)
5860 #ifdef _SC_MEMLOCK_RANGE
5861 {*r = _SC_MEMLOCK_RANGE; return 0;}
5862 #else /* def _SC_MEMLOCK_RANGE */
5863 {errno = EINVAL; return -1;}
5864 #endif /* ndef _SC_MEMLOCK_RANGE */
5865 if (x == Mono_Posix_SysconfName__SC_MEMORY_PROTECTION)
5866 #ifdef _SC_MEMORY_PROTECTION
5867 {*r = _SC_MEMORY_PROTECTION; return 0;}
5868 #else /* def _SC_MEMORY_PROTECTION */
5869 {errno = EINVAL; return -1;}
5870 #endif /* ndef _SC_MEMORY_PROTECTION */
5871 if (x == Mono_Posix_SysconfName__SC_MESSAGE_PASSING)
5872 #ifdef _SC_MESSAGE_PASSING
5873 {*r = _SC_MESSAGE_PASSING; return 0;}
5874 #else /* def _SC_MESSAGE_PASSING */
5875 {errno = EINVAL; return -1;}
5876 #endif /* ndef _SC_MESSAGE_PASSING */
5877 if (x == Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK)
5878 #ifdef _SC_MONOTONIC_CLOCK
5879 {*r = _SC_MONOTONIC_CLOCK; return 0;}
5880 #else /* def _SC_MONOTONIC_CLOCK */
5881 {errno = EINVAL; return -1;}
5882 #endif /* ndef _SC_MONOTONIC_CLOCK */
5883 if (x == Mono_Posix_SysconfName__SC_MQ_OPEN_MAX)
5884 #ifdef _SC_MQ_OPEN_MAX
5885 {*r = _SC_MQ_OPEN_MAX; return 0;}
5886 #else /* def _SC_MQ_OPEN_MAX */
5887 {errno = EINVAL; return -1;}
5888 #endif /* ndef _SC_MQ_OPEN_MAX */
5889 if (x == Mono_Posix_SysconfName__SC_MQ_PRIO_MAX)
5890 #ifdef _SC_MQ_PRIO_MAX
5891 {*r = _SC_MQ_PRIO_MAX; return 0;}
5892 #else /* def _SC_MQ_PRIO_MAX */
5893 {errno = EINVAL; return -1;}
5894 #endif /* ndef _SC_MQ_PRIO_MAX */
5895 if (x == Mono_Posix_SysconfName__SC_MULTI_PROCESS)
5896 #ifdef _SC_MULTI_PROCESS
5897 {*r = _SC_MULTI_PROCESS; return 0;}
5898 #else /* def _SC_MULTI_PROCESS */
5899 {errno = EINVAL; return -1;}
5900 #endif /* ndef _SC_MULTI_PROCESS */
5901 if (x == Mono_Posix_SysconfName__SC_NETWORKING)
5902 #ifdef _SC_NETWORKING
5903 {*r = _SC_NETWORKING; return 0;}
5904 #else /* def _SC_NETWORKING */
5905 {errno = EINVAL; return -1;}
5906 #endif /* ndef _SC_NETWORKING */
5907 if (x == Mono_Posix_SysconfName__SC_NGROUPS_MAX)
5908 #ifdef _SC_NGROUPS_MAX
5909 {*r = _SC_NGROUPS_MAX; return 0;}
5910 #else /* def _SC_NGROUPS_MAX */
5911 {errno = EINVAL; return -1;}
5912 #endif /* ndef _SC_NGROUPS_MAX */
5913 if (x == Mono_Posix_SysconfName__SC_NL_ARGMAX)
5914 #ifdef _SC_NL_ARGMAX
5915 {*r = _SC_NL_ARGMAX; return 0;}
5916 #else /* def _SC_NL_ARGMAX */
5917 {errno = EINVAL; return -1;}
5918 #endif /* ndef _SC_NL_ARGMAX */
5919 if (x == Mono_Posix_SysconfName__SC_NL_LANGMAX)
5920 #ifdef _SC_NL_LANGMAX
5921 {*r = _SC_NL_LANGMAX; return 0;}
5922 #else /* def _SC_NL_LANGMAX */
5923 {errno = EINVAL; return -1;}
5924 #endif /* ndef _SC_NL_LANGMAX */
5925 if (x == Mono_Posix_SysconfName__SC_NL_MSGMAX)
5926 #ifdef _SC_NL_MSGMAX
5927 {*r = _SC_NL_MSGMAX; return 0;}
5928 #else /* def _SC_NL_MSGMAX */
5929 {errno = EINVAL; return -1;}
5930 #endif /* ndef _SC_NL_MSGMAX */
5931 if (x == Mono_Posix_SysconfName__SC_NL_NMAX)
5932 #ifdef _SC_NL_NMAX
5933 {*r = _SC_NL_NMAX; return 0;}
5934 #else /* def _SC_NL_NMAX */
5935 {errno = EINVAL; return -1;}
5936 #endif /* ndef _SC_NL_NMAX */
5937 if (x == Mono_Posix_SysconfName__SC_NL_SETMAX)
5938 #ifdef _SC_NL_SETMAX
5939 {*r = _SC_NL_SETMAX; return 0;}
5940 #else /* def _SC_NL_SETMAX */
5941 {errno = EINVAL; return -1;}
5942 #endif /* ndef _SC_NL_SETMAX */
5943 if (x == Mono_Posix_SysconfName__SC_NL_TEXTMAX)
5944 #ifdef _SC_NL_TEXTMAX
5945 {*r = _SC_NL_TEXTMAX; return 0;}
5946 #else /* def _SC_NL_TEXTMAX */
5947 {errno = EINVAL; return -1;}
5948 #endif /* ndef _SC_NL_TEXTMAX */
5949 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_CONF)
5950 #ifdef _SC_NPROCESSORS_CONF
5951 {*r = _SC_NPROCESSORS_CONF; return 0;}
5952 #else /* def _SC_NPROCESSORS_CONF */
5953 {errno = EINVAL; return -1;}
5954 #endif /* ndef _SC_NPROCESSORS_CONF */
5955 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN)
5956 #ifdef _SC_NPROCESSORS_ONLN
5957 {*r = _SC_NPROCESSORS_ONLN; return 0;}
5958 #else /* def _SC_NPROCESSORS_ONLN */
5959 {errno = EINVAL; return -1;}
5960 #endif /* ndef _SC_NPROCESSORS_ONLN */
5961 if (x == Mono_Posix_SysconfName__SC_NZERO)
5962 #ifdef _SC_NZERO
5963 {*r = _SC_NZERO; return 0;}
5964 #else /* def _SC_NZERO */
5965 {errno = EINVAL; return -1;}
5966 #endif /* ndef _SC_NZERO */
5967 if (x == Mono_Posix_SysconfName__SC_OPEN_MAX)
5968 #ifdef _SC_OPEN_MAX
5969 {*r = _SC_OPEN_MAX; return 0;}
5970 #else /* def _SC_OPEN_MAX */
5971 {errno = EINVAL; return -1;}
5972 #endif /* ndef _SC_OPEN_MAX */
5973 if (x == Mono_Posix_SysconfName__SC_PAGESIZE)
5974 #ifdef _SC_PAGESIZE
5975 {*r = _SC_PAGESIZE; return 0;}
5976 #else /* def _SC_PAGESIZE */
5977 {errno = EINVAL; return -1;}
5978 #endif /* ndef _SC_PAGESIZE */
5979 if (x == Mono_Posix_SysconfName__SC_PASS_MAX)
5980 #ifdef _SC_PASS_MAX
5981 {*r = _SC_PASS_MAX; return 0;}
5982 #else /* def _SC_PASS_MAX */
5983 {errno = EINVAL; return -1;}
5984 #endif /* ndef _SC_PASS_MAX */
5985 if (x == Mono_Posix_SysconfName__SC_PHYS_PAGES)
5986 #ifdef _SC_PHYS_PAGES
5987 {*r = _SC_PHYS_PAGES; return 0;}
5988 #else /* def _SC_PHYS_PAGES */
5989 {errno = EINVAL; return -1;}
5990 #endif /* ndef _SC_PHYS_PAGES */
5991 if (x == Mono_Posix_SysconfName__SC_PII)
5992 #ifdef _SC_PII
5993 {*r = _SC_PII; return 0;}
5994 #else /* def _SC_PII */
5995 {errno = EINVAL; return -1;}
5996 #endif /* ndef _SC_PII */
5997 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET)
5998 #ifdef _SC_PII_INTERNET
5999 {*r = _SC_PII_INTERNET; return 0;}
6000 #else /* def _SC_PII_INTERNET */
6001 {errno = EINVAL; return -1;}
6002 #endif /* ndef _SC_PII_INTERNET */
6003 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM)
6004 #ifdef _SC_PII_INTERNET_DGRAM
6005 {*r = _SC_PII_INTERNET_DGRAM; return 0;}
6006 #else /* def _SC_PII_INTERNET_DGRAM */
6007 {errno = EINVAL; return -1;}
6008 #endif /* ndef _SC_PII_INTERNET_DGRAM */
6009 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM)
6010 #ifdef _SC_PII_INTERNET_STREAM
6011 {*r = _SC_PII_INTERNET_STREAM; return 0;}
6012 #else /* def _SC_PII_INTERNET_STREAM */
6013 {errno = EINVAL; return -1;}
6014 #endif /* ndef _SC_PII_INTERNET_STREAM */
6015 if (x == Mono_Posix_SysconfName__SC_PII_OSI)
6016 #ifdef _SC_PII_OSI
6017 {*r = _SC_PII_OSI; return 0;}
6018 #else /* def _SC_PII_OSI */
6019 {errno = EINVAL; return -1;}
6020 #endif /* ndef _SC_PII_OSI */
6021 if (x == Mono_Posix_SysconfName__SC_PII_OSI_CLTS)
6022 #ifdef _SC_PII_OSI_CLTS
6023 {*r = _SC_PII_OSI_CLTS; return 0;}
6024 #else /* def _SC_PII_OSI_CLTS */
6025 {errno = EINVAL; return -1;}
6026 #endif /* ndef _SC_PII_OSI_CLTS */
6027 if (x == Mono_Posix_SysconfName__SC_PII_OSI_COTS)
6028 #ifdef _SC_PII_OSI_COTS
6029 {*r = _SC_PII_OSI_COTS; return 0;}
6030 #else /* def _SC_PII_OSI_COTS */
6031 {errno = EINVAL; return -1;}
6032 #endif /* ndef _SC_PII_OSI_COTS */
6033 if (x == Mono_Posix_SysconfName__SC_PII_OSI_M)
6034 #ifdef _SC_PII_OSI_M
6035 {*r = _SC_PII_OSI_M; return 0;}
6036 #else /* def _SC_PII_OSI_M */
6037 {errno = EINVAL; return -1;}
6038 #endif /* ndef _SC_PII_OSI_M */
6039 if (x == Mono_Posix_SysconfName__SC_PII_SOCKET)
6040 #ifdef _SC_PII_SOCKET
6041 {*r = _SC_PII_SOCKET; return 0;}
6042 #else /* def _SC_PII_SOCKET */
6043 {errno = EINVAL; return -1;}
6044 #endif /* ndef _SC_PII_SOCKET */
6045 if (x == Mono_Posix_SysconfName__SC_PII_XTI)
6046 #ifdef _SC_PII_XTI
6047 {*r = _SC_PII_XTI; return 0;}
6048 #else /* def _SC_PII_XTI */
6049 {errno = EINVAL; return -1;}
6050 #endif /* ndef _SC_PII_XTI */
6051 if (x == Mono_Posix_SysconfName__SC_PIPE)
6052 #ifdef _SC_PIPE
6053 {*r = _SC_PIPE; return 0;}
6054 #else /* def _SC_PIPE */
6055 {errno = EINVAL; return -1;}
6056 #endif /* ndef _SC_PIPE */
6057 if (x == Mono_Posix_SysconfName__SC_POLL)
6058 #ifdef _SC_POLL
6059 {*r = _SC_POLL; return 0;}
6060 #else /* def _SC_POLL */
6061 {errno = EINVAL; return -1;}
6062 #endif /* ndef _SC_POLL */
6063 if (x == Mono_Posix_SysconfName__SC_PRIORITIZED_IO)
6064 #ifdef _SC_PRIORITIZED_IO
6065 {*r = _SC_PRIORITIZED_IO; return 0;}
6066 #else /* def _SC_PRIORITIZED_IO */
6067 {errno = EINVAL; return -1;}
6068 #endif /* ndef _SC_PRIORITIZED_IO */
6069 if (x == Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING)
6070 #ifdef _SC_PRIORITY_SCHEDULING
6071 {*r = _SC_PRIORITY_SCHEDULING; return 0;}
6072 #else /* def _SC_PRIORITY_SCHEDULING */
6073 {errno = EINVAL; return -1;}
6074 #endif /* ndef _SC_PRIORITY_SCHEDULING */
6075 if (x == Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS)
6076 #ifdef _SC_READER_WRITER_LOCKS
6077 {*r = _SC_READER_WRITER_LOCKS; return 0;}
6078 #else /* def _SC_READER_WRITER_LOCKS */
6079 {errno = EINVAL; return -1;}
6080 #endif /* ndef _SC_READER_WRITER_LOCKS */
6081 if (x == Mono_Posix_SysconfName__SC_REALTIME_SIGNALS)
6082 #ifdef _SC_REALTIME_SIGNALS
6083 {*r = _SC_REALTIME_SIGNALS; return 0;}
6084 #else /* def _SC_REALTIME_SIGNALS */
6085 {errno = EINVAL; return -1;}
6086 #endif /* ndef _SC_REALTIME_SIGNALS */
6087 if (x == Mono_Posix_SysconfName__SC_REGEXP)
6088 #ifdef _SC_REGEXP
6089 {*r = _SC_REGEXP; return 0;}
6090 #else /* def _SC_REGEXP */
6091 {errno = EINVAL; return -1;}
6092 #endif /* ndef _SC_REGEXP */
6093 if (x == Mono_Posix_SysconfName__SC_REGEX_VERSION)
6094 #ifdef _SC_REGEX_VERSION
6095 {*r = _SC_REGEX_VERSION; return 0;}
6096 #else /* def _SC_REGEX_VERSION */
6097 {errno = EINVAL; return -1;}
6098 #endif /* ndef _SC_REGEX_VERSION */
6099 if (x == Mono_Posix_SysconfName__SC_RE_DUP_MAX)
6100 #ifdef _SC_RE_DUP_MAX
6101 {*r = _SC_RE_DUP_MAX; return 0;}
6102 #else /* def _SC_RE_DUP_MAX */
6103 {errno = EINVAL; return -1;}
6104 #endif /* ndef _SC_RE_DUP_MAX */
6105 if (x == Mono_Posix_SysconfName__SC_RTSIG_MAX)
6106 #ifdef _SC_RTSIG_MAX
6107 {*r = _SC_RTSIG_MAX; return 0;}
6108 #else /* def _SC_RTSIG_MAX */
6109 {errno = EINVAL; return -1;}
6110 #endif /* ndef _SC_RTSIG_MAX */
6111 if (x == Mono_Posix_SysconfName__SC_SAVED_IDS)
6112 #ifdef _SC_SAVED_IDS
6113 {*r = _SC_SAVED_IDS; return 0;}
6114 #else /* def _SC_SAVED_IDS */
6115 {errno = EINVAL; return -1;}
6116 #endif /* ndef _SC_SAVED_IDS */
6117 if (x == Mono_Posix_SysconfName__SC_SCHAR_MAX)
6118 #ifdef _SC_SCHAR_MAX
6119 {*r = _SC_SCHAR_MAX; return 0;}
6120 #else /* def _SC_SCHAR_MAX */
6121 {errno = EINVAL; return -1;}
6122 #endif /* ndef _SC_SCHAR_MAX */
6123 if (x == Mono_Posix_SysconfName__SC_SCHAR_MIN)
6124 #ifdef _SC_SCHAR_MIN
6125 {*r = _SC_SCHAR_MIN; return 0;}
6126 #else /* def _SC_SCHAR_MIN */
6127 {errno = EINVAL; return -1;}
6128 #endif /* ndef _SC_SCHAR_MIN */
6129 if (x == Mono_Posix_SysconfName__SC_SELECT)
6130 #ifdef _SC_SELECT
6131 {*r = _SC_SELECT; return 0;}
6132 #else /* def _SC_SELECT */
6133 {errno = EINVAL; return -1;}
6134 #endif /* ndef _SC_SELECT */
6135 if (x == Mono_Posix_SysconfName__SC_SEMAPHORES)
6136 #ifdef _SC_SEMAPHORES
6137 {*r = _SC_SEMAPHORES; return 0;}
6138 #else /* def _SC_SEMAPHORES */
6139 {errno = EINVAL; return -1;}
6140 #endif /* ndef _SC_SEMAPHORES */
6141 if (x == Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX)
6142 #ifdef _SC_SEM_NSEMS_MAX
6143 {*r = _SC_SEM_NSEMS_MAX; return 0;}
6144 #else /* def _SC_SEM_NSEMS_MAX */
6145 {errno = EINVAL; return -1;}
6146 #endif /* ndef _SC_SEM_NSEMS_MAX */
6147 if (x == Mono_Posix_SysconfName__SC_SEM_VALUE_MAX)
6148 #ifdef _SC_SEM_VALUE_MAX
6149 {*r = _SC_SEM_VALUE_MAX; return 0;}
6150 #else /* def _SC_SEM_VALUE_MAX */
6151 {errno = EINVAL; return -1;}
6152 #endif /* ndef _SC_SEM_VALUE_MAX */
6153 if (x == Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS)
6154 #ifdef _SC_SHARED_MEMORY_OBJECTS
6155 {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
6156 #else /* def _SC_SHARED_MEMORY_OBJECTS */
6157 {errno = EINVAL; return -1;}
6158 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
6159 if (x == Mono_Posix_SysconfName__SC_SHELL)
6160 #ifdef _SC_SHELL
6161 {*r = _SC_SHELL; return 0;}
6162 #else /* def _SC_SHELL */
6163 {errno = EINVAL; return -1;}
6164 #endif /* ndef _SC_SHELL */
6165 if (x == Mono_Posix_SysconfName__SC_SHRT_MAX)
6166 #ifdef _SC_SHRT_MAX
6167 {*r = _SC_SHRT_MAX; return 0;}
6168 #else /* def _SC_SHRT_MAX */
6169 {errno = EINVAL; return -1;}
6170 #endif /* ndef _SC_SHRT_MAX */
6171 if (x == Mono_Posix_SysconfName__SC_SHRT_MIN)
6172 #ifdef _SC_SHRT_MIN
6173 {*r = _SC_SHRT_MIN; return 0;}
6174 #else /* def _SC_SHRT_MIN */
6175 {errno = EINVAL; return -1;}
6176 #endif /* ndef _SC_SHRT_MIN */
6177 if (x == Mono_Posix_SysconfName__SC_SIGNALS)
6178 #ifdef _SC_SIGNALS
6179 {*r = _SC_SIGNALS; return 0;}
6180 #else /* def _SC_SIGNALS */
6181 {errno = EINVAL; return -1;}
6182 #endif /* ndef _SC_SIGNALS */
6183 if (x == Mono_Posix_SysconfName__SC_SIGQUEUE_MAX)
6184 #ifdef _SC_SIGQUEUE_MAX
6185 {*r = _SC_SIGQUEUE_MAX; return 0;}
6186 #else /* def _SC_SIGQUEUE_MAX */
6187 {errno = EINVAL; return -1;}
6188 #endif /* ndef _SC_SIGQUEUE_MAX */
6189 if (x == Mono_Posix_SysconfName__SC_SINGLE_PROCESS)
6190 #ifdef _SC_SINGLE_PROCESS
6191 {*r = _SC_SINGLE_PROCESS; return 0;}
6192 #else /* def _SC_SINGLE_PROCESS */
6193 {errno = EINVAL; return -1;}
6194 #endif /* ndef _SC_SINGLE_PROCESS */
6195 if (x == Mono_Posix_SysconfName__SC_SPAWN)
6196 #ifdef _SC_SPAWN
6197 {*r = _SC_SPAWN; return 0;}
6198 #else /* def _SC_SPAWN */
6199 {errno = EINVAL; return -1;}
6200 #endif /* ndef _SC_SPAWN */
6201 if (x == Mono_Posix_SysconfName__SC_SPIN_LOCKS)
6202 #ifdef _SC_SPIN_LOCKS
6203 {*r = _SC_SPIN_LOCKS; return 0;}
6204 #else /* def _SC_SPIN_LOCKS */
6205 {errno = EINVAL; return -1;}
6206 #endif /* ndef _SC_SPIN_LOCKS */
6207 if (x == Mono_Posix_SysconfName__SC_SPORADIC_SERVER)
6208 #ifdef _SC_SPORADIC_SERVER
6209 {*r = _SC_SPORADIC_SERVER; return 0;}
6210 #else /* def _SC_SPORADIC_SERVER */
6211 {errno = EINVAL; return -1;}
6212 #endif /* ndef _SC_SPORADIC_SERVER */
6213 if (x == Mono_Posix_SysconfName__SC_SSIZE_MAX)
6214 #ifdef _SC_SSIZE_MAX
6215 {*r = _SC_SSIZE_MAX; return 0;}
6216 #else /* def _SC_SSIZE_MAX */
6217 {errno = EINVAL; return -1;}
6218 #endif /* ndef _SC_SSIZE_MAX */
6219 if (x == Mono_Posix_SysconfName__SC_STREAMS)
6220 #ifdef _SC_STREAMS
6221 {*r = _SC_STREAMS; return 0;}
6222 #else /* def _SC_STREAMS */
6223 {errno = EINVAL; return -1;}
6224 #endif /* ndef _SC_STREAMS */
6225 if (x == Mono_Posix_SysconfName__SC_STREAM_MAX)
6226 #ifdef _SC_STREAM_MAX
6227 {*r = _SC_STREAM_MAX; return 0;}
6228 #else /* def _SC_STREAM_MAX */
6229 {errno = EINVAL; return -1;}
6230 #endif /* ndef _SC_STREAM_MAX */
6231 if (x == Mono_Posix_SysconfName__SC_SYMLOOP_MAX)
6232 #ifdef _SC_SYMLOOP_MAX
6233 {*r = _SC_SYMLOOP_MAX; return 0;}
6234 #else /* def _SC_SYMLOOP_MAX */
6235 {errno = EINVAL; return -1;}
6236 #endif /* ndef _SC_SYMLOOP_MAX */
6237 if (x == Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO)
6238 #ifdef _SC_SYNCHRONIZED_IO
6239 {*r = _SC_SYNCHRONIZED_IO; return 0;}
6240 #else /* def _SC_SYNCHRONIZED_IO */
6241 {errno = EINVAL; return -1;}
6242 #endif /* ndef _SC_SYNCHRONIZED_IO */
6243 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE)
6244 #ifdef _SC_SYSTEM_DATABASE
6245 {*r = _SC_SYSTEM_DATABASE; return 0;}
6246 #else /* def _SC_SYSTEM_DATABASE */
6247 {errno = EINVAL; return -1;}
6248 #endif /* ndef _SC_SYSTEM_DATABASE */
6249 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R)
6250 #ifdef _SC_SYSTEM_DATABASE_R
6251 {*r = _SC_SYSTEM_DATABASE_R; return 0;}
6252 #else /* def _SC_SYSTEM_DATABASE_R */
6253 {errno = EINVAL; return -1;}
6254 #endif /* ndef _SC_SYSTEM_DATABASE_R */
6255 if (x == Mono_Posix_SysconfName__SC_THREADS)
6256 #ifdef _SC_THREADS
6257 {*r = _SC_THREADS; return 0;}
6258 #else /* def _SC_THREADS */
6259 {errno = EINVAL; return -1;}
6260 #endif /* ndef _SC_THREADS */
6261 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR)
6262 #ifdef _SC_THREAD_ATTR_STACKADDR
6263 {*r = _SC_THREAD_ATTR_STACKADDR; return 0;}
6264 #else /* def _SC_THREAD_ATTR_STACKADDR */
6265 {errno = EINVAL; return -1;}
6266 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
6267 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE)
6268 #ifdef _SC_THREAD_ATTR_STACKSIZE
6269 {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;}
6270 #else /* def _SC_THREAD_ATTR_STACKSIZE */
6271 {errno = EINVAL; return -1;}
6272 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
6273 if (x == Mono_Posix_SysconfName__SC_THREAD_CPUTIME)
6274 #ifdef _SC_THREAD_CPUTIME
6275 {*r = _SC_THREAD_CPUTIME; return 0;}
6276 #else /* def _SC_THREAD_CPUTIME */
6277 {errno = EINVAL; return -1;}
6278 #endif /* ndef _SC_THREAD_CPUTIME */
6279 if (x == Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS)
6280 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
6281 {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
6282 #else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */
6283 {errno = EINVAL; return -1;}
6284 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
6285 if (x == Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX)
6286 #ifdef _SC_THREAD_KEYS_MAX
6287 {*r = _SC_THREAD_KEYS_MAX; return 0;}
6288 #else /* def _SC_THREAD_KEYS_MAX */
6289 {errno = EINVAL; return -1;}
6290 #endif /* ndef _SC_THREAD_KEYS_MAX */
6291 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING)
6292 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
6293 {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;}
6294 #else /* def _SC_THREAD_PRIORITY_SCHEDULING */
6295 {errno = EINVAL; return -1;}
6296 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
6297 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT)
6298 #ifdef _SC_THREAD_PRIO_INHERIT
6299 {*r = _SC_THREAD_PRIO_INHERIT; return 0;}
6300 #else /* def _SC_THREAD_PRIO_INHERIT */
6301 {errno = EINVAL; return -1;}
6302 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
6303 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT)
6304 #ifdef _SC_THREAD_PRIO_PROTECT
6305 {*r = _SC_THREAD_PRIO_PROTECT; return 0;}
6306 #else /* def _SC_THREAD_PRIO_PROTECT */
6307 {errno = EINVAL; return -1;}
6308 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
6309 if (x == Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED)
6310 #ifdef _SC_THREAD_PROCESS_SHARED
6311 {*r = _SC_THREAD_PROCESS_SHARED; return 0;}
6312 #else /* def _SC_THREAD_PROCESS_SHARED */
6313 {errno = EINVAL; return -1;}
6314 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
6315 if (x == Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS)
6316 #ifdef _SC_THREAD_SAFE_FUNCTIONS
6317 {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;}
6318 #else /* def _SC_THREAD_SAFE_FUNCTIONS */
6319 {errno = EINVAL; return -1;}
6320 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
6321 if (x == Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER)
6322 #ifdef _SC_THREAD_SPORADIC_SERVER
6323 {*r = _SC_THREAD_SPORADIC_SERVER; return 0;}
6324 #else /* def _SC_THREAD_SPORADIC_SERVER */
6325 {errno = EINVAL; return -1;}
6326 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
6327 if (x == Mono_Posix_SysconfName__SC_THREAD_STACK_MIN)
6328 #ifdef _SC_THREAD_STACK_MIN
6329 {*r = _SC_THREAD_STACK_MIN; return 0;}
6330 #else /* def _SC_THREAD_STACK_MIN */
6331 {errno = EINVAL; return -1;}
6332 #endif /* ndef _SC_THREAD_STACK_MIN */
6333 if (x == Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX)
6334 #ifdef _SC_THREAD_THREADS_MAX
6335 {*r = _SC_THREAD_THREADS_MAX; return 0;}
6336 #else /* def _SC_THREAD_THREADS_MAX */
6337 {errno = EINVAL; return -1;}
6338 #endif /* ndef _SC_THREAD_THREADS_MAX */
6339 if (x == Mono_Posix_SysconfName__SC_TIMEOUTS)
6340 #ifdef _SC_TIMEOUTS
6341 {*r = _SC_TIMEOUTS; return 0;}
6342 #else /* def _SC_TIMEOUTS */
6343 {errno = EINVAL; return -1;}
6344 #endif /* ndef _SC_TIMEOUTS */
6345 if (x == Mono_Posix_SysconfName__SC_TIMERS)
6346 #ifdef _SC_TIMERS
6347 {*r = _SC_TIMERS; return 0;}
6348 #else /* def _SC_TIMERS */
6349 {errno = EINVAL; return -1;}
6350 #endif /* ndef _SC_TIMERS */
6351 if (x == Mono_Posix_SysconfName__SC_TIMER_MAX)
6352 #ifdef _SC_TIMER_MAX
6353 {*r = _SC_TIMER_MAX; return 0;}
6354 #else /* def _SC_TIMER_MAX */
6355 {errno = EINVAL; return -1;}
6356 #endif /* ndef _SC_TIMER_MAX */
6357 if (x == Mono_Posix_SysconfName__SC_TRACE)
6358 #ifdef _SC_TRACE
6359 {*r = _SC_TRACE; return 0;}
6360 #else /* def _SC_TRACE */
6361 {errno = EINVAL; return -1;}
6362 #endif /* ndef _SC_TRACE */
6363 if (x == Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER)
6364 #ifdef _SC_TRACE_EVENT_FILTER
6365 {*r = _SC_TRACE_EVENT_FILTER; return 0;}
6366 #else /* def _SC_TRACE_EVENT_FILTER */
6367 {errno = EINVAL; return -1;}
6368 #endif /* ndef _SC_TRACE_EVENT_FILTER */
6369 if (x == Mono_Posix_SysconfName__SC_TRACE_INHERIT)
6370 #ifdef _SC_TRACE_INHERIT
6371 {*r = _SC_TRACE_INHERIT; return 0;}
6372 #else /* def _SC_TRACE_INHERIT */
6373 {errno = EINVAL; return -1;}
6374 #endif /* ndef _SC_TRACE_INHERIT */
6375 if (x == Mono_Posix_SysconfName__SC_TRACE_LOG)
6376 #ifdef _SC_TRACE_LOG
6377 {*r = _SC_TRACE_LOG; return 0;}
6378 #else /* def _SC_TRACE_LOG */
6379 {errno = EINVAL; return -1;}
6380 #endif /* ndef _SC_TRACE_LOG */
6381 if (x == Mono_Posix_SysconfName__SC_TTY_NAME_MAX)
6382 #ifdef _SC_TTY_NAME_MAX
6383 {*r = _SC_TTY_NAME_MAX; return 0;}
6384 #else /* def _SC_TTY_NAME_MAX */
6385 {errno = EINVAL; return -1;}
6386 #endif /* ndef _SC_TTY_NAME_MAX */
6387 if (x == Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS)
6388 #ifdef _SC_TYPED_MEMORY_OBJECTS
6389 {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;}
6390 #else /* def _SC_TYPED_MEMORY_OBJECTS */
6391 {errno = EINVAL; return -1;}
6392 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
6393 if (x == Mono_Posix_SysconfName__SC_TZNAME_MAX)
6394 #ifdef _SC_TZNAME_MAX
6395 {*r = _SC_TZNAME_MAX; return 0;}
6396 #else /* def _SC_TZNAME_MAX */
6397 {errno = EINVAL; return -1;}
6398 #endif /* ndef _SC_TZNAME_MAX */
6399 if (x == Mono_Posix_SysconfName__SC_T_IOV_MAX)
6400 #ifdef _SC_T_IOV_MAX
6401 {*r = _SC_T_IOV_MAX; return 0;}
6402 #else /* def _SC_T_IOV_MAX */
6403 {errno = EINVAL; return -1;}
6404 #endif /* ndef _SC_T_IOV_MAX */
6405 if (x == Mono_Posix_SysconfName__SC_UCHAR_MAX)
6406 #ifdef _SC_UCHAR_MAX
6407 {*r = _SC_UCHAR_MAX; return 0;}
6408 #else /* def _SC_UCHAR_MAX */
6409 {errno = EINVAL; return -1;}
6410 #endif /* ndef _SC_UCHAR_MAX */
6411 if (x == Mono_Posix_SysconfName__SC_UINT_MAX)
6412 #ifdef _SC_UINT_MAX
6413 {*r = _SC_UINT_MAX; return 0;}
6414 #else /* def _SC_UINT_MAX */
6415 {errno = EINVAL; return -1;}
6416 #endif /* ndef _SC_UINT_MAX */
6417 if (x == Mono_Posix_SysconfName__SC_UIO_MAXIOV)
6418 #ifdef _SC_UIO_MAXIOV
6419 {*r = _SC_UIO_MAXIOV; return 0;}
6420 #else /* def _SC_UIO_MAXIOV */
6421 {errno = EINVAL; return -1;}
6422 #endif /* ndef _SC_UIO_MAXIOV */
6423 if (x == Mono_Posix_SysconfName__SC_ULONG_MAX)
6424 #ifdef _SC_ULONG_MAX
6425 {*r = _SC_ULONG_MAX; return 0;}
6426 #else /* def _SC_ULONG_MAX */
6427 {errno = EINVAL; return -1;}
6428 #endif /* ndef _SC_ULONG_MAX */
6429 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS)
6430 #ifdef _SC_USER_GROUPS
6431 {*r = _SC_USER_GROUPS; return 0;}
6432 #else /* def _SC_USER_GROUPS */
6433 {errno = EINVAL; return -1;}
6434 #endif /* ndef _SC_USER_GROUPS */
6435 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS_R)
6436 #ifdef _SC_USER_GROUPS_R
6437 {*r = _SC_USER_GROUPS_R; return 0;}
6438 #else /* def _SC_USER_GROUPS_R */
6439 {errno = EINVAL; return -1;}
6440 #endif /* ndef _SC_USER_GROUPS_R */
6441 if (x == Mono_Posix_SysconfName__SC_USHRT_MAX)
6442 #ifdef _SC_USHRT_MAX
6443 {*r = _SC_USHRT_MAX; return 0;}
6444 #else /* def _SC_USHRT_MAX */
6445 {errno = EINVAL; return -1;}
6446 #endif /* ndef _SC_USHRT_MAX */
6447 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFF32)
6448 #ifdef _SC_V6_ILP32_OFF32
6449 {*r = _SC_V6_ILP32_OFF32; return 0;}
6450 #else /* def _SC_V6_ILP32_OFF32 */
6451 {errno = EINVAL; return -1;}
6452 #endif /* ndef _SC_V6_ILP32_OFF32 */
6453 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG)
6454 #ifdef _SC_V6_ILP32_OFFBIG
6455 {*r = _SC_V6_ILP32_OFFBIG; return 0;}
6456 #else /* def _SC_V6_ILP32_OFFBIG */
6457 {errno = EINVAL; return -1;}
6458 #endif /* ndef _SC_V6_ILP32_OFFBIG */
6459 if (x == Mono_Posix_SysconfName__SC_V6_LP64_OFF64)
6460 #ifdef _SC_V6_LP64_OFF64
6461 {*r = _SC_V6_LP64_OFF64; return 0;}
6462 #else /* def _SC_V6_LP64_OFF64 */
6463 {errno = EINVAL; return -1;}
6464 #endif /* ndef _SC_V6_LP64_OFF64 */
6465 if (x == Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG)
6466 #ifdef _SC_V6_LPBIG_OFFBIG
6467 {*r = _SC_V6_LPBIG_OFFBIG; return 0;}
6468 #else /* def _SC_V6_LPBIG_OFFBIG */
6469 {errno = EINVAL; return -1;}
6470 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
6471 if (x == Mono_Posix_SysconfName__SC_VERSION)
6472 #ifdef _SC_VERSION
6473 {*r = _SC_VERSION; return 0;}
6474 #else /* def _SC_VERSION */
6475 {errno = EINVAL; return -1;}
6476 #endif /* ndef _SC_VERSION */
6477 if (x == Mono_Posix_SysconfName__SC_WORD_BIT)
6478 #ifdef _SC_WORD_BIT
6479 {*r = _SC_WORD_BIT; return 0;}
6480 #else /* def _SC_WORD_BIT */
6481 {errno = EINVAL; return -1;}
6482 #endif /* ndef _SC_WORD_BIT */
6483 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32)
6484 #ifdef _SC_XBS5_ILP32_OFF32
6485 {*r = _SC_XBS5_ILP32_OFF32; return 0;}
6486 #else /* def _SC_XBS5_ILP32_OFF32 */
6487 {errno = EINVAL; return -1;}
6488 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
6489 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG)
6490 #ifdef _SC_XBS5_ILP32_OFFBIG
6491 {*r = _SC_XBS5_ILP32_OFFBIG; return 0;}
6492 #else /* def _SC_XBS5_ILP32_OFFBIG */
6493 {errno = EINVAL; return -1;}
6494 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
6495 if (x == Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64)
6496 #ifdef _SC_XBS5_LP64_OFF64
6497 {*r = _SC_XBS5_LP64_OFF64; return 0;}
6498 #else /* def _SC_XBS5_LP64_OFF64 */
6499 {errno = EINVAL; return -1;}
6500 #endif /* ndef _SC_XBS5_LP64_OFF64 */
6501 if (x == Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG)
6502 #ifdef _SC_XBS5_LPBIG_OFFBIG
6503 {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;}
6504 #else /* def _SC_XBS5_LPBIG_OFFBIG */
6505 {errno = EINVAL; return -1;}
6506 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
6507 if (x == Mono_Posix_SysconfName__SC_XOPEN_CRYPT)
6508 #ifdef _SC_XOPEN_CRYPT
6509 {*r = _SC_XOPEN_CRYPT; return 0;}
6510 #else /* def _SC_XOPEN_CRYPT */
6511 {errno = EINVAL; return -1;}
6512 #endif /* ndef _SC_XOPEN_CRYPT */
6513 if (x == Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N)
6514 #ifdef _SC_XOPEN_ENH_I18N
6515 {*r = _SC_XOPEN_ENH_I18N; return 0;}
6516 #else /* def _SC_XOPEN_ENH_I18N */
6517 {errno = EINVAL; return -1;}
6518 #endif /* ndef _SC_XOPEN_ENH_I18N */
6519 if (x == Mono_Posix_SysconfName__SC_XOPEN_LEGACY)
6520 #ifdef _SC_XOPEN_LEGACY
6521 {*r = _SC_XOPEN_LEGACY; return 0;}
6522 #else /* def _SC_XOPEN_LEGACY */
6523 {errno = EINVAL; return -1;}
6524 #endif /* ndef _SC_XOPEN_LEGACY */
6525 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME)
6526 #ifdef _SC_XOPEN_REALTIME
6527 {*r = _SC_XOPEN_REALTIME; return 0;}
6528 #else /* def _SC_XOPEN_REALTIME */
6529 {errno = EINVAL; return -1;}
6530 #endif /* ndef _SC_XOPEN_REALTIME */
6531 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS)
6532 #ifdef _SC_XOPEN_REALTIME_THREADS
6533 {*r = _SC_XOPEN_REALTIME_THREADS; return 0;}
6534 #else /* def _SC_XOPEN_REALTIME_THREADS */
6535 {errno = EINVAL; return -1;}
6536 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6537 if (x == Mono_Posix_SysconfName__SC_XOPEN_SHM)
6538 #ifdef _SC_XOPEN_SHM
6539 {*r = _SC_XOPEN_SHM; return 0;}
6540 #else /* def _SC_XOPEN_SHM */
6541 {errno = EINVAL; return -1;}
6542 #endif /* ndef _SC_XOPEN_SHM */
6543 if (x == Mono_Posix_SysconfName__SC_XOPEN_UNIX)
6544 #ifdef _SC_XOPEN_UNIX
6545 {*r = _SC_XOPEN_UNIX; return 0;}
6546 #else /* def _SC_XOPEN_UNIX */
6547 {errno = EINVAL; return -1;}
6548 #endif /* ndef _SC_XOPEN_UNIX */
6549 if (x == Mono_Posix_SysconfName__SC_XOPEN_VERSION)
6550 #ifdef _SC_XOPEN_VERSION
6551 {*r = _SC_XOPEN_VERSION; return 0;}
6552 #else /* def _SC_XOPEN_VERSION */
6553 {errno = EINVAL; return -1;}
6554 #endif /* ndef _SC_XOPEN_VERSION */
6555 if (x == Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION)
6556 #ifdef _SC_XOPEN_XCU_VERSION
6557 {*r = _SC_XOPEN_XCU_VERSION; return 0;}
6558 #else /* def _SC_XOPEN_XCU_VERSION */
6559 {errno = EINVAL; return -1;}
6560 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6561 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG2)
6562 #ifdef _SC_XOPEN_XPG2
6563 {*r = _SC_XOPEN_XPG2; return 0;}
6564 #else /* def _SC_XOPEN_XPG2 */
6565 {errno = EINVAL; return -1;}
6566 #endif /* ndef _SC_XOPEN_XPG2 */
6567 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG3)
6568 #ifdef _SC_XOPEN_XPG3
6569 {*r = _SC_XOPEN_XPG3; return 0;}
6570 #else /* def _SC_XOPEN_XPG3 */
6571 {errno = EINVAL; return -1;}
6572 #endif /* ndef _SC_XOPEN_XPG3 */
6573 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG4)
6574 #ifdef _SC_XOPEN_XPG4
6575 {*r = _SC_XOPEN_XPG4; return 0;}
6576 #else /* def _SC_XOPEN_XPG4 */
6577 {errno = EINVAL; return -1;}
6578 #endif /* ndef _SC_XOPEN_XPG4 */
6579 if (x == 0)
6580 return 0;
6581 errno = EINVAL; return -1;
6584 int Mono_Posix_ToSysconfName (int x, int *r)
6586 *r = 0;
6587 if (x == 0)
6588 return 0;
6589 #ifdef _SC_2_CHAR_TERM
6590 if (x == _SC_2_CHAR_TERM)
6591 {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
6592 #endif /* ndef _SC_2_CHAR_TERM */
6593 #ifdef _SC_2_C_BIND
6594 if (x == _SC_2_C_BIND)
6595 {*r = Mono_Posix_SysconfName__SC_2_C_BIND; return 0;}
6596 #endif /* ndef _SC_2_C_BIND */
6597 #ifdef _SC_2_C_DEV
6598 if (x == _SC_2_C_DEV)
6599 {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
6600 #endif /* ndef _SC_2_C_DEV */
6601 #ifdef _SC_2_C_VERSION
6602 if (x == _SC_2_C_VERSION)
6603 {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
6604 #endif /* ndef _SC_2_C_VERSION */
6605 #ifdef _SC_2_FORT_DEV
6606 if (x == _SC_2_FORT_DEV)
6607 {*r = Mono_Posix_SysconfName__SC_2_FORT_DEV; return 0;}
6608 #endif /* ndef _SC_2_FORT_DEV */
6609 #ifdef _SC_2_FORT_RUN
6610 if (x == _SC_2_FORT_RUN)
6611 {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
6612 #endif /* ndef _SC_2_FORT_RUN */
6613 #ifdef _SC_2_LOCALEDEF
6614 if (x == _SC_2_LOCALEDEF)
6615 {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
6616 #endif /* ndef _SC_2_LOCALEDEF */
6617 #ifdef _SC_2_PBS
6618 if (x == _SC_2_PBS)
6619 {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
6620 #endif /* ndef _SC_2_PBS */
6621 #ifdef _SC_2_PBS_ACCOUNTING
6622 if (x == _SC_2_PBS_ACCOUNTING)
6623 {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
6624 #endif /* ndef _SC_2_PBS_ACCOUNTING */
6625 #ifdef _SC_2_PBS_CHECKPOINT
6626 if (x == _SC_2_PBS_CHECKPOINT)
6627 {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
6628 #endif /* ndef _SC_2_PBS_CHECKPOINT */
6629 #ifdef _SC_2_PBS_LOCATE
6630 if (x == _SC_2_PBS_LOCATE)
6631 {*r = Mono_Posix_SysconfName__SC_2_PBS_LOCATE; return 0;}
6632 #endif /* ndef _SC_2_PBS_LOCATE */
6633 #ifdef _SC_2_PBS_MESSAGE
6634 if (x == _SC_2_PBS_MESSAGE)
6635 {*r = Mono_Posix_SysconfName__SC_2_PBS_MESSAGE; return 0;}
6636 #endif /* ndef _SC_2_PBS_MESSAGE */
6637 #ifdef _SC_2_PBS_TRACK
6638 if (x == _SC_2_PBS_TRACK)
6639 {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
6640 #endif /* ndef _SC_2_PBS_TRACK */
6641 #ifdef _SC_2_SW_DEV
6642 if (x == _SC_2_SW_DEV)
6643 {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
6644 #endif /* ndef _SC_2_SW_DEV */
6645 #ifdef _SC_2_UPE
6646 if (x == _SC_2_UPE)
6647 {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
6648 #endif /* ndef _SC_2_UPE */
6649 #ifdef _SC_2_VERSION
6650 if (x == _SC_2_VERSION)
6651 {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
6652 #endif /* ndef _SC_2_VERSION */
6653 #ifdef _SC_ADVISORY_INFO
6654 if (x == _SC_ADVISORY_INFO)
6655 {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
6656 #endif /* ndef _SC_ADVISORY_INFO */
6657 #ifdef _SC_AIO_LISTIO_MAX
6658 if (x == _SC_AIO_LISTIO_MAX)
6659 {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
6660 #endif /* ndef _SC_AIO_LISTIO_MAX */
6661 #ifdef _SC_AIO_MAX
6662 if (x == _SC_AIO_MAX)
6663 {*r = Mono_Posix_SysconfName__SC_AIO_MAX; return 0;}
6664 #endif /* ndef _SC_AIO_MAX */
6665 #ifdef _SC_AIO_PRIO_DELTA_MAX
6666 if (x == _SC_AIO_PRIO_DELTA_MAX)
6667 {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
6668 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
6669 #ifdef _SC_ARG_MAX
6670 if (x == _SC_ARG_MAX)
6671 {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
6672 #endif /* ndef _SC_ARG_MAX */
6673 #ifdef _SC_ASYNCHRONOUS_IO
6674 if (x == _SC_ASYNCHRONOUS_IO)
6675 {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
6676 #endif /* ndef _SC_ASYNCHRONOUS_IO */
6677 #ifdef _SC_ATEXIT_MAX
6678 if (x == _SC_ATEXIT_MAX)
6679 {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
6680 #endif /* ndef _SC_ATEXIT_MAX */
6681 #ifdef _SC_AVPHYS_PAGES
6682 if (x == _SC_AVPHYS_PAGES)
6683 {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
6684 #endif /* ndef _SC_AVPHYS_PAGES */
6685 #ifdef _SC_BARRIERS
6686 if (x == _SC_BARRIERS)
6687 {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
6688 #endif /* ndef _SC_BARRIERS */
6689 #ifdef _SC_BASE
6690 if (x == _SC_BASE)
6691 {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
6692 #endif /* ndef _SC_BASE */
6693 #ifdef _SC_BC_BASE_MAX
6694 if (x == _SC_BC_BASE_MAX)
6695 {*r = Mono_Posix_SysconfName__SC_BC_BASE_MAX; return 0;}
6696 #endif /* ndef _SC_BC_BASE_MAX */
6697 #ifdef _SC_BC_DIM_MAX
6698 if (x == _SC_BC_DIM_MAX)
6699 {*r = Mono_Posix_SysconfName__SC_BC_DIM_MAX; return 0;}
6700 #endif /* ndef _SC_BC_DIM_MAX */
6701 #ifdef _SC_BC_SCALE_MAX
6702 if (x == _SC_BC_SCALE_MAX)
6703 {*r = Mono_Posix_SysconfName__SC_BC_SCALE_MAX; return 0;}
6704 #endif /* ndef _SC_BC_SCALE_MAX */
6705 #ifdef _SC_BC_STRING_MAX
6706 if (x == _SC_BC_STRING_MAX)
6707 {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
6708 #endif /* ndef _SC_BC_STRING_MAX */
6709 #ifdef _SC_CHARCLASS_NAME_MAX
6710 if (x == _SC_CHARCLASS_NAME_MAX)
6711 {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
6712 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
6713 #ifdef _SC_CHAR_BIT
6714 if (x == _SC_CHAR_BIT)
6715 {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
6716 #endif /* ndef _SC_CHAR_BIT */
6717 #ifdef _SC_CHAR_MAX
6718 if (x == _SC_CHAR_MAX)
6719 {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
6720 #endif /* ndef _SC_CHAR_MAX */
6721 #ifdef _SC_CHAR_MIN
6722 if (x == _SC_CHAR_MIN)
6723 {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
6724 #endif /* ndef _SC_CHAR_MIN */
6725 #ifdef _SC_CHILD_MAX
6726 if (x == _SC_CHILD_MAX)
6727 {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
6728 #endif /* ndef _SC_CHILD_MAX */
6729 #ifdef _SC_CLK_TCK
6730 if (x == _SC_CLK_TCK)
6731 {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
6732 #endif /* ndef _SC_CLK_TCK */
6733 #ifdef _SC_CLOCK_SELECTION
6734 if (x == _SC_CLOCK_SELECTION)
6735 {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
6736 #endif /* ndef _SC_CLOCK_SELECTION */
6737 #ifdef _SC_COLL_WEIGHTS_MAX
6738 if (x == _SC_COLL_WEIGHTS_MAX)
6739 {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
6740 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
6741 #ifdef _SC_CPUTIME
6742 if (x == _SC_CPUTIME)
6743 {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
6744 #endif /* ndef _SC_CPUTIME */
6745 #ifdef _SC_C_LANG_SUPPORT
6746 if (x == _SC_C_LANG_SUPPORT)
6747 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT; return 0;}
6748 #endif /* ndef _SC_C_LANG_SUPPORT */
6749 #ifdef _SC_C_LANG_SUPPORT_R
6750 if (x == _SC_C_LANG_SUPPORT_R)
6751 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
6752 #endif /* ndef _SC_C_LANG_SUPPORT_R */
6753 #ifdef _SC_DELAYTIMER_MAX
6754 if (x == _SC_DELAYTIMER_MAX)
6755 {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
6756 #endif /* ndef _SC_DELAYTIMER_MAX */
6757 #ifdef _SC_DEVICE_IO
6758 if (x == _SC_DEVICE_IO)
6759 {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
6760 #endif /* ndef _SC_DEVICE_IO */
6761 #ifdef _SC_DEVICE_SPECIFIC
6762 if (x == _SC_DEVICE_SPECIFIC)
6763 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
6764 #endif /* ndef _SC_DEVICE_SPECIFIC */
6765 #ifdef _SC_DEVICE_SPECIFIC_R
6766 if (x == _SC_DEVICE_SPECIFIC_R)
6767 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
6768 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
6769 #ifdef _SC_EQUIV_CLASS_MAX
6770 if (x == _SC_EQUIV_CLASS_MAX)
6771 {*r = Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX; return 0;}
6772 #endif /* ndef _SC_EQUIV_CLASS_MAX */
6773 #ifdef _SC_EXPR_NEST_MAX
6774 if (x == _SC_EXPR_NEST_MAX)
6775 {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
6776 #endif /* ndef _SC_EXPR_NEST_MAX */
6777 #ifdef _SC_FD_MGMT
6778 if (x == _SC_FD_MGMT)
6779 {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
6780 #endif /* ndef _SC_FD_MGMT */
6781 #ifdef _SC_FIFO
6782 if (x == _SC_FIFO)
6783 {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
6784 #endif /* ndef _SC_FIFO */
6785 #ifdef _SC_FILE_ATTRIBUTES
6786 if (x == _SC_FILE_ATTRIBUTES)
6787 {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
6788 #endif /* ndef _SC_FILE_ATTRIBUTES */
6789 #ifdef _SC_FILE_LOCKING
6790 if (x == _SC_FILE_LOCKING)
6791 {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
6792 #endif /* ndef _SC_FILE_LOCKING */
6793 #ifdef _SC_FILE_SYSTEM
6794 if (x == _SC_FILE_SYSTEM)
6795 {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
6796 #endif /* ndef _SC_FILE_SYSTEM */
6797 #ifdef _SC_FSYNC
6798 if (x == _SC_FSYNC)
6799 {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
6800 #endif /* ndef _SC_FSYNC */
6801 #ifdef _SC_GETGR_R_SIZE_MAX
6802 if (x == _SC_GETGR_R_SIZE_MAX)
6803 {*r = Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX; return 0;}
6804 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
6805 #ifdef _SC_GETPW_R_SIZE_MAX
6806 if (x == _SC_GETPW_R_SIZE_MAX)
6807 {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
6808 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
6809 #ifdef _SC_HOST_NAME_MAX
6810 if (x == _SC_HOST_NAME_MAX)
6811 {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
6812 #endif /* ndef _SC_HOST_NAME_MAX */
6813 #ifdef _SC_INT_MAX
6814 if (x == _SC_INT_MAX)
6815 {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
6816 #endif /* ndef _SC_INT_MAX */
6817 #ifdef _SC_INT_MIN
6818 if (x == _SC_INT_MIN)
6819 {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
6820 #endif /* ndef _SC_INT_MIN */
6821 #ifdef _SC_IOV_MAX
6822 if (x == _SC_IOV_MAX)
6823 {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
6824 #endif /* ndef _SC_IOV_MAX */
6825 #ifdef _SC_JOB_CONTROL
6826 if (x == _SC_JOB_CONTROL)
6827 {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
6828 #endif /* ndef _SC_JOB_CONTROL */
6829 #ifdef _SC_LEVEL1_DCACHE_ASSOC
6830 if (x == _SC_LEVEL1_DCACHE_ASSOC)
6831 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC; return 0;}
6832 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
6833 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
6834 if (x == _SC_LEVEL1_DCACHE_LINESIZE)
6835 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
6836 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
6837 #ifdef _SC_LEVEL1_DCACHE_SIZE
6838 if (x == _SC_LEVEL1_DCACHE_SIZE)
6839 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
6840 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
6841 #ifdef _SC_LEVEL1_ICACHE_ASSOC
6842 if (x == _SC_LEVEL1_ICACHE_ASSOC)
6843 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC; return 0;}
6844 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
6845 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
6846 if (x == _SC_LEVEL1_ICACHE_LINESIZE)
6847 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
6848 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
6849 #ifdef _SC_LEVEL1_ICACHE_SIZE
6850 if (x == _SC_LEVEL1_ICACHE_SIZE)
6851 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
6852 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
6853 #ifdef _SC_LEVEL2_CACHE_ASSOC
6854 if (x == _SC_LEVEL2_CACHE_ASSOC)
6855 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC; return 0;}
6856 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
6857 #ifdef _SC_LEVEL2_CACHE_LINESIZE
6858 if (x == _SC_LEVEL2_CACHE_LINESIZE)
6859 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
6860 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
6861 #ifdef _SC_LEVEL2_CACHE_SIZE
6862 if (x == _SC_LEVEL2_CACHE_SIZE)
6863 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
6864 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
6865 #ifdef _SC_LEVEL3_CACHE_ASSOC
6866 if (x == _SC_LEVEL3_CACHE_ASSOC)
6867 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC; return 0;}
6868 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
6869 #ifdef _SC_LEVEL3_CACHE_LINESIZE
6870 if (x == _SC_LEVEL3_CACHE_LINESIZE)
6871 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
6872 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
6873 #ifdef _SC_LEVEL3_CACHE_SIZE
6874 if (x == _SC_LEVEL3_CACHE_SIZE)
6875 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
6876 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
6877 #ifdef _SC_LEVEL4_CACHE_ASSOC
6878 if (x == _SC_LEVEL4_CACHE_ASSOC)
6879 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC; return 0;}
6880 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
6881 #ifdef _SC_LEVEL4_CACHE_LINESIZE
6882 if (x == _SC_LEVEL4_CACHE_LINESIZE)
6883 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
6884 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
6885 #ifdef _SC_LEVEL4_CACHE_SIZE
6886 if (x == _SC_LEVEL4_CACHE_SIZE)
6887 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
6888 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
6889 #ifdef _SC_LINE_MAX
6890 if (x == _SC_LINE_MAX)
6891 {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
6892 #endif /* ndef _SC_LINE_MAX */
6893 #ifdef _SC_LOGIN_NAME_MAX
6894 if (x == _SC_LOGIN_NAME_MAX)
6895 {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
6896 #endif /* ndef _SC_LOGIN_NAME_MAX */
6897 #ifdef _SC_LONG_BIT
6898 if (x == _SC_LONG_BIT)
6899 {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
6900 #endif /* ndef _SC_LONG_BIT */
6901 #ifdef _SC_MAPPED_FILES
6902 if (x == _SC_MAPPED_FILES)
6903 {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
6904 #endif /* ndef _SC_MAPPED_FILES */
6905 #ifdef _SC_MB_LEN_MAX
6906 if (x == _SC_MB_LEN_MAX)
6907 {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
6908 #endif /* ndef _SC_MB_LEN_MAX */
6909 #ifdef _SC_MEMLOCK
6910 if (x == _SC_MEMLOCK)
6911 {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
6912 #endif /* ndef _SC_MEMLOCK */
6913 #ifdef _SC_MEMLOCK_RANGE
6914 if (x == _SC_MEMLOCK_RANGE)
6915 {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
6916 #endif /* ndef _SC_MEMLOCK_RANGE */
6917 #ifdef _SC_MEMORY_PROTECTION
6918 if (x == _SC_MEMORY_PROTECTION)
6919 {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
6920 #endif /* ndef _SC_MEMORY_PROTECTION */
6921 #ifdef _SC_MESSAGE_PASSING
6922 if (x == _SC_MESSAGE_PASSING)
6923 {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
6924 #endif /* ndef _SC_MESSAGE_PASSING */
6925 #ifdef _SC_MONOTONIC_CLOCK
6926 if (x == _SC_MONOTONIC_CLOCK)
6927 {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
6928 #endif /* ndef _SC_MONOTONIC_CLOCK */
6929 #ifdef _SC_MQ_OPEN_MAX
6930 if (x == _SC_MQ_OPEN_MAX)
6931 {*r = Mono_Posix_SysconfName__SC_MQ_OPEN_MAX; return 0;}
6932 #endif /* ndef _SC_MQ_OPEN_MAX */
6933 #ifdef _SC_MQ_PRIO_MAX
6934 if (x == _SC_MQ_PRIO_MAX)
6935 {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
6936 #endif /* ndef _SC_MQ_PRIO_MAX */
6937 #ifdef _SC_MULTI_PROCESS
6938 if (x == _SC_MULTI_PROCESS)
6939 {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
6940 #endif /* ndef _SC_MULTI_PROCESS */
6941 #ifdef _SC_NETWORKING
6942 if (x == _SC_NETWORKING)
6943 {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
6944 #endif /* ndef _SC_NETWORKING */
6945 #ifdef _SC_NGROUPS_MAX
6946 if (x == _SC_NGROUPS_MAX)
6947 {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
6948 #endif /* ndef _SC_NGROUPS_MAX */
6949 #ifdef _SC_NL_ARGMAX
6950 if (x == _SC_NL_ARGMAX)
6951 {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
6952 #endif /* ndef _SC_NL_ARGMAX */
6953 #ifdef _SC_NL_LANGMAX
6954 if (x == _SC_NL_LANGMAX)
6955 {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
6956 #endif /* ndef _SC_NL_LANGMAX */
6957 #ifdef _SC_NL_MSGMAX
6958 if (x == _SC_NL_MSGMAX)
6959 {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
6960 #endif /* ndef _SC_NL_MSGMAX */
6961 #ifdef _SC_NL_NMAX
6962 if (x == _SC_NL_NMAX)
6963 {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
6964 #endif /* ndef _SC_NL_NMAX */
6965 #ifdef _SC_NL_SETMAX
6966 if (x == _SC_NL_SETMAX)
6967 {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
6968 #endif /* ndef _SC_NL_SETMAX */
6969 #ifdef _SC_NL_TEXTMAX
6970 if (x == _SC_NL_TEXTMAX)
6971 {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
6972 #endif /* ndef _SC_NL_TEXTMAX */
6973 #ifdef _SC_NPROCESSORS_CONF
6974 if (x == _SC_NPROCESSORS_CONF)
6975 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
6976 #endif /* ndef _SC_NPROCESSORS_CONF */
6977 #ifdef _SC_NPROCESSORS_ONLN
6978 if (x == _SC_NPROCESSORS_ONLN)
6979 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
6980 #endif /* ndef _SC_NPROCESSORS_ONLN */
6981 #ifdef _SC_NZERO
6982 if (x == _SC_NZERO)
6983 {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
6984 #endif /* ndef _SC_NZERO */
6985 #ifdef _SC_OPEN_MAX
6986 if (x == _SC_OPEN_MAX)
6987 {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
6988 #endif /* ndef _SC_OPEN_MAX */
6989 #ifdef _SC_PAGESIZE
6990 if (x == _SC_PAGESIZE)
6991 {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
6992 #endif /* ndef _SC_PAGESIZE */
6993 #ifdef _SC_PASS_MAX
6994 if (x == _SC_PASS_MAX)
6995 {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
6996 #endif /* ndef _SC_PASS_MAX */
6997 #ifdef _SC_PHYS_PAGES
6998 if (x == _SC_PHYS_PAGES)
6999 {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
7000 #endif /* ndef _SC_PHYS_PAGES */
7001 #ifdef _SC_PII
7002 if (x == _SC_PII)
7003 {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
7004 #endif /* ndef _SC_PII */
7005 #ifdef _SC_PII_INTERNET
7006 if (x == _SC_PII_INTERNET)
7007 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
7008 #endif /* ndef _SC_PII_INTERNET */
7009 #ifdef _SC_PII_INTERNET_DGRAM
7010 if (x == _SC_PII_INTERNET_DGRAM)
7011 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
7012 #endif /* ndef _SC_PII_INTERNET_DGRAM */
7013 #ifdef _SC_PII_INTERNET_STREAM
7014 if (x == _SC_PII_INTERNET_STREAM)
7015 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
7016 #endif /* ndef _SC_PII_INTERNET_STREAM */
7017 #ifdef _SC_PII_OSI
7018 if (x == _SC_PII_OSI)
7019 {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
7020 #endif /* ndef _SC_PII_OSI */
7021 #ifdef _SC_PII_OSI_CLTS
7022 if (x == _SC_PII_OSI_CLTS)
7023 {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
7024 #endif /* ndef _SC_PII_OSI_CLTS */
7025 #ifdef _SC_PII_OSI_COTS
7026 if (x == _SC_PII_OSI_COTS)
7027 {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
7028 #endif /* ndef _SC_PII_OSI_COTS */
7029 #ifdef _SC_PII_OSI_M
7030 if (x == _SC_PII_OSI_M)
7031 {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
7032 #endif /* ndef _SC_PII_OSI_M */
7033 #ifdef _SC_PII_SOCKET
7034 if (x == _SC_PII_SOCKET)
7035 {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
7036 #endif /* ndef _SC_PII_SOCKET */
7037 #ifdef _SC_PII_XTI
7038 if (x == _SC_PII_XTI)
7039 {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
7040 #endif /* ndef _SC_PII_XTI */
7041 #ifdef _SC_PIPE
7042 if (x == _SC_PIPE)
7043 {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
7044 #endif /* ndef _SC_PIPE */
7045 #ifdef _SC_POLL
7046 if (x == _SC_POLL)
7047 {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
7048 #endif /* ndef _SC_POLL */
7049 #ifdef _SC_PRIORITIZED_IO
7050 if (x == _SC_PRIORITIZED_IO)
7051 {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
7052 #endif /* ndef _SC_PRIORITIZED_IO */
7053 #ifdef _SC_PRIORITY_SCHEDULING
7054 if (x == _SC_PRIORITY_SCHEDULING)
7055 {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
7056 #endif /* ndef _SC_PRIORITY_SCHEDULING */
7057 #ifdef _SC_READER_WRITER_LOCKS
7058 if (x == _SC_READER_WRITER_LOCKS)
7059 {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
7060 #endif /* ndef _SC_READER_WRITER_LOCKS */
7061 #ifdef _SC_REALTIME_SIGNALS
7062 if (x == _SC_REALTIME_SIGNALS)
7063 {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
7064 #endif /* ndef _SC_REALTIME_SIGNALS */
7065 #ifdef _SC_REGEXP
7066 if (x == _SC_REGEXP)
7067 {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
7068 #endif /* ndef _SC_REGEXP */
7069 #ifdef _SC_REGEX_VERSION
7070 if (x == _SC_REGEX_VERSION)
7071 {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
7072 #endif /* ndef _SC_REGEX_VERSION */
7073 #ifdef _SC_RE_DUP_MAX
7074 if (x == _SC_RE_DUP_MAX)
7075 {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
7076 #endif /* ndef _SC_RE_DUP_MAX */
7077 #ifdef _SC_RTSIG_MAX
7078 if (x == _SC_RTSIG_MAX)
7079 {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
7080 #endif /* ndef _SC_RTSIG_MAX */
7081 #ifdef _SC_SAVED_IDS
7082 if (x == _SC_SAVED_IDS)
7083 {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
7084 #endif /* ndef _SC_SAVED_IDS */
7085 #ifdef _SC_SCHAR_MAX
7086 if (x == _SC_SCHAR_MAX)
7087 {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
7088 #endif /* ndef _SC_SCHAR_MAX */
7089 #ifdef _SC_SCHAR_MIN
7090 if (x == _SC_SCHAR_MIN)
7091 {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
7092 #endif /* ndef _SC_SCHAR_MIN */
7093 #ifdef _SC_SELECT
7094 if (x == _SC_SELECT)
7095 {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
7096 #endif /* ndef _SC_SELECT */
7097 #ifdef _SC_SEMAPHORES
7098 if (x == _SC_SEMAPHORES)
7099 {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
7100 #endif /* ndef _SC_SEMAPHORES */
7101 #ifdef _SC_SEM_NSEMS_MAX
7102 if (x == _SC_SEM_NSEMS_MAX)
7103 {*r = Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX; return 0;}
7104 #endif /* ndef _SC_SEM_NSEMS_MAX */
7105 #ifdef _SC_SEM_VALUE_MAX
7106 if (x == _SC_SEM_VALUE_MAX)
7107 {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
7108 #endif /* ndef _SC_SEM_VALUE_MAX */
7109 #ifdef _SC_SHARED_MEMORY_OBJECTS
7110 if (x == _SC_SHARED_MEMORY_OBJECTS)
7111 {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
7112 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
7113 #ifdef _SC_SHELL
7114 if (x == _SC_SHELL)
7115 {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
7116 #endif /* ndef _SC_SHELL */
7117 #ifdef _SC_SHRT_MAX
7118 if (x == _SC_SHRT_MAX)
7119 {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
7120 #endif /* ndef _SC_SHRT_MAX */
7121 #ifdef _SC_SHRT_MIN
7122 if (x == _SC_SHRT_MIN)
7123 {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
7124 #endif /* ndef _SC_SHRT_MIN */
7125 #ifdef _SC_SIGNALS
7126 if (x == _SC_SIGNALS)
7127 {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
7128 #endif /* ndef _SC_SIGNALS */
7129 #ifdef _SC_SIGQUEUE_MAX
7130 if (x == _SC_SIGQUEUE_MAX)
7131 {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
7132 #endif /* ndef _SC_SIGQUEUE_MAX */
7133 #ifdef _SC_SINGLE_PROCESS
7134 if (x == _SC_SINGLE_PROCESS)
7135 {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
7136 #endif /* ndef _SC_SINGLE_PROCESS */
7137 #ifdef _SC_SPAWN
7138 if (x == _SC_SPAWN)
7139 {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
7140 #endif /* ndef _SC_SPAWN */
7141 #ifdef _SC_SPIN_LOCKS
7142 if (x == _SC_SPIN_LOCKS)
7143 {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
7144 #endif /* ndef _SC_SPIN_LOCKS */
7145 #ifdef _SC_SPORADIC_SERVER
7146 if (x == _SC_SPORADIC_SERVER)
7147 {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
7148 #endif /* ndef _SC_SPORADIC_SERVER */
7149 #ifdef _SC_SSIZE_MAX
7150 if (x == _SC_SSIZE_MAX)
7151 {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
7152 #endif /* ndef _SC_SSIZE_MAX */
7153 #ifdef _SC_STREAMS
7154 if (x == _SC_STREAMS)
7155 {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
7156 #endif /* ndef _SC_STREAMS */
7157 #ifdef _SC_STREAM_MAX
7158 if (x == _SC_STREAM_MAX)
7159 {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
7160 #endif /* ndef _SC_STREAM_MAX */
7161 #ifdef _SC_SYMLOOP_MAX
7162 if (x == _SC_SYMLOOP_MAX)
7163 {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
7164 #endif /* ndef _SC_SYMLOOP_MAX */
7165 #ifdef _SC_SYNCHRONIZED_IO
7166 if (x == _SC_SYNCHRONIZED_IO)
7167 {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
7168 #endif /* ndef _SC_SYNCHRONIZED_IO */
7169 #ifdef _SC_SYSTEM_DATABASE
7170 if (x == _SC_SYSTEM_DATABASE)
7171 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
7172 #endif /* ndef _SC_SYSTEM_DATABASE */
7173 #ifdef _SC_SYSTEM_DATABASE_R
7174 if (x == _SC_SYSTEM_DATABASE_R)
7175 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
7176 #endif /* ndef _SC_SYSTEM_DATABASE_R */
7177 #ifdef _SC_THREADS
7178 if (x == _SC_THREADS)
7179 {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
7180 #endif /* ndef _SC_THREADS */
7181 #ifdef _SC_THREAD_ATTR_STACKADDR
7182 if (x == _SC_THREAD_ATTR_STACKADDR)
7183 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR; return 0;}
7184 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
7185 #ifdef _SC_THREAD_ATTR_STACKSIZE
7186 if (x == _SC_THREAD_ATTR_STACKSIZE)
7187 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
7188 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
7189 #ifdef _SC_THREAD_CPUTIME
7190 if (x == _SC_THREAD_CPUTIME)
7191 {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
7192 #endif /* ndef _SC_THREAD_CPUTIME */
7193 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
7194 if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
7195 {*r = Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
7196 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
7197 #ifdef _SC_THREAD_KEYS_MAX
7198 if (x == _SC_THREAD_KEYS_MAX)
7199 {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
7200 #endif /* ndef _SC_THREAD_KEYS_MAX */
7201 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
7202 if (x == _SC_THREAD_PRIORITY_SCHEDULING)
7203 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
7204 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
7205 #ifdef _SC_THREAD_PRIO_INHERIT
7206 if (x == _SC_THREAD_PRIO_INHERIT)
7207 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT; return 0;}
7208 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
7209 #ifdef _SC_THREAD_PRIO_PROTECT
7210 if (x == _SC_THREAD_PRIO_PROTECT)
7211 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT; return 0;}
7212 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
7213 #ifdef _SC_THREAD_PROCESS_SHARED
7214 if (x == _SC_THREAD_PROCESS_SHARED)
7215 {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
7216 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
7217 #ifdef _SC_THREAD_SAFE_FUNCTIONS
7218 if (x == _SC_THREAD_SAFE_FUNCTIONS)
7219 {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
7220 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
7221 #ifdef _SC_THREAD_SPORADIC_SERVER
7222 if (x == _SC_THREAD_SPORADIC_SERVER)
7223 {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
7224 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
7225 #ifdef _SC_THREAD_STACK_MIN
7226 if (x == _SC_THREAD_STACK_MIN)
7227 {*r = Mono_Posix_SysconfName__SC_THREAD_STACK_MIN; return 0;}
7228 #endif /* ndef _SC_THREAD_STACK_MIN */
7229 #ifdef _SC_THREAD_THREADS_MAX
7230 if (x == _SC_THREAD_THREADS_MAX)
7231 {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
7232 #endif /* ndef _SC_THREAD_THREADS_MAX */
7233 #ifdef _SC_TIMEOUTS
7234 if (x == _SC_TIMEOUTS)
7235 {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
7236 #endif /* ndef _SC_TIMEOUTS */
7237 #ifdef _SC_TIMERS
7238 if (x == _SC_TIMERS)
7239 {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
7240 #endif /* ndef _SC_TIMERS */
7241 #ifdef _SC_TIMER_MAX
7242 if (x == _SC_TIMER_MAX)
7243 {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
7244 #endif /* ndef _SC_TIMER_MAX */
7245 #ifdef _SC_TRACE
7246 if (x == _SC_TRACE)
7247 {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
7248 #endif /* ndef _SC_TRACE */
7249 #ifdef _SC_TRACE_EVENT_FILTER
7250 if (x == _SC_TRACE_EVENT_FILTER)
7251 {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
7252 #endif /* ndef _SC_TRACE_EVENT_FILTER */
7253 #ifdef _SC_TRACE_INHERIT
7254 if (x == _SC_TRACE_INHERIT)
7255 {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
7256 #endif /* ndef _SC_TRACE_INHERIT */
7257 #ifdef _SC_TRACE_LOG
7258 if (x == _SC_TRACE_LOG)
7259 {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
7260 #endif /* ndef _SC_TRACE_LOG */
7261 #ifdef _SC_TTY_NAME_MAX
7262 if (x == _SC_TTY_NAME_MAX)
7263 {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
7264 #endif /* ndef _SC_TTY_NAME_MAX */
7265 #ifdef _SC_TYPED_MEMORY_OBJECTS
7266 if (x == _SC_TYPED_MEMORY_OBJECTS)
7267 {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
7268 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
7269 #ifdef _SC_TZNAME_MAX
7270 if (x == _SC_TZNAME_MAX)
7271 {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
7272 #endif /* ndef _SC_TZNAME_MAX */
7273 #ifdef _SC_T_IOV_MAX
7274 if (x == _SC_T_IOV_MAX)
7275 {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
7276 #endif /* ndef _SC_T_IOV_MAX */
7277 #ifdef _SC_UCHAR_MAX
7278 if (x == _SC_UCHAR_MAX)
7279 {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
7280 #endif /* ndef _SC_UCHAR_MAX */
7281 #ifdef _SC_UINT_MAX
7282 if (x == _SC_UINT_MAX)
7283 {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
7284 #endif /* ndef _SC_UINT_MAX */
7285 #ifdef _SC_UIO_MAXIOV
7286 if (x == _SC_UIO_MAXIOV)
7287 {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
7288 #endif /* ndef _SC_UIO_MAXIOV */
7289 #ifdef _SC_ULONG_MAX
7290 if (x == _SC_ULONG_MAX)
7291 {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
7292 #endif /* ndef _SC_ULONG_MAX */
7293 #ifdef _SC_USER_GROUPS
7294 if (x == _SC_USER_GROUPS)
7295 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
7296 #endif /* ndef _SC_USER_GROUPS */
7297 #ifdef _SC_USER_GROUPS_R
7298 if (x == _SC_USER_GROUPS_R)
7299 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
7300 #endif /* ndef _SC_USER_GROUPS_R */
7301 #ifdef _SC_USHRT_MAX
7302 if (x == _SC_USHRT_MAX)
7303 {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
7304 #endif /* ndef _SC_USHRT_MAX */
7305 #ifdef _SC_V6_ILP32_OFF32
7306 if (x == _SC_V6_ILP32_OFF32)
7307 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFF32; return 0;}
7308 #endif /* ndef _SC_V6_ILP32_OFF32 */
7309 #ifdef _SC_V6_ILP32_OFFBIG
7310 if (x == _SC_V6_ILP32_OFFBIG)
7311 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG; return 0;}
7312 #endif /* ndef _SC_V6_ILP32_OFFBIG */
7313 #ifdef _SC_V6_LP64_OFF64
7314 if (x == _SC_V6_LP64_OFF64)
7315 {*r = Mono_Posix_SysconfName__SC_V6_LP64_OFF64; return 0;}
7316 #endif /* ndef _SC_V6_LP64_OFF64 */
7317 #ifdef _SC_V6_LPBIG_OFFBIG
7318 if (x == _SC_V6_LPBIG_OFFBIG)
7319 {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
7320 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
7321 #ifdef _SC_VERSION
7322 if (x == _SC_VERSION)
7323 {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
7324 #endif /* ndef _SC_VERSION */
7325 #ifdef _SC_WORD_BIT
7326 if (x == _SC_WORD_BIT)
7327 {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
7328 #endif /* ndef _SC_WORD_BIT */
7329 #ifdef _SC_XBS5_ILP32_OFF32
7330 if (x == _SC_XBS5_ILP32_OFF32)
7331 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32; return 0;}
7332 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
7333 #ifdef _SC_XBS5_ILP32_OFFBIG
7334 if (x == _SC_XBS5_ILP32_OFFBIG)
7335 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG; return 0;}
7336 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
7337 #ifdef _SC_XBS5_LP64_OFF64
7338 if (x == _SC_XBS5_LP64_OFF64)
7339 {*r = Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64; return 0;}
7340 #endif /* ndef _SC_XBS5_LP64_OFF64 */
7341 #ifdef _SC_XBS5_LPBIG_OFFBIG
7342 if (x == _SC_XBS5_LPBIG_OFFBIG)
7343 {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
7344 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
7345 #ifdef _SC_XOPEN_CRYPT
7346 if (x == _SC_XOPEN_CRYPT)
7347 {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
7348 #endif /* ndef _SC_XOPEN_CRYPT */
7349 #ifdef _SC_XOPEN_ENH_I18N
7350 if (x == _SC_XOPEN_ENH_I18N)
7351 {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
7352 #endif /* ndef _SC_XOPEN_ENH_I18N */
7353 #ifdef _SC_XOPEN_LEGACY
7354 if (x == _SC_XOPEN_LEGACY)
7355 {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
7356 #endif /* ndef _SC_XOPEN_LEGACY */
7357 #ifdef _SC_XOPEN_REALTIME
7358 if (x == _SC_XOPEN_REALTIME)
7359 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
7360 #endif /* ndef _SC_XOPEN_REALTIME */
7361 #ifdef _SC_XOPEN_REALTIME_THREADS
7362 if (x == _SC_XOPEN_REALTIME_THREADS)
7363 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
7364 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
7365 #ifdef _SC_XOPEN_SHM
7366 if (x == _SC_XOPEN_SHM)
7367 {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
7368 #endif /* ndef _SC_XOPEN_SHM */
7369 #ifdef _SC_XOPEN_UNIX
7370 if (x == _SC_XOPEN_UNIX)
7371 {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
7372 #endif /* ndef _SC_XOPEN_UNIX */
7373 #ifdef _SC_XOPEN_VERSION
7374 if (x == _SC_XOPEN_VERSION)
7375 {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
7376 #endif /* ndef _SC_XOPEN_VERSION */
7377 #ifdef _SC_XOPEN_XCU_VERSION
7378 if (x == _SC_XOPEN_XCU_VERSION)
7379 {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
7380 #endif /* ndef _SC_XOPEN_XCU_VERSION */
7381 #ifdef _SC_XOPEN_XPG2
7382 if (x == _SC_XOPEN_XPG2)
7383 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
7384 #endif /* ndef _SC_XOPEN_XPG2 */
7385 #ifdef _SC_XOPEN_XPG3
7386 if (x == _SC_XOPEN_XPG3)
7387 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
7388 #endif /* ndef _SC_XOPEN_XPG3 */
7389 #ifdef _SC_XOPEN_XPG4
7390 if (x == _SC_XOPEN_XPG4)
7391 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
7392 #endif /* ndef _SC_XOPEN_XPG4 */
7393 errno = EINVAL; return -1;
7396 int Mono_Posix_FromSyslogFacility (int x, int *r)
7398 *r = 0;
7399 if (x == Mono_Posix_SyslogFacility_LOG_AUTH)
7400 #ifdef LOG_AUTH
7401 {*r = LOG_AUTH; return 0;}
7402 #else /* def LOG_AUTH */
7403 {errno = EINVAL; return -1;}
7404 #endif /* ndef LOG_AUTH */
7405 if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
7406 #ifdef LOG_AUTHPRIV
7407 {*r = LOG_AUTHPRIV; return 0;}
7408 #else /* def LOG_AUTHPRIV */
7409 {errno = EINVAL; return -1;}
7410 #endif /* ndef LOG_AUTHPRIV */
7411 if (x == Mono_Posix_SyslogFacility_LOG_CRON)
7412 #ifdef LOG_CRON
7413 {*r = LOG_CRON; return 0;}
7414 #else /* def LOG_CRON */
7415 {errno = EINVAL; return -1;}
7416 #endif /* ndef LOG_CRON */
7417 if (x == Mono_Posix_SyslogFacility_LOG_DAEMON)
7418 #ifdef LOG_DAEMON
7419 {*r = LOG_DAEMON; return 0;}
7420 #else /* def LOG_DAEMON */
7421 {errno = EINVAL; return -1;}
7422 #endif /* ndef LOG_DAEMON */
7423 if (x == Mono_Posix_SyslogFacility_LOG_FTP)
7424 #ifdef LOG_FTP
7425 {*r = LOG_FTP; return 0;}
7426 #else /* def LOG_FTP */
7427 {errno = EINVAL; return -1;}
7428 #endif /* ndef LOG_FTP */
7429 if (x == Mono_Posix_SyslogFacility_LOG_KERN)
7430 #ifdef LOG_KERN
7431 {*r = LOG_KERN; return 0;}
7432 #else /* def LOG_KERN */
7433 {errno = EINVAL; return -1;}
7434 #endif /* ndef LOG_KERN */
7435 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0)
7436 #ifdef LOG_LOCAL0
7437 {*r = LOG_LOCAL0; return 0;}
7438 #else /* def LOG_LOCAL0 */
7439 {errno = EINVAL; return -1;}
7440 #endif /* ndef LOG_LOCAL0 */
7441 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1)
7442 #ifdef LOG_LOCAL1
7443 {*r = LOG_LOCAL1; return 0;}
7444 #else /* def LOG_LOCAL1 */
7445 {errno = EINVAL; return -1;}
7446 #endif /* ndef LOG_LOCAL1 */
7447 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2)
7448 #ifdef LOG_LOCAL2
7449 {*r = LOG_LOCAL2; return 0;}
7450 #else /* def LOG_LOCAL2 */
7451 {errno = EINVAL; return -1;}
7452 #endif /* ndef LOG_LOCAL2 */
7453 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3)
7454 #ifdef LOG_LOCAL3
7455 {*r = LOG_LOCAL3; return 0;}
7456 #else /* def LOG_LOCAL3 */
7457 {errno = EINVAL; return -1;}
7458 #endif /* ndef LOG_LOCAL3 */
7459 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4)
7460 #ifdef LOG_LOCAL4
7461 {*r = LOG_LOCAL4; return 0;}
7462 #else /* def LOG_LOCAL4 */
7463 {errno = EINVAL; return -1;}
7464 #endif /* ndef LOG_LOCAL4 */
7465 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5)
7466 #ifdef LOG_LOCAL5
7467 {*r = LOG_LOCAL5; return 0;}
7468 #else /* def LOG_LOCAL5 */
7469 {errno = EINVAL; return -1;}
7470 #endif /* ndef LOG_LOCAL5 */
7471 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6)
7472 #ifdef LOG_LOCAL6
7473 {*r = LOG_LOCAL6; return 0;}
7474 #else /* def LOG_LOCAL6 */
7475 {errno = EINVAL; return -1;}
7476 #endif /* ndef LOG_LOCAL6 */
7477 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7)
7478 #ifdef LOG_LOCAL7
7479 {*r = LOG_LOCAL7; return 0;}
7480 #else /* def LOG_LOCAL7 */
7481 {errno = EINVAL; return -1;}
7482 #endif /* ndef LOG_LOCAL7 */
7483 if (x == Mono_Posix_SyslogFacility_LOG_LPR)
7484 #ifdef LOG_LPR
7485 {*r = LOG_LPR; return 0;}
7486 #else /* def LOG_LPR */
7487 {errno = EINVAL; return -1;}
7488 #endif /* ndef LOG_LPR */
7489 if (x == Mono_Posix_SyslogFacility_LOG_MAIL)
7490 #ifdef LOG_MAIL
7491 {*r = LOG_MAIL; return 0;}
7492 #else /* def LOG_MAIL */
7493 {errno = EINVAL; return -1;}
7494 #endif /* ndef LOG_MAIL */
7495 if (x == Mono_Posix_SyslogFacility_LOG_NEWS)
7496 #ifdef LOG_NEWS
7497 {*r = LOG_NEWS; return 0;}
7498 #else /* def LOG_NEWS */
7499 {errno = EINVAL; return -1;}
7500 #endif /* ndef LOG_NEWS */
7501 if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG)
7502 #ifdef LOG_SYSLOG
7503 {*r = LOG_SYSLOG; return 0;}
7504 #else /* def LOG_SYSLOG */
7505 {errno = EINVAL; return -1;}
7506 #endif /* ndef LOG_SYSLOG */
7507 if (x == Mono_Posix_SyslogFacility_LOG_USER)
7508 #ifdef LOG_USER
7509 {*r = LOG_USER; return 0;}
7510 #else /* def LOG_USER */
7511 {errno = EINVAL; return -1;}
7512 #endif /* ndef LOG_USER */
7513 if (x == Mono_Posix_SyslogFacility_LOG_UUCP)
7514 #ifdef LOG_UUCP
7515 {*r = LOG_UUCP; return 0;}
7516 #else /* def LOG_UUCP */
7517 {errno = EINVAL; return -1;}
7518 #endif /* ndef LOG_UUCP */
7519 if (x == 0)
7520 return 0;
7521 errno = EINVAL; return -1;
7524 int Mono_Posix_ToSyslogFacility (int x, int *r)
7526 *r = 0;
7527 if (x == 0)
7528 return 0;
7529 #ifdef LOG_AUTH
7530 if (x == LOG_AUTH)
7531 {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
7532 #endif /* ndef LOG_AUTH */
7533 #ifdef LOG_AUTHPRIV
7534 if (x == LOG_AUTHPRIV)
7535 {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
7536 #endif /* ndef LOG_AUTHPRIV */
7537 #ifdef LOG_CRON
7538 if (x == LOG_CRON)
7539 {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
7540 #endif /* ndef LOG_CRON */
7541 #ifdef LOG_DAEMON
7542 if (x == LOG_DAEMON)
7543 {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
7544 #endif /* ndef LOG_DAEMON */
7545 #ifdef LOG_FTP
7546 if (x == LOG_FTP)
7547 {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
7548 #endif /* ndef LOG_FTP */
7549 #ifdef LOG_KERN
7550 if (x == LOG_KERN)
7551 {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
7552 #endif /* ndef LOG_KERN */
7553 #ifdef LOG_LOCAL0
7554 if (x == LOG_LOCAL0)
7555 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;}
7556 #endif /* ndef LOG_LOCAL0 */
7557 #ifdef LOG_LOCAL1
7558 if (x == LOG_LOCAL1)
7559 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;}
7560 #endif /* ndef LOG_LOCAL1 */
7561 #ifdef LOG_LOCAL2
7562 if (x == LOG_LOCAL2)
7563 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;}
7564 #endif /* ndef LOG_LOCAL2 */
7565 #ifdef LOG_LOCAL3
7566 if (x == LOG_LOCAL3)
7567 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;}
7568 #endif /* ndef LOG_LOCAL3 */
7569 #ifdef LOG_LOCAL4
7570 if (x == LOG_LOCAL4)
7571 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;}
7572 #endif /* ndef LOG_LOCAL4 */
7573 #ifdef LOG_LOCAL5
7574 if (x == LOG_LOCAL5)
7575 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;}
7576 #endif /* ndef LOG_LOCAL5 */
7577 #ifdef LOG_LOCAL6
7578 if (x == LOG_LOCAL6)
7579 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;}
7580 #endif /* ndef LOG_LOCAL6 */
7581 #ifdef LOG_LOCAL7
7582 if (x == LOG_LOCAL7)
7583 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;}
7584 #endif /* ndef LOG_LOCAL7 */
7585 #ifdef LOG_LPR
7586 if (x == LOG_LPR)
7587 {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
7588 #endif /* ndef LOG_LPR */
7589 #ifdef LOG_MAIL
7590 if (x == LOG_MAIL)
7591 {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
7592 #endif /* ndef LOG_MAIL */
7593 #ifdef LOG_NEWS
7594 if (x == LOG_NEWS)
7595 {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
7596 #endif /* ndef LOG_NEWS */
7597 #ifdef LOG_SYSLOG
7598 if (x == LOG_SYSLOG)
7599 {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
7600 #endif /* ndef LOG_SYSLOG */
7601 #ifdef LOG_USER
7602 if (x == LOG_USER)
7603 {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
7604 #endif /* ndef LOG_USER */
7605 #ifdef LOG_UUCP
7606 if (x == LOG_UUCP)
7607 {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
7608 #endif /* ndef LOG_UUCP */
7609 errno = EINVAL; return -1;
7612 int Mono_Posix_FromSyslogLevel (int x, int *r)
7614 *r = 0;
7615 if (x == Mono_Posix_SyslogLevel_LOG_ALERT)
7616 #ifdef LOG_ALERT
7617 {*r = LOG_ALERT; return 0;}
7618 #else /* def LOG_ALERT */
7619 {errno = EINVAL; return -1;}
7620 #endif /* ndef LOG_ALERT */
7621 if (x == Mono_Posix_SyslogLevel_LOG_CRIT)
7622 #ifdef LOG_CRIT
7623 {*r = LOG_CRIT; return 0;}
7624 #else /* def LOG_CRIT */
7625 {errno = EINVAL; return -1;}
7626 #endif /* ndef LOG_CRIT */
7627 if (x == Mono_Posix_SyslogLevel_LOG_DEBUG)
7628 #ifdef LOG_DEBUG
7629 {*r = LOG_DEBUG; return 0;}
7630 #else /* def LOG_DEBUG */
7631 {errno = EINVAL; return -1;}
7632 #endif /* ndef LOG_DEBUG */
7633 if (x == Mono_Posix_SyslogLevel_LOG_EMERG)
7634 #ifdef LOG_EMERG
7635 {*r = LOG_EMERG; return 0;}
7636 #else /* def LOG_EMERG */
7637 {errno = EINVAL; return -1;}
7638 #endif /* ndef LOG_EMERG */
7639 if (x == Mono_Posix_SyslogLevel_LOG_ERR)
7640 #ifdef LOG_ERR
7641 {*r = LOG_ERR; return 0;}
7642 #else /* def LOG_ERR */
7643 {errno = EINVAL; return -1;}
7644 #endif /* ndef LOG_ERR */
7645 if (x == Mono_Posix_SyslogLevel_LOG_INFO)
7646 #ifdef LOG_INFO
7647 {*r = LOG_INFO; return 0;}
7648 #else /* def LOG_INFO */
7649 {errno = EINVAL; return -1;}
7650 #endif /* ndef LOG_INFO */
7651 if (x == Mono_Posix_SyslogLevel_LOG_NOTICE)
7652 #ifdef LOG_NOTICE
7653 {*r = LOG_NOTICE; return 0;}
7654 #else /* def LOG_NOTICE */
7655 {errno = EINVAL; return -1;}
7656 #endif /* ndef LOG_NOTICE */
7657 if (x == Mono_Posix_SyslogLevel_LOG_WARNING)
7658 #ifdef LOG_WARNING
7659 {*r = LOG_WARNING; return 0;}
7660 #else /* def LOG_WARNING */
7661 {errno = EINVAL; return -1;}
7662 #endif /* ndef LOG_WARNING */
7663 if (x == 0)
7664 return 0;
7665 errno = EINVAL; return -1;
7668 int Mono_Posix_ToSyslogLevel (int x, int *r)
7670 *r = 0;
7671 if (x == 0)
7672 return 0;
7673 #ifdef LOG_ALERT
7674 if (x == LOG_ALERT)
7675 {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;}
7676 #endif /* ndef LOG_ALERT */
7677 #ifdef LOG_CRIT
7678 if (x == LOG_CRIT)
7679 {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;}
7680 #endif /* ndef LOG_CRIT */
7681 #ifdef LOG_DEBUG
7682 if (x == LOG_DEBUG)
7683 {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
7684 #endif /* ndef LOG_DEBUG */
7685 #ifdef LOG_EMERG
7686 if (x == LOG_EMERG)
7687 {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
7688 #endif /* ndef LOG_EMERG */
7689 #ifdef LOG_ERR
7690 if (x == LOG_ERR)
7691 {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
7692 #endif /* ndef LOG_ERR */
7693 #ifdef LOG_INFO
7694 if (x == LOG_INFO)
7695 {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
7696 #endif /* ndef LOG_INFO */
7697 #ifdef LOG_NOTICE
7698 if (x == LOG_NOTICE)
7699 {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
7700 #endif /* ndef LOG_NOTICE */
7701 #ifdef LOG_WARNING
7702 if (x == LOG_WARNING)
7703 {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
7704 #endif /* ndef LOG_WARNING */
7705 errno = EINVAL; return -1;
7708 int Mono_Posix_FromSyslogOptions (int x, int *r)
7710 *r = 0;
7711 if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
7712 #ifdef LOG_CONS
7713 *r |= LOG_CONS;
7714 #else /* def LOG_CONS */
7715 {errno = EINVAL; return -1;}
7716 #endif /* ndef LOG_CONS */
7717 if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
7718 #ifdef LOG_NDELAY
7719 *r |= LOG_NDELAY;
7720 #else /* def LOG_NDELAY */
7721 {errno = EINVAL; return -1;}
7722 #endif /* ndef LOG_NDELAY */
7723 if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
7724 #ifdef LOG_NOWAIT
7725 *r |= LOG_NOWAIT;
7726 #else /* def LOG_NOWAIT */
7727 {errno = EINVAL; return -1;}
7728 #endif /* ndef LOG_NOWAIT */
7729 if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
7730 #ifdef LOG_ODELAY
7731 *r |= LOG_ODELAY;
7732 #else /* def LOG_ODELAY */
7733 {errno = EINVAL; return -1;}
7734 #endif /* ndef LOG_ODELAY */
7735 if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
7736 #ifdef LOG_PERROR
7737 *r |= LOG_PERROR;
7738 #else /* def LOG_PERROR */
7739 {errno = EINVAL; return -1;}
7740 #endif /* ndef LOG_PERROR */
7741 if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
7742 #ifdef LOG_PID
7743 *r |= LOG_PID;
7744 #else /* def LOG_PID */
7745 {errno = EINVAL; return -1;}
7746 #endif /* ndef LOG_PID */
7747 if (x == 0)
7748 return 0;
7749 return 0;
7752 int Mono_Posix_ToSyslogOptions (int x, int *r)
7754 *r = 0;
7755 if (x == 0)
7756 return 0;
7757 #ifdef LOG_CONS
7758 if ((x & LOG_CONS) == LOG_CONS)
7759 *r |= Mono_Posix_SyslogOptions_LOG_CONS;
7760 #endif /* ndef LOG_CONS */
7761 #ifdef LOG_NDELAY
7762 if ((x & LOG_NDELAY) == LOG_NDELAY)
7763 *r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
7764 #endif /* ndef LOG_NDELAY */
7765 #ifdef LOG_NOWAIT
7766 if ((x & LOG_NOWAIT) == LOG_NOWAIT)
7767 *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
7768 #endif /* ndef LOG_NOWAIT */
7769 #ifdef LOG_ODELAY
7770 if ((x & LOG_ODELAY) == LOG_ODELAY)
7771 *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
7772 #endif /* ndef LOG_ODELAY */
7773 #ifdef LOG_PERROR
7774 if ((x & LOG_PERROR) == LOG_PERROR)
7775 *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
7776 #endif /* ndef LOG_PERROR */
7777 #ifdef LOG_PID
7778 if ((x & LOG_PID) == LOG_PID)
7779 *r |= Mono_Posix_SyslogOptions_LOG_PID;
7780 #endif /* ndef LOG_PID */
7781 return 0;
7784 #ifdef HAVE_STRUCT_TIMESPEC
7786 Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
7788 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7789 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7791 memset (to, 0, sizeof(*to));
7793 to->tv_sec = from->tv_sec;
7794 to->tv_nsec = from->tv_nsec;
7796 return 0;
7798 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7801 #ifdef HAVE_STRUCT_TIMESPEC
7803 Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
7805 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7806 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7808 memset (to, 0, sizeof(*to));
7810 to->tv_sec = from->tv_sec;
7811 to->tv_nsec = from->tv_nsec;
7813 return 0;
7815 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7818 #ifdef HAVE_STRUCT_TIMEVAL
7820 Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
7822 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7823 _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
7825 memset (to, 0, sizeof(*to));
7827 to->tv_sec = from->tv_sec;
7828 to->tv_usec = from->tv_usec;
7830 return 0;
7832 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7835 #ifdef HAVE_STRUCT_TIMEVAL
7837 Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
7839 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7840 _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
7842 memset (to, 0, sizeof(*to));
7844 to->tv_sec = from->tv_sec;
7845 to->tv_usec = from->tv_usec;
7847 return 0;
7849 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7852 #ifdef HAVE_STRUCT_TIMEZONE
7854 Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
7856 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7857 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7859 memset (to, 0, sizeof(*to));
7861 to->tz_minuteswest = from->tz_minuteswest;
7862 to->tz_dsttime = from->tz_dsttime;
7864 return 0;
7866 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7869 #ifdef HAVE_STRUCT_TIMEZONE
7871 Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
7873 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7874 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7876 memset (to, 0, sizeof(*to));
7878 to->tz_minuteswest = from->tz_minuteswest;
7879 to->tz_dsttime = from->tz_dsttime;
7881 return 0;
7883 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7886 int Mono_Posix_FromUnixAddressFamily (int x, int *r)
7888 *r = 0;
7889 if (x == Mono_Posix_UnixAddressFamily_AF_ALG)
7890 #ifdef AF_ALG
7891 {*r = AF_ALG; return 0;}
7892 #else /* def AF_ALG */
7893 {errno = EINVAL; return -1;}
7894 #endif /* ndef AF_ALG */
7895 if (x == Mono_Posix_UnixAddressFamily_AF_APPLETALK)
7896 #ifdef AF_APPLETALK
7897 {*r = AF_APPLETALK; return 0;}
7898 #else /* def AF_APPLETALK */
7899 {errno = EINVAL; return -1;}
7900 #endif /* ndef AF_APPLETALK */
7901 if (x == Mono_Posix_UnixAddressFamily_AF_ASH)
7902 #ifdef AF_ASH
7903 {*r = AF_ASH; return 0;}
7904 #else /* def AF_ASH */
7905 {errno = EINVAL; return -1;}
7906 #endif /* ndef AF_ASH */
7907 if (x == Mono_Posix_UnixAddressFamily_AF_ATMPVC)
7908 #ifdef AF_ATMPVC
7909 {*r = AF_ATMPVC; return 0;}
7910 #else /* def AF_ATMPVC */
7911 {errno = EINVAL; return -1;}
7912 #endif /* ndef AF_ATMPVC */
7913 if (x == Mono_Posix_UnixAddressFamily_AF_ATMSVC)
7914 #ifdef AF_ATMSVC
7915 {*r = AF_ATMSVC; return 0;}
7916 #else /* def AF_ATMSVC */
7917 {errno = EINVAL; return -1;}
7918 #endif /* ndef AF_ATMSVC */
7919 if (x == Mono_Posix_UnixAddressFamily_AF_AX25)
7920 #ifdef AF_AX25
7921 {*r = AF_AX25; return 0;}
7922 #else /* def AF_AX25 */
7923 {errno = EINVAL; return -1;}
7924 #endif /* ndef AF_AX25 */
7925 if (x == Mono_Posix_UnixAddressFamily_AF_BLUETOOTH)
7926 #ifdef AF_BLUETOOTH
7927 {*r = AF_BLUETOOTH; return 0;}
7928 #else /* def AF_BLUETOOTH */
7929 {errno = EINVAL; return -1;}
7930 #endif /* ndef AF_BLUETOOTH */
7931 if (x == Mono_Posix_UnixAddressFamily_AF_BRIDGE)
7932 #ifdef AF_BRIDGE
7933 {*r = AF_BRIDGE; return 0;}
7934 #else /* def AF_BRIDGE */
7935 {errno = EINVAL; return -1;}
7936 #endif /* ndef AF_BRIDGE */
7937 if (x == Mono_Posix_UnixAddressFamily_AF_CAIF)
7938 #ifdef AF_CAIF
7939 {*r = AF_CAIF; return 0;}
7940 #else /* def AF_CAIF */
7941 {errno = EINVAL; return -1;}
7942 #endif /* ndef AF_CAIF */
7943 if (x == Mono_Posix_UnixAddressFamily_AF_CAN)
7944 #ifdef AF_CAN
7945 {*r = AF_CAN; return 0;}
7946 #else /* def AF_CAN */
7947 {errno = EINVAL; return -1;}
7948 #endif /* ndef AF_CAN */
7949 if (x == Mono_Posix_UnixAddressFamily_AF_DECnet)
7950 #ifdef AF_DECnet
7951 {*r = AF_DECnet; return 0;}
7952 #else /* def AF_DECnet */
7953 {errno = EINVAL; return -1;}
7954 #endif /* ndef AF_DECnet */
7955 if (x == Mono_Posix_UnixAddressFamily_AF_ECONET)
7956 #ifdef AF_ECONET
7957 {*r = AF_ECONET; return 0;}
7958 #else /* def AF_ECONET */
7959 {errno = EINVAL; return -1;}
7960 #endif /* ndef AF_ECONET */
7961 if (x == Mono_Posix_UnixAddressFamily_AF_IEEE802154)
7962 #ifdef AF_IEEE802154
7963 {*r = AF_IEEE802154; return 0;}
7964 #else /* def AF_IEEE802154 */
7965 {errno = EINVAL; return -1;}
7966 #endif /* ndef AF_IEEE802154 */
7967 if (x == Mono_Posix_UnixAddressFamily_AF_INET)
7968 #ifdef AF_INET
7969 {*r = AF_INET; return 0;}
7970 #else /* def AF_INET */
7971 {errno = EINVAL; return -1;}
7972 #endif /* ndef AF_INET */
7973 if (x == Mono_Posix_UnixAddressFamily_AF_INET6)
7974 #ifdef AF_INET6
7975 {*r = AF_INET6; return 0;}
7976 #else /* def AF_INET6 */
7977 {errno = EINVAL; return -1;}
7978 #endif /* ndef AF_INET6 */
7979 if (x == Mono_Posix_UnixAddressFamily_AF_IPX)
7980 #ifdef AF_IPX
7981 {*r = AF_IPX; return 0;}
7982 #else /* def AF_IPX */
7983 {errno = EINVAL; return -1;}
7984 #endif /* ndef AF_IPX */
7985 if (x == Mono_Posix_UnixAddressFamily_AF_IRDA)
7986 #ifdef AF_IRDA
7987 {*r = AF_IRDA; return 0;}
7988 #else /* def AF_IRDA */
7989 {errno = EINVAL; return -1;}
7990 #endif /* ndef AF_IRDA */
7991 if (x == Mono_Posix_UnixAddressFamily_AF_ISDN)
7992 #ifdef AF_ISDN
7993 {*r = AF_ISDN; return 0;}
7994 #else /* def AF_ISDN */
7995 {errno = EINVAL; return -1;}
7996 #endif /* ndef AF_ISDN */
7997 if (x == Mono_Posix_UnixAddressFamily_AF_IUCV)
7998 #ifdef AF_IUCV
7999 {*r = AF_IUCV; return 0;}
8000 #else /* def AF_IUCV */
8001 {errno = EINVAL; return -1;}
8002 #endif /* ndef AF_IUCV */
8003 if (x == Mono_Posix_UnixAddressFamily_AF_KEY)
8004 #ifdef AF_KEY
8005 {*r = AF_KEY; return 0;}
8006 #else /* def AF_KEY */
8007 {errno = EINVAL; return -1;}
8008 #endif /* ndef AF_KEY */
8009 if (x == Mono_Posix_UnixAddressFamily_AF_LLC)
8010 #ifdef AF_LLC
8011 {*r = AF_LLC; return 0;}
8012 #else /* def AF_LLC */
8013 {errno = EINVAL; return -1;}
8014 #endif /* ndef AF_LLC */
8015 if (x == Mono_Posix_UnixAddressFamily_AF_NETBEUI)
8016 #ifdef AF_NETBEUI
8017 {*r = AF_NETBEUI; return 0;}
8018 #else /* def AF_NETBEUI */
8019 {errno = EINVAL; return -1;}
8020 #endif /* ndef AF_NETBEUI */
8021 if (x == Mono_Posix_UnixAddressFamily_AF_NETLINK)
8022 #ifdef AF_NETLINK
8023 {*r = AF_NETLINK; return 0;}
8024 #else /* def AF_NETLINK */
8025 {errno = EINVAL; return -1;}
8026 #endif /* ndef AF_NETLINK */
8027 if (x == Mono_Posix_UnixAddressFamily_AF_NETROM)
8028 #ifdef AF_NETROM
8029 {*r = AF_NETROM; return 0;}
8030 #else /* def AF_NETROM */
8031 {errno = EINVAL; return -1;}
8032 #endif /* ndef AF_NETROM */
8033 if (x == Mono_Posix_UnixAddressFamily_AF_NFC)
8034 #ifdef AF_NFC
8035 {*r = AF_NFC; return 0;}
8036 #else /* def AF_NFC */
8037 {errno = EINVAL; return -1;}
8038 #endif /* ndef AF_NFC */
8039 if (x == Mono_Posix_UnixAddressFamily_AF_PACKET)
8040 #ifdef AF_PACKET
8041 {*r = AF_PACKET; return 0;}
8042 #else /* def AF_PACKET */
8043 {errno = EINVAL; return -1;}
8044 #endif /* ndef AF_PACKET */
8045 if (x == Mono_Posix_UnixAddressFamily_AF_PHONET)
8046 #ifdef AF_PHONET
8047 {*r = AF_PHONET; return 0;}
8048 #else /* def AF_PHONET */
8049 {errno = EINVAL; return -1;}
8050 #endif /* ndef AF_PHONET */
8051 if (x == Mono_Posix_UnixAddressFamily_AF_PPPOX)
8052 #ifdef AF_PPPOX
8053 {*r = AF_PPPOX; return 0;}
8054 #else /* def AF_PPPOX */
8055 {errno = EINVAL; return -1;}
8056 #endif /* ndef AF_PPPOX */
8057 if (x == Mono_Posix_UnixAddressFamily_AF_RDS)
8058 #ifdef AF_RDS
8059 {*r = AF_RDS; return 0;}
8060 #else /* def AF_RDS */
8061 {errno = EINVAL; return -1;}
8062 #endif /* ndef AF_RDS */
8063 if (x == Mono_Posix_UnixAddressFamily_AF_ROSE)
8064 #ifdef AF_ROSE
8065 {*r = AF_ROSE; return 0;}
8066 #else /* def AF_ROSE */
8067 {errno = EINVAL; return -1;}
8068 #endif /* ndef AF_ROSE */
8069 if (x == Mono_Posix_UnixAddressFamily_AF_RXRPC)
8070 #ifdef AF_RXRPC
8071 {*r = AF_RXRPC; return 0;}
8072 #else /* def AF_RXRPC */
8073 {errno = EINVAL; return -1;}
8074 #endif /* ndef AF_RXRPC */
8075 if (x == Mono_Posix_UnixAddressFamily_AF_SECURITY)
8076 #ifdef AF_SECURITY
8077 {*r = AF_SECURITY; return 0;}
8078 #else /* def AF_SECURITY */
8079 {errno = EINVAL; return -1;}
8080 #endif /* ndef AF_SECURITY */
8081 if (x == Mono_Posix_UnixAddressFamily_AF_SNA)
8082 #ifdef AF_SNA
8083 {*r = AF_SNA; return 0;}
8084 #else /* def AF_SNA */
8085 {errno = EINVAL; return -1;}
8086 #endif /* ndef AF_SNA */
8087 if (x == Mono_Posix_UnixAddressFamily_AF_TIPC)
8088 #ifdef AF_TIPC
8089 {*r = AF_TIPC; return 0;}
8090 #else /* def AF_TIPC */
8091 {errno = EINVAL; return -1;}
8092 #endif /* ndef AF_TIPC */
8093 if (x == Mono_Posix_UnixAddressFamily_AF_UNIX)
8094 #ifdef AF_UNIX
8095 {*r = AF_UNIX; return 0;}
8096 #else /* def AF_UNIX */
8097 {errno = EINVAL; return -1;}
8098 #endif /* ndef AF_UNIX */
8099 if (x == Mono_Posix_UnixAddressFamily_AF_UNSPEC)
8100 #ifdef AF_UNSPEC
8101 {*r = AF_UNSPEC; return 0;}
8102 #else /* def AF_UNSPEC */
8103 {errno = EINVAL; return -1;}
8104 #endif /* ndef AF_UNSPEC */
8105 if (x == Mono_Posix_UnixAddressFamily_AF_VSOCK)
8106 #ifdef AF_VSOCK
8107 {*r = AF_VSOCK; return 0;}
8108 #else /* def AF_VSOCK */
8109 {errno = EINVAL; return -1;}
8110 #endif /* ndef AF_VSOCK */
8111 if (x == Mono_Posix_UnixAddressFamily_AF_WANPIPE)
8112 #ifdef AF_WANPIPE
8113 {*r = AF_WANPIPE; return 0;}
8114 #else /* def AF_WANPIPE */
8115 {errno = EINVAL; return -1;}
8116 #endif /* ndef AF_WANPIPE */
8117 if (x == Mono_Posix_UnixAddressFamily_AF_X25)
8118 #ifdef AF_X25
8119 {*r = AF_X25; return 0;}
8120 #else /* def AF_X25 */
8121 {errno = EINVAL; return -1;}
8122 #endif /* ndef AF_X25 */
8123 if (x == Mono_Posix_UnixAddressFamily_Unknown)
8124 #ifdef Unknown
8125 {*r = Unknown; return 0;}
8126 #else /* def Unknown */
8127 {errno = EINVAL; return -1;}
8128 #endif /* ndef Unknown */
8129 if (x == 0)
8130 return 0;
8131 errno = EINVAL; return -1;
8134 int Mono_Posix_ToUnixAddressFamily (int x, int *r)
8136 *r = 0;
8137 if (x == 0)
8138 return 0;
8139 #ifdef AF_ALG
8140 if (x == AF_ALG)
8141 {*r = Mono_Posix_UnixAddressFamily_AF_ALG; return 0;}
8142 #endif /* ndef AF_ALG */
8143 #ifdef AF_APPLETALK
8144 if (x == AF_APPLETALK)
8145 {*r = Mono_Posix_UnixAddressFamily_AF_APPLETALK; return 0;}
8146 #endif /* ndef AF_APPLETALK */
8147 #ifdef AF_ASH
8148 if (x == AF_ASH)
8149 {*r = Mono_Posix_UnixAddressFamily_AF_ASH; return 0;}
8150 #endif /* ndef AF_ASH */
8151 #ifdef AF_ATMPVC
8152 if (x == AF_ATMPVC)
8153 {*r = Mono_Posix_UnixAddressFamily_AF_ATMPVC; return 0;}
8154 #endif /* ndef AF_ATMPVC */
8155 #ifdef AF_ATMSVC
8156 if (x == AF_ATMSVC)
8157 {*r = Mono_Posix_UnixAddressFamily_AF_ATMSVC; return 0;}
8158 #endif /* ndef AF_ATMSVC */
8159 #ifdef AF_AX25
8160 if (x == AF_AX25)
8161 {*r = Mono_Posix_UnixAddressFamily_AF_AX25; return 0;}
8162 #endif /* ndef AF_AX25 */
8163 #ifdef AF_BLUETOOTH
8164 if (x == AF_BLUETOOTH)
8165 {*r = Mono_Posix_UnixAddressFamily_AF_BLUETOOTH; return 0;}
8166 #endif /* ndef AF_BLUETOOTH */
8167 #ifdef AF_BRIDGE
8168 if (x == AF_BRIDGE)
8169 {*r = Mono_Posix_UnixAddressFamily_AF_BRIDGE; return 0;}
8170 #endif /* ndef AF_BRIDGE */
8171 #ifdef AF_CAIF
8172 if (x == AF_CAIF)
8173 {*r = Mono_Posix_UnixAddressFamily_AF_CAIF; return 0;}
8174 #endif /* ndef AF_CAIF */
8175 #ifdef AF_CAN
8176 if (x == AF_CAN)
8177 {*r = Mono_Posix_UnixAddressFamily_AF_CAN; return 0;}
8178 #endif /* ndef AF_CAN */
8179 #ifdef AF_DECnet
8180 if (x == AF_DECnet)
8181 {*r = Mono_Posix_UnixAddressFamily_AF_DECnet; return 0;}
8182 #endif /* ndef AF_DECnet */
8183 #ifdef AF_ECONET
8184 if (x == AF_ECONET)
8185 {*r = Mono_Posix_UnixAddressFamily_AF_ECONET; return 0;}
8186 #endif /* ndef AF_ECONET */
8187 #ifdef AF_IEEE802154
8188 if (x == AF_IEEE802154)
8189 {*r = Mono_Posix_UnixAddressFamily_AF_IEEE802154; return 0;}
8190 #endif /* ndef AF_IEEE802154 */
8191 #ifdef AF_INET
8192 if (x == AF_INET)
8193 {*r = Mono_Posix_UnixAddressFamily_AF_INET; return 0;}
8194 #endif /* ndef AF_INET */
8195 #ifdef AF_INET6
8196 if (x == AF_INET6)
8197 {*r = Mono_Posix_UnixAddressFamily_AF_INET6; return 0;}
8198 #endif /* ndef AF_INET6 */
8199 #ifdef AF_IPX
8200 if (x == AF_IPX)
8201 {*r = Mono_Posix_UnixAddressFamily_AF_IPX; return 0;}
8202 #endif /* ndef AF_IPX */
8203 #ifdef AF_IRDA
8204 if (x == AF_IRDA)
8205 {*r = Mono_Posix_UnixAddressFamily_AF_IRDA; return 0;}
8206 #endif /* ndef AF_IRDA */
8207 #ifdef AF_ISDN
8208 if (x == AF_ISDN)
8209 {*r = Mono_Posix_UnixAddressFamily_AF_ISDN; return 0;}
8210 #endif /* ndef AF_ISDN */
8211 #ifdef AF_IUCV
8212 if (x == AF_IUCV)
8213 {*r = Mono_Posix_UnixAddressFamily_AF_IUCV; return 0;}
8214 #endif /* ndef AF_IUCV */
8215 #ifdef AF_KEY
8216 if (x == AF_KEY)
8217 {*r = Mono_Posix_UnixAddressFamily_AF_KEY; return 0;}
8218 #endif /* ndef AF_KEY */
8219 #ifdef AF_LLC
8220 if (x == AF_LLC)
8221 {*r = Mono_Posix_UnixAddressFamily_AF_LLC; return 0;}
8222 #endif /* ndef AF_LLC */
8223 #ifdef AF_NETBEUI
8224 if (x == AF_NETBEUI)
8225 {*r = Mono_Posix_UnixAddressFamily_AF_NETBEUI; return 0;}
8226 #endif /* ndef AF_NETBEUI */
8227 #ifdef AF_NETLINK
8228 if (x == AF_NETLINK)
8229 {*r = Mono_Posix_UnixAddressFamily_AF_NETLINK; return 0;}
8230 #endif /* ndef AF_NETLINK */
8231 #ifdef AF_NETROM
8232 if (x == AF_NETROM)
8233 {*r = Mono_Posix_UnixAddressFamily_AF_NETROM; return 0;}
8234 #endif /* ndef AF_NETROM */
8235 #ifdef AF_NFC
8236 if (x == AF_NFC)
8237 {*r = Mono_Posix_UnixAddressFamily_AF_NFC; return 0;}
8238 #endif /* ndef AF_NFC */
8239 #ifdef AF_PACKET
8240 if (x == AF_PACKET)
8241 {*r = Mono_Posix_UnixAddressFamily_AF_PACKET; return 0;}
8242 #endif /* ndef AF_PACKET */
8243 #ifdef AF_PHONET
8244 if (x == AF_PHONET)
8245 {*r = Mono_Posix_UnixAddressFamily_AF_PHONET; return 0;}
8246 #endif /* ndef AF_PHONET */
8247 #ifdef AF_PPPOX
8248 if (x == AF_PPPOX)
8249 {*r = Mono_Posix_UnixAddressFamily_AF_PPPOX; return 0;}
8250 #endif /* ndef AF_PPPOX */
8251 #ifdef AF_RDS
8252 if (x == AF_RDS)
8253 {*r = Mono_Posix_UnixAddressFamily_AF_RDS; return 0;}
8254 #endif /* ndef AF_RDS */
8255 #ifdef AF_ROSE
8256 if (x == AF_ROSE)
8257 {*r = Mono_Posix_UnixAddressFamily_AF_ROSE; return 0;}
8258 #endif /* ndef AF_ROSE */
8259 #ifdef AF_RXRPC
8260 if (x == AF_RXRPC)
8261 {*r = Mono_Posix_UnixAddressFamily_AF_RXRPC; return 0;}
8262 #endif /* ndef AF_RXRPC */
8263 #ifdef AF_SECURITY
8264 if (x == AF_SECURITY)
8265 {*r = Mono_Posix_UnixAddressFamily_AF_SECURITY; return 0;}
8266 #endif /* ndef AF_SECURITY */
8267 #ifdef AF_SNA
8268 if (x == AF_SNA)
8269 {*r = Mono_Posix_UnixAddressFamily_AF_SNA; return 0;}
8270 #endif /* ndef AF_SNA */
8271 #ifdef AF_TIPC
8272 if (x == AF_TIPC)
8273 {*r = Mono_Posix_UnixAddressFamily_AF_TIPC; return 0;}
8274 #endif /* ndef AF_TIPC */
8275 #ifdef AF_UNIX
8276 if (x == AF_UNIX)
8277 {*r = Mono_Posix_UnixAddressFamily_AF_UNIX; return 0;}
8278 #endif /* ndef AF_UNIX */
8279 #ifdef AF_UNSPEC
8280 if (x == AF_UNSPEC)
8281 {*r = Mono_Posix_UnixAddressFamily_AF_UNSPEC; return 0;}
8282 #endif /* ndef AF_UNSPEC */
8283 #ifdef AF_VSOCK
8284 if (x == AF_VSOCK)
8285 {*r = Mono_Posix_UnixAddressFamily_AF_VSOCK; return 0;}
8286 #endif /* ndef AF_VSOCK */
8287 #ifdef AF_WANPIPE
8288 if (x == AF_WANPIPE)
8289 {*r = Mono_Posix_UnixAddressFamily_AF_WANPIPE; return 0;}
8290 #endif /* ndef AF_WANPIPE */
8291 #ifdef AF_X25
8292 if (x == AF_X25)
8293 {*r = Mono_Posix_UnixAddressFamily_AF_X25; return 0;}
8294 #endif /* ndef AF_X25 */
8295 #ifdef Unknown
8296 if (x == Unknown)
8297 {*r = Mono_Posix_UnixAddressFamily_Unknown; return 0;}
8298 #endif /* ndef Unknown */
8299 errno = EINVAL; return -1;
8302 int Mono_Posix_FromUnixSocketControlMessage (int x, int *r)
8304 *r = 0;
8305 if (x == Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS)
8306 #ifdef SCM_CREDENTIALS
8307 {*r = SCM_CREDENTIALS; return 0;}
8308 #else /* def SCM_CREDENTIALS */
8309 {errno = EINVAL; return -1;}
8310 #endif /* ndef SCM_CREDENTIALS */
8311 if (x == Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS)
8312 #ifdef SCM_RIGHTS
8313 {*r = SCM_RIGHTS; return 0;}
8314 #else /* def SCM_RIGHTS */
8315 {errno = EINVAL; return -1;}
8316 #endif /* ndef SCM_RIGHTS */
8317 if (x == 0)
8318 return 0;
8319 errno = EINVAL; return -1;
8322 int Mono_Posix_ToUnixSocketControlMessage (int x, int *r)
8324 *r = 0;
8325 if (x == 0)
8326 return 0;
8327 #ifdef SCM_CREDENTIALS
8328 if (x == SCM_CREDENTIALS)
8329 {*r = Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS; return 0;}
8330 #endif /* ndef SCM_CREDENTIALS */
8331 #ifdef SCM_RIGHTS
8332 if (x == SCM_RIGHTS)
8333 {*r = Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS; return 0;}
8334 #endif /* ndef SCM_RIGHTS */
8335 errno = EINVAL; return -1;
8338 int Mono_Posix_FromUnixSocketFlags (int x, int *r)
8340 *r = 0;
8341 if ((x & Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC) == Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC)
8342 #ifdef SOCK_CLOEXEC
8343 *r |= SOCK_CLOEXEC;
8344 #else /* def SOCK_CLOEXEC */
8345 {errno = EINVAL; return -1;}
8346 #endif /* ndef SOCK_CLOEXEC */
8347 if ((x & Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK) == Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK)
8348 #ifdef SOCK_NONBLOCK
8349 *r |= SOCK_NONBLOCK;
8350 #else /* def SOCK_NONBLOCK */
8351 {errno = EINVAL; return -1;}
8352 #endif /* ndef SOCK_NONBLOCK */
8353 if (x == 0)
8354 return 0;
8355 return 0;
8358 int Mono_Posix_ToUnixSocketFlags (int x, int *r)
8360 *r = 0;
8361 if (x == 0)
8362 return 0;
8363 #ifdef SOCK_CLOEXEC
8364 if ((x & SOCK_CLOEXEC) == SOCK_CLOEXEC)
8365 *r |= Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC;
8366 #endif /* ndef SOCK_CLOEXEC */
8367 #ifdef SOCK_NONBLOCK
8368 if ((x & SOCK_NONBLOCK) == SOCK_NONBLOCK)
8369 *r |= Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK;
8370 #endif /* ndef SOCK_NONBLOCK */
8371 return 0;
8374 int Mono_Posix_FromUnixSocketOptionName (int x, int *r)
8376 *r = 0;
8377 if (x == Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN)
8378 #ifdef SO_ACCEPTCONN
8379 {*r = SO_ACCEPTCONN; return 0;}
8380 #else /* def SO_ACCEPTCONN */
8381 {errno = EINVAL; return -1;}
8382 #endif /* ndef SO_ACCEPTCONN */
8383 if (x == Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER)
8384 #ifdef SO_ATTACH_FILTER
8385 {*r = SO_ATTACH_FILTER; return 0;}
8386 #else /* def SO_ATTACH_FILTER */
8387 {errno = EINVAL; return -1;}
8388 #endif /* ndef SO_ATTACH_FILTER */
8389 if (x == Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE)
8390 #ifdef SO_BINDTODEVICE
8391 {*r = SO_BINDTODEVICE; return 0;}
8392 #else /* def SO_BINDTODEVICE */
8393 {errno = EINVAL; return -1;}
8394 #endif /* ndef SO_BINDTODEVICE */
8395 if (x == Mono_Posix_UnixSocketOptionName_SO_BROADCAST)
8396 #ifdef SO_BROADCAST
8397 {*r = SO_BROADCAST; return 0;}
8398 #else /* def SO_BROADCAST */
8399 {errno = EINVAL; return -1;}
8400 #endif /* ndef SO_BROADCAST */
8401 if (x == Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT)
8402 #ifdef SO_BSDCOMPAT
8403 {*r = SO_BSDCOMPAT; return 0;}
8404 #else /* def SO_BSDCOMPAT */
8405 {errno = EINVAL; return -1;}
8406 #endif /* ndef SO_BSDCOMPAT */
8407 if (x == Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL)
8408 #ifdef SO_BUSY_POLL
8409 {*r = SO_BUSY_POLL; return 0;}
8410 #else /* def SO_BUSY_POLL */
8411 {errno = EINVAL; return -1;}
8412 #endif /* ndef SO_BUSY_POLL */
8413 if (x == Mono_Posix_UnixSocketOptionName_SO_DEBUG)
8414 #ifdef SO_DEBUG
8415 {*r = SO_DEBUG; return 0;}
8416 #else /* def SO_DEBUG */
8417 {errno = EINVAL; return -1;}
8418 #endif /* ndef SO_DEBUG */
8419 if (x == Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER)
8420 #ifdef SO_DETACH_FILTER
8421 {*r = SO_DETACH_FILTER; return 0;}
8422 #else /* def SO_DETACH_FILTER */
8423 {errno = EINVAL; return -1;}
8424 #endif /* ndef SO_DETACH_FILTER */
8425 if (x == Mono_Posix_UnixSocketOptionName_SO_DOMAIN)
8426 #ifdef SO_DOMAIN
8427 {*r = SO_DOMAIN; return 0;}
8428 #else /* def SO_DOMAIN */
8429 {errno = EINVAL; return -1;}
8430 #endif /* ndef SO_DOMAIN */
8431 if (x == Mono_Posix_UnixSocketOptionName_SO_DONTROUTE)
8432 #ifdef SO_DONTROUTE
8433 {*r = SO_DONTROUTE; return 0;}
8434 #else /* def SO_DONTROUTE */
8435 {errno = EINVAL; return -1;}
8436 #endif /* ndef SO_DONTROUTE */
8437 if (x == Mono_Posix_UnixSocketOptionName_SO_ERROR)
8438 #ifdef SO_ERROR
8439 {*r = SO_ERROR; return 0;}
8440 #else /* def SO_ERROR */
8441 {errno = EINVAL; return -1;}
8442 #endif /* ndef SO_ERROR */
8443 if (x == Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE)
8444 #ifdef SO_KEEPALIVE
8445 {*r = SO_KEEPALIVE; return 0;}
8446 #else /* def SO_KEEPALIVE */
8447 {errno = EINVAL; return -1;}
8448 #endif /* ndef SO_KEEPALIVE */
8449 if (x == Mono_Posix_UnixSocketOptionName_SO_LINGER)
8450 #ifdef SO_LINGER
8451 {*r = SO_LINGER; return 0;}
8452 #else /* def SO_LINGER */
8453 {errno = EINVAL; return -1;}
8454 #endif /* ndef SO_LINGER */
8455 if (x == Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER)
8456 #ifdef SO_LOCK_FILTER
8457 {*r = SO_LOCK_FILTER; return 0;}
8458 #else /* def SO_LOCK_FILTER */
8459 {errno = EINVAL; return -1;}
8460 #endif /* ndef SO_LOCK_FILTER */
8461 if (x == Mono_Posix_UnixSocketOptionName_SO_MARK)
8462 #ifdef SO_MARK
8463 {*r = SO_MARK; return 0;}
8464 #else /* def SO_MARK */
8465 {errno = EINVAL; return -1;}
8466 #endif /* ndef SO_MARK */
8467 if (x == Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE)
8468 #ifdef SO_MAX_PACING_RATE
8469 {*r = SO_MAX_PACING_RATE; return 0;}
8470 #else /* def SO_MAX_PACING_RATE */
8471 {errno = EINVAL; return -1;}
8472 #endif /* ndef SO_MAX_PACING_RATE */
8473 if (x == Mono_Posix_UnixSocketOptionName_SO_NOFCS)
8474 #ifdef SO_NOFCS
8475 {*r = SO_NOFCS; return 0;}
8476 #else /* def SO_NOFCS */
8477 {errno = EINVAL; return -1;}
8478 #endif /* ndef SO_NOFCS */
8479 if (x == Mono_Posix_UnixSocketOptionName_SO_NO_CHECK)
8480 #ifdef SO_NO_CHECK
8481 {*r = SO_NO_CHECK; return 0;}
8482 #else /* def SO_NO_CHECK */
8483 {errno = EINVAL; return -1;}
8484 #endif /* ndef SO_NO_CHECK */
8485 if (x == Mono_Posix_UnixSocketOptionName_SO_OOBINLINE)
8486 #ifdef SO_OOBINLINE
8487 {*r = SO_OOBINLINE; return 0;}
8488 #else /* def SO_OOBINLINE */
8489 {errno = EINVAL; return -1;}
8490 #endif /* ndef SO_OOBINLINE */
8491 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSCRED)
8492 #ifdef SO_PASSCRED
8493 {*r = SO_PASSCRED; return 0;}
8494 #else /* def SO_PASSCRED */
8495 {errno = EINVAL; return -1;}
8496 #endif /* ndef SO_PASSCRED */
8497 if (x == Mono_Posix_UnixSocketOptionName_SO_PASSSEC)
8498 #ifdef SO_PASSSEC
8499 {*r = SO_PASSSEC; return 0;}
8500 #else /* def SO_PASSSEC */
8501 {errno = EINVAL; return -1;}
8502 #endif /* ndef SO_PASSSEC */
8503 if (x == Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF)
8504 #ifdef SO_PEEK_OFF
8505 {*r = SO_PEEK_OFF; return 0;}
8506 #else /* def SO_PEEK_OFF */
8507 {errno = EINVAL; return -1;}
8508 #endif /* ndef SO_PEEK_OFF */
8509 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERCRED)
8510 #ifdef SO_PEERCRED
8511 {*r = SO_PEERCRED; return 0;}
8512 #else /* def SO_PEERCRED */
8513 {errno = EINVAL; return -1;}
8514 #endif /* ndef SO_PEERCRED */
8515 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERNAME)
8516 #ifdef SO_PEERNAME
8517 {*r = SO_PEERNAME; return 0;}
8518 #else /* def SO_PEERNAME */
8519 {errno = EINVAL; return -1;}
8520 #endif /* ndef SO_PEERNAME */
8521 if (x == Mono_Posix_UnixSocketOptionName_SO_PEERSEC)
8522 #ifdef SO_PEERSEC
8523 {*r = SO_PEERSEC; return 0;}
8524 #else /* def SO_PEERSEC */
8525 {errno = EINVAL; return -1;}
8526 #endif /* ndef SO_PEERSEC */
8527 if (x == Mono_Posix_UnixSocketOptionName_SO_PRIORITY)
8528 #ifdef SO_PRIORITY
8529 {*r = SO_PRIORITY; return 0;}
8530 #else /* def SO_PRIORITY */
8531 {errno = EINVAL; return -1;}
8532 #endif /* ndef SO_PRIORITY */
8533 if (x == Mono_Posix_UnixSocketOptionName_SO_PROTOCOL)
8534 #ifdef SO_PROTOCOL
8535 {*r = SO_PROTOCOL; return 0;}
8536 #else /* def SO_PROTOCOL */
8537 {errno = EINVAL; return -1;}
8538 #endif /* ndef SO_PROTOCOL */
8539 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUF)
8540 #ifdef SO_RCVBUF
8541 {*r = SO_RCVBUF; return 0;}
8542 #else /* def SO_RCVBUF */
8543 {errno = EINVAL; return -1;}
8544 #endif /* ndef SO_RCVBUF */
8545 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE)
8546 #ifdef SO_RCVBUFFORCE
8547 {*r = SO_RCVBUFFORCE; return 0;}
8548 #else /* def SO_RCVBUFFORCE */
8549 {errno = EINVAL; return -1;}
8550 #endif /* ndef SO_RCVBUFFORCE */
8551 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT)
8552 #ifdef SO_RCVLOWAT
8553 {*r = SO_RCVLOWAT; return 0;}
8554 #else /* def SO_RCVLOWAT */
8555 {errno = EINVAL; return -1;}
8556 #endif /* ndef SO_RCVLOWAT */
8557 if (x == Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO)
8558 #ifdef SO_RCVTIMEO
8559 {*r = SO_RCVTIMEO; return 0;}
8560 #else /* def SO_RCVTIMEO */
8561 {errno = EINVAL; return -1;}
8562 #endif /* ndef SO_RCVTIMEO */
8563 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEADDR)
8564 #ifdef SO_REUSEADDR
8565 {*r = SO_REUSEADDR; return 0;}
8566 #else /* def SO_REUSEADDR */
8567 {errno = EINVAL; return -1;}
8568 #endif /* ndef SO_REUSEADDR */
8569 if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEPORT)
8570 #ifdef SO_REUSEPORT
8571 {*r = SO_REUSEPORT; return 0;}
8572 #else /* def SO_REUSEPORT */
8573 {errno = EINVAL; return -1;}
8574 #endif /* ndef SO_REUSEPORT */
8575 if (x == Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL)
8576 #ifdef SO_RXQ_OVFL
8577 {*r = SO_RXQ_OVFL; return 0;}
8578 #else /* def SO_RXQ_OVFL */
8579 {errno = EINVAL; return -1;}
8580 #endif /* ndef SO_RXQ_OVFL */
8581 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION)
8582 #ifdef SO_SECURITY_AUTHENTICATION
8583 {*r = SO_SECURITY_AUTHENTICATION; return 0;}
8584 #else /* def SO_SECURITY_AUTHENTICATION */
8585 {errno = EINVAL; return -1;}
8586 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8587 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK)
8588 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8589 {*r = SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8590 #else /* def SO_SECURITY_ENCRYPTION_NETWORK */
8591 {errno = EINVAL; return -1;}
8592 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8593 if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT)
8594 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8595 {*r = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8596 #else /* def SO_SECURITY_ENCRYPTION_TRANSPORT */
8597 {errno = EINVAL; return -1;}
8598 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8599 if (x == Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE)
8600 #ifdef SO_SELECT_ERR_QUEUE
8601 {*r = SO_SELECT_ERR_QUEUE; return 0;}
8602 #else /* def SO_SELECT_ERR_QUEUE */
8603 {errno = EINVAL; return -1;}
8604 #endif /* ndef SO_SELECT_ERR_QUEUE */
8605 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUF)
8606 #ifdef SO_SNDBUF
8607 {*r = SO_SNDBUF; return 0;}
8608 #else /* def SO_SNDBUF */
8609 {errno = EINVAL; return -1;}
8610 #endif /* ndef SO_SNDBUF */
8611 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE)
8612 #ifdef SO_SNDBUFFORCE
8613 {*r = SO_SNDBUFFORCE; return 0;}
8614 #else /* def SO_SNDBUFFORCE */
8615 {errno = EINVAL; return -1;}
8616 #endif /* ndef SO_SNDBUFFORCE */
8617 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT)
8618 #ifdef SO_SNDLOWAT
8619 {*r = SO_SNDLOWAT; return 0;}
8620 #else /* def SO_SNDLOWAT */
8621 {errno = EINVAL; return -1;}
8622 #endif /* ndef SO_SNDLOWAT */
8623 if (x == Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO)
8624 #ifdef SO_SNDTIMEO
8625 {*r = SO_SNDTIMEO; return 0;}
8626 #else /* def SO_SNDTIMEO */
8627 {errno = EINVAL; return -1;}
8628 #endif /* ndef SO_SNDTIMEO */
8629 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP)
8630 #ifdef SO_TIMESTAMP
8631 {*r = SO_TIMESTAMP; return 0;}
8632 #else /* def SO_TIMESTAMP */
8633 {errno = EINVAL; return -1;}
8634 #endif /* ndef SO_TIMESTAMP */
8635 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING)
8636 #ifdef SO_TIMESTAMPING
8637 {*r = SO_TIMESTAMPING; return 0;}
8638 #else /* def SO_TIMESTAMPING */
8639 {errno = EINVAL; return -1;}
8640 #endif /* ndef SO_TIMESTAMPING */
8641 if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS)
8642 #ifdef SO_TIMESTAMPNS
8643 {*r = SO_TIMESTAMPNS; return 0;}
8644 #else /* def SO_TIMESTAMPNS */
8645 {errno = EINVAL; return -1;}
8646 #endif /* ndef SO_TIMESTAMPNS */
8647 if (x == Mono_Posix_UnixSocketOptionName_SO_TYPE)
8648 #ifdef SO_TYPE
8649 {*r = SO_TYPE; return 0;}
8650 #else /* def SO_TYPE */
8651 {errno = EINVAL; return -1;}
8652 #endif /* ndef SO_TYPE */
8653 if (x == Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS)
8654 #ifdef SO_WIFI_STATUS
8655 {*r = SO_WIFI_STATUS; return 0;}
8656 #else /* def SO_WIFI_STATUS */
8657 {errno = EINVAL; return -1;}
8658 #endif /* ndef SO_WIFI_STATUS */
8659 if (x == 0)
8660 return 0;
8661 errno = EINVAL; return -1;
8664 int Mono_Posix_ToUnixSocketOptionName (int x, int *r)
8666 *r = 0;
8667 if (x == 0)
8668 return 0;
8669 #ifdef SO_ACCEPTCONN
8670 if (x == SO_ACCEPTCONN)
8671 {*r = Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN; return 0;}
8672 #endif /* ndef SO_ACCEPTCONN */
8673 #ifdef SO_ATTACH_FILTER
8674 if (x == SO_ATTACH_FILTER)
8675 {*r = Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER; return 0;}
8676 #endif /* ndef SO_ATTACH_FILTER */
8677 #ifdef SO_BINDTODEVICE
8678 if (x == SO_BINDTODEVICE)
8679 {*r = Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE; return 0;}
8680 #endif /* ndef SO_BINDTODEVICE */
8681 #ifdef SO_BROADCAST
8682 if (x == SO_BROADCAST)
8683 {*r = Mono_Posix_UnixSocketOptionName_SO_BROADCAST; return 0;}
8684 #endif /* ndef SO_BROADCAST */
8685 #ifdef SO_BSDCOMPAT
8686 if (x == SO_BSDCOMPAT)
8687 {*r = Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT; return 0;}
8688 #endif /* ndef SO_BSDCOMPAT */
8689 #ifdef SO_BUSY_POLL
8690 if (x == SO_BUSY_POLL)
8691 {*r = Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL; return 0;}
8692 #endif /* ndef SO_BUSY_POLL */
8693 #ifdef SO_DEBUG
8694 if (x == SO_DEBUG)
8695 {*r = Mono_Posix_UnixSocketOptionName_SO_DEBUG; return 0;}
8696 #endif /* ndef SO_DEBUG */
8697 #ifdef SO_DETACH_FILTER
8698 if (x == SO_DETACH_FILTER)
8699 {*r = Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER; return 0;}
8700 #endif /* ndef SO_DETACH_FILTER */
8701 #ifdef SO_DOMAIN
8702 if (x == SO_DOMAIN)
8703 {*r = Mono_Posix_UnixSocketOptionName_SO_DOMAIN; return 0;}
8704 #endif /* ndef SO_DOMAIN */
8705 #ifdef SO_DONTROUTE
8706 if (x == SO_DONTROUTE)
8707 {*r = Mono_Posix_UnixSocketOptionName_SO_DONTROUTE; return 0;}
8708 #endif /* ndef SO_DONTROUTE */
8709 #ifdef SO_ERROR
8710 if (x == SO_ERROR)
8711 {*r = Mono_Posix_UnixSocketOptionName_SO_ERROR; return 0;}
8712 #endif /* ndef SO_ERROR */
8713 #ifdef SO_KEEPALIVE
8714 if (x == SO_KEEPALIVE)
8715 {*r = Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE; return 0;}
8716 #endif /* ndef SO_KEEPALIVE */
8717 #ifdef SO_LINGER
8718 if (x == SO_LINGER)
8719 {*r = Mono_Posix_UnixSocketOptionName_SO_LINGER; return 0;}
8720 #endif /* ndef SO_LINGER */
8721 #ifdef SO_LOCK_FILTER
8722 if (x == SO_LOCK_FILTER)
8723 {*r = Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER; return 0;}
8724 #endif /* ndef SO_LOCK_FILTER */
8725 #ifdef SO_MARK
8726 if (x == SO_MARK)
8727 {*r = Mono_Posix_UnixSocketOptionName_SO_MARK; return 0;}
8728 #endif /* ndef SO_MARK */
8729 #ifdef SO_MAX_PACING_RATE
8730 if (x == SO_MAX_PACING_RATE)
8731 {*r = Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE; return 0;}
8732 #endif /* ndef SO_MAX_PACING_RATE */
8733 #ifdef SO_NOFCS
8734 if (x == SO_NOFCS)
8735 {*r = Mono_Posix_UnixSocketOptionName_SO_NOFCS; return 0;}
8736 #endif /* ndef SO_NOFCS */
8737 #ifdef SO_NO_CHECK
8738 if (x == SO_NO_CHECK)
8739 {*r = Mono_Posix_UnixSocketOptionName_SO_NO_CHECK; return 0;}
8740 #endif /* ndef SO_NO_CHECK */
8741 #ifdef SO_OOBINLINE
8742 if (x == SO_OOBINLINE)
8743 {*r = Mono_Posix_UnixSocketOptionName_SO_OOBINLINE; return 0;}
8744 #endif /* ndef SO_OOBINLINE */
8745 #ifdef SO_PASSCRED
8746 if (x == SO_PASSCRED)
8747 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSCRED; return 0;}
8748 #endif /* ndef SO_PASSCRED */
8749 #ifdef SO_PASSSEC
8750 if (x == SO_PASSSEC)
8751 {*r = Mono_Posix_UnixSocketOptionName_SO_PASSSEC; return 0;}
8752 #endif /* ndef SO_PASSSEC */
8753 #ifdef SO_PEEK_OFF
8754 if (x == SO_PEEK_OFF)
8755 {*r = Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF; return 0;}
8756 #endif /* ndef SO_PEEK_OFF */
8757 #ifdef SO_PEERCRED
8758 if (x == SO_PEERCRED)
8759 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERCRED; return 0;}
8760 #endif /* ndef SO_PEERCRED */
8761 #ifdef SO_PEERNAME
8762 if (x == SO_PEERNAME)
8763 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERNAME; return 0;}
8764 #endif /* ndef SO_PEERNAME */
8765 #ifdef SO_PEERSEC
8766 if (x == SO_PEERSEC)
8767 {*r = Mono_Posix_UnixSocketOptionName_SO_PEERSEC; return 0;}
8768 #endif /* ndef SO_PEERSEC */
8769 #ifdef SO_PRIORITY
8770 if (x == SO_PRIORITY)
8771 {*r = Mono_Posix_UnixSocketOptionName_SO_PRIORITY; return 0;}
8772 #endif /* ndef SO_PRIORITY */
8773 #ifdef SO_PROTOCOL
8774 if (x == SO_PROTOCOL)
8775 {*r = Mono_Posix_UnixSocketOptionName_SO_PROTOCOL; return 0;}
8776 #endif /* ndef SO_PROTOCOL */
8777 #ifdef SO_RCVBUF
8778 if (x == SO_RCVBUF)
8779 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUF; return 0;}
8780 #endif /* ndef SO_RCVBUF */
8781 #ifdef SO_RCVBUFFORCE
8782 if (x == SO_RCVBUFFORCE)
8783 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE; return 0;}
8784 #endif /* ndef SO_RCVBUFFORCE */
8785 #ifdef SO_RCVLOWAT
8786 if (x == SO_RCVLOWAT)
8787 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT; return 0;}
8788 #endif /* ndef SO_RCVLOWAT */
8789 #ifdef SO_RCVTIMEO
8790 if (x == SO_RCVTIMEO)
8791 {*r = Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO; return 0;}
8792 #endif /* ndef SO_RCVTIMEO */
8793 #ifdef SO_REUSEADDR
8794 if (x == SO_REUSEADDR)
8795 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEADDR; return 0;}
8796 #endif /* ndef SO_REUSEADDR */
8797 #ifdef SO_REUSEPORT
8798 if (x == SO_REUSEPORT)
8799 {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEPORT; return 0;}
8800 #endif /* ndef SO_REUSEPORT */
8801 #ifdef SO_RXQ_OVFL
8802 if (x == SO_RXQ_OVFL)
8803 {*r = Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL; return 0;}
8804 #endif /* ndef SO_RXQ_OVFL */
8805 #ifdef SO_SECURITY_AUTHENTICATION
8806 if (x == SO_SECURITY_AUTHENTICATION)
8807 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION; return 0;}
8808 #endif /* ndef SO_SECURITY_AUTHENTICATION */
8809 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
8810 if (x == SO_SECURITY_ENCRYPTION_NETWORK)
8811 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
8812 #endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
8813 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
8814 if (x == SO_SECURITY_ENCRYPTION_TRANSPORT)
8815 {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
8816 #endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
8817 #ifdef SO_SELECT_ERR_QUEUE
8818 if (x == SO_SELECT_ERR_QUEUE)
8819 {*r = Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE; return 0;}
8820 #endif /* ndef SO_SELECT_ERR_QUEUE */
8821 #ifdef SO_SNDBUF
8822 if (x == SO_SNDBUF)
8823 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUF; return 0;}
8824 #endif /* ndef SO_SNDBUF */
8825 #ifdef SO_SNDBUFFORCE
8826 if (x == SO_SNDBUFFORCE)
8827 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE; return 0;}
8828 #endif /* ndef SO_SNDBUFFORCE */
8829 #ifdef SO_SNDLOWAT
8830 if (x == SO_SNDLOWAT)
8831 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT; return 0;}
8832 #endif /* ndef SO_SNDLOWAT */
8833 #ifdef SO_SNDTIMEO
8834 if (x == SO_SNDTIMEO)
8835 {*r = Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO; return 0;}
8836 #endif /* ndef SO_SNDTIMEO */
8837 #ifdef SO_TIMESTAMP
8838 if (x == SO_TIMESTAMP)
8839 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP; return 0;}
8840 #endif /* ndef SO_TIMESTAMP */
8841 #ifdef SO_TIMESTAMPING
8842 if (x == SO_TIMESTAMPING)
8843 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING; return 0;}
8844 #endif /* ndef SO_TIMESTAMPING */
8845 #ifdef SO_TIMESTAMPNS
8846 if (x == SO_TIMESTAMPNS)
8847 {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS; return 0;}
8848 #endif /* ndef SO_TIMESTAMPNS */
8849 #ifdef SO_TYPE
8850 if (x == SO_TYPE)
8851 {*r = Mono_Posix_UnixSocketOptionName_SO_TYPE; return 0;}
8852 #endif /* ndef SO_TYPE */
8853 #ifdef SO_WIFI_STATUS
8854 if (x == SO_WIFI_STATUS)
8855 {*r = Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS; return 0;}
8856 #endif /* ndef SO_WIFI_STATUS */
8857 errno = EINVAL; return -1;
8860 int Mono_Posix_FromUnixSocketProtocol (int x, int *r)
8862 *r = 0;
8863 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_AH)
8864 #ifdef IPPROTO_AH
8865 {*r = IPPROTO_AH; return 0;}
8866 #else /* def IPPROTO_AH */
8867 {errno = EINVAL; return -1;}
8868 #endif /* ndef IPPROTO_AH */
8869 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH)
8870 #ifdef IPPROTO_BEETPH
8871 {*r = IPPROTO_BEETPH; return 0;}
8872 #else /* def IPPROTO_BEETPH */
8873 {errno = EINVAL; return -1;}
8874 #endif /* ndef IPPROTO_BEETPH */
8875 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_COMP)
8876 #ifdef IPPROTO_COMP
8877 {*r = IPPROTO_COMP; return 0;}
8878 #else /* def IPPROTO_COMP */
8879 {errno = EINVAL; return -1;}
8880 #endif /* ndef IPPROTO_COMP */
8881 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP)
8882 #ifdef IPPROTO_DCCP
8883 {*r = IPPROTO_DCCP; return 0;}
8884 #else /* def IPPROTO_DCCP */
8885 {errno = EINVAL; return -1;}
8886 #endif /* ndef IPPROTO_DCCP */
8887 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_EGP)
8888 #ifdef IPPROTO_EGP
8889 {*r = IPPROTO_EGP; return 0;}
8890 #else /* def IPPROTO_EGP */
8891 {errno = EINVAL; return -1;}
8892 #endif /* ndef IPPROTO_EGP */
8893 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP)
8894 #ifdef IPPROTO_ENCAP
8895 {*r = IPPROTO_ENCAP; return 0;}
8896 #else /* def IPPROTO_ENCAP */
8897 {errno = EINVAL; return -1;}
8898 #endif /* ndef IPPROTO_ENCAP */
8899 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ESP)
8900 #ifdef IPPROTO_ESP
8901 {*r = IPPROTO_ESP; return 0;}
8902 #else /* def IPPROTO_ESP */
8903 {errno = EINVAL; return -1;}
8904 #endif /* ndef IPPROTO_ESP */
8905 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_GRE)
8906 #ifdef IPPROTO_GRE
8907 {*r = IPPROTO_GRE; return 0;}
8908 #else /* def IPPROTO_GRE */
8909 {errno = EINVAL; return -1;}
8910 #endif /* ndef IPPROTO_GRE */
8911 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP)
8912 #ifdef IPPROTO_ICMP
8913 {*r = IPPROTO_ICMP; return 0;}
8914 #else /* def IPPROTO_ICMP */
8915 {errno = EINVAL; return -1;}
8916 #endif /* ndef IPPROTO_ICMP */
8917 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IDP)
8918 #ifdef IPPROTO_IDP
8919 {*r = IPPROTO_IDP; return 0;}
8920 #else /* def IPPROTO_IDP */
8921 {errno = EINVAL; return -1;}
8922 #endif /* ndef IPPROTO_IDP */
8923 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP)
8924 #ifdef IPPROTO_IGMP
8925 {*r = IPPROTO_IGMP; return 0;}
8926 #else /* def IPPROTO_IGMP */
8927 {errno = EINVAL; return -1;}
8928 #endif /* ndef IPPROTO_IGMP */
8929 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IP)
8930 #ifdef IPPROTO_IP
8931 {*r = IPPROTO_IP; return 0;}
8932 #else /* def IPPROTO_IP */
8933 {errno = EINVAL; return -1;}
8934 #endif /* ndef IPPROTO_IP */
8935 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP)
8936 #ifdef IPPROTO_IPIP
8937 {*r = IPPROTO_IPIP; return 0;}
8938 #else /* def IPPROTO_IPIP */
8939 {errno = EINVAL; return -1;}
8940 #endif /* ndef IPPROTO_IPIP */
8941 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6)
8942 #ifdef IPPROTO_IPV6
8943 {*r = IPPROTO_IPV6; return 0;}
8944 #else /* def IPPROTO_IPV6 */
8945 {errno = EINVAL; return -1;}
8946 #endif /* ndef IPPROTO_IPV6 */
8947 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_MTP)
8948 #ifdef IPPROTO_MTP
8949 {*r = IPPROTO_MTP; return 0;}
8950 #else /* def IPPROTO_MTP */
8951 {errno = EINVAL; return -1;}
8952 #endif /* ndef IPPROTO_MTP */
8953 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PIM)
8954 #ifdef IPPROTO_PIM
8955 {*r = IPPROTO_PIM; return 0;}
8956 #else /* def IPPROTO_PIM */
8957 {errno = EINVAL; return -1;}
8958 #endif /* ndef IPPROTO_PIM */
8959 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PUP)
8960 #ifdef IPPROTO_PUP
8961 {*r = IPPROTO_PUP; return 0;}
8962 #else /* def IPPROTO_PUP */
8963 {errno = EINVAL; return -1;}
8964 #endif /* ndef IPPROTO_PUP */
8965 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RAW)
8966 #ifdef IPPROTO_RAW
8967 {*r = IPPROTO_RAW; return 0;}
8968 #else /* def IPPROTO_RAW */
8969 {errno = EINVAL; return -1;}
8970 #endif /* ndef IPPROTO_RAW */
8971 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP)
8972 #ifdef IPPROTO_RSVP
8973 {*r = IPPROTO_RSVP; return 0;}
8974 #else /* def IPPROTO_RSVP */
8975 {errno = EINVAL; return -1;}
8976 #endif /* ndef IPPROTO_RSVP */
8977 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP)
8978 #ifdef IPPROTO_SCTP
8979 {*r = IPPROTO_SCTP; return 0;}
8980 #else /* def IPPROTO_SCTP */
8981 {errno = EINVAL; return -1;}
8982 #endif /* ndef IPPROTO_SCTP */
8983 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TCP)
8984 #ifdef IPPROTO_TCP
8985 {*r = IPPROTO_TCP; return 0;}
8986 #else /* def IPPROTO_TCP */
8987 {errno = EINVAL; return -1;}
8988 #endif /* ndef IPPROTO_TCP */
8989 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TP)
8990 #ifdef IPPROTO_TP
8991 {*r = IPPROTO_TP; return 0;}
8992 #else /* def IPPROTO_TP */
8993 {errno = EINVAL; return -1;}
8994 #endif /* ndef IPPROTO_TP */
8995 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDP)
8996 #ifdef IPPROTO_UDP
8997 {*r = IPPROTO_UDP; return 0;}
8998 #else /* def IPPROTO_UDP */
8999 {errno = EINVAL; return -1;}
9000 #endif /* ndef IPPROTO_UDP */
9001 if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE)
9002 #ifdef IPPROTO_UDPLITE
9003 {*r = IPPROTO_UDPLITE; return 0;}
9004 #else /* def IPPROTO_UDPLITE */
9005 {errno = EINVAL; return -1;}
9006 #endif /* ndef IPPROTO_UDPLITE */
9007 if (x == Mono_Posix_UnixSocketProtocol_SOL_SOCKET)
9008 #ifdef SOL_SOCKET
9009 {*r = SOL_SOCKET; return 0;}
9010 #else /* def SOL_SOCKET */
9011 {errno = EINVAL; return -1;}
9012 #endif /* ndef SOL_SOCKET */
9013 if (x == 0)
9014 return 0;
9015 errno = EINVAL; return -1;
9018 int Mono_Posix_ToUnixSocketProtocol (int x, int *r)
9020 *r = 0;
9021 if (x == 0)
9022 return 0;
9023 #ifdef IPPROTO_AH
9024 if (x == IPPROTO_AH)
9025 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_AH; return 0;}
9026 #endif /* ndef IPPROTO_AH */
9027 #ifdef IPPROTO_BEETPH
9028 if (x == IPPROTO_BEETPH)
9029 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH; return 0;}
9030 #endif /* ndef IPPROTO_BEETPH */
9031 #ifdef IPPROTO_COMP
9032 if (x == IPPROTO_COMP)
9033 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_COMP; return 0;}
9034 #endif /* ndef IPPROTO_COMP */
9035 #ifdef IPPROTO_DCCP
9036 if (x == IPPROTO_DCCP)
9037 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP; return 0;}
9038 #endif /* ndef IPPROTO_DCCP */
9039 #ifdef IPPROTO_EGP
9040 if (x == IPPROTO_EGP)
9041 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_EGP; return 0;}
9042 #endif /* ndef IPPROTO_EGP */
9043 #ifdef IPPROTO_ENCAP
9044 if (x == IPPROTO_ENCAP)
9045 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP; return 0;}
9046 #endif /* ndef IPPROTO_ENCAP */
9047 #ifdef IPPROTO_ESP
9048 if (x == IPPROTO_ESP)
9049 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ESP; return 0;}
9050 #endif /* ndef IPPROTO_ESP */
9051 #ifdef IPPROTO_GRE
9052 if (x == IPPROTO_GRE)
9053 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_GRE; return 0;}
9054 #endif /* ndef IPPROTO_GRE */
9055 #ifdef IPPROTO_ICMP
9056 if (x == IPPROTO_ICMP)
9057 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP; return 0;}
9058 #endif /* ndef IPPROTO_ICMP */
9059 #ifdef IPPROTO_IDP
9060 if (x == IPPROTO_IDP)
9061 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IDP; return 0;}
9062 #endif /* ndef IPPROTO_IDP */
9063 #ifdef IPPROTO_IGMP
9064 if (x == IPPROTO_IGMP)
9065 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP; return 0;}
9066 #endif /* ndef IPPROTO_IGMP */
9067 #ifdef IPPROTO_IP
9068 if (x == IPPROTO_IP)
9069 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IP; return 0;}
9070 #endif /* ndef IPPROTO_IP */
9071 #ifdef IPPROTO_IPIP
9072 if (x == IPPROTO_IPIP)
9073 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP; return 0;}
9074 #endif /* ndef IPPROTO_IPIP */
9075 #ifdef IPPROTO_IPV6
9076 if (x == IPPROTO_IPV6)
9077 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6; return 0;}
9078 #endif /* ndef IPPROTO_IPV6 */
9079 #ifdef IPPROTO_MTP
9080 if (x == IPPROTO_MTP)
9081 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_MTP; return 0;}
9082 #endif /* ndef IPPROTO_MTP */
9083 #ifdef IPPROTO_PIM
9084 if (x == IPPROTO_PIM)
9085 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PIM; return 0;}
9086 #endif /* ndef IPPROTO_PIM */
9087 #ifdef IPPROTO_PUP
9088 if (x == IPPROTO_PUP)
9089 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PUP; return 0;}
9090 #endif /* ndef IPPROTO_PUP */
9091 #ifdef IPPROTO_RAW
9092 if (x == IPPROTO_RAW)
9093 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RAW; return 0;}
9094 #endif /* ndef IPPROTO_RAW */
9095 #ifdef IPPROTO_RSVP
9096 if (x == IPPROTO_RSVP)
9097 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP; return 0;}
9098 #endif /* ndef IPPROTO_RSVP */
9099 #ifdef IPPROTO_SCTP
9100 if (x == IPPROTO_SCTP)
9101 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP; return 0;}
9102 #endif /* ndef IPPROTO_SCTP */
9103 #ifdef IPPROTO_TCP
9104 if (x == IPPROTO_TCP)
9105 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TCP; return 0;}
9106 #endif /* ndef IPPROTO_TCP */
9107 #ifdef IPPROTO_TP
9108 if (x == IPPROTO_TP)
9109 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TP; return 0;}
9110 #endif /* ndef IPPROTO_TP */
9111 #ifdef IPPROTO_UDP
9112 if (x == IPPROTO_UDP)
9113 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDP; return 0;}
9114 #endif /* ndef IPPROTO_UDP */
9115 #ifdef IPPROTO_UDPLITE
9116 if (x == IPPROTO_UDPLITE)
9117 {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE; return 0;}
9118 #endif /* ndef IPPROTO_UDPLITE */
9119 #ifdef SOL_SOCKET
9120 if (x == SOL_SOCKET)
9121 {*r = Mono_Posix_UnixSocketProtocol_SOL_SOCKET; return 0;}
9122 #endif /* ndef SOL_SOCKET */
9123 errno = EINVAL; return -1;
9126 int Mono_Posix_FromUnixSocketType (int x, int *r)
9128 *r = 0;
9129 if (x == Mono_Posix_UnixSocketType_SOCK_DCCP)
9130 #ifdef SOCK_DCCP
9131 {*r = SOCK_DCCP; return 0;}
9132 #else /* def SOCK_DCCP */
9133 {errno = EINVAL; return -1;}
9134 #endif /* ndef SOCK_DCCP */
9135 if (x == Mono_Posix_UnixSocketType_SOCK_DGRAM)
9136 #ifdef SOCK_DGRAM
9137 {*r = SOCK_DGRAM; return 0;}
9138 #else /* def SOCK_DGRAM */
9139 {errno = EINVAL; return -1;}
9140 #endif /* ndef SOCK_DGRAM */
9141 if (x == Mono_Posix_UnixSocketType_SOCK_PACKET)
9142 #ifdef SOCK_PACKET
9143 {*r = SOCK_PACKET; return 0;}
9144 #else /* def SOCK_PACKET */
9145 {errno = EINVAL; return -1;}
9146 #endif /* ndef SOCK_PACKET */
9147 if (x == Mono_Posix_UnixSocketType_SOCK_RAW)
9148 #ifdef SOCK_RAW
9149 {*r = SOCK_RAW; return 0;}
9150 #else /* def SOCK_RAW */
9151 {errno = EINVAL; return -1;}
9152 #endif /* ndef SOCK_RAW */
9153 if (x == Mono_Posix_UnixSocketType_SOCK_RDM)
9154 #ifdef SOCK_RDM
9155 {*r = SOCK_RDM; return 0;}
9156 #else /* def SOCK_RDM */
9157 {errno = EINVAL; return -1;}
9158 #endif /* ndef SOCK_RDM */
9159 if (x == Mono_Posix_UnixSocketType_SOCK_SEQPACKET)
9160 #ifdef SOCK_SEQPACKET
9161 {*r = SOCK_SEQPACKET; return 0;}
9162 #else /* def SOCK_SEQPACKET */
9163 {errno = EINVAL; return -1;}
9164 #endif /* ndef SOCK_SEQPACKET */
9165 if (x == Mono_Posix_UnixSocketType_SOCK_STREAM)
9166 #ifdef SOCK_STREAM
9167 {*r = SOCK_STREAM; return 0;}
9168 #else /* def SOCK_STREAM */
9169 {errno = EINVAL; return -1;}
9170 #endif /* ndef SOCK_STREAM */
9171 if (x == 0)
9172 return 0;
9173 errno = EINVAL; return -1;
9176 int Mono_Posix_ToUnixSocketType (int x, int *r)
9178 *r = 0;
9179 if (x == 0)
9180 return 0;
9181 #ifdef SOCK_DCCP
9182 if (x == SOCK_DCCP)
9183 {*r = Mono_Posix_UnixSocketType_SOCK_DCCP; return 0;}
9184 #endif /* ndef SOCK_DCCP */
9185 #ifdef SOCK_DGRAM
9186 if (x == SOCK_DGRAM)
9187 {*r = Mono_Posix_UnixSocketType_SOCK_DGRAM; return 0;}
9188 #endif /* ndef SOCK_DGRAM */
9189 #ifdef SOCK_PACKET
9190 if (x == SOCK_PACKET)
9191 {*r = Mono_Posix_UnixSocketType_SOCK_PACKET; return 0;}
9192 #endif /* ndef SOCK_PACKET */
9193 #ifdef SOCK_RAW
9194 if (x == SOCK_RAW)
9195 {*r = Mono_Posix_UnixSocketType_SOCK_RAW; return 0;}
9196 #endif /* ndef SOCK_RAW */
9197 #ifdef SOCK_RDM
9198 if (x == SOCK_RDM)
9199 {*r = Mono_Posix_UnixSocketType_SOCK_RDM; return 0;}
9200 #endif /* ndef SOCK_RDM */
9201 #ifdef SOCK_SEQPACKET
9202 if (x == SOCK_SEQPACKET)
9203 {*r = Mono_Posix_UnixSocketType_SOCK_SEQPACKET; return 0;}
9204 #endif /* ndef SOCK_SEQPACKET */
9205 #ifdef SOCK_STREAM
9206 if (x == SOCK_STREAM)
9207 {*r = Mono_Posix_UnixSocketType_SOCK_STREAM; return 0;}
9208 #endif /* ndef SOCK_STREAM */
9209 errno = EINVAL; return -1;
9212 #ifdef HAVE_STRUCT_UTIMBUF
9214 Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
9216 _cnm_return_val_if_overflow (time_t, from->actime, -1);
9217 _cnm_return_val_if_overflow (time_t, from->modtime, -1);
9219 memset (to, 0, sizeof(*to));
9221 to->actime = from->actime;
9222 to->modtime = from->modtime;
9224 return 0;
9226 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9229 #ifdef HAVE_STRUCT_UTIMBUF
9231 Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
9233 _cnm_return_val_if_overflow (gint64, from->actime, -1);
9234 _cnm_return_val_if_overflow (gint64, from->modtime, -1);
9236 memset (to, 0, sizeof(*to));
9238 to->actime = from->actime;
9239 to->modtime = from->modtime;
9241 return 0;
9243 #endif /* ndef HAVE_STRUCT_UTIMBUF */
9246 int Mono_Posix_FromWaitOptions (int x, int *r)
9248 *r = 0;
9249 if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
9250 #ifdef WNOHANG
9251 *r |= WNOHANG;
9252 #else /* def WNOHANG */
9253 {errno = EINVAL; return -1;}
9254 #endif /* ndef WNOHANG */
9255 if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
9256 #ifdef WUNTRACED
9257 *r |= WUNTRACED;
9258 #else /* def WUNTRACED */
9259 {errno = EINVAL; return -1;}
9260 #endif /* ndef WUNTRACED */
9261 if (x == 0)
9262 return 0;
9263 return 0;
9266 int Mono_Posix_ToWaitOptions (int x, int *r)
9268 *r = 0;
9269 if (x == 0)
9270 return 0;
9271 #ifdef WNOHANG
9272 if ((x & WNOHANG) == WNOHANG)
9273 *r |= Mono_Posix_WaitOptions_WNOHANG;
9274 #endif /* ndef WNOHANG */
9275 #ifdef WUNTRACED
9276 if ((x & WUNTRACED) == WUNTRACED)
9277 *r |= Mono_Posix_WaitOptions_WUNTRACED;
9278 #endif /* ndef WUNTRACED */
9279 return 0;
9282 int Mono_Posix_FromXattrFlags (int x, int *r)
9284 *r = 0;
9285 if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO)
9286 #ifdef XATTR_AUTO
9287 *r |= XATTR_AUTO;
9288 #else /* def XATTR_AUTO */
9289 {errno = EINVAL; return -1;}
9290 #endif /* ndef XATTR_AUTO */
9291 if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE)
9292 #ifdef XATTR_CREATE
9293 *r |= XATTR_CREATE;
9294 #else /* def XATTR_CREATE */
9295 {errno = EINVAL; return -1;}
9296 #endif /* ndef XATTR_CREATE */
9297 if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE)
9298 #ifdef XATTR_REPLACE
9299 *r |= XATTR_REPLACE;
9300 #else /* def XATTR_REPLACE */
9301 {errno = EINVAL; return -1;}
9302 #endif /* ndef XATTR_REPLACE */
9303 if (x == 0)
9304 return 0;
9305 return 0;
9308 int Mono_Posix_ToXattrFlags (int x, int *r)
9310 *r = 0;
9311 if (x == 0)
9312 return 0;
9313 #ifdef XATTR_AUTO
9314 if ((x & XATTR_AUTO) == XATTR_AUTO)
9315 *r |= Mono_Posix_XattrFlags_XATTR_AUTO;
9316 #endif /* ndef XATTR_AUTO */
9317 #ifdef XATTR_CREATE
9318 if ((x & XATTR_CREATE) == XATTR_CREATE)
9319 *r |= Mono_Posix_XattrFlags_XATTR_CREATE;
9320 #endif /* ndef XATTR_CREATE */
9321 #ifdef XATTR_REPLACE
9322 if ((x & XATTR_REPLACE) == XATTR_REPLACE)
9323 *r |= Mono_Posix_XattrFlags_XATTR_REPLACE;
9324 #endif /* ndef XATTR_REPLACE */
9325 return 0;