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