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