[amd64] Fix the popping of LMF frames during unwinding. Fixes #20616.
[mono-project.git] / support / map.c
blob9049e3cc931aeb1082c95c99e3793b1c69582cf9
1 /*
2 * This file was automatically generated by create-native-map from ../../mcs/class/lib/net_2_0/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_SYS_TIME_H
31 #include <sys/time.h>
32 #endif /* ndef HAVE_SYS_TIME_H */
33 #ifdef HAVE_SYS_POLL_H
34 #include <sys/poll.h>
35 #endif /* ndef HAVE_SYS_POLL_H */
36 #ifdef HAVE_SYS_WAIT_H
37 #include <sys/wait.h>
38 #endif /* ndef HAVE_SYS_WAIT_H */
39 #ifdef HAVE_SYS_STATVFS_H
40 #include <sys/statvfs.h>
41 #endif /* ndef HAVE_SYS_STATVFS_H */
42 #ifdef HAVE_SYS_XATTR_H
43 #include <sys/xattr.h>
44 #endif /* ndef HAVE_SYS_XATTR_H */
45 #ifdef HAVE_SYS_MMAN_H
46 #include <sys/mman.h>
47 #endif /* ndef HAVE_SYS_MMAN_H */
48 #ifdef HAVE_SYS_UIO_H
49 #include <sys/uio.h>
50 #endif /* ndef HAVE_SYS_UIO_H */
51 #ifdef HAVE_UNISTD_H
52 #include <unistd.h>
53 #endif /* ndef HAVE_UNISTD_H */
54 #include <fcntl.h>
55 #include <signal.h>
56 #ifdef HAVE_POLL_H
57 #include <poll.h>
58 #endif /* ndef HAVE_POLL_H */
59 #ifdef HAVE_GRP_H
60 #include <grp.h>
61 #endif /* ndef HAVE_GRP_H */
62 #include <errno.h>
63 #ifdef HAVE_SYSLOG_H
64 #include <syslog.h>
65 #endif /* ndef HAVE_SYSLOG_H */
66 #ifdef HAVE_DIRENT_H
67 #include <dirent.h>
68 #endif /* ndef HAVE_DIRENT_H */
69 #ifdef HAVE_UTIME_H
70 #include <utime.h>
71 #endif /* ndef HAVE_UTIME_H */
72 #include <time.h>
73 #include "mph.h"
75 #include "map.h"
77 #include <errno.h> /* errno, EOVERFLOW */
78 #include <glib.h> /* g* types, g_assert_not_reached() */
80 #if defined (G_MININT8)
81 #define CNM_MININT8 G_MININT8
82 #else
83 #define CNM_MININT8 (-128)
84 #endif
86 #if defined (G_MAXINT8)
87 #define CNM_MAXINT8 G_MAXINT8
88 #else
89 #define CNM_MAXINT8 (127)
90 #endif
92 #if defined (G_MAXUINT8)
93 #define CNM_MAXUINT8 G_MAXUINT8
94 #else
95 #define CNM_MAXUINT8 (255)
96 #endif
98 #if defined (G_MININT16)
99 #define CNM_MININT16 G_MININT16
100 #else
101 #define CNM_MININT16 (-32768)
102 #endif
104 #if defined (G_MAXINT16)
105 #define CNM_MAXINT16 G_MAXINT16
106 #else
107 #define CNM_MAXINT16 (32767)
108 #endif
110 #if defined (G_MAXUINT16)
111 #define CNM_MAXUINT16 G_MAXUINT16
112 #else
113 #define CNM_MAXUINT16 (65535)
114 #endif
116 #if defined (G_MININT32)
117 #define CNM_MININT32 G_MININT32
118 #else
119 #define CNM_MININT32 (-2147483648)
120 #endif
122 #if defined (G_MAXINT32)
123 #define CNM_MAXINT32 G_MAXINT32
124 #else
125 #define CNM_MAXINT32 (2147483647)
126 #endif
128 #if defined (G_MAXUINT32)
129 #define CNM_MAXUINT32 G_MAXUINT32
130 #else
131 #define CNM_MAXUINT32 (4294967295U)
132 #endif
134 #if defined (G_MININT64)
135 #define CNM_MININT64 G_MININT64
136 #else
137 #define CNM_MININT64 (-9223372036854775808LL)
138 #endif
140 #if defined (G_MAXINT64)
141 #define CNM_MAXINT64 G_MAXINT64
142 #else
143 #define CNM_MAXINT64 (9223372036854775807LL)
144 #endif
146 #if defined (G_MAXUINT64)
147 #define CNM_MAXUINT64 G_MAXUINT64
148 #else
149 #define CNM_MAXUINT64 (18446744073709551615ULL)
150 #endif
153 /* returns TRUE if @type is an unsigned type */
154 #define _cnm_integral_type_is_unsigned(type) \
155 (sizeof(type) == sizeof(gint8) \
156 ? (((type)-1) > CNM_MAXINT8) \
157 : sizeof(type) == sizeof(gint16) \
158 ? (((type)-1) > CNM_MAXINT16) \
159 : sizeof(type) == sizeof(gint32) \
160 ? (((type)-1) > CNM_MAXINT32) \
161 : sizeof(type) == sizeof(gint64) \
162 ? (((type)-1) > CNM_MAXINT64) \
163 : (g_assert_not_reached (), 0))
165 /* returns the minimum value of @type as a gint64 */
166 #define _cnm_integral_type_min(type) \
167 (_cnm_integral_type_is_unsigned (type) \
168 ? 0 \
169 : sizeof(type) == sizeof(gint8) \
170 ? CNM_MININT8 \
171 : sizeof(type) == sizeof(gint16) \
172 ? CNM_MININT16 \
173 : sizeof(type) == sizeof(gint32) \
174 ? CNM_MININT32 \
175 : sizeof(type) == sizeof(gint64) \
176 ? CNM_MININT64 \
177 : (g_assert_not_reached (), 0))
179 /* returns the maximum value of @type as a guint64 */
180 #define _cnm_integral_type_max(type) \
181 (_cnm_integral_type_is_unsigned (type) \
182 ? sizeof(type) == sizeof(gint8) \
183 ? CNM_MAXUINT8 \
184 : sizeof(type) == sizeof(gint16) \
185 ? CNM_MAXUINT16 \
186 : sizeof(type) == sizeof(gint32) \
187 ? CNM_MAXUINT32 \
188 : sizeof(type) == sizeof(gint64) \
189 ? CNM_MAXUINT64 \
190 : (g_assert_not_reached (), 0) \
191 : sizeof(type) == sizeof(gint8) \
192 ? CNM_MAXINT8 \
193 : sizeof(type) == sizeof(gint16) \
194 ? CNM_MAXINT16 \
195 : sizeof(type) == sizeof(gint32) \
196 ? CNM_MAXINT32 \
197 : sizeof(type) == sizeof(gint64) \
198 ? CNM_MAXINT64 \
199 : (g_assert_not_reached (), 0))
201 #ifdef _CNM_DUMP
202 #define _cnm_dump(to_t,from) \
203 printf ("# %s -> %s: uns=%i; min=%llx; max=%llx; value=%llx; lt=%i; l0=%i; gt=%i; e=%i\n", \
204 #from, #to_t, \
205 (int) _cnm_integral_type_is_unsigned (to_t), \
206 (gint64) (_cnm_integral_type_min (to_t)), \
207 (gint64) (_cnm_integral_type_max (to_t)), \
208 (gint64) (from), \
209 (((gint64) _cnm_integral_type_min (to_t)) <= (gint64) from), \
210 (from < 0), \
211 (((guint64) from) <= (guint64) _cnm_integral_type_max (to_t)), \
212 !((int) _cnm_integral_type_is_unsigned (to_t) \
213 ? ((0 <= from) && \
214 ((guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \
215 : ((gint64) _cnm_integral_type_min(to_t) <= (gint64) from && \
216 (guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \
218 #else /* ndef _CNM_DUMP */
219 #define _cnm_dump(to_t, from) do {} while (0)
220 #endif /* def _CNM_DUMP */
222 #ifdef DEBUG
223 #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \
224 int uns = _cnm_integral_type_is_unsigned (to_t); \
225 gint64 min = (gint64) _cnm_integral_type_min (to_t); \
226 guint64 max = (guint64) _cnm_integral_type_max (to_t); \
227 gint64 sf = (gint64) from; \
228 guint64 uf = (guint64) from; \
229 if (!(uns ? ((0 <= from) && (uf <= max)) \
230 : (min <= sf && (from < 0 || uf <= max)))) { \
231 _cnm_dump(to_t, from); \
232 errno = EOVERFLOW; \
233 return (val); \
235 } G_STMT_END
236 #else /* !def DEBUG */
237 /* don't do any overflow checking */
238 #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \
239 } G_STMT_END
240 #endif /* def DEBUG */
242 int Mono_Posix_FromAccessModes (int x, int *r)
244 *r = 0;
245 if ((x & Mono_Posix_AccessModes_F_OK) == Mono_Posix_AccessModes_F_OK)
246 #ifdef F_OK
247 *r |= F_OK;
248 #else /* def F_OK */
249 {errno = EINVAL; return -1;}
250 #endif /* ndef F_OK */
251 if ((x & Mono_Posix_AccessModes_R_OK) == Mono_Posix_AccessModes_R_OK)
252 #ifdef R_OK
253 *r |= R_OK;
254 #else /* def R_OK */
255 {errno = EINVAL; return -1;}
256 #endif /* ndef R_OK */
257 if ((x & Mono_Posix_AccessModes_W_OK) == Mono_Posix_AccessModes_W_OK)
258 #ifdef W_OK
259 *r |= W_OK;
260 #else /* def W_OK */
261 {errno = EINVAL; return -1;}
262 #endif /* ndef W_OK */
263 if ((x & Mono_Posix_AccessModes_X_OK) == Mono_Posix_AccessModes_X_OK)
264 #ifdef X_OK
265 *r |= X_OK;
266 #else /* def X_OK */
267 {errno = EINVAL; return -1;}
268 #endif /* ndef X_OK */
269 if (x == 0)
270 return 0;
271 return 0;
274 int Mono_Posix_ToAccessModes (int x, int *r)
276 *r = 0;
277 if (x == 0)
278 return 0;
279 #ifdef F_OK
280 if ((x & F_OK) == F_OK)
281 *r |= Mono_Posix_AccessModes_F_OK;
282 #endif /* ndef F_OK */
283 #ifdef R_OK
284 if ((x & R_OK) == R_OK)
285 *r |= Mono_Posix_AccessModes_R_OK;
286 #endif /* ndef R_OK */
287 #ifdef W_OK
288 if ((x & W_OK) == W_OK)
289 *r |= Mono_Posix_AccessModes_W_OK;
290 #endif /* ndef W_OK */
291 #ifdef X_OK
292 if ((x & X_OK) == X_OK)
293 *r |= Mono_Posix_AccessModes_X_OK;
294 #endif /* ndef X_OK */
295 return 0;
298 int Mono_Posix_FromAtFlags (int x, int *r)
300 *r = 0;
301 if ((x & Mono_Posix_AtFlags_AT_EMPTY_PATH) == Mono_Posix_AtFlags_AT_EMPTY_PATH)
302 #ifdef AT_EMPTY_PATH
303 *r |= AT_EMPTY_PATH;
304 #else /* def AT_EMPTY_PATH */
305 {errno = EINVAL; return -1;}
306 #endif /* ndef AT_EMPTY_PATH */
307 if ((x & Mono_Posix_AtFlags_AT_NO_AUTOMOUNT) == Mono_Posix_AtFlags_AT_NO_AUTOMOUNT)
308 #ifdef AT_NO_AUTOMOUNT
309 *r |= AT_NO_AUTOMOUNT;
310 #else /* def AT_NO_AUTOMOUNT */
311 {errno = EINVAL; return -1;}
312 #endif /* ndef AT_NO_AUTOMOUNT */
313 if ((x & Mono_Posix_AtFlags_AT_REMOVEDIR) == Mono_Posix_AtFlags_AT_REMOVEDIR)
314 #ifdef AT_REMOVEDIR
315 *r |= AT_REMOVEDIR;
316 #else /* def AT_REMOVEDIR */
317 {errno = EINVAL; return -1;}
318 #endif /* ndef AT_REMOVEDIR */
319 if ((x & Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW)
320 #ifdef AT_SYMLINK_FOLLOW
321 *r |= AT_SYMLINK_FOLLOW;
322 #else /* def AT_SYMLINK_FOLLOW */
323 {errno = EINVAL; return -1;}
324 #endif /* ndef AT_SYMLINK_FOLLOW */
325 if ((x & Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW)
326 #ifdef AT_SYMLINK_NOFOLLOW
327 *r |= AT_SYMLINK_NOFOLLOW;
328 #else /* def AT_SYMLINK_NOFOLLOW */
329 {errno = EINVAL; return -1;}
330 #endif /* ndef AT_SYMLINK_NOFOLLOW */
331 if (x == 0)
332 return 0;
333 return 0;
336 int Mono_Posix_ToAtFlags (int x, int *r)
338 *r = 0;
339 if (x == 0)
340 return 0;
341 #ifdef AT_EMPTY_PATH
342 if ((x & AT_EMPTY_PATH) == AT_EMPTY_PATH)
343 *r |= Mono_Posix_AtFlags_AT_EMPTY_PATH;
344 #endif /* ndef AT_EMPTY_PATH */
345 #ifdef AT_NO_AUTOMOUNT
346 if ((x & AT_NO_AUTOMOUNT) == AT_NO_AUTOMOUNT)
347 *r |= Mono_Posix_AtFlags_AT_NO_AUTOMOUNT;
348 #endif /* ndef AT_NO_AUTOMOUNT */
349 #ifdef AT_REMOVEDIR
350 if ((x & AT_REMOVEDIR) == AT_REMOVEDIR)
351 *r |= Mono_Posix_AtFlags_AT_REMOVEDIR;
352 #endif /* ndef AT_REMOVEDIR */
353 #ifdef AT_SYMLINK_FOLLOW
354 if ((x & AT_SYMLINK_FOLLOW) == AT_SYMLINK_FOLLOW)
355 *r |= Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW;
356 #endif /* ndef AT_SYMLINK_FOLLOW */
357 #ifdef AT_SYMLINK_NOFOLLOW
358 if ((x & AT_SYMLINK_NOFOLLOW) == AT_SYMLINK_NOFOLLOW)
359 *r |= Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW;
360 #endif /* ndef AT_SYMLINK_NOFOLLOW */
361 return 0;
364 int Mono_Posix_FromConfstrName (int x, int *r)
366 *r = 0;
367 if (x == Mono_Posix_ConfstrName__CS_GNU_LIBC_VERSION)
368 #ifdef _CS_GNU_LIBC_VERSION
369 {*r = _CS_GNU_LIBC_VERSION; return 0;}
370 #else /* def _CS_GNU_LIBC_VERSION */
371 {errno = EINVAL; return -1;}
372 #endif /* ndef _CS_GNU_LIBC_VERSION */
373 if (x == Mono_Posix_ConfstrName__CS_GNU_LIBPTHREAD_VERSION)
374 #ifdef _CS_GNU_LIBPTHREAD_VERSION
375 {*r = _CS_GNU_LIBPTHREAD_VERSION; return 0;}
376 #else /* def _CS_GNU_LIBPTHREAD_VERSION */
377 {errno = EINVAL; return -1;}
378 #endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
379 if (x == Mono_Posix_ConfstrName__CS_LFS64_CFLAGS)
380 #ifdef _CS_LFS64_CFLAGS
381 {*r = _CS_LFS64_CFLAGS; return 0;}
382 #else /* def _CS_LFS64_CFLAGS */
383 {errno = EINVAL; return -1;}
384 #endif /* ndef _CS_LFS64_CFLAGS */
385 if (x == Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS)
386 #ifdef _CS_LFS64_LDFLAGS
387 {*r = _CS_LFS64_LDFLAGS; return 0;}
388 #else /* def _CS_LFS64_LDFLAGS */
389 {errno = EINVAL; return -1;}
390 #endif /* ndef _CS_LFS64_LDFLAGS */
391 if (x == Mono_Posix_ConfstrName__CS_LFS64_LIBS)
392 #ifdef _CS_LFS64_LIBS
393 {*r = _CS_LFS64_LIBS; return 0;}
394 #else /* def _CS_LFS64_LIBS */
395 {errno = EINVAL; return -1;}
396 #endif /* ndef _CS_LFS64_LIBS */
397 if (x == Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS)
398 #ifdef _CS_LFS64_LINTFLAGS
399 {*r = _CS_LFS64_LINTFLAGS; return 0;}
400 #else /* def _CS_LFS64_LINTFLAGS */
401 {errno = EINVAL; return -1;}
402 #endif /* ndef _CS_LFS64_LINTFLAGS */
403 if (x == Mono_Posix_ConfstrName__CS_LFS_CFLAGS)
404 #ifdef _CS_LFS_CFLAGS
405 {*r = _CS_LFS_CFLAGS; return 0;}
406 #else /* def _CS_LFS_CFLAGS */
407 {errno = EINVAL; return -1;}
408 #endif /* ndef _CS_LFS_CFLAGS */
409 if (x == Mono_Posix_ConfstrName__CS_LFS_LDFLAGS)
410 #ifdef _CS_LFS_LDFLAGS
411 {*r = _CS_LFS_LDFLAGS; return 0;}
412 #else /* def _CS_LFS_LDFLAGS */
413 {errno = EINVAL; return -1;}
414 #endif /* ndef _CS_LFS_LDFLAGS */
415 if (x == Mono_Posix_ConfstrName__CS_LFS_LIBS)
416 #ifdef _CS_LFS_LIBS
417 {*r = _CS_LFS_LIBS; return 0;}
418 #else /* def _CS_LFS_LIBS */
419 {errno = EINVAL; return -1;}
420 #endif /* ndef _CS_LFS_LIBS */
421 if (x == Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS)
422 #ifdef _CS_LFS_LINTFLAGS
423 {*r = _CS_LFS_LINTFLAGS; return 0;}
424 #else /* def _CS_LFS_LINTFLAGS */
425 {errno = EINVAL; return -1;}
426 #endif /* ndef _CS_LFS_LINTFLAGS */
427 if (x == Mono_Posix_ConfstrName__CS_PATH)
428 #ifdef _CS_PATH
429 {*r = _CS_PATH; return 0;}
430 #else /* def _CS_PATH */
431 {errno = EINVAL; return -1;}
432 #endif /* ndef _CS_PATH */
433 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_CFLAGS)
434 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
435 {*r = _CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;}
436 #else /* def _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
437 {errno = EINVAL; return -1;}
438 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
439 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LDFLAGS)
440 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
441 {*r = _CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;}
442 #else /* def _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
443 {errno = EINVAL; return -1;}
444 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
445 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LIBS)
446 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
447 {*r = _CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;}
448 #else /* def _CS_POSIX_V6_ILP32_OFF32_LIBS */
449 {errno = EINVAL; return -1;}
450 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */
451 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
452 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
453 {*r = _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;}
454 #else /* def _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
455 {errno = EINVAL; return -1;}
456 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
457 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)
458 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
459 {*r = _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;}
460 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
461 {errno = EINVAL; return -1;}
462 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
463 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS)
464 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
465 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;}
466 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
467 {errno = EINVAL; return -1;}
468 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
469 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LIBS)
470 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
471 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;}
472 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
473 {errno = EINVAL; return -1;}
474 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
475 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
476 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
477 {*r = _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;}
478 #else /* def _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
479 {errno = EINVAL; return -1;}
480 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
481 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_CFLAGS)
482 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
483 {*r = _CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;}
484 #else /* def _CS_POSIX_V6_LP64_OFF64_CFLAGS */
485 {errno = EINVAL; return -1;}
486 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */
487 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LDFLAGS)
488 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
489 {*r = _CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;}
490 #else /* def _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
491 {errno = EINVAL; return -1;}
492 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
493 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LIBS)
494 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
495 {*r = _CS_POSIX_V6_LP64_OFF64_LIBS; return 0;}
496 #else /* def _CS_POSIX_V6_LP64_OFF64_LIBS */
497 {errno = EINVAL; return -1;}
498 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */
499 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
500 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
501 {*r = _CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;}
502 #else /* def _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
503 {errno = EINVAL; return -1;}
504 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
505 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)
506 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
507 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;}
508 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
509 {errno = EINVAL; return -1;}
510 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
511 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS)
512 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
513 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;}
514 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
515 {errno = EINVAL; return -1;}
516 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
517 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LIBS)
518 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
519 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;}
520 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
521 {errno = EINVAL; return -1;}
522 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
523 if (x == Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
524 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
525 {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
526 #else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
527 {errno = EINVAL; return -1;}
528 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
529 if (x == Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS)
530 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
531 {*r = _CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
532 #else /* def _CS_V6_WIDTH_RESTRICTED_ENVS */
533 {errno = EINVAL; return -1;}
534 #endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
535 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_CFLAGS)
536 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
537 {*r = _CS_XBS5_ILP32_OFF32_CFLAGS; return 0;}
538 #else /* def _CS_XBS5_ILP32_OFF32_CFLAGS */
539 {errno = EINVAL; return -1;}
540 #endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */
541 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LDFLAGS)
542 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
543 {*r = _CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;}
544 #else /* def _CS_XBS5_ILP32_OFF32_LDFLAGS */
545 {errno = EINVAL; return -1;}
546 #endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */
547 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LIBS)
548 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
549 {*r = _CS_XBS5_ILP32_OFF32_LIBS; return 0;}
550 #else /* def _CS_XBS5_ILP32_OFF32_LIBS */
551 {errno = EINVAL; return -1;}
552 #endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */
553 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LINTFLAGS)
554 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
555 {*r = _CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;}
556 #else /* def _CS_XBS5_ILP32_OFF32_LINTFLAGS */
557 {errno = EINVAL; return -1;}
558 #endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */
559 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_CFLAGS)
560 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
561 {*r = _CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;}
562 #else /* def _CS_XBS5_ILP32_OFFBIG_CFLAGS */
563 {errno = EINVAL; return -1;}
564 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */
565 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LDFLAGS)
566 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
567 {*r = _CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;}
568 #else /* def _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
569 {errno = EINVAL; return -1;}
570 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
571 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LIBS)
572 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
573 {*r = _CS_XBS5_ILP32_OFFBIG_LIBS; return 0;}
574 #else /* def _CS_XBS5_ILP32_OFFBIG_LIBS */
575 {errno = EINVAL; return -1;}
576 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */
577 if (x == Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LINTFLAGS)
578 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
579 {*r = _CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;}
580 #else /* def _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
581 {errno = EINVAL; return -1;}
582 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
583 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_CFLAGS)
584 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
585 {*r = _CS_XBS5_LP64_OFF64_CFLAGS; return 0;}
586 #else /* def _CS_XBS5_LP64_OFF64_CFLAGS */
587 {errno = EINVAL; return -1;}
588 #endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */
589 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LDFLAGS)
590 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
591 {*r = _CS_XBS5_LP64_OFF64_LDFLAGS; return 0;}
592 #else /* def _CS_XBS5_LP64_OFF64_LDFLAGS */
593 {errno = EINVAL; return -1;}
594 #endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */
595 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LIBS)
596 #ifdef _CS_XBS5_LP64_OFF64_LIBS
597 {*r = _CS_XBS5_LP64_OFF64_LIBS; return 0;}
598 #else /* def _CS_XBS5_LP64_OFF64_LIBS */
599 {errno = EINVAL; return -1;}
600 #endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */
601 if (x == Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LINTFLAGS)
602 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
603 {*r = _CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;}
604 #else /* def _CS_XBS5_LP64_OFF64_LINTFLAGS */
605 {errno = EINVAL; return -1;}
606 #endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */
607 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_CFLAGS)
608 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
609 {*r = _CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;}
610 #else /* def _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
611 {errno = EINVAL; return -1;}
612 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
613 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LDFLAGS)
614 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
615 {*r = _CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;}
616 #else /* def _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
617 {errno = EINVAL; return -1;}
618 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
619 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LIBS)
620 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
621 {*r = _CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;}
622 #else /* def _CS_XBS5_LPBIG_OFFBIG_LIBS */
623 {errno = EINVAL; return -1;}
624 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */
625 if (x == Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS)
626 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
627 {*r = _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
628 #else /* def _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
629 {errno = EINVAL; return -1;}
630 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
631 if (x == 0)
632 return 0;
633 errno = EINVAL; return -1;
636 int Mono_Posix_ToConfstrName (int x, int *r)
638 *r = 0;
639 if (x == 0)
640 return 0;
641 #ifdef _CS_GNU_LIBC_VERSION
642 if (x == _CS_GNU_LIBC_VERSION)
643 {*r = Mono_Posix_ConfstrName__CS_GNU_LIBC_VERSION; return 0;}
644 #endif /* ndef _CS_GNU_LIBC_VERSION */
645 #ifdef _CS_GNU_LIBPTHREAD_VERSION
646 if (x == _CS_GNU_LIBPTHREAD_VERSION)
647 {*r = Mono_Posix_ConfstrName__CS_GNU_LIBPTHREAD_VERSION; return 0;}
648 #endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
649 #ifdef _CS_LFS64_CFLAGS
650 if (x == _CS_LFS64_CFLAGS)
651 {*r = Mono_Posix_ConfstrName__CS_LFS64_CFLAGS; return 0;}
652 #endif /* ndef _CS_LFS64_CFLAGS */
653 #ifdef _CS_LFS64_LDFLAGS
654 if (x == _CS_LFS64_LDFLAGS)
655 {*r = Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS; return 0;}
656 #endif /* ndef _CS_LFS64_LDFLAGS */
657 #ifdef _CS_LFS64_LIBS
658 if (x == _CS_LFS64_LIBS)
659 {*r = Mono_Posix_ConfstrName__CS_LFS64_LIBS; return 0;}
660 #endif /* ndef _CS_LFS64_LIBS */
661 #ifdef _CS_LFS64_LINTFLAGS
662 if (x == _CS_LFS64_LINTFLAGS)
663 {*r = Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS; return 0;}
664 #endif /* ndef _CS_LFS64_LINTFLAGS */
665 #ifdef _CS_LFS_CFLAGS
666 if (x == _CS_LFS_CFLAGS)
667 {*r = Mono_Posix_ConfstrName__CS_LFS_CFLAGS; return 0;}
668 #endif /* ndef _CS_LFS_CFLAGS */
669 #ifdef _CS_LFS_LDFLAGS
670 if (x == _CS_LFS_LDFLAGS)
671 {*r = Mono_Posix_ConfstrName__CS_LFS_LDFLAGS; return 0;}
672 #endif /* ndef _CS_LFS_LDFLAGS */
673 #ifdef _CS_LFS_LIBS
674 if (x == _CS_LFS_LIBS)
675 {*r = Mono_Posix_ConfstrName__CS_LFS_LIBS; return 0;}
676 #endif /* ndef _CS_LFS_LIBS */
677 #ifdef _CS_LFS_LINTFLAGS
678 if (x == _CS_LFS_LINTFLAGS)
679 {*r = Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS; return 0;}
680 #endif /* ndef _CS_LFS_LINTFLAGS */
681 #ifdef _CS_PATH
682 if (x == _CS_PATH)
683 {*r = Mono_Posix_ConfstrName__CS_PATH; return 0;}
684 #endif /* ndef _CS_PATH */
685 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
686 if (x == _CS_POSIX_V6_ILP32_OFF32_CFLAGS)
687 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;}
688 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
689 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
690 if (x == _CS_POSIX_V6_ILP32_OFF32_LDFLAGS)
691 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;}
692 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
693 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
694 if (x == _CS_POSIX_V6_ILP32_OFF32_LIBS)
695 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;}
696 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */
697 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
698 if (x == _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
699 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;}
700 #endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
701 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
702 if (x == _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)
703 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;}
704 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
705 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
706 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS)
707 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;}
708 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
709 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
710 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LIBS)
711 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;}
712 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
713 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
714 if (x == _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
715 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;}
716 #endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
717 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
718 if (x == _CS_POSIX_V6_LP64_OFF64_CFLAGS)
719 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;}
720 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */
721 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
722 if (x == _CS_POSIX_V6_LP64_OFF64_LDFLAGS)
723 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;}
724 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
725 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
726 if (x == _CS_POSIX_V6_LP64_OFF64_LIBS)
727 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LIBS; return 0;}
728 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */
729 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
730 if (x == _CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
731 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;}
732 #endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
733 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
734 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)
735 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;}
736 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
737 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
738 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS)
739 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;}
740 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
741 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
742 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LIBS)
743 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;}
744 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
745 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
746 if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
747 {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
748 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
749 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
750 if (x == _CS_V6_WIDTH_RESTRICTED_ENVS)
751 {*r = Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
752 #endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
753 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
754 if (x == _CS_XBS5_ILP32_OFF32_CFLAGS)
755 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_CFLAGS; return 0;}
756 #endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */
757 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
758 if (x == _CS_XBS5_ILP32_OFF32_LDFLAGS)
759 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;}
760 #endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */
761 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
762 if (x == _CS_XBS5_ILP32_OFF32_LIBS)
763 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LIBS; return 0;}
764 #endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */
765 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
766 if (x == _CS_XBS5_ILP32_OFF32_LINTFLAGS)
767 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;}
768 #endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */
769 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
770 if (x == _CS_XBS5_ILP32_OFFBIG_CFLAGS)
771 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;}
772 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */
773 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
774 if (x == _CS_XBS5_ILP32_OFFBIG_LDFLAGS)
775 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;}
776 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
777 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
778 if (x == _CS_XBS5_ILP32_OFFBIG_LIBS)
779 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LIBS; return 0;}
780 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */
781 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
782 if (x == _CS_XBS5_ILP32_OFFBIG_LINTFLAGS)
783 {*r = Mono_Posix_ConfstrName__CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;}
784 #endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
785 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
786 if (x == _CS_XBS5_LP64_OFF64_CFLAGS)
787 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_CFLAGS; return 0;}
788 #endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */
789 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
790 if (x == _CS_XBS5_LP64_OFF64_LDFLAGS)
791 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LDFLAGS; return 0;}
792 #endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */
793 #ifdef _CS_XBS5_LP64_OFF64_LIBS
794 if (x == _CS_XBS5_LP64_OFF64_LIBS)
795 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LIBS; return 0;}
796 #endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */
797 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
798 if (x == _CS_XBS5_LP64_OFF64_LINTFLAGS)
799 {*r = Mono_Posix_ConfstrName__CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;}
800 #endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */
801 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
802 if (x == _CS_XBS5_LPBIG_OFFBIG_CFLAGS)
803 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;}
804 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
805 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
806 if (x == _CS_XBS5_LPBIG_OFFBIG_LDFLAGS)
807 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;}
808 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
809 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
810 if (x == _CS_XBS5_LPBIG_OFFBIG_LIBS)
811 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;}
812 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */
813 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
814 if (x == _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS)
815 {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
816 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
817 errno = EINVAL; return -1;
820 int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r)
822 *r = 0;
823 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) == Mono_Posix_DirectoryNotifyFlags_DN_ACCESS)
824 #ifdef DN_ACCESS
825 *r |= DN_ACCESS;
826 #else /* def DN_ACCESS */
827 {errno = EINVAL; return -1;}
828 #endif /* ndef DN_ACCESS */
829 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) == Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB)
830 #ifdef DN_ATTRIB
831 *r |= DN_ATTRIB;
832 #else /* def DN_ATTRIB */
833 {errno = EINVAL; return -1;}
834 #endif /* ndef DN_ATTRIB */
835 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_CREATE) == Mono_Posix_DirectoryNotifyFlags_DN_CREATE)
836 #ifdef DN_CREATE
837 *r |= DN_CREATE;
838 #else /* def DN_CREATE */
839 {errno = EINVAL; return -1;}
840 #endif /* ndef DN_CREATE */
841 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_DELETE) == Mono_Posix_DirectoryNotifyFlags_DN_DELETE)
842 #ifdef DN_DELETE
843 *r |= DN_DELETE;
844 #else /* def DN_DELETE */
845 {errno = EINVAL; return -1;}
846 #endif /* ndef DN_DELETE */
847 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY)
848 #ifdef DN_MODIFY
849 *r |= DN_MODIFY;
850 #else /* def DN_MODIFY */
851 {errno = EINVAL; return -1;}
852 #endif /* ndef DN_MODIFY */
853 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT)
854 #ifdef DN_MULTISHOT
855 *r |= DN_MULTISHOT;
856 #else /* def DN_MULTISHOT */
857 {errno = EINVAL; return -1;}
858 #endif /* ndef DN_MULTISHOT */
859 if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME)
860 #ifdef DN_RENAME
861 *r |= DN_RENAME;
862 #else /* def DN_RENAME */
863 {errno = EINVAL; return -1;}
864 #endif /* ndef DN_RENAME */
865 if (x == 0)
866 return 0;
867 return 0;
870 int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r)
872 *r = 0;
873 if (x == 0)
874 return 0;
875 #ifdef DN_ACCESS
876 if ((x & DN_ACCESS) == DN_ACCESS)
877 *r |= Mono_Posix_DirectoryNotifyFlags_DN_ACCESS;
878 #endif /* ndef DN_ACCESS */
879 #ifdef DN_ATTRIB
880 if ((x & DN_ATTRIB) == DN_ATTRIB)
881 *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
882 #endif /* ndef DN_ATTRIB */
883 #ifdef DN_CREATE
884 if ((x & DN_CREATE) == DN_CREATE)
885 *r |= Mono_Posix_DirectoryNotifyFlags_DN_CREATE;
886 #endif /* ndef DN_CREATE */
887 #ifdef DN_DELETE
888 if ((x & DN_DELETE) == DN_DELETE)
889 *r |= Mono_Posix_DirectoryNotifyFlags_DN_DELETE;
890 #endif /* ndef DN_DELETE */
891 #ifdef DN_MODIFY
892 if ((x & DN_MODIFY) == DN_MODIFY)
893 *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
894 #endif /* ndef DN_MODIFY */
895 #ifdef DN_MULTISHOT
896 if ((x & DN_MULTISHOT) == DN_MULTISHOT)
897 *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
898 #endif /* ndef DN_MULTISHOT */
899 #ifdef DN_RENAME
900 if ((x & DN_RENAME) == DN_RENAME)
901 *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
902 #endif /* ndef DN_RENAME */
903 return 0;
906 int Mono_Posix_FromEpollEvents (unsigned int x, unsigned int *r)
908 *r = 0;
909 if ((x & Mono_Posix_EpollEvents_EPOLLERR) == Mono_Posix_EpollEvents_EPOLLERR)
910 #ifdef EPOLLERR
911 *r |= EPOLLERR;
912 #else /* def EPOLLERR */
913 {errno = EINVAL; return -1;}
914 #endif /* ndef EPOLLERR */
915 if ((x & Mono_Posix_EpollEvents_EPOLLET) == Mono_Posix_EpollEvents_EPOLLET)
916 #ifdef EPOLLET
917 *r |= EPOLLET;
918 #else /* def EPOLLET */
919 {errno = EINVAL; return -1;}
920 #endif /* ndef EPOLLET */
921 if ((x & Mono_Posix_EpollEvents_EPOLLHUP) == Mono_Posix_EpollEvents_EPOLLHUP)
922 #ifdef EPOLLHUP
923 *r |= EPOLLHUP;
924 #else /* def EPOLLHUP */
925 {errno = EINVAL; return -1;}
926 #endif /* ndef EPOLLHUP */
927 if ((x & Mono_Posix_EpollEvents_EPOLLIN) == Mono_Posix_EpollEvents_EPOLLIN)
928 #ifdef EPOLLIN
929 *r |= EPOLLIN;
930 #else /* def EPOLLIN */
931 {errno = EINVAL; return -1;}
932 #endif /* ndef EPOLLIN */
933 if ((x & Mono_Posix_EpollEvents_EPOLLMSG) == Mono_Posix_EpollEvents_EPOLLMSG)
934 #ifdef EPOLLMSG
935 *r |= EPOLLMSG;
936 #else /* def EPOLLMSG */
937 {errno = EINVAL; return -1;}
938 #endif /* ndef EPOLLMSG */
939 if ((x & Mono_Posix_EpollEvents_EPOLLONESHOT) == Mono_Posix_EpollEvents_EPOLLONESHOT)
940 #ifdef EPOLLONESHOT
941 *r |= EPOLLONESHOT;
942 #else /* def EPOLLONESHOT */
943 {errno = EINVAL; return -1;}
944 #endif /* ndef EPOLLONESHOT */
945 if ((x & Mono_Posix_EpollEvents_EPOLLOUT) == Mono_Posix_EpollEvents_EPOLLOUT)
946 #ifdef EPOLLOUT
947 *r |= EPOLLOUT;
948 #else /* def EPOLLOUT */
949 {errno = EINVAL; return -1;}
950 #endif /* ndef EPOLLOUT */
951 if ((x & Mono_Posix_EpollEvents_EPOLLPRI) == Mono_Posix_EpollEvents_EPOLLPRI)
952 #ifdef EPOLLPRI
953 *r |= EPOLLPRI;
954 #else /* def EPOLLPRI */
955 {errno = EINVAL; return -1;}
956 #endif /* ndef EPOLLPRI */
957 if ((x & Mono_Posix_EpollEvents_EPOLLRDBAND) == Mono_Posix_EpollEvents_EPOLLRDBAND)
958 #ifdef EPOLLRDBAND
959 *r |= EPOLLRDBAND;
960 #else /* def EPOLLRDBAND */
961 {errno = EINVAL; return -1;}
962 #endif /* ndef EPOLLRDBAND */
963 if ((x & Mono_Posix_EpollEvents_EPOLLRDHUP) == Mono_Posix_EpollEvents_EPOLLRDHUP)
964 #ifdef EPOLLRDHUP
965 *r |= EPOLLRDHUP;
966 #else /* def EPOLLRDHUP */
967 {errno = EINVAL; return -1;}
968 #endif /* ndef EPOLLRDHUP */
969 if ((x & Mono_Posix_EpollEvents_EPOLLRDNORM) == Mono_Posix_EpollEvents_EPOLLRDNORM)
970 #ifdef EPOLLRDNORM
971 *r |= EPOLLRDNORM;
972 #else /* def EPOLLRDNORM */
973 {errno = EINVAL; return -1;}
974 #endif /* ndef EPOLLRDNORM */
975 if ((x & Mono_Posix_EpollEvents_EPOLLWRBAND) == Mono_Posix_EpollEvents_EPOLLWRBAND)
976 #ifdef EPOLLWRBAND
977 *r |= EPOLLWRBAND;
978 #else /* def EPOLLWRBAND */
979 {errno = EINVAL; return -1;}
980 #endif /* ndef EPOLLWRBAND */
981 if ((x & Mono_Posix_EpollEvents_EPOLLWRNORM) == Mono_Posix_EpollEvents_EPOLLWRNORM)
982 #ifdef EPOLLWRNORM
983 *r |= EPOLLWRNORM;
984 #else /* def EPOLLWRNORM */
985 {errno = EINVAL; return -1;}
986 #endif /* ndef EPOLLWRNORM */
987 if (x == 0)
988 return 0;
989 return 0;
992 int Mono_Posix_ToEpollEvents (unsigned int x, unsigned int *r)
994 *r = 0;
995 if (x == 0)
996 return 0;
997 #ifdef EPOLLERR
998 if ((x & EPOLLERR) == EPOLLERR)
999 *r |= Mono_Posix_EpollEvents_EPOLLERR;
1000 #endif /* ndef EPOLLERR */
1001 #ifdef EPOLLET
1002 if ((x & EPOLLET) == EPOLLET)
1003 *r |= Mono_Posix_EpollEvents_EPOLLET;
1004 #endif /* ndef EPOLLET */
1005 #ifdef EPOLLHUP
1006 if ((x & EPOLLHUP) == EPOLLHUP)
1007 *r |= Mono_Posix_EpollEvents_EPOLLHUP;
1008 #endif /* ndef EPOLLHUP */
1009 #ifdef EPOLLIN
1010 if ((x & EPOLLIN) == EPOLLIN)
1011 *r |= Mono_Posix_EpollEvents_EPOLLIN;
1012 #endif /* ndef EPOLLIN */
1013 #ifdef EPOLLMSG
1014 if ((x & EPOLLMSG) == EPOLLMSG)
1015 *r |= Mono_Posix_EpollEvents_EPOLLMSG;
1016 #endif /* ndef EPOLLMSG */
1017 #ifdef EPOLLONESHOT
1018 if ((x & EPOLLONESHOT) == EPOLLONESHOT)
1019 *r |= Mono_Posix_EpollEvents_EPOLLONESHOT;
1020 #endif /* ndef EPOLLONESHOT */
1021 #ifdef EPOLLOUT
1022 if ((x & EPOLLOUT) == EPOLLOUT)
1023 *r |= Mono_Posix_EpollEvents_EPOLLOUT;
1024 #endif /* ndef EPOLLOUT */
1025 #ifdef EPOLLPRI
1026 if ((x & EPOLLPRI) == EPOLLPRI)
1027 *r |= Mono_Posix_EpollEvents_EPOLLPRI;
1028 #endif /* ndef EPOLLPRI */
1029 #ifdef EPOLLRDBAND
1030 if ((x & EPOLLRDBAND) == EPOLLRDBAND)
1031 *r |= Mono_Posix_EpollEvents_EPOLLRDBAND;
1032 #endif /* ndef EPOLLRDBAND */
1033 #ifdef EPOLLRDHUP
1034 if ((x & EPOLLRDHUP) == EPOLLRDHUP)
1035 *r |= Mono_Posix_EpollEvents_EPOLLRDHUP;
1036 #endif /* ndef EPOLLRDHUP */
1037 #ifdef EPOLLRDNORM
1038 if ((x & EPOLLRDNORM) == EPOLLRDNORM)
1039 *r |= Mono_Posix_EpollEvents_EPOLLRDNORM;
1040 #endif /* ndef EPOLLRDNORM */
1041 #ifdef EPOLLWRBAND
1042 if ((x & EPOLLWRBAND) == EPOLLWRBAND)
1043 *r |= Mono_Posix_EpollEvents_EPOLLWRBAND;
1044 #endif /* ndef EPOLLWRBAND */
1045 #ifdef EPOLLWRNORM
1046 if ((x & EPOLLWRNORM) == EPOLLWRNORM)
1047 *r |= Mono_Posix_EpollEvents_EPOLLWRNORM;
1048 #endif /* ndef EPOLLWRNORM */
1049 return 0;
1052 int Mono_Posix_FromEpollFlags (int x, int *r)
1054 *r = 0;
1055 if ((x & Mono_Posix_EpollFlags_EPOLL_CLOEXEC) == Mono_Posix_EpollFlags_EPOLL_CLOEXEC)
1056 #ifdef EPOLL_CLOEXEC
1057 *r |= EPOLL_CLOEXEC;
1058 #else /* def EPOLL_CLOEXEC */
1059 {errno = EINVAL; return -1;}
1060 #endif /* ndef EPOLL_CLOEXEC */
1061 if ((x & Mono_Posix_EpollFlags_EPOLL_NONBLOCK) == Mono_Posix_EpollFlags_EPOLL_NONBLOCK)
1062 #ifdef EPOLL_NONBLOCK
1063 *r |= EPOLL_NONBLOCK;
1064 #else /* def EPOLL_NONBLOCK */
1065 {errno = EINVAL; return -1;}
1066 #endif /* ndef EPOLL_NONBLOCK */
1067 if (x == 0)
1068 return 0;
1069 return 0;
1072 int Mono_Posix_ToEpollFlags (int x, int *r)
1074 *r = 0;
1075 if (x == 0)
1076 return 0;
1077 #ifdef EPOLL_CLOEXEC
1078 if ((x & EPOLL_CLOEXEC) == EPOLL_CLOEXEC)
1079 *r |= Mono_Posix_EpollFlags_EPOLL_CLOEXEC;
1080 #endif /* ndef EPOLL_CLOEXEC */
1081 #ifdef EPOLL_NONBLOCK
1082 if ((x & EPOLL_NONBLOCK) == EPOLL_NONBLOCK)
1083 *r |= Mono_Posix_EpollFlags_EPOLL_NONBLOCK;
1084 #endif /* ndef EPOLL_NONBLOCK */
1085 return 0;
1088 int Mono_Posix_FromErrno (int x, int *r)
1090 *r = 0;
1091 if (x == Mono_Posix_Errno_E2BIG)
1092 #ifdef E2BIG
1093 {*r = E2BIG; return 0;}
1094 #else /* def E2BIG */
1095 {errno = EINVAL; return -1;}
1096 #endif /* ndef E2BIG */
1097 if (x == Mono_Posix_Errno_EACCES)
1098 #ifdef EACCES
1099 {*r = EACCES; return 0;}
1100 #else /* def EACCES */
1101 {errno = EINVAL; return -1;}
1102 #endif /* ndef EACCES */
1103 if (x == Mono_Posix_Errno_EADDRINUSE)
1104 #ifdef EADDRINUSE
1105 {*r = EADDRINUSE; return 0;}
1106 #else /* def EADDRINUSE */
1107 {errno = EINVAL; return -1;}
1108 #endif /* ndef EADDRINUSE */
1109 if (x == Mono_Posix_Errno_EADDRNOTAVAIL)
1110 #ifdef EADDRNOTAVAIL
1111 {*r = EADDRNOTAVAIL; return 0;}
1112 #else /* def EADDRNOTAVAIL */
1113 {errno = EINVAL; return -1;}
1114 #endif /* ndef EADDRNOTAVAIL */
1115 if (x == Mono_Posix_Errno_EADV)
1116 #ifdef EADV
1117 {*r = EADV; return 0;}
1118 #else /* def EADV */
1119 {errno = EINVAL; return -1;}
1120 #endif /* ndef EADV */
1121 if (x == Mono_Posix_Errno_EAFNOSUPPORT)
1122 #ifdef EAFNOSUPPORT
1123 {*r = EAFNOSUPPORT; return 0;}
1124 #else /* def EAFNOSUPPORT */
1125 {errno = EINVAL; return -1;}
1126 #endif /* ndef EAFNOSUPPORT */
1127 if (x == Mono_Posix_Errno_EAGAIN)
1128 #ifdef EAGAIN
1129 {*r = EAGAIN; return 0;}
1130 #else /* def EAGAIN */
1131 {errno = EINVAL; return -1;}
1132 #endif /* ndef EAGAIN */
1133 if (x == Mono_Posix_Errno_EALREADY)
1134 #ifdef EALREADY
1135 {*r = EALREADY; return 0;}
1136 #else /* def EALREADY */
1137 {errno = EINVAL; return -1;}
1138 #endif /* ndef EALREADY */
1139 if (x == Mono_Posix_Errno_EAUTH)
1140 #ifdef EAUTH
1141 {*r = EAUTH; return 0;}
1142 #else /* def EAUTH */
1143 {errno = EINVAL; return -1;}
1144 #endif /* ndef EAUTH */
1145 if (x == Mono_Posix_Errno_EBADARCH)
1146 #ifdef EBADARCH
1147 {*r = EBADARCH; return 0;}
1148 #else /* def EBADARCH */
1149 {errno = EINVAL; return -1;}
1150 #endif /* ndef EBADARCH */
1151 if (x == Mono_Posix_Errno_EBADE)
1152 #ifdef EBADE
1153 {*r = EBADE; return 0;}
1154 #else /* def EBADE */
1155 {errno = EINVAL; return -1;}
1156 #endif /* ndef EBADE */
1157 if (x == Mono_Posix_Errno_EBADEXEC)
1158 #ifdef EBADEXEC
1159 {*r = EBADEXEC; return 0;}
1160 #else /* def EBADEXEC */
1161 {errno = EINVAL; return -1;}
1162 #endif /* ndef EBADEXEC */
1163 if (x == Mono_Posix_Errno_EBADF)
1164 #ifdef EBADF
1165 {*r = EBADF; return 0;}
1166 #else /* def EBADF */
1167 {errno = EINVAL; return -1;}
1168 #endif /* ndef EBADF */
1169 if (x == Mono_Posix_Errno_EBADFD)
1170 #ifdef EBADFD
1171 {*r = EBADFD; return 0;}
1172 #else /* def EBADFD */
1173 {errno = EINVAL; return -1;}
1174 #endif /* ndef EBADFD */
1175 if (x == Mono_Posix_Errno_EBADMACHO)
1176 #ifdef EBADMACHO
1177 {*r = EBADMACHO; return 0;}
1178 #else /* def EBADMACHO */
1179 {errno = EINVAL; return -1;}
1180 #endif /* ndef EBADMACHO */
1181 if (x == Mono_Posix_Errno_EBADMSG)
1182 #ifdef EBADMSG
1183 {*r = EBADMSG; return 0;}
1184 #else /* def EBADMSG */
1185 {errno = EINVAL; return -1;}
1186 #endif /* ndef EBADMSG */
1187 if (x == Mono_Posix_Errno_EBADR)
1188 #ifdef EBADR
1189 {*r = EBADR; return 0;}
1190 #else /* def EBADR */
1191 {errno = EINVAL; return -1;}
1192 #endif /* ndef EBADR */
1193 if (x == Mono_Posix_Errno_EBADRPC)
1194 #ifdef EBADRPC
1195 {*r = EBADRPC; return 0;}
1196 #else /* def EBADRPC */
1197 {errno = EINVAL; return -1;}
1198 #endif /* ndef EBADRPC */
1199 if (x == Mono_Posix_Errno_EBADRQC)
1200 #ifdef EBADRQC
1201 {*r = EBADRQC; return 0;}
1202 #else /* def EBADRQC */
1203 {errno = EINVAL; return -1;}
1204 #endif /* ndef EBADRQC */
1205 if (x == Mono_Posix_Errno_EBADSLT)
1206 #ifdef EBADSLT
1207 {*r = EBADSLT; return 0;}
1208 #else /* def EBADSLT */
1209 {errno = EINVAL; return -1;}
1210 #endif /* ndef EBADSLT */
1211 if (x == Mono_Posix_Errno_EBFONT)
1212 #ifdef EBFONT
1213 {*r = EBFONT; return 0;}
1214 #else /* def EBFONT */
1215 {errno = EINVAL; return -1;}
1216 #endif /* ndef EBFONT */
1217 if (x == Mono_Posix_Errno_EBUSY)
1218 #ifdef EBUSY
1219 {*r = EBUSY; return 0;}
1220 #else /* def EBUSY */
1221 {errno = EINVAL; return -1;}
1222 #endif /* ndef EBUSY */
1223 if (x == Mono_Posix_Errno_ECANCELED)
1224 #ifdef ECANCELED
1225 {*r = ECANCELED; return 0;}
1226 #else /* def ECANCELED */
1227 {errno = EINVAL; return -1;}
1228 #endif /* ndef ECANCELED */
1229 if (x == Mono_Posix_Errno_ECHILD)
1230 #ifdef ECHILD
1231 {*r = ECHILD; return 0;}
1232 #else /* def ECHILD */
1233 {errno = EINVAL; return -1;}
1234 #endif /* ndef ECHILD */
1235 if (x == Mono_Posix_Errno_ECHRNG)
1236 #ifdef ECHRNG
1237 {*r = ECHRNG; return 0;}
1238 #else /* def ECHRNG */
1239 {errno = EINVAL; return -1;}
1240 #endif /* ndef ECHRNG */
1241 if (x == Mono_Posix_Errno_ECOMM)
1242 #ifdef ECOMM
1243 {*r = ECOMM; return 0;}
1244 #else /* def ECOMM */
1245 {errno = EINVAL; return -1;}
1246 #endif /* ndef ECOMM */
1247 if (x == Mono_Posix_Errno_ECONNABORTED)
1248 #ifdef ECONNABORTED
1249 {*r = ECONNABORTED; return 0;}
1250 #else /* def ECONNABORTED */
1251 {errno = EINVAL; return -1;}
1252 #endif /* ndef ECONNABORTED */
1253 if (x == Mono_Posix_Errno_ECONNREFUSED)
1254 #ifdef ECONNREFUSED
1255 {*r = ECONNREFUSED; return 0;}
1256 #else /* def ECONNREFUSED */
1257 {errno = EINVAL; return -1;}
1258 #endif /* ndef ECONNREFUSED */
1259 if (x == Mono_Posix_Errno_ECONNRESET)
1260 #ifdef ECONNRESET
1261 {*r = ECONNRESET; return 0;}
1262 #else /* def ECONNRESET */
1263 {errno = EINVAL; return -1;}
1264 #endif /* ndef ECONNRESET */
1265 if (x == Mono_Posix_Errno_EDEADLK)
1266 #ifdef EDEADLK
1267 {*r = EDEADLK; return 0;}
1268 #else /* def EDEADLK */
1269 {errno = EINVAL; return -1;}
1270 #endif /* ndef EDEADLK */
1271 if (x == Mono_Posix_Errno_EDEADLOCK)
1272 #ifdef EDEADLOCK
1273 {*r = EDEADLOCK; return 0;}
1274 #else /* def EDEADLOCK */
1275 {errno = EINVAL; return -1;}
1276 #endif /* ndef EDEADLOCK */
1277 if (x == Mono_Posix_Errno_EDESTADDRREQ)
1278 #ifdef EDESTADDRREQ
1279 {*r = EDESTADDRREQ; return 0;}
1280 #else /* def EDESTADDRREQ */
1281 {errno = EINVAL; return -1;}
1282 #endif /* ndef EDESTADDRREQ */
1283 if (x == Mono_Posix_Errno_EDEVERR)
1284 #ifdef EDEVERR
1285 {*r = EDEVERR; return 0;}
1286 #else /* def EDEVERR */
1287 {errno = EINVAL; return -1;}
1288 #endif /* ndef EDEVERR */
1289 if (x == Mono_Posix_Errno_EDOM)
1290 #ifdef EDOM
1291 {*r = EDOM; return 0;}
1292 #else /* def EDOM */
1293 {errno = EINVAL; return -1;}
1294 #endif /* ndef EDOM */
1295 if (x == Mono_Posix_Errno_EDOTDOT)
1296 #ifdef EDOTDOT
1297 {*r = EDOTDOT; return 0;}
1298 #else /* def EDOTDOT */
1299 {errno = EINVAL; return -1;}
1300 #endif /* ndef EDOTDOT */
1301 if (x == Mono_Posix_Errno_EDQUOT)
1302 #ifdef EDQUOT
1303 {*r = EDQUOT; return 0;}
1304 #else /* def EDQUOT */
1305 {errno = EINVAL; return -1;}
1306 #endif /* ndef EDQUOT */
1307 if (x == Mono_Posix_Errno_EEXIST)
1308 #ifdef EEXIST
1309 {*r = EEXIST; return 0;}
1310 #else /* def EEXIST */
1311 {errno = EINVAL; return -1;}
1312 #endif /* ndef EEXIST */
1313 if (x == Mono_Posix_Errno_EFAULT)
1314 #ifdef EFAULT
1315 {*r = EFAULT; return 0;}
1316 #else /* def EFAULT */
1317 {errno = EINVAL; return -1;}
1318 #endif /* ndef EFAULT */
1319 if (x == Mono_Posix_Errno_EFBIG)
1320 #ifdef EFBIG
1321 {*r = EFBIG; return 0;}
1322 #else /* def EFBIG */
1323 {errno = EINVAL; return -1;}
1324 #endif /* ndef EFBIG */
1325 if (x == Mono_Posix_Errno_EFTYPE)
1326 #ifdef EFTYPE
1327 {*r = EFTYPE; return 0;}
1328 #else /* def EFTYPE */
1329 {errno = EINVAL; return -1;}
1330 #endif /* ndef EFTYPE */
1331 if (x == Mono_Posix_Errno_EHOSTDOWN)
1332 #ifdef EHOSTDOWN
1333 {*r = EHOSTDOWN; return 0;}
1334 #else /* def EHOSTDOWN */
1335 {errno = EINVAL; return -1;}
1336 #endif /* ndef EHOSTDOWN */
1337 if (x == Mono_Posix_Errno_EHOSTUNREACH)
1338 #ifdef EHOSTUNREACH
1339 {*r = EHOSTUNREACH; return 0;}
1340 #else /* def EHOSTUNREACH */
1341 {errno = EINVAL; return -1;}
1342 #endif /* ndef EHOSTUNREACH */
1343 if (x == Mono_Posix_Errno_EIDRM)
1344 #ifdef EIDRM
1345 {*r = EIDRM; return 0;}
1346 #else /* def EIDRM */
1347 {errno = EINVAL; return -1;}
1348 #endif /* ndef EIDRM */
1349 if (x == Mono_Posix_Errno_EILSEQ)
1350 #ifdef EILSEQ
1351 {*r = EILSEQ; return 0;}
1352 #else /* def EILSEQ */
1353 {errno = EINVAL; return -1;}
1354 #endif /* ndef EILSEQ */
1355 if (x == Mono_Posix_Errno_EINPROGRESS)
1356 #ifdef EINPROGRESS
1357 {*r = EINPROGRESS; return 0;}
1358 #else /* def EINPROGRESS */
1359 {errno = EINVAL; return -1;}
1360 #endif /* ndef EINPROGRESS */
1361 if (x == Mono_Posix_Errno_EINTR)
1362 #ifdef EINTR
1363 {*r = EINTR; return 0;}
1364 #else /* def EINTR */
1365 {errno = EINVAL; return -1;}
1366 #endif /* ndef EINTR */
1367 if (x == Mono_Posix_Errno_EINVAL)
1368 #ifdef EINVAL
1369 {*r = EINVAL; return 0;}
1370 #else /* def EINVAL */
1371 {errno = EINVAL; return -1;}
1372 #endif /* ndef EINVAL */
1373 if (x == Mono_Posix_Errno_EIO)
1374 #ifdef EIO
1375 {*r = EIO; return 0;}
1376 #else /* def EIO */
1377 {errno = EINVAL; return -1;}
1378 #endif /* ndef EIO */
1379 if (x == Mono_Posix_Errno_EISCONN)
1380 #ifdef EISCONN
1381 {*r = EISCONN; return 0;}
1382 #else /* def EISCONN */
1383 {errno = EINVAL; return -1;}
1384 #endif /* ndef EISCONN */
1385 if (x == Mono_Posix_Errno_EISDIR)
1386 #ifdef EISDIR
1387 {*r = EISDIR; return 0;}
1388 #else /* def EISDIR */
1389 {errno = EINVAL; return -1;}
1390 #endif /* ndef EISDIR */
1391 if (x == Mono_Posix_Errno_EISNAM)
1392 #ifdef EISNAM
1393 {*r = EISNAM; return 0;}
1394 #else /* def EISNAM */
1395 {errno = EINVAL; return -1;}
1396 #endif /* ndef EISNAM */
1397 if (x == Mono_Posix_Errno_EKEYEXPIRED)
1398 #ifdef EKEYEXPIRED
1399 {*r = EKEYEXPIRED; return 0;}
1400 #else /* def EKEYEXPIRED */
1401 {errno = EINVAL; return -1;}
1402 #endif /* ndef EKEYEXPIRED */
1403 if (x == Mono_Posix_Errno_EKEYREJECTED)
1404 #ifdef EKEYREJECTED
1405 {*r = EKEYREJECTED; return 0;}
1406 #else /* def EKEYREJECTED */
1407 {errno = EINVAL; return -1;}
1408 #endif /* ndef EKEYREJECTED */
1409 if (x == Mono_Posix_Errno_EKEYREVOKED)
1410 #ifdef EKEYREVOKED
1411 {*r = EKEYREVOKED; return 0;}
1412 #else /* def EKEYREVOKED */
1413 {errno = EINVAL; return -1;}
1414 #endif /* ndef EKEYREVOKED */
1415 if (x == Mono_Posix_Errno_EL2HLT)
1416 #ifdef EL2HLT
1417 {*r = EL2HLT; return 0;}
1418 #else /* def EL2HLT */
1419 {errno = EINVAL; return -1;}
1420 #endif /* ndef EL2HLT */
1421 if (x == Mono_Posix_Errno_EL2NSYNC)
1422 #ifdef EL2NSYNC
1423 {*r = EL2NSYNC; return 0;}
1424 #else /* def EL2NSYNC */
1425 {errno = EINVAL; return -1;}
1426 #endif /* ndef EL2NSYNC */
1427 if (x == Mono_Posix_Errno_EL3HLT)
1428 #ifdef EL3HLT
1429 {*r = EL3HLT; return 0;}
1430 #else /* def EL3HLT */
1431 {errno = EINVAL; return -1;}
1432 #endif /* ndef EL3HLT */
1433 if (x == Mono_Posix_Errno_EL3RST)
1434 #ifdef EL3RST
1435 {*r = EL3RST; return 0;}
1436 #else /* def EL3RST */
1437 {errno = EINVAL; return -1;}
1438 #endif /* ndef EL3RST */
1439 if (x == Mono_Posix_Errno_ELIBACC)
1440 #ifdef ELIBACC
1441 {*r = ELIBACC; return 0;}
1442 #else /* def ELIBACC */
1443 {errno = EINVAL; return -1;}
1444 #endif /* ndef ELIBACC */
1445 if (x == Mono_Posix_Errno_ELIBBAD)
1446 #ifdef ELIBBAD
1447 {*r = ELIBBAD; return 0;}
1448 #else /* def ELIBBAD */
1449 {errno = EINVAL; return -1;}
1450 #endif /* ndef ELIBBAD */
1451 if (x == Mono_Posix_Errno_ELIBEXEC)
1452 #ifdef ELIBEXEC
1453 {*r = ELIBEXEC; return 0;}
1454 #else /* def ELIBEXEC */
1455 {errno = EINVAL; return -1;}
1456 #endif /* ndef ELIBEXEC */
1457 if (x == Mono_Posix_Errno_ELIBMAX)
1458 #ifdef ELIBMAX
1459 {*r = ELIBMAX; return 0;}
1460 #else /* def ELIBMAX */
1461 {errno = EINVAL; return -1;}
1462 #endif /* ndef ELIBMAX */
1463 if (x == Mono_Posix_Errno_ELIBSCN)
1464 #ifdef ELIBSCN
1465 {*r = ELIBSCN; return 0;}
1466 #else /* def ELIBSCN */
1467 {errno = EINVAL; return -1;}
1468 #endif /* ndef ELIBSCN */
1469 if (x == Mono_Posix_Errno_ELNRNG)
1470 #ifdef ELNRNG
1471 {*r = ELNRNG; return 0;}
1472 #else /* def ELNRNG */
1473 {errno = EINVAL; return -1;}
1474 #endif /* ndef ELNRNG */
1475 if (x == Mono_Posix_Errno_ELOOP)
1476 #ifdef ELOOP
1477 {*r = ELOOP; return 0;}
1478 #else /* def ELOOP */
1479 {errno = EINVAL; return -1;}
1480 #endif /* ndef ELOOP */
1481 if (x == Mono_Posix_Errno_EMEDIUMTYPE)
1482 #ifdef EMEDIUMTYPE
1483 {*r = EMEDIUMTYPE; return 0;}
1484 #else /* def EMEDIUMTYPE */
1485 {errno = EINVAL; return -1;}
1486 #endif /* ndef EMEDIUMTYPE */
1487 if (x == Mono_Posix_Errno_EMFILE)
1488 #ifdef EMFILE
1489 {*r = EMFILE; return 0;}
1490 #else /* def EMFILE */
1491 {errno = EINVAL; return -1;}
1492 #endif /* ndef EMFILE */
1493 if (x == Mono_Posix_Errno_EMLINK)
1494 #ifdef EMLINK
1495 {*r = EMLINK; return 0;}
1496 #else /* def EMLINK */
1497 {errno = EINVAL; return -1;}
1498 #endif /* ndef EMLINK */
1499 if (x == Mono_Posix_Errno_EMSGSIZE)
1500 #ifdef EMSGSIZE
1501 {*r = EMSGSIZE; return 0;}
1502 #else /* def EMSGSIZE */
1503 {errno = EINVAL; return -1;}
1504 #endif /* ndef EMSGSIZE */
1505 if (x == Mono_Posix_Errno_EMULTIHOP)
1506 #ifdef EMULTIHOP
1507 {*r = EMULTIHOP; return 0;}
1508 #else /* def EMULTIHOP */
1509 {errno = EINVAL; return -1;}
1510 #endif /* ndef EMULTIHOP */
1511 if (x == Mono_Posix_Errno_ENAMETOOLONG)
1512 #ifdef ENAMETOOLONG
1513 {*r = ENAMETOOLONG; return 0;}
1514 #else /* def ENAMETOOLONG */
1515 {errno = EINVAL; return -1;}
1516 #endif /* ndef ENAMETOOLONG */
1517 if (x == Mono_Posix_Errno_ENAVAIL)
1518 #ifdef ENAVAIL
1519 {*r = ENAVAIL; return 0;}
1520 #else /* def ENAVAIL */
1521 {errno = EINVAL; return -1;}
1522 #endif /* ndef ENAVAIL */
1523 if (x == Mono_Posix_Errno_ENEEDAUTH)
1524 #ifdef ENEEDAUTH
1525 {*r = ENEEDAUTH; return 0;}
1526 #else /* def ENEEDAUTH */
1527 {errno = EINVAL; return -1;}
1528 #endif /* ndef ENEEDAUTH */
1529 if (x == Mono_Posix_Errno_ENETDOWN)
1530 #ifdef ENETDOWN
1531 {*r = ENETDOWN; return 0;}
1532 #else /* def ENETDOWN */
1533 {errno = EINVAL; return -1;}
1534 #endif /* ndef ENETDOWN */
1535 if (x == Mono_Posix_Errno_ENETRESET)
1536 #ifdef ENETRESET
1537 {*r = ENETRESET; return 0;}
1538 #else /* def ENETRESET */
1539 {errno = EINVAL; return -1;}
1540 #endif /* ndef ENETRESET */
1541 if (x == Mono_Posix_Errno_ENETUNREACH)
1542 #ifdef ENETUNREACH
1543 {*r = ENETUNREACH; return 0;}
1544 #else /* def ENETUNREACH */
1545 {errno = EINVAL; return -1;}
1546 #endif /* ndef ENETUNREACH */
1547 if (x == Mono_Posix_Errno_ENFILE)
1548 #ifdef ENFILE
1549 {*r = ENFILE; return 0;}
1550 #else /* def ENFILE */
1551 {errno = EINVAL; return -1;}
1552 #endif /* ndef ENFILE */
1553 if (x == Mono_Posix_Errno_ENOANO)
1554 #ifdef ENOANO
1555 {*r = ENOANO; return 0;}
1556 #else /* def ENOANO */
1557 {errno = EINVAL; return -1;}
1558 #endif /* ndef ENOANO */
1559 if (x == Mono_Posix_Errno_ENOATTR)
1560 #ifdef ENOATTR
1561 {*r = ENOATTR; return 0;}
1562 #else /* def ENOATTR */
1563 {errno = EINVAL; return -1;}
1564 #endif /* ndef ENOATTR */
1565 if (x == Mono_Posix_Errno_ENOBUFS)
1566 #ifdef ENOBUFS
1567 {*r = ENOBUFS; return 0;}
1568 #else /* def ENOBUFS */
1569 {errno = EINVAL; return -1;}
1570 #endif /* ndef ENOBUFS */
1571 if (x == Mono_Posix_Errno_ENOCSI)
1572 #ifdef ENOCSI
1573 {*r = ENOCSI; return 0;}
1574 #else /* def ENOCSI */
1575 {errno = EINVAL; return -1;}
1576 #endif /* ndef ENOCSI */
1577 if (x == Mono_Posix_Errno_ENODATA)
1578 #ifdef ENODATA
1579 {*r = ENODATA; return 0;}
1580 #else /* def ENODATA */
1581 {errno = EINVAL; return -1;}
1582 #endif /* ndef ENODATA */
1583 if (x == Mono_Posix_Errno_ENODEV)
1584 #ifdef ENODEV
1585 {*r = ENODEV; return 0;}
1586 #else /* def ENODEV */
1587 {errno = EINVAL; return -1;}
1588 #endif /* ndef ENODEV */
1589 if (x == Mono_Posix_Errno_ENOENT)
1590 #ifdef ENOENT
1591 {*r = ENOENT; return 0;}
1592 #else /* def ENOENT */
1593 {errno = EINVAL; return -1;}
1594 #endif /* ndef ENOENT */
1595 if (x == Mono_Posix_Errno_ENOEXEC)
1596 #ifdef ENOEXEC
1597 {*r = ENOEXEC; return 0;}
1598 #else /* def ENOEXEC */
1599 {errno = EINVAL; return -1;}
1600 #endif /* ndef ENOEXEC */
1601 if (x == Mono_Posix_Errno_ENOKEY)
1602 #ifdef ENOKEY
1603 {*r = ENOKEY; return 0;}
1604 #else /* def ENOKEY */
1605 {errno = EINVAL; return -1;}
1606 #endif /* ndef ENOKEY */
1607 if (x == Mono_Posix_Errno_ENOLCK)
1608 #ifdef ENOLCK
1609 {*r = ENOLCK; return 0;}
1610 #else /* def ENOLCK */
1611 {errno = EINVAL; return -1;}
1612 #endif /* ndef ENOLCK */
1613 if (x == Mono_Posix_Errno_ENOLINK)
1614 #ifdef ENOLINK
1615 {*r = ENOLINK; return 0;}
1616 #else /* def ENOLINK */
1617 {errno = EINVAL; return -1;}
1618 #endif /* ndef ENOLINK */
1619 if (x == Mono_Posix_Errno_ENOMEDIUM)
1620 #ifdef ENOMEDIUM
1621 {*r = ENOMEDIUM; return 0;}
1622 #else /* def ENOMEDIUM */
1623 {errno = EINVAL; return -1;}
1624 #endif /* ndef ENOMEDIUM */
1625 if (x == Mono_Posix_Errno_ENOMEM)
1626 #ifdef ENOMEM
1627 {*r = ENOMEM; return 0;}
1628 #else /* def ENOMEM */
1629 {errno = EINVAL; return -1;}
1630 #endif /* ndef ENOMEM */
1631 if (x == Mono_Posix_Errno_ENOMSG)
1632 #ifdef ENOMSG
1633 {*r = ENOMSG; return 0;}
1634 #else /* def ENOMSG */
1635 {errno = EINVAL; return -1;}
1636 #endif /* ndef ENOMSG */
1637 if (x == Mono_Posix_Errno_ENONET)
1638 #ifdef ENONET
1639 {*r = ENONET; return 0;}
1640 #else /* def ENONET */
1641 {errno = EINVAL; return -1;}
1642 #endif /* ndef ENONET */
1643 if (x == Mono_Posix_Errno_ENOPKG)
1644 #ifdef ENOPKG
1645 {*r = ENOPKG; return 0;}
1646 #else /* def ENOPKG */
1647 {errno = EINVAL; return -1;}
1648 #endif /* ndef ENOPKG */
1649 if (x == Mono_Posix_Errno_ENOPOLICY)
1650 #ifdef ENOPOLICY
1651 {*r = ENOPOLICY; return 0;}
1652 #else /* def ENOPOLICY */
1653 {errno = EINVAL; return -1;}
1654 #endif /* ndef ENOPOLICY */
1655 if (x == Mono_Posix_Errno_ENOPROTOOPT)
1656 #ifdef ENOPROTOOPT
1657 {*r = ENOPROTOOPT; return 0;}
1658 #else /* def ENOPROTOOPT */
1659 {errno = EINVAL; return -1;}
1660 #endif /* ndef ENOPROTOOPT */
1661 if (x == Mono_Posix_Errno_ENOSPC)
1662 #ifdef ENOSPC
1663 {*r = ENOSPC; return 0;}
1664 #else /* def ENOSPC */
1665 {errno = EINVAL; return -1;}
1666 #endif /* ndef ENOSPC */
1667 if (x == Mono_Posix_Errno_ENOSR)
1668 #ifdef ENOSR
1669 {*r = ENOSR; return 0;}
1670 #else /* def ENOSR */
1671 {errno = EINVAL; return -1;}
1672 #endif /* ndef ENOSR */
1673 if (x == Mono_Posix_Errno_ENOSTR)
1674 #ifdef ENOSTR
1675 {*r = ENOSTR; return 0;}
1676 #else /* def ENOSTR */
1677 {errno = EINVAL; return -1;}
1678 #endif /* ndef ENOSTR */
1679 if (x == Mono_Posix_Errno_ENOSYS)
1680 #ifdef ENOSYS
1681 {*r = ENOSYS; return 0;}
1682 #else /* def ENOSYS */
1683 {errno = EINVAL; return -1;}
1684 #endif /* ndef ENOSYS */
1685 if (x == Mono_Posix_Errno_ENOTBLK)
1686 #ifdef ENOTBLK
1687 {*r = ENOTBLK; return 0;}
1688 #else /* def ENOTBLK */
1689 {errno = EINVAL; return -1;}
1690 #endif /* ndef ENOTBLK */
1691 if (x == Mono_Posix_Errno_ENOTCONN)
1692 #ifdef ENOTCONN
1693 {*r = ENOTCONN; return 0;}
1694 #else /* def ENOTCONN */
1695 {errno = EINVAL; return -1;}
1696 #endif /* ndef ENOTCONN */
1697 if (x == Mono_Posix_Errno_ENOTDIR)
1698 #ifdef ENOTDIR
1699 {*r = ENOTDIR; return 0;}
1700 #else /* def ENOTDIR */
1701 {errno = EINVAL; return -1;}
1702 #endif /* ndef ENOTDIR */
1703 if (x == Mono_Posix_Errno_ENOTEMPTY)
1704 #ifdef ENOTEMPTY
1705 {*r = ENOTEMPTY; return 0;}
1706 #else /* def ENOTEMPTY */
1707 {errno = EINVAL; return -1;}
1708 #endif /* ndef ENOTEMPTY */
1709 if (x == Mono_Posix_Errno_ENOTNAM)
1710 #ifdef ENOTNAM
1711 {*r = ENOTNAM; return 0;}
1712 #else /* def ENOTNAM */
1713 {errno = EINVAL; return -1;}
1714 #endif /* ndef ENOTNAM */
1715 if (x == Mono_Posix_Errno_ENOTRECOVERABLE)
1716 #ifdef ENOTRECOVERABLE
1717 {*r = ENOTRECOVERABLE; return 0;}
1718 #else /* def ENOTRECOVERABLE */
1719 {errno = EINVAL; return -1;}
1720 #endif /* ndef ENOTRECOVERABLE */
1721 if (x == Mono_Posix_Errno_ENOTSOCK)
1722 #ifdef ENOTSOCK
1723 {*r = ENOTSOCK; return 0;}
1724 #else /* def ENOTSOCK */
1725 {errno = EINVAL; return -1;}
1726 #endif /* ndef ENOTSOCK */
1727 if (x == Mono_Posix_Errno_ENOTTY)
1728 #ifdef ENOTTY
1729 {*r = ENOTTY; return 0;}
1730 #else /* def ENOTTY */
1731 {errno = EINVAL; return -1;}
1732 #endif /* ndef ENOTTY */
1733 if (x == Mono_Posix_Errno_ENOTUNIQ)
1734 #ifdef ENOTUNIQ
1735 {*r = ENOTUNIQ; return 0;}
1736 #else /* def ENOTUNIQ */
1737 {errno = EINVAL; return -1;}
1738 #endif /* ndef ENOTUNIQ */
1739 if (x == Mono_Posix_Errno_ENXIO)
1740 #ifdef ENXIO
1741 {*r = ENXIO; return 0;}
1742 #else /* def ENXIO */
1743 {errno = EINVAL; return -1;}
1744 #endif /* ndef ENXIO */
1745 if (x == Mono_Posix_Errno_EOPNOTSUPP)
1746 #ifdef EOPNOTSUPP
1747 {*r = EOPNOTSUPP; return 0;}
1748 #else /* def EOPNOTSUPP */
1749 {errno = EINVAL; return -1;}
1750 #endif /* ndef EOPNOTSUPP */
1751 if (x == Mono_Posix_Errno_EOVERFLOW)
1752 #ifdef EOVERFLOW
1753 {*r = EOVERFLOW; return 0;}
1754 #else /* def EOVERFLOW */
1755 {errno = EINVAL; return -1;}
1756 #endif /* ndef EOVERFLOW */
1757 if (x == Mono_Posix_Errno_EOWNERDEAD)
1758 #ifdef EOWNERDEAD
1759 {*r = EOWNERDEAD; return 0;}
1760 #else /* def EOWNERDEAD */
1761 {errno = EINVAL; return -1;}
1762 #endif /* ndef EOWNERDEAD */
1763 if (x == Mono_Posix_Errno_EPERM)
1764 #ifdef EPERM
1765 {*r = EPERM; return 0;}
1766 #else /* def EPERM */
1767 {errno = EINVAL; return -1;}
1768 #endif /* ndef EPERM */
1769 if (x == Mono_Posix_Errno_EPFNOSUPPORT)
1770 #ifdef EPFNOSUPPORT
1771 {*r = EPFNOSUPPORT; return 0;}
1772 #else /* def EPFNOSUPPORT */
1773 {errno = EINVAL; return -1;}
1774 #endif /* ndef EPFNOSUPPORT */
1775 if (x == Mono_Posix_Errno_EPIPE)
1776 #ifdef EPIPE
1777 {*r = EPIPE; return 0;}
1778 #else /* def EPIPE */
1779 {errno = EINVAL; return -1;}
1780 #endif /* ndef EPIPE */
1781 if (x == Mono_Posix_Errno_EPROCLIM)
1782 #ifdef EPROCLIM
1783 {*r = EPROCLIM; return 0;}
1784 #else /* def EPROCLIM */
1785 {errno = EINVAL; return -1;}
1786 #endif /* ndef EPROCLIM */
1787 if (x == Mono_Posix_Errno_EPROCUNAVAIL)
1788 #ifdef EPROCUNAVAIL
1789 {*r = EPROCUNAVAIL; return 0;}
1790 #else /* def EPROCUNAVAIL */
1791 {errno = EINVAL; return -1;}
1792 #endif /* ndef EPROCUNAVAIL */
1793 if (x == Mono_Posix_Errno_EPROGMISMATCH)
1794 #ifdef EPROGMISMATCH
1795 {*r = EPROGMISMATCH; return 0;}
1796 #else /* def EPROGMISMATCH */
1797 {errno = EINVAL; return -1;}
1798 #endif /* ndef EPROGMISMATCH */
1799 if (x == Mono_Posix_Errno_EPROGUNAVAIL)
1800 #ifdef EPROGUNAVAIL
1801 {*r = EPROGUNAVAIL; return 0;}
1802 #else /* def EPROGUNAVAIL */
1803 {errno = EINVAL; return -1;}
1804 #endif /* ndef EPROGUNAVAIL */
1805 if (x == Mono_Posix_Errno_EPROTO)
1806 #ifdef EPROTO
1807 {*r = EPROTO; return 0;}
1808 #else /* def EPROTO */
1809 {errno = EINVAL; return -1;}
1810 #endif /* ndef EPROTO */
1811 if (x == Mono_Posix_Errno_EPROTONOSUPPORT)
1812 #ifdef EPROTONOSUPPORT
1813 {*r = EPROTONOSUPPORT; return 0;}
1814 #else /* def EPROTONOSUPPORT */
1815 {errno = EINVAL; return -1;}
1816 #endif /* ndef EPROTONOSUPPORT */
1817 if (x == Mono_Posix_Errno_EPROTOTYPE)
1818 #ifdef EPROTOTYPE
1819 {*r = EPROTOTYPE; return 0;}
1820 #else /* def EPROTOTYPE */
1821 {errno = EINVAL; return -1;}
1822 #endif /* ndef EPROTOTYPE */
1823 if (x == Mono_Posix_Errno_EPWROFF)
1824 #ifdef EPWROFF
1825 {*r = EPWROFF; return 0;}
1826 #else /* def EPWROFF */
1827 {errno = EINVAL; return -1;}
1828 #endif /* ndef EPWROFF */
1829 if (x == Mono_Posix_Errno_ERANGE)
1830 #ifdef ERANGE
1831 {*r = ERANGE; return 0;}
1832 #else /* def ERANGE */
1833 {errno = EINVAL; return -1;}
1834 #endif /* ndef ERANGE */
1835 if (x == Mono_Posix_Errno_EREMCHG)
1836 #ifdef EREMCHG
1837 {*r = EREMCHG; return 0;}
1838 #else /* def EREMCHG */
1839 {errno = EINVAL; return -1;}
1840 #endif /* ndef EREMCHG */
1841 if (x == Mono_Posix_Errno_EREMOTE)
1842 #ifdef EREMOTE
1843 {*r = EREMOTE; return 0;}
1844 #else /* def EREMOTE */
1845 {errno = EINVAL; return -1;}
1846 #endif /* ndef EREMOTE */
1847 if (x == Mono_Posix_Errno_EREMOTEIO)
1848 #ifdef EREMOTEIO
1849 {*r = EREMOTEIO; return 0;}
1850 #else /* def EREMOTEIO */
1851 {errno = EINVAL; return -1;}
1852 #endif /* ndef EREMOTEIO */
1853 if (x == Mono_Posix_Errno_ERESTART)
1854 #ifdef ERESTART
1855 {*r = ERESTART; return 0;}
1856 #else /* def ERESTART */
1857 {errno = EINVAL; return -1;}
1858 #endif /* ndef ERESTART */
1859 if (x == Mono_Posix_Errno_EROFS)
1860 #ifdef EROFS
1861 {*r = EROFS; return 0;}
1862 #else /* def EROFS */
1863 {errno = EINVAL; return -1;}
1864 #endif /* ndef EROFS */
1865 if (x == Mono_Posix_Errno_ERPCMISMATCH)
1866 #ifdef ERPCMISMATCH
1867 {*r = ERPCMISMATCH; return 0;}
1868 #else /* def ERPCMISMATCH */
1869 {errno = EINVAL; return -1;}
1870 #endif /* ndef ERPCMISMATCH */
1871 if (x == Mono_Posix_Errno_ESHLIBVERS)
1872 #ifdef ESHLIBVERS
1873 {*r = ESHLIBVERS; return 0;}
1874 #else /* def ESHLIBVERS */
1875 {errno = EINVAL; return -1;}
1876 #endif /* ndef ESHLIBVERS */
1877 if (x == Mono_Posix_Errno_ESHUTDOWN)
1878 #ifdef ESHUTDOWN
1879 {*r = ESHUTDOWN; return 0;}
1880 #else /* def ESHUTDOWN */
1881 {errno = EINVAL; return -1;}
1882 #endif /* ndef ESHUTDOWN */
1883 if (x == Mono_Posix_Errno_ESOCKTNOSUPPORT)
1884 #ifdef ESOCKTNOSUPPORT
1885 {*r = ESOCKTNOSUPPORT; return 0;}
1886 #else /* def ESOCKTNOSUPPORT */
1887 {errno = EINVAL; return -1;}
1888 #endif /* ndef ESOCKTNOSUPPORT */
1889 if (x == Mono_Posix_Errno_ESPIPE)
1890 #ifdef ESPIPE
1891 {*r = ESPIPE; return 0;}
1892 #else /* def ESPIPE */
1893 {errno = EINVAL; return -1;}
1894 #endif /* ndef ESPIPE */
1895 if (x == Mono_Posix_Errno_ESRCH)
1896 #ifdef ESRCH
1897 {*r = ESRCH; return 0;}
1898 #else /* def ESRCH */
1899 {errno = EINVAL; return -1;}
1900 #endif /* ndef ESRCH */
1901 if (x == Mono_Posix_Errno_ESRMNT)
1902 #ifdef ESRMNT
1903 {*r = ESRMNT; return 0;}
1904 #else /* def ESRMNT */
1905 {errno = EINVAL; return -1;}
1906 #endif /* ndef ESRMNT */
1907 if (x == Mono_Posix_Errno_ESTALE)
1908 #ifdef ESTALE
1909 {*r = ESTALE; return 0;}
1910 #else /* def ESTALE */
1911 {errno = EINVAL; return -1;}
1912 #endif /* ndef ESTALE */
1913 if (x == Mono_Posix_Errno_ESTRPIPE)
1914 #ifdef ESTRPIPE
1915 {*r = ESTRPIPE; return 0;}
1916 #else /* def ESTRPIPE */
1917 {errno = EINVAL; return -1;}
1918 #endif /* ndef ESTRPIPE */
1919 if (x == Mono_Posix_Errno_ETIME)
1920 #ifdef ETIME
1921 {*r = ETIME; return 0;}
1922 #else /* def ETIME */
1923 {errno = EINVAL; return -1;}
1924 #endif /* ndef ETIME */
1925 if (x == Mono_Posix_Errno_ETIMEDOUT)
1926 #ifdef ETIMEDOUT
1927 {*r = ETIMEDOUT; return 0;}
1928 #else /* def ETIMEDOUT */
1929 {errno = EINVAL; return -1;}
1930 #endif /* ndef ETIMEDOUT */
1931 if (x == Mono_Posix_Errno_ETOOMANYREFS)
1932 #ifdef ETOOMANYREFS
1933 {*r = ETOOMANYREFS; return 0;}
1934 #else /* def ETOOMANYREFS */
1935 {errno = EINVAL; return -1;}
1936 #endif /* ndef ETOOMANYREFS */
1937 if (x == Mono_Posix_Errno_ETXTBSY)
1938 #ifdef ETXTBSY
1939 {*r = ETXTBSY; return 0;}
1940 #else /* def ETXTBSY */
1941 {errno = EINVAL; return -1;}
1942 #endif /* ndef ETXTBSY */
1943 if (x == Mono_Posix_Errno_EUCLEAN)
1944 #ifdef EUCLEAN
1945 {*r = EUCLEAN; return 0;}
1946 #else /* def EUCLEAN */
1947 {errno = EINVAL; return -1;}
1948 #endif /* ndef EUCLEAN */
1949 if (x == Mono_Posix_Errno_EUNATCH)
1950 #ifdef EUNATCH
1951 {*r = EUNATCH; return 0;}
1952 #else /* def EUNATCH */
1953 {errno = EINVAL; return -1;}
1954 #endif /* ndef EUNATCH */
1955 if (x == Mono_Posix_Errno_EUSERS)
1956 #ifdef EUSERS
1957 {*r = EUSERS; return 0;}
1958 #else /* def EUSERS */
1959 {errno = EINVAL; return -1;}
1960 #endif /* ndef EUSERS */
1961 if (x == Mono_Posix_Errno_EWOULDBLOCK)
1962 #ifdef EWOULDBLOCK
1963 {*r = EWOULDBLOCK; return 0;}
1964 #else /* def EWOULDBLOCK */
1965 {errno = EINVAL; return -1;}
1966 #endif /* ndef EWOULDBLOCK */
1967 if (x == Mono_Posix_Errno_EXDEV)
1968 #ifdef EXDEV
1969 {*r = EXDEV; return 0;}
1970 #else /* def EXDEV */
1971 {errno = EINVAL; return -1;}
1972 #endif /* ndef EXDEV */
1973 if (x == Mono_Posix_Errno_EXFULL)
1974 #ifdef EXFULL
1975 {*r = EXFULL; return 0;}
1976 #else /* def EXFULL */
1977 {errno = EINVAL; return -1;}
1978 #endif /* ndef EXFULL */
1979 if (x == 0)
1980 return 0;
1981 errno = EINVAL; return -1;
1984 int Mono_Posix_ToErrno (int x, int *r)
1986 *r = 0;
1987 if (x == 0)
1988 return 0;
1989 #ifdef E2BIG
1990 if (x == E2BIG)
1991 {*r = Mono_Posix_Errno_E2BIG; return 0;}
1992 #endif /* ndef E2BIG */
1993 #ifdef EACCES
1994 if (x == EACCES)
1995 {*r = Mono_Posix_Errno_EACCES; return 0;}
1996 #endif /* ndef EACCES */
1997 #ifdef EADDRINUSE
1998 if (x == EADDRINUSE)
1999 {*r = Mono_Posix_Errno_EADDRINUSE; return 0;}
2000 #endif /* ndef EADDRINUSE */
2001 #ifdef EADDRNOTAVAIL
2002 if (x == EADDRNOTAVAIL)
2003 {*r = Mono_Posix_Errno_EADDRNOTAVAIL; return 0;}
2004 #endif /* ndef EADDRNOTAVAIL */
2005 #ifdef EADV
2006 if (x == EADV)
2007 {*r = Mono_Posix_Errno_EADV; return 0;}
2008 #endif /* ndef EADV */
2009 #ifdef EAFNOSUPPORT
2010 if (x == EAFNOSUPPORT)
2011 {*r = Mono_Posix_Errno_EAFNOSUPPORT; return 0;}
2012 #endif /* ndef EAFNOSUPPORT */
2013 #ifdef EAGAIN
2014 if (x == EAGAIN)
2015 {*r = Mono_Posix_Errno_EAGAIN; return 0;}
2016 #endif /* ndef EAGAIN */
2017 #ifdef EALREADY
2018 if (x == EALREADY)
2019 {*r = Mono_Posix_Errno_EALREADY; return 0;}
2020 #endif /* ndef EALREADY */
2021 #ifdef EAUTH
2022 if (x == EAUTH)
2023 {*r = Mono_Posix_Errno_EAUTH; return 0;}
2024 #endif /* ndef EAUTH */
2025 #ifdef EBADARCH
2026 if (x == EBADARCH)
2027 {*r = Mono_Posix_Errno_EBADARCH; return 0;}
2028 #endif /* ndef EBADARCH */
2029 #ifdef EBADE
2030 if (x == EBADE)
2031 {*r = Mono_Posix_Errno_EBADE; return 0;}
2032 #endif /* ndef EBADE */
2033 #ifdef EBADEXEC
2034 if (x == EBADEXEC)
2035 {*r = Mono_Posix_Errno_EBADEXEC; return 0;}
2036 #endif /* ndef EBADEXEC */
2037 #ifdef EBADF
2038 if (x == EBADF)
2039 {*r = Mono_Posix_Errno_EBADF; return 0;}
2040 #endif /* ndef EBADF */
2041 #ifdef EBADFD
2042 if (x == EBADFD)
2043 {*r = Mono_Posix_Errno_EBADFD; return 0;}
2044 #endif /* ndef EBADFD */
2045 #ifdef EBADMACHO
2046 if (x == EBADMACHO)
2047 {*r = Mono_Posix_Errno_EBADMACHO; return 0;}
2048 #endif /* ndef EBADMACHO */
2049 #ifdef EBADMSG
2050 if (x == EBADMSG)
2051 {*r = Mono_Posix_Errno_EBADMSG; return 0;}
2052 #endif /* ndef EBADMSG */
2053 #ifdef EBADR
2054 if (x == EBADR)
2055 {*r = Mono_Posix_Errno_EBADR; return 0;}
2056 #endif /* ndef EBADR */
2057 #ifdef EBADRPC
2058 if (x == EBADRPC)
2059 {*r = Mono_Posix_Errno_EBADRPC; return 0;}
2060 #endif /* ndef EBADRPC */
2061 #ifdef EBADRQC
2062 if (x == EBADRQC)
2063 {*r = Mono_Posix_Errno_EBADRQC; return 0;}
2064 #endif /* ndef EBADRQC */
2065 #ifdef EBADSLT
2066 if (x == EBADSLT)
2067 {*r = Mono_Posix_Errno_EBADSLT; return 0;}
2068 #endif /* ndef EBADSLT */
2069 #ifdef EBFONT
2070 if (x == EBFONT)
2071 {*r = Mono_Posix_Errno_EBFONT; return 0;}
2072 #endif /* ndef EBFONT */
2073 #ifdef EBUSY
2074 if (x == EBUSY)
2075 {*r = Mono_Posix_Errno_EBUSY; return 0;}
2076 #endif /* ndef EBUSY */
2077 #ifdef ECANCELED
2078 if (x == ECANCELED)
2079 {*r = Mono_Posix_Errno_ECANCELED; return 0;}
2080 #endif /* ndef ECANCELED */
2081 #ifdef ECHILD
2082 if (x == ECHILD)
2083 {*r = Mono_Posix_Errno_ECHILD; return 0;}
2084 #endif /* ndef ECHILD */
2085 #ifdef ECHRNG
2086 if (x == ECHRNG)
2087 {*r = Mono_Posix_Errno_ECHRNG; return 0;}
2088 #endif /* ndef ECHRNG */
2089 #ifdef ECOMM
2090 if (x == ECOMM)
2091 {*r = Mono_Posix_Errno_ECOMM; return 0;}
2092 #endif /* ndef ECOMM */
2093 #ifdef ECONNABORTED
2094 if (x == ECONNABORTED)
2095 {*r = Mono_Posix_Errno_ECONNABORTED; return 0;}
2096 #endif /* ndef ECONNABORTED */
2097 #ifdef ECONNREFUSED
2098 if (x == ECONNREFUSED)
2099 {*r = Mono_Posix_Errno_ECONNREFUSED; return 0;}
2100 #endif /* ndef ECONNREFUSED */
2101 #ifdef ECONNRESET
2102 if (x == ECONNRESET)
2103 {*r = Mono_Posix_Errno_ECONNRESET; return 0;}
2104 #endif /* ndef ECONNRESET */
2105 #ifdef EDEADLK
2106 if (x == EDEADLK)
2107 {*r = Mono_Posix_Errno_EDEADLK; return 0;}
2108 #endif /* ndef EDEADLK */
2109 #ifdef EDEADLOCK
2110 if (x == EDEADLOCK)
2111 {*r = Mono_Posix_Errno_EDEADLOCK; return 0;}
2112 #endif /* ndef EDEADLOCK */
2113 #ifdef EDESTADDRREQ
2114 if (x == EDESTADDRREQ)
2115 {*r = Mono_Posix_Errno_EDESTADDRREQ; return 0;}
2116 #endif /* ndef EDESTADDRREQ */
2117 #ifdef EDEVERR
2118 if (x == EDEVERR)
2119 {*r = Mono_Posix_Errno_EDEVERR; return 0;}
2120 #endif /* ndef EDEVERR */
2121 #ifdef EDOM
2122 if (x == EDOM)
2123 {*r = Mono_Posix_Errno_EDOM; return 0;}
2124 #endif /* ndef EDOM */
2125 #ifdef EDOTDOT
2126 if (x == EDOTDOT)
2127 {*r = Mono_Posix_Errno_EDOTDOT; return 0;}
2128 #endif /* ndef EDOTDOT */
2129 #ifdef EDQUOT
2130 if (x == EDQUOT)
2131 {*r = Mono_Posix_Errno_EDQUOT; return 0;}
2132 #endif /* ndef EDQUOT */
2133 #ifdef EEXIST
2134 if (x == EEXIST)
2135 {*r = Mono_Posix_Errno_EEXIST; return 0;}
2136 #endif /* ndef EEXIST */
2137 #ifdef EFAULT
2138 if (x == EFAULT)
2139 {*r = Mono_Posix_Errno_EFAULT; return 0;}
2140 #endif /* ndef EFAULT */
2141 #ifdef EFBIG
2142 if (x == EFBIG)
2143 {*r = Mono_Posix_Errno_EFBIG; return 0;}
2144 #endif /* ndef EFBIG */
2145 #ifdef EFTYPE
2146 if (x == EFTYPE)
2147 {*r = Mono_Posix_Errno_EFTYPE; return 0;}
2148 #endif /* ndef EFTYPE */
2149 #ifdef EHOSTDOWN
2150 if (x == EHOSTDOWN)
2151 {*r = Mono_Posix_Errno_EHOSTDOWN; return 0;}
2152 #endif /* ndef EHOSTDOWN */
2153 #ifdef EHOSTUNREACH
2154 if (x == EHOSTUNREACH)
2155 {*r = Mono_Posix_Errno_EHOSTUNREACH; return 0;}
2156 #endif /* ndef EHOSTUNREACH */
2157 #ifdef EIDRM
2158 if (x == EIDRM)
2159 {*r = Mono_Posix_Errno_EIDRM; return 0;}
2160 #endif /* ndef EIDRM */
2161 #ifdef EILSEQ
2162 if (x == EILSEQ)
2163 {*r = Mono_Posix_Errno_EILSEQ; return 0;}
2164 #endif /* ndef EILSEQ */
2165 #ifdef EINPROGRESS
2166 if (x == EINPROGRESS)
2167 {*r = Mono_Posix_Errno_EINPROGRESS; return 0;}
2168 #endif /* ndef EINPROGRESS */
2169 #ifdef EINTR
2170 if (x == EINTR)
2171 {*r = Mono_Posix_Errno_EINTR; return 0;}
2172 #endif /* ndef EINTR */
2173 #ifdef EINVAL
2174 if (x == EINVAL)
2175 {*r = Mono_Posix_Errno_EINVAL; return 0;}
2176 #endif /* ndef EINVAL */
2177 #ifdef EIO
2178 if (x == EIO)
2179 {*r = Mono_Posix_Errno_EIO; return 0;}
2180 #endif /* ndef EIO */
2181 #ifdef EISCONN
2182 if (x == EISCONN)
2183 {*r = Mono_Posix_Errno_EISCONN; return 0;}
2184 #endif /* ndef EISCONN */
2185 #ifdef EISDIR
2186 if (x == EISDIR)
2187 {*r = Mono_Posix_Errno_EISDIR; return 0;}
2188 #endif /* ndef EISDIR */
2189 #ifdef EISNAM
2190 if (x == EISNAM)
2191 {*r = Mono_Posix_Errno_EISNAM; return 0;}
2192 #endif /* ndef EISNAM */
2193 #ifdef EKEYEXPIRED
2194 if (x == EKEYEXPIRED)
2195 {*r = Mono_Posix_Errno_EKEYEXPIRED; return 0;}
2196 #endif /* ndef EKEYEXPIRED */
2197 #ifdef EKEYREJECTED
2198 if (x == EKEYREJECTED)
2199 {*r = Mono_Posix_Errno_EKEYREJECTED; return 0;}
2200 #endif /* ndef EKEYREJECTED */
2201 #ifdef EKEYREVOKED
2202 if (x == EKEYREVOKED)
2203 {*r = Mono_Posix_Errno_EKEYREVOKED; return 0;}
2204 #endif /* ndef EKEYREVOKED */
2205 #ifdef EL2HLT
2206 if (x == EL2HLT)
2207 {*r = Mono_Posix_Errno_EL2HLT; return 0;}
2208 #endif /* ndef EL2HLT */
2209 #ifdef EL2NSYNC
2210 if (x == EL2NSYNC)
2211 {*r = Mono_Posix_Errno_EL2NSYNC; return 0;}
2212 #endif /* ndef EL2NSYNC */
2213 #ifdef EL3HLT
2214 if (x == EL3HLT)
2215 {*r = Mono_Posix_Errno_EL3HLT; return 0;}
2216 #endif /* ndef EL3HLT */
2217 #ifdef EL3RST
2218 if (x == EL3RST)
2219 {*r = Mono_Posix_Errno_EL3RST; return 0;}
2220 #endif /* ndef EL3RST */
2221 #ifdef ELIBACC
2222 if (x == ELIBACC)
2223 {*r = Mono_Posix_Errno_ELIBACC; return 0;}
2224 #endif /* ndef ELIBACC */
2225 #ifdef ELIBBAD
2226 if (x == ELIBBAD)
2227 {*r = Mono_Posix_Errno_ELIBBAD; return 0;}
2228 #endif /* ndef ELIBBAD */
2229 #ifdef ELIBEXEC
2230 if (x == ELIBEXEC)
2231 {*r = Mono_Posix_Errno_ELIBEXEC; return 0;}
2232 #endif /* ndef ELIBEXEC */
2233 #ifdef ELIBMAX
2234 if (x == ELIBMAX)
2235 {*r = Mono_Posix_Errno_ELIBMAX; return 0;}
2236 #endif /* ndef ELIBMAX */
2237 #ifdef ELIBSCN
2238 if (x == ELIBSCN)
2239 {*r = Mono_Posix_Errno_ELIBSCN; return 0;}
2240 #endif /* ndef ELIBSCN */
2241 #ifdef ELNRNG
2242 if (x == ELNRNG)
2243 {*r = Mono_Posix_Errno_ELNRNG; return 0;}
2244 #endif /* ndef ELNRNG */
2245 #ifdef ELOOP
2246 if (x == ELOOP)
2247 {*r = Mono_Posix_Errno_ELOOP; return 0;}
2248 #endif /* ndef ELOOP */
2249 #ifdef EMEDIUMTYPE
2250 if (x == EMEDIUMTYPE)
2251 {*r = Mono_Posix_Errno_EMEDIUMTYPE; return 0;}
2252 #endif /* ndef EMEDIUMTYPE */
2253 #ifdef EMFILE
2254 if (x == EMFILE)
2255 {*r = Mono_Posix_Errno_EMFILE; return 0;}
2256 #endif /* ndef EMFILE */
2257 #ifdef EMLINK
2258 if (x == EMLINK)
2259 {*r = Mono_Posix_Errno_EMLINK; return 0;}
2260 #endif /* ndef EMLINK */
2261 #ifdef EMSGSIZE
2262 if (x == EMSGSIZE)
2263 {*r = Mono_Posix_Errno_EMSGSIZE; return 0;}
2264 #endif /* ndef EMSGSIZE */
2265 #ifdef EMULTIHOP
2266 if (x == EMULTIHOP)
2267 {*r = Mono_Posix_Errno_EMULTIHOP; return 0;}
2268 #endif /* ndef EMULTIHOP */
2269 #ifdef ENAMETOOLONG
2270 if (x == ENAMETOOLONG)
2271 {*r = Mono_Posix_Errno_ENAMETOOLONG; return 0;}
2272 #endif /* ndef ENAMETOOLONG */
2273 #ifdef ENAVAIL
2274 if (x == ENAVAIL)
2275 {*r = Mono_Posix_Errno_ENAVAIL; return 0;}
2276 #endif /* ndef ENAVAIL */
2277 #ifdef ENEEDAUTH
2278 if (x == ENEEDAUTH)
2279 {*r = Mono_Posix_Errno_ENEEDAUTH; return 0;}
2280 #endif /* ndef ENEEDAUTH */
2281 #ifdef ENETDOWN
2282 if (x == ENETDOWN)
2283 {*r = Mono_Posix_Errno_ENETDOWN; return 0;}
2284 #endif /* ndef ENETDOWN */
2285 #ifdef ENETRESET
2286 if (x == ENETRESET)
2287 {*r = Mono_Posix_Errno_ENETRESET; return 0;}
2288 #endif /* ndef ENETRESET */
2289 #ifdef ENETUNREACH
2290 if (x == ENETUNREACH)
2291 {*r = Mono_Posix_Errno_ENETUNREACH; return 0;}
2292 #endif /* ndef ENETUNREACH */
2293 #ifdef ENFILE
2294 if (x == ENFILE)
2295 {*r = Mono_Posix_Errno_ENFILE; return 0;}
2296 #endif /* ndef ENFILE */
2297 #ifdef ENOANO
2298 if (x == ENOANO)
2299 {*r = Mono_Posix_Errno_ENOANO; return 0;}
2300 #endif /* ndef ENOANO */
2301 #ifdef ENOATTR
2302 if (x == ENOATTR)
2303 {*r = Mono_Posix_Errno_ENOATTR; return 0;}
2304 #endif /* ndef ENOATTR */
2305 #ifdef ENOBUFS
2306 if (x == ENOBUFS)
2307 {*r = Mono_Posix_Errno_ENOBUFS; return 0;}
2308 #endif /* ndef ENOBUFS */
2309 #ifdef ENOCSI
2310 if (x == ENOCSI)
2311 {*r = Mono_Posix_Errno_ENOCSI; return 0;}
2312 #endif /* ndef ENOCSI */
2313 #ifdef ENODATA
2314 if (x == ENODATA)
2315 {*r = Mono_Posix_Errno_ENODATA; return 0;}
2316 #endif /* ndef ENODATA */
2317 #ifdef ENODEV
2318 if (x == ENODEV)
2319 {*r = Mono_Posix_Errno_ENODEV; return 0;}
2320 #endif /* ndef ENODEV */
2321 #ifdef ENOENT
2322 if (x == ENOENT)
2323 {*r = Mono_Posix_Errno_ENOENT; return 0;}
2324 #endif /* ndef ENOENT */
2325 #ifdef ENOEXEC
2326 if (x == ENOEXEC)
2327 {*r = Mono_Posix_Errno_ENOEXEC; return 0;}
2328 #endif /* ndef ENOEXEC */
2329 #ifdef ENOKEY
2330 if (x == ENOKEY)
2331 {*r = Mono_Posix_Errno_ENOKEY; return 0;}
2332 #endif /* ndef ENOKEY */
2333 #ifdef ENOLCK
2334 if (x == ENOLCK)
2335 {*r = Mono_Posix_Errno_ENOLCK; return 0;}
2336 #endif /* ndef ENOLCK */
2337 #ifdef ENOLINK
2338 if (x == ENOLINK)
2339 {*r = Mono_Posix_Errno_ENOLINK; return 0;}
2340 #endif /* ndef ENOLINK */
2341 #ifdef ENOMEDIUM
2342 if (x == ENOMEDIUM)
2343 {*r = Mono_Posix_Errno_ENOMEDIUM; return 0;}
2344 #endif /* ndef ENOMEDIUM */
2345 #ifdef ENOMEM
2346 if (x == ENOMEM)
2347 {*r = Mono_Posix_Errno_ENOMEM; return 0;}
2348 #endif /* ndef ENOMEM */
2349 #ifdef ENOMSG
2350 if (x == ENOMSG)
2351 {*r = Mono_Posix_Errno_ENOMSG; return 0;}
2352 #endif /* ndef ENOMSG */
2353 #ifdef ENONET
2354 if (x == ENONET)
2355 {*r = Mono_Posix_Errno_ENONET; return 0;}
2356 #endif /* ndef ENONET */
2357 #ifdef ENOPKG
2358 if (x == ENOPKG)
2359 {*r = Mono_Posix_Errno_ENOPKG; return 0;}
2360 #endif /* ndef ENOPKG */
2361 #ifdef ENOPOLICY
2362 if (x == ENOPOLICY)
2363 {*r = Mono_Posix_Errno_ENOPOLICY; return 0;}
2364 #endif /* ndef ENOPOLICY */
2365 #ifdef ENOPROTOOPT
2366 if (x == ENOPROTOOPT)
2367 {*r = Mono_Posix_Errno_ENOPROTOOPT; return 0;}
2368 #endif /* ndef ENOPROTOOPT */
2369 #ifdef ENOSPC
2370 if (x == ENOSPC)
2371 {*r = Mono_Posix_Errno_ENOSPC; return 0;}
2372 #endif /* ndef ENOSPC */
2373 #ifdef ENOSR
2374 if (x == ENOSR)
2375 {*r = Mono_Posix_Errno_ENOSR; return 0;}
2376 #endif /* ndef ENOSR */
2377 #ifdef ENOSTR
2378 if (x == ENOSTR)
2379 {*r = Mono_Posix_Errno_ENOSTR; return 0;}
2380 #endif /* ndef ENOSTR */
2381 #ifdef ENOSYS
2382 if (x == ENOSYS)
2383 {*r = Mono_Posix_Errno_ENOSYS; return 0;}
2384 #endif /* ndef ENOSYS */
2385 #ifdef ENOTBLK
2386 if (x == ENOTBLK)
2387 {*r = Mono_Posix_Errno_ENOTBLK; return 0;}
2388 #endif /* ndef ENOTBLK */
2389 #ifdef ENOTCONN
2390 if (x == ENOTCONN)
2391 {*r = Mono_Posix_Errno_ENOTCONN; return 0;}
2392 #endif /* ndef ENOTCONN */
2393 #ifdef ENOTDIR
2394 if (x == ENOTDIR)
2395 {*r = Mono_Posix_Errno_ENOTDIR; return 0;}
2396 #endif /* ndef ENOTDIR */
2397 #ifdef ENOTEMPTY
2398 if (x == ENOTEMPTY)
2399 {*r = Mono_Posix_Errno_ENOTEMPTY; return 0;}
2400 #endif /* ndef ENOTEMPTY */
2401 #ifdef ENOTNAM
2402 if (x == ENOTNAM)
2403 {*r = Mono_Posix_Errno_ENOTNAM; return 0;}
2404 #endif /* ndef ENOTNAM */
2405 #ifdef ENOTRECOVERABLE
2406 if (x == ENOTRECOVERABLE)
2407 {*r = Mono_Posix_Errno_ENOTRECOVERABLE; return 0;}
2408 #endif /* ndef ENOTRECOVERABLE */
2409 #ifdef ENOTSOCK
2410 if (x == ENOTSOCK)
2411 {*r = Mono_Posix_Errno_ENOTSOCK; return 0;}
2412 #endif /* ndef ENOTSOCK */
2413 #ifdef ENOTTY
2414 if (x == ENOTTY)
2415 {*r = Mono_Posix_Errno_ENOTTY; return 0;}
2416 #endif /* ndef ENOTTY */
2417 #ifdef ENOTUNIQ
2418 if (x == ENOTUNIQ)
2419 {*r = Mono_Posix_Errno_ENOTUNIQ; return 0;}
2420 #endif /* ndef ENOTUNIQ */
2421 #ifdef ENXIO
2422 if (x == ENXIO)
2423 {*r = Mono_Posix_Errno_ENXIO; return 0;}
2424 #endif /* ndef ENXIO */
2425 #ifdef EOPNOTSUPP
2426 if (x == EOPNOTSUPP)
2427 {*r = Mono_Posix_Errno_EOPNOTSUPP; return 0;}
2428 #endif /* ndef EOPNOTSUPP */
2429 #ifdef EOVERFLOW
2430 if (x == EOVERFLOW)
2431 {*r = Mono_Posix_Errno_EOVERFLOW; return 0;}
2432 #endif /* ndef EOVERFLOW */
2433 #ifdef EOWNERDEAD
2434 if (x == EOWNERDEAD)
2435 {*r = Mono_Posix_Errno_EOWNERDEAD; return 0;}
2436 #endif /* ndef EOWNERDEAD */
2437 #ifdef EPERM
2438 if (x == EPERM)
2439 {*r = Mono_Posix_Errno_EPERM; return 0;}
2440 #endif /* ndef EPERM */
2441 #ifdef EPFNOSUPPORT
2442 if (x == EPFNOSUPPORT)
2443 {*r = Mono_Posix_Errno_EPFNOSUPPORT; return 0;}
2444 #endif /* ndef EPFNOSUPPORT */
2445 #ifdef EPIPE
2446 if (x == EPIPE)
2447 {*r = Mono_Posix_Errno_EPIPE; return 0;}
2448 #endif /* ndef EPIPE */
2449 #ifdef EPROCLIM
2450 if (x == EPROCLIM)
2451 {*r = Mono_Posix_Errno_EPROCLIM; return 0;}
2452 #endif /* ndef EPROCLIM */
2453 #ifdef EPROCUNAVAIL
2454 if (x == EPROCUNAVAIL)
2455 {*r = Mono_Posix_Errno_EPROCUNAVAIL; return 0;}
2456 #endif /* ndef EPROCUNAVAIL */
2457 #ifdef EPROGMISMATCH
2458 if (x == EPROGMISMATCH)
2459 {*r = Mono_Posix_Errno_EPROGMISMATCH; return 0;}
2460 #endif /* ndef EPROGMISMATCH */
2461 #ifdef EPROGUNAVAIL
2462 if (x == EPROGUNAVAIL)
2463 {*r = Mono_Posix_Errno_EPROGUNAVAIL; return 0;}
2464 #endif /* ndef EPROGUNAVAIL */
2465 #ifdef EPROTO
2466 if (x == EPROTO)
2467 {*r = Mono_Posix_Errno_EPROTO; return 0;}
2468 #endif /* ndef EPROTO */
2469 #ifdef EPROTONOSUPPORT
2470 if (x == EPROTONOSUPPORT)
2471 {*r = Mono_Posix_Errno_EPROTONOSUPPORT; return 0;}
2472 #endif /* ndef EPROTONOSUPPORT */
2473 #ifdef EPROTOTYPE
2474 if (x == EPROTOTYPE)
2475 {*r = Mono_Posix_Errno_EPROTOTYPE; return 0;}
2476 #endif /* ndef EPROTOTYPE */
2477 #ifdef EPWROFF
2478 if (x == EPWROFF)
2479 {*r = Mono_Posix_Errno_EPWROFF; return 0;}
2480 #endif /* ndef EPWROFF */
2481 #ifdef ERANGE
2482 if (x == ERANGE)
2483 {*r = Mono_Posix_Errno_ERANGE; return 0;}
2484 #endif /* ndef ERANGE */
2485 #ifdef EREMCHG
2486 if (x == EREMCHG)
2487 {*r = Mono_Posix_Errno_EREMCHG; return 0;}
2488 #endif /* ndef EREMCHG */
2489 #ifdef EREMOTE
2490 if (x == EREMOTE)
2491 {*r = Mono_Posix_Errno_EREMOTE; return 0;}
2492 #endif /* ndef EREMOTE */
2493 #ifdef EREMOTEIO
2494 if (x == EREMOTEIO)
2495 {*r = Mono_Posix_Errno_EREMOTEIO; return 0;}
2496 #endif /* ndef EREMOTEIO */
2497 #ifdef ERESTART
2498 if (x == ERESTART)
2499 {*r = Mono_Posix_Errno_ERESTART; return 0;}
2500 #endif /* ndef ERESTART */
2501 #ifdef EROFS
2502 if (x == EROFS)
2503 {*r = Mono_Posix_Errno_EROFS; return 0;}
2504 #endif /* ndef EROFS */
2505 #ifdef ERPCMISMATCH
2506 if (x == ERPCMISMATCH)
2507 {*r = Mono_Posix_Errno_ERPCMISMATCH; return 0;}
2508 #endif /* ndef ERPCMISMATCH */
2509 #ifdef ESHLIBVERS
2510 if (x == ESHLIBVERS)
2511 {*r = Mono_Posix_Errno_ESHLIBVERS; return 0;}
2512 #endif /* ndef ESHLIBVERS */
2513 #ifdef ESHUTDOWN
2514 if (x == ESHUTDOWN)
2515 {*r = Mono_Posix_Errno_ESHUTDOWN; return 0;}
2516 #endif /* ndef ESHUTDOWN */
2517 #ifdef ESOCKTNOSUPPORT
2518 if (x == ESOCKTNOSUPPORT)
2519 {*r = Mono_Posix_Errno_ESOCKTNOSUPPORT; return 0;}
2520 #endif /* ndef ESOCKTNOSUPPORT */
2521 #ifdef ESPIPE
2522 if (x == ESPIPE)
2523 {*r = Mono_Posix_Errno_ESPIPE; return 0;}
2524 #endif /* ndef ESPIPE */
2525 #ifdef ESRCH
2526 if (x == ESRCH)
2527 {*r = Mono_Posix_Errno_ESRCH; return 0;}
2528 #endif /* ndef ESRCH */
2529 #ifdef ESRMNT
2530 if (x == ESRMNT)
2531 {*r = Mono_Posix_Errno_ESRMNT; return 0;}
2532 #endif /* ndef ESRMNT */
2533 #ifdef ESTALE
2534 if (x == ESTALE)
2535 {*r = Mono_Posix_Errno_ESTALE; return 0;}
2536 #endif /* ndef ESTALE */
2537 #ifdef ESTRPIPE
2538 if (x == ESTRPIPE)
2539 {*r = Mono_Posix_Errno_ESTRPIPE; return 0;}
2540 #endif /* ndef ESTRPIPE */
2541 #ifdef ETIME
2542 if (x == ETIME)
2543 {*r = Mono_Posix_Errno_ETIME; return 0;}
2544 #endif /* ndef ETIME */
2545 #ifdef ETIMEDOUT
2546 if (x == ETIMEDOUT)
2547 {*r = Mono_Posix_Errno_ETIMEDOUT; return 0;}
2548 #endif /* ndef ETIMEDOUT */
2549 #ifdef ETOOMANYREFS
2550 if (x == ETOOMANYREFS)
2551 {*r = Mono_Posix_Errno_ETOOMANYREFS; return 0;}
2552 #endif /* ndef ETOOMANYREFS */
2553 #ifdef ETXTBSY
2554 if (x == ETXTBSY)
2555 {*r = Mono_Posix_Errno_ETXTBSY; return 0;}
2556 #endif /* ndef ETXTBSY */
2557 #ifdef EUCLEAN
2558 if (x == EUCLEAN)
2559 {*r = Mono_Posix_Errno_EUCLEAN; return 0;}
2560 #endif /* ndef EUCLEAN */
2561 #ifdef EUNATCH
2562 if (x == EUNATCH)
2563 {*r = Mono_Posix_Errno_EUNATCH; return 0;}
2564 #endif /* ndef EUNATCH */
2565 #ifdef EUSERS
2566 if (x == EUSERS)
2567 {*r = Mono_Posix_Errno_EUSERS; return 0;}
2568 #endif /* ndef EUSERS */
2569 #ifdef EWOULDBLOCK
2570 if (x == EWOULDBLOCK)
2571 {*r = Mono_Posix_Errno_EWOULDBLOCK; return 0;}
2572 #endif /* ndef EWOULDBLOCK */
2573 #ifdef EXDEV
2574 if (x == EXDEV)
2575 {*r = Mono_Posix_Errno_EXDEV; return 0;}
2576 #endif /* ndef EXDEV */
2577 #ifdef EXFULL
2578 if (x == EXFULL)
2579 {*r = Mono_Posix_Errno_EXFULL; return 0;}
2580 #endif /* ndef EXFULL */
2581 errno = EINVAL; return -1;
2584 int Mono_Posix_FromFcntlCommand (int x, int *r)
2586 *r = 0;
2587 if (x == Mono_Posix_FcntlCommand_F_DUPFD)
2588 #ifdef F_DUPFD
2589 {*r = F_DUPFD; return 0;}
2590 #else /* def F_DUPFD */
2591 {errno = EINVAL; return -1;}
2592 #endif /* ndef F_DUPFD */
2593 if (x == Mono_Posix_FcntlCommand_F_GETFD)
2594 #ifdef F_GETFD
2595 {*r = F_GETFD; return 0;}
2596 #else /* def F_GETFD */
2597 {errno = EINVAL; return -1;}
2598 #endif /* ndef F_GETFD */
2599 if (x == Mono_Posix_FcntlCommand_F_GETFL)
2600 #ifdef F_GETFL
2601 {*r = F_GETFL; return 0;}
2602 #else /* def F_GETFL */
2603 {errno = EINVAL; return -1;}
2604 #endif /* ndef F_GETFL */
2605 if (x == Mono_Posix_FcntlCommand_F_GETLEASE)
2606 #ifdef F_GETLEASE
2607 {*r = F_GETLEASE; return 0;}
2608 #else /* def F_GETLEASE */
2609 {errno = EINVAL; return -1;}
2610 #endif /* ndef F_GETLEASE */
2611 if (x == Mono_Posix_FcntlCommand_F_GETLK)
2612 #ifdef F_GETLK
2613 {*r = F_GETLK; return 0;}
2614 #else /* def F_GETLK */
2615 {errno = EINVAL; return -1;}
2616 #endif /* ndef F_GETLK */
2617 if (x == Mono_Posix_FcntlCommand_F_GETOWN)
2618 #ifdef F_GETOWN
2619 {*r = F_GETOWN; return 0;}
2620 #else /* def F_GETOWN */
2621 {errno = EINVAL; return -1;}
2622 #endif /* ndef F_GETOWN */
2623 if (x == Mono_Posix_FcntlCommand_F_GETSIG)
2624 #ifdef F_GETSIG
2625 {*r = F_GETSIG; return 0;}
2626 #else /* def F_GETSIG */
2627 {errno = EINVAL; return -1;}
2628 #endif /* ndef F_GETSIG */
2629 if (x == Mono_Posix_FcntlCommand_F_NOTIFY)
2630 #ifdef F_NOTIFY
2631 {*r = F_NOTIFY; return 0;}
2632 #else /* def F_NOTIFY */
2633 {errno = EINVAL; return -1;}
2634 #endif /* ndef F_NOTIFY */
2635 if (x == Mono_Posix_FcntlCommand_F_SETFD)
2636 #ifdef F_SETFD
2637 {*r = F_SETFD; return 0;}
2638 #else /* def F_SETFD */
2639 {errno = EINVAL; return -1;}
2640 #endif /* ndef F_SETFD */
2641 if (x == Mono_Posix_FcntlCommand_F_SETFL)
2642 #ifdef F_SETFL
2643 {*r = F_SETFL; return 0;}
2644 #else /* def F_SETFL */
2645 {errno = EINVAL; return -1;}
2646 #endif /* ndef F_SETFL */
2647 if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
2648 #ifdef F_SETLEASE
2649 {*r = F_SETLEASE; return 0;}
2650 #else /* def F_SETLEASE */
2651 {errno = EINVAL; return -1;}
2652 #endif /* ndef F_SETLEASE */
2653 if (x == Mono_Posix_FcntlCommand_F_SETLK)
2654 #ifdef F_SETLK
2655 {*r = F_SETLK; return 0;}
2656 #else /* def F_SETLK */
2657 {errno = EINVAL; return -1;}
2658 #endif /* ndef F_SETLK */
2659 if (x == Mono_Posix_FcntlCommand_F_SETLKW)
2660 #ifdef F_SETLKW
2661 {*r = F_SETLKW; return 0;}
2662 #else /* def F_SETLKW */
2663 {errno = EINVAL; return -1;}
2664 #endif /* ndef F_SETLKW */
2665 if (x == Mono_Posix_FcntlCommand_F_SETOWN)
2666 #ifdef F_SETOWN
2667 {*r = F_SETOWN; return 0;}
2668 #else /* def F_SETOWN */
2669 {errno = EINVAL; return -1;}
2670 #endif /* ndef F_SETOWN */
2671 if (x == Mono_Posix_FcntlCommand_F_SETSIG)
2672 #ifdef F_SETSIG
2673 {*r = F_SETSIG; return 0;}
2674 #else /* def F_SETSIG */
2675 {errno = EINVAL; return -1;}
2676 #endif /* ndef F_SETSIG */
2677 if (x == 0)
2678 return 0;
2679 errno = EINVAL; return -1;
2682 int Mono_Posix_ToFcntlCommand (int x, int *r)
2684 *r = 0;
2685 if (x == 0)
2686 return 0;
2687 #ifdef F_DUPFD
2688 if (x == F_DUPFD)
2689 {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
2690 #endif /* ndef F_DUPFD */
2691 #ifdef F_GETFD
2692 if (x == F_GETFD)
2693 {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
2694 #endif /* ndef F_GETFD */
2695 #ifdef F_GETFL
2696 if (x == F_GETFL)
2697 {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
2698 #endif /* ndef F_GETFL */
2699 #ifdef F_GETLEASE
2700 if (x == F_GETLEASE)
2701 {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
2702 #endif /* ndef F_GETLEASE */
2703 #ifdef F_GETLK
2704 if (x == F_GETLK)
2705 {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
2706 #endif /* ndef F_GETLK */
2707 #ifdef F_GETOWN
2708 if (x == F_GETOWN)
2709 {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
2710 #endif /* ndef F_GETOWN */
2711 #ifdef F_GETSIG
2712 if (x == F_GETSIG)
2713 {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
2714 #endif /* ndef F_GETSIG */
2715 #ifdef F_NOTIFY
2716 if (x == F_NOTIFY)
2717 {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
2718 #endif /* ndef F_NOTIFY */
2719 #ifdef F_SETFD
2720 if (x == F_SETFD)
2721 {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
2722 #endif /* ndef F_SETFD */
2723 #ifdef F_SETFL
2724 if (x == F_SETFL)
2725 {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
2726 #endif /* ndef F_SETFL */
2727 #ifdef F_SETLEASE
2728 if (x == F_SETLEASE)
2729 {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
2730 #endif /* ndef F_SETLEASE */
2731 #ifdef F_SETLK
2732 if (x == F_SETLK)
2733 {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
2734 #endif /* ndef F_SETLK */
2735 #ifdef F_SETLKW
2736 if (x == F_SETLKW)
2737 {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
2738 #endif /* ndef F_SETLKW */
2739 #ifdef F_SETOWN
2740 if (x == F_SETOWN)
2741 {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
2742 #endif /* ndef F_SETOWN */
2743 #ifdef F_SETSIG
2744 if (x == F_SETSIG)
2745 {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
2746 #endif /* ndef F_SETSIG */
2747 errno = EINVAL; return -1;
2750 int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
2752 *r = 0;
2753 if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
2754 #ifdef ACCESSPERMS
2755 *r |= ACCESSPERMS;
2756 #else /* def ACCESSPERMS */
2757 {/* Ignoring Mono_Posix_FilePermissions_ACCESSPERMS, as it is constructed from other values */}
2758 #endif /* ndef ACCESSPERMS */
2759 if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
2760 #ifdef ALLPERMS
2761 *r |= ALLPERMS;
2762 #else /* def ALLPERMS */
2763 {/* Ignoring Mono_Posix_FilePermissions_ALLPERMS, as it is constructed from other values */}
2764 #endif /* ndef ALLPERMS */
2765 if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
2766 #ifdef DEFFILEMODE
2767 *r |= DEFFILEMODE;
2768 #else /* def DEFFILEMODE */
2769 {/* Ignoring Mono_Posix_FilePermissions_DEFFILEMODE, as it is constructed from other values */}
2770 #endif /* ndef DEFFILEMODE */
2771 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFBLK)
2772 #ifdef S_IFBLK
2773 *r |= S_IFBLK;
2774 #else /* def S_IFBLK */
2775 {errno = EINVAL; return -1;}
2776 #endif /* ndef S_IFBLK */
2777 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFCHR)
2778 #ifdef S_IFCHR
2779 *r |= S_IFCHR;
2780 #else /* def S_IFCHR */
2781 {errno = EINVAL; return -1;}
2782 #endif /* ndef S_IFCHR */
2783 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFDIR)
2784 #ifdef S_IFDIR
2785 *r |= S_IFDIR;
2786 #else /* def S_IFDIR */
2787 {errno = EINVAL; return -1;}
2788 #endif /* ndef S_IFDIR */
2789 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFIFO)
2790 #ifdef S_IFIFO
2791 *r |= S_IFIFO;
2792 #else /* def S_IFIFO */
2793 {errno = EINVAL; return -1;}
2794 #endif /* ndef S_IFIFO */
2795 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFLNK)
2796 #ifdef S_IFLNK
2797 *r |= S_IFLNK;
2798 #else /* def S_IFLNK */
2799 {errno = EINVAL; return -1;}
2800 #endif /* ndef S_IFLNK */
2801 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
2802 #ifdef S_IFMT
2803 *r |= S_IFMT;
2804 #else /* def S_IFMT */
2805 {/* Ignoring Mono_Posix_FilePermissions_S_IFMT, as it is constructed from other values */}
2806 #endif /* ndef S_IFMT */
2807 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFREG)
2808 #ifdef S_IFREG
2809 *r |= S_IFREG;
2810 #else /* def S_IFREG */
2811 {errno = EINVAL; return -1;}
2812 #endif /* ndef S_IFREG */
2813 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFSOCK)
2814 #ifdef S_IFSOCK
2815 *r |= S_IFSOCK;
2816 #else /* def S_IFSOCK */
2817 {errno = EINVAL; return -1;}
2818 #endif /* ndef S_IFSOCK */
2819 if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
2820 #ifdef S_IRGRP
2821 *r |= S_IRGRP;
2822 #else /* def S_IRGRP */
2823 {errno = EINVAL; return -1;}
2824 #endif /* ndef S_IRGRP */
2825 if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
2826 #ifdef S_IROTH
2827 *r |= S_IROTH;
2828 #else /* def S_IROTH */
2829 {errno = EINVAL; return -1;}
2830 #endif /* ndef S_IROTH */
2831 if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
2832 #ifdef S_IRUSR
2833 *r |= S_IRUSR;
2834 #else /* def S_IRUSR */
2835 {errno = EINVAL; return -1;}
2836 #endif /* ndef S_IRUSR */
2837 if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
2838 #ifdef S_IRWXG
2839 *r |= S_IRWXG;
2840 #else /* def S_IRWXG */
2841 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXG, as it is constructed from other values */}
2842 #endif /* ndef S_IRWXG */
2843 if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
2844 #ifdef S_IRWXO
2845 *r |= S_IRWXO;
2846 #else /* def S_IRWXO */
2847 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXO, as it is constructed from other values */}
2848 #endif /* ndef S_IRWXO */
2849 if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
2850 #ifdef S_IRWXU
2851 *r |= S_IRWXU;
2852 #else /* def S_IRWXU */
2853 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXU, as it is constructed from other values */}
2854 #endif /* ndef S_IRWXU */
2855 if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
2856 #ifdef S_ISGID
2857 *r |= S_ISGID;
2858 #else /* def S_ISGID */
2859 {errno = EINVAL; return -1;}
2860 #endif /* ndef S_ISGID */
2861 if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
2862 #ifdef S_ISUID
2863 *r |= S_ISUID;
2864 #else /* def S_ISUID */
2865 {errno = EINVAL; return -1;}
2866 #endif /* ndef S_ISUID */
2867 if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
2868 #ifdef S_ISVTX
2869 *r |= S_ISVTX;
2870 #else /* def S_ISVTX */
2871 {errno = EINVAL; return -1;}
2872 #endif /* ndef S_ISVTX */
2873 if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
2874 #ifdef S_IWGRP
2875 *r |= S_IWGRP;
2876 #else /* def S_IWGRP */
2877 {errno = EINVAL; return -1;}
2878 #endif /* ndef S_IWGRP */
2879 if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
2880 #ifdef S_IWOTH
2881 *r |= S_IWOTH;
2882 #else /* def S_IWOTH */
2883 {errno = EINVAL; return -1;}
2884 #endif /* ndef S_IWOTH */
2885 if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
2886 #ifdef S_IWUSR
2887 *r |= S_IWUSR;
2888 #else /* def S_IWUSR */
2889 {errno = EINVAL; return -1;}
2890 #endif /* ndef S_IWUSR */
2891 if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
2892 #ifdef S_IXGRP
2893 *r |= S_IXGRP;
2894 #else /* def S_IXGRP */
2895 {errno = EINVAL; return -1;}
2896 #endif /* ndef S_IXGRP */
2897 if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
2898 #ifdef S_IXOTH
2899 *r |= S_IXOTH;
2900 #else /* def S_IXOTH */
2901 {errno = EINVAL; return -1;}
2902 #endif /* ndef S_IXOTH */
2903 if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
2904 #ifdef S_IXUSR
2905 *r |= S_IXUSR;
2906 #else /* def S_IXUSR */
2907 {errno = EINVAL; return -1;}
2908 #endif /* ndef S_IXUSR */
2909 if (x == 0)
2910 return 0;
2911 return 0;
2914 int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
2916 *r = 0;
2917 if (x == 0)
2918 return 0;
2919 #ifdef ACCESSPERMS
2920 if ((x & ACCESSPERMS) == ACCESSPERMS)
2921 *r |= Mono_Posix_FilePermissions_ACCESSPERMS;
2922 #endif /* ndef ACCESSPERMS */
2923 #ifdef ALLPERMS
2924 if ((x & ALLPERMS) == ALLPERMS)
2925 *r |= Mono_Posix_FilePermissions_ALLPERMS;
2926 #endif /* ndef ALLPERMS */
2927 #ifdef DEFFILEMODE
2928 if ((x & DEFFILEMODE) == DEFFILEMODE)
2929 *r |= Mono_Posix_FilePermissions_DEFFILEMODE;
2930 #endif /* ndef DEFFILEMODE */
2931 #ifdef S_IFBLK
2932 if ((x & S_IFMT) == S_IFBLK)
2933 *r |= Mono_Posix_FilePermissions_S_IFBLK;
2934 #endif /* ndef S_IFBLK */
2935 #ifdef S_IFCHR
2936 if ((x & S_IFMT) == S_IFCHR)
2937 *r |= Mono_Posix_FilePermissions_S_IFCHR;
2938 #endif /* ndef S_IFCHR */
2939 #ifdef S_IFDIR
2940 if ((x & S_IFMT) == S_IFDIR)
2941 *r |= Mono_Posix_FilePermissions_S_IFDIR;
2942 #endif /* ndef S_IFDIR */
2943 #ifdef S_IFIFO
2944 if ((x & S_IFMT) == S_IFIFO)
2945 *r |= Mono_Posix_FilePermissions_S_IFIFO;
2946 #endif /* ndef S_IFIFO */
2947 #ifdef S_IFLNK
2948 if ((x & S_IFMT) == S_IFLNK)
2949 *r |= Mono_Posix_FilePermissions_S_IFLNK;
2950 #endif /* ndef S_IFLNK */
2951 #ifdef S_IFMT
2952 if ((x & S_IFMT) == S_IFMT)
2953 *r |= Mono_Posix_FilePermissions_S_IFMT;
2954 #endif /* ndef S_IFMT */
2955 #ifdef S_IFREG
2956 if ((x & S_IFMT) == S_IFREG)
2957 *r |= Mono_Posix_FilePermissions_S_IFREG;
2958 #endif /* ndef S_IFREG */
2959 #ifdef S_IFSOCK
2960 if ((x & S_IFMT) == S_IFSOCK)
2961 *r |= Mono_Posix_FilePermissions_S_IFSOCK;
2962 #endif /* ndef S_IFSOCK */
2963 #ifdef S_IRGRP
2964 if ((x & S_IRGRP) == S_IRGRP)
2965 *r |= Mono_Posix_FilePermissions_S_IRGRP;
2966 #endif /* ndef S_IRGRP */
2967 #ifdef S_IROTH
2968 if ((x & S_IROTH) == S_IROTH)
2969 *r |= Mono_Posix_FilePermissions_S_IROTH;
2970 #endif /* ndef S_IROTH */
2971 #ifdef S_IRUSR
2972 if ((x & S_IRUSR) == S_IRUSR)
2973 *r |= Mono_Posix_FilePermissions_S_IRUSR;
2974 #endif /* ndef S_IRUSR */
2975 #ifdef S_IRWXG
2976 if ((x & S_IRWXG) == S_IRWXG)
2977 *r |= Mono_Posix_FilePermissions_S_IRWXG;
2978 #endif /* ndef S_IRWXG */
2979 #ifdef S_IRWXO
2980 if ((x & S_IRWXO) == S_IRWXO)
2981 *r |= Mono_Posix_FilePermissions_S_IRWXO;
2982 #endif /* ndef S_IRWXO */
2983 #ifdef S_IRWXU
2984 if ((x & S_IRWXU) == S_IRWXU)
2985 *r |= Mono_Posix_FilePermissions_S_IRWXU;
2986 #endif /* ndef S_IRWXU */
2987 #ifdef S_ISGID
2988 if ((x & S_ISGID) == S_ISGID)
2989 *r |= Mono_Posix_FilePermissions_S_ISGID;
2990 #endif /* ndef S_ISGID */
2991 #ifdef S_ISUID
2992 if ((x & S_ISUID) == S_ISUID)
2993 *r |= Mono_Posix_FilePermissions_S_ISUID;
2994 #endif /* ndef S_ISUID */
2995 #ifdef S_ISVTX
2996 if ((x & S_ISVTX) == S_ISVTX)
2997 *r |= Mono_Posix_FilePermissions_S_ISVTX;
2998 #endif /* ndef S_ISVTX */
2999 #ifdef S_IWGRP
3000 if ((x & S_IWGRP) == S_IWGRP)
3001 *r |= Mono_Posix_FilePermissions_S_IWGRP;
3002 #endif /* ndef S_IWGRP */
3003 #ifdef S_IWOTH
3004 if ((x & S_IWOTH) == S_IWOTH)
3005 *r |= Mono_Posix_FilePermissions_S_IWOTH;
3006 #endif /* ndef S_IWOTH */
3007 #ifdef S_IWUSR
3008 if ((x & S_IWUSR) == S_IWUSR)
3009 *r |= Mono_Posix_FilePermissions_S_IWUSR;
3010 #endif /* ndef S_IWUSR */
3011 #ifdef S_IXGRP
3012 if ((x & S_IXGRP) == S_IXGRP)
3013 *r |= Mono_Posix_FilePermissions_S_IXGRP;
3014 #endif /* ndef S_IXGRP */
3015 #ifdef S_IXOTH
3016 if ((x & S_IXOTH) == S_IXOTH)
3017 *r |= Mono_Posix_FilePermissions_S_IXOTH;
3018 #endif /* ndef S_IXOTH */
3019 #ifdef S_IXUSR
3020 if ((x & S_IXUSR) == S_IXUSR)
3021 *r |= Mono_Posix_FilePermissions_S_IXUSR;
3022 #endif /* ndef S_IXUSR */
3023 return 0;
3026 #ifdef HAVE_STRUCT_FLOCK
3028 Mono_Posix_FromFlock (struct Mono_Posix_Flock *from, struct flock *to)
3030 _cnm_return_val_if_overflow (off_t, from->l_start, -1);
3031 _cnm_return_val_if_overflow (off_t, from->l_len, -1);
3032 _cnm_return_val_if_overflow (pid_t, from->l_pid, -1);
3034 memset (to, 0, sizeof(*to));
3036 if (Mono_Posix_FromLockType (from->l_type, &to->l_type) != 0) {
3037 return -1;
3039 if (Mono_Posix_FromSeekFlags (from->l_whence, &to->l_whence) != 0) {
3040 return -1;
3042 to->l_start = from->l_start;
3043 to->l_len = from->l_len;
3044 to->l_pid = from->l_pid;
3046 return 0;
3048 #endif /* ndef HAVE_STRUCT_FLOCK */
3051 #ifdef HAVE_STRUCT_FLOCK
3053 Mono_Posix_ToFlock (struct flock *from, struct Mono_Posix_Flock *to)
3055 _cnm_return_val_if_overflow (gint64, from->l_start, -1);
3056 _cnm_return_val_if_overflow (gint64, from->l_len, -1);
3057 _cnm_return_val_if_overflow (int, from->l_pid, -1);
3059 memset (to, 0, sizeof(*to));
3061 if (Mono_Posix_ToLockType (from->l_type, &to->l_type) != 0) {
3062 return -1;
3064 if (Mono_Posix_ToSeekFlags (from->l_whence, &to->l_whence) != 0) {
3065 return -1;
3067 to->l_start = from->l_start;
3068 to->l_len = from->l_len;
3069 to->l_pid = from->l_pid;
3071 return 0;
3073 #endif /* ndef HAVE_STRUCT_FLOCK */
3076 #ifdef HAVE_STRUCT_IOVEC
3078 Mono_Posix_FromIovec (struct Mono_Posix_Iovec *from, struct iovec *to)
3080 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3082 memset (to, 0, sizeof(*to));
3084 to->iov_base = from->iov_base;
3085 to->iov_len = from->iov_len;
3087 return 0;
3089 #endif /* ndef HAVE_STRUCT_IOVEC */
3092 #ifdef HAVE_STRUCT_IOVEC
3094 Mono_Posix_ToIovec (struct iovec *from, struct Mono_Posix_Iovec *to)
3096 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3098 memset (to, 0, sizeof(*to));
3100 to->iov_base = from->iov_base;
3101 to->iov_len = from->iov_len;
3103 return 0;
3105 #endif /* ndef HAVE_STRUCT_IOVEC */
3108 int Mono_Posix_FromLockType (short x, short *r)
3110 *r = 0;
3111 if (x == Mono_Posix_LockType_F_RDLCK)
3112 #ifdef F_RDLCK
3113 {*r = F_RDLCK; return 0;}
3114 #else /* def F_RDLCK */
3115 {errno = EINVAL; return -1;}
3116 #endif /* ndef F_RDLCK */
3117 if (x == Mono_Posix_LockType_F_UNLCK)
3118 #ifdef F_UNLCK
3119 {*r = F_UNLCK; return 0;}
3120 #else /* def F_UNLCK */
3121 {errno = EINVAL; return -1;}
3122 #endif /* ndef F_UNLCK */
3123 if (x == Mono_Posix_LockType_F_WRLCK)
3124 #ifdef F_WRLCK
3125 {*r = F_WRLCK; return 0;}
3126 #else /* def F_WRLCK */
3127 {errno = EINVAL; return -1;}
3128 #endif /* ndef F_WRLCK */
3129 if (x == 0)
3130 return 0;
3131 errno = EINVAL; return -1;
3134 int Mono_Posix_ToLockType (short x, short *r)
3136 *r = 0;
3137 if (x == 0)
3138 return 0;
3139 #ifdef F_RDLCK
3140 if (x == F_RDLCK)
3141 {*r = Mono_Posix_LockType_F_RDLCK; return 0;}
3142 #endif /* ndef F_RDLCK */
3143 #ifdef F_UNLCK
3144 if (x == F_UNLCK)
3145 {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
3146 #endif /* ndef F_UNLCK */
3147 #ifdef F_WRLCK
3148 if (x == F_WRLCK)
3149 {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
3150 #endif /* ndef F_WRLCK */
3151 errno = EINVAL; return -1;
3154 int Mono_Posix_FromLockfCommand (int x, int *r)
3156 *r = 0;
3157 if (x == Mono_Posix_LockfCommand_F_LOCK)
3158 #ifdef F_LOCK
3159 {*r = F_LOCK; return 0;}
3160 #else /* def F_LOCK */
3161 {errno = EINVAL; return -1;}
3162 #endif /* ndef F_LOCK */
3163 if (x == Mono_Posix_LockfCommand_F_TEST)
3164 #ifdef F_TEST
3165 {*r = F_TEST; return 0;}
3166 #else /* def F_TEST */
3167 {errno = EINVAL; return -1;}
3168 #endif /* ndef F_TEST */
3169 if (x == Mono_Posix_LockfCommand_F_TLOCK)
3170 #ifdef F_TLOCK
3171 {*r = F_TLOCK; return 0;}
3172 #else /* def F_TLOCK */
3173 {errno = EINVAL; return -1;}
3174 #endif /* ndef F_TLOCK */
3175 if (x == Mono_Posix_LockfCommand_F_ULOCK)
3176 #ifdef F_ULOCK
3177 {*r = F_ULOCK; return 0;}
3178 #else /* def F_ULOCK */
3179 {errno = EINVAL; return -1;}
3180 #endif /* ndef F_ULOCK */
3181 if (x == 0)
3182 return 0;
3183 errno = EINVAL; return -1;
3186 int Mono_Posix_ToLockfCommand (int x, int *r)
3188 *r = 0;
3189 if (x == 0)
3190 return 0;
3191 #ifdef F_LOCK
3192 if (x == F_LOCK)
3193 {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
3194 #endif /* ndef F_LOCK */
3195 #ifdef F_TEST
3196 if (x == F_TEST)
3197 {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
3198 #endif /* ndef F_TEST */
3199 #ifdef F_TLOCK
3200 if (x == F_TLOCK)
3201 {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
3202 #endif /* ndef F_TLOCK */
3203 #ifdef F_ULOCK
3204 if (x == F_ULOCK)
3205 {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
3206 #endif /* ndef F_ULOCK */
3207 errno = EINVAL; return -1;
3210 int Mono_Posix_FromMlockallFlags (int x, int *r)
3212 *r = 0;
3213 if ((x & Mono_Posix_MlockallFlags_MCL_CURRENT) == Mono_Posix_MlockallFlags_MCL_CURRENT)
3214 #ifdef MCL_CURRENT
3215 *r |= MCL_CURRENT;
3216 #else /* def MCL_CURRENT */
3217 {errno = EINVAL; return -1;}
3218 #endif /* ndef MCL_CURRENT */
3219 if ((x & Mono_Posix_MlockallFlags_MCL_FUTURE) == Mono_Posix_MlockallFlags_MCL_FUTURE)
3220 #ifdef MCL_FUTURE
3221 *r |= MCL_FUTURE;
3222 #else /* def MCL_FUTURE */
3223 {errno = EINVAL; return -1;}
3224 #endif /* ndef MCL_FUTURE */
3225 if (x == 0)
3226 return 0;
3227 return 0;
3230 int Mono_Posix_ToMlockallFlags (int x, int *r)
3232 *r = 0;
3233 if (x == 0)
3234 return 0;
3235 #ifdef MCL_CURRENT
3236 if ((x & MCL_CURRENT) == MCL_CURRENT)
3237 *r |= Mono_Posix_MlockallFlags_MCL_CURRENT;
3238 #endif /* ndef MCL_CURRENT */
3239 #ifdef MCL_FUTURE
3240 if ((x & MCL_FUTURE) == MCL_FUTURE)
3241 *r |= Mono_Posix_MlockallFlags_MCL_FUTURE;
3242 #endif /* ndef MCL_FUTURE */
3243 return 0;
3246 int Mono_Posix_FromMmapFlags (int x, int *r)
3248 *r = 0;
3249 if ((x & Mono_Posix_MmapFlags_MAP_ANON) == Mono_Posix_MmapFlags_MAP_ANON)
3250 #ifdef MAP_ANON
3251 *r |= MAP_ANON;
3252 #else /* def MAP_ANON */
3253 {errno = EINVAL; return -1;}
3254 #endif /* ndef MAP_ANON */
3255 if ((x & Mono_Posix_MmapFlags_MAP_ANONYMOUS) == Mono_Posix_MmapFlags_MAP_ANONYMOUS)
3256 #ifdef MAP_ANONYMOUS
3257 *r |= MAP_ANONYMOUS;
3258 #else /* def MAP_ANONYMOUS */
3259 {errno = EINVAL; return -1;}
3260 #endif /* ndef MAP_ANONYMOUS */
3261 if ((x & Mono_Posix_MmapFlags_MAP_DENYWRITE) == Mono_Posix_MmapFlags_MAP_DENYWRITE)
3262 #ifdef MAP_DENYWRITE
3263 *r |= MAP_DENYWRITE;
3264 #else /* def MAP_DENYWRITE */
3265 {errno = EINVAL; return -1;}
3266 #endif /* ndef MAP_DENYWRITE */
3267 if ((x & Mono_Posix_MmapFlags_MAP_EXECUTABLE) == Mono_Posix_MmapFlags_MAP_EXECUTABLE)
3268 #ifdef MAP_EXECUTABLE
3269 *r |= MAP_EXECUTABLE;
3270 #else /* def MAP_EXECUTABLE */
3271 {errno = EINVAL; return -1;}
3272 #endif /* ndef MAP_EXECUTABLE */
3273 if ((x & Mono_Posix_MmapFlags_MAP_FILE) == Mono_Posix_MmapFlags_MAP_FILE)
3274 #ifdef MAP_FILE
3275 *r |= MAP_FILE;
3276 #else /* def MAP_FILE */
3277 {errno = EINVAL; return -1;}
3278 #endif /* ndef MAP_FILE */
3279 if ((x & Mono_Posix_MmapFlags_MAP_FIXED) == Mono_Posix_MmapFlags_MAP_FIXED)
3280 #ifdef MAP_FIXED
3281 *r |= MAP_FIXED;
3282 #else /* def MAP_FIXED */
3283 {errno = EINVAL; return -1;}
3284 #endif /* ndef MAP_FIXED */
3285 if ((x & Mono_Posix_MmapFlags_MAP_GROWSDOWN) == Mono_Posix_MmapFlags_MAP_GROWSDOWN)
3286 #ifdef MAP_GROWSDOWN
3287 *r |= MAP_GROWSDOWN;
3288 #else /* def MAP_GROWSDOWN */
3289 {errno = EINVAL; return -1;}
3290 #endif /* ndef MAP_GROWSDOWN */
3291 if ((x & Mono_Posix_MmapFlags_MAP_LOCKED) == Mono_Posix_MmapFlags_MAP_LOCKED)
3292 #ifdef MAP_LOCKED
3293 *r |= MAP_LOCKED;
3294 #else /* def MAP_LOCKED */
3295 {errno = EINVAL; return -1;}
3296 #endif /* ndef MAP_LOCKED */
3297 if ((x & Mono_Posix_MmapFlags_MAP_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK)
3298 #ifdef MAP_NONBLOCK
3299 *r |= MAP_NONBLOCK;
3300 #else /* def MAP_NONBLOCK */
3301 {errno = EINVAL; return -1;}
3302 #endif /* ndef MAP_NONBLOCK */
3303 if ((x & Mono_Posix_MmapFlags_MAP_NORESERVE) == Mono_Posix_MmapFlags_MAP_NORESERVE)
3304 #ifdef MAP_NORESERVE
3305 *r |= MAP_NORESERVE;
3306 #else /* def MAP_NORESERVE */
3307 {errno = EINVAL; return -1;}
3308 #endif /* ndef MAP_NORESERVE */
3309 if ((x & Mono_Posix_MmapFlags_MAP_POPULATE) == Mono_Posix_MmapFlags_MAP_POPULATE)
3310 #ifdef MAP_POPULATE
3311 *r |= MAP_POPULATE;
3312 #else /* def MAP_POPULATE */
3313 {errno = EINVAL; return -1;}
3314 #endif /* ndef MAP_POPULATE */
3315 if ((x & Mono_Posix_MmapFlags_MAP_PRIVATE) == Mono_Posix_MmapFlags_MAP_PRIVATE)
3316 #ifdef MAP_PRIVATE
3317 *r |= MAP_PRIVATE;
3318 #else /* def MAP_PRIVATE */
3319 {errno = EINVAL; return -1;}
3320 #endif /* ndef MAP_PRIVATE */
3321 if ((x & Mono_Posix_MmapFlags_MAP_SHARED) == Mono_Posix_MmapFlags_MAP_SHARED)
3322 #ifdef MAP_SHARED
3323 *r |= MAP_SHARED;
3324 #else /* def MAP_SHARED */
3325 {errno = EINVAL; return -1;}
3326 #endif /* ndef MAP_SHARED */
3327 if ((x & Mono_Posix_MmapFlags_MAP_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE)
3328 #ifdef MAP_TYPE
3329 *r |= MAP_TYPE;
3330 #else /* def MAP_TYPE */
3331 {errno = EINVAL; return -1;}
3332 #endif /* ndef MAP_TYPE */
3333 if (x == 0)
3334 return 0;
3335 return 0;
3338 int Mono_Posix_ToMmapFlags (int x, int *r)
3340 *r = 0;
3341 if (x == 0)
3342 return 0;
3343 #ifdef MAP_ANON
3344 if ((x & MAP_ANON) == MAP_ANON)
3345 *r |= Mono_Posix_MmapFlags_MAP_ANON;
3346 #endif /* ndef MAP_ANON */
3347 #ifdef MAP_ANONYMOUS
3348 if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
3349 *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
3350 #endif /* ndef MAP_ANONYMOUS */
3351 #ifdef MAP_DENYWRITE
3352 if ((x & MAP_DENYWRITE) == MAP_DENYWRITE)
3353 *r |= Mono_Posix_MmapFlags_MAP_DENYWRITE;
3354 #endif /* ndef MAP_DENYWRITE */
3355 #ifdef MAP_EXECUTABLE
3356 if ((x & MAP_EXECUTABLE) == MAP_EXECUTABLE)
3357 *r |= Mono_Posix_MmapFlags_MAP_EXECUTABLE;
3358 #endif /* ndef MAP_EXECUTABLE */
3359 #ifdef MAP_FILE
3360 if ((x & MAP_FILE) == MAP_FILE)
3361 *r |= Mono_Posix_MmapFlags_MAP_FILE;
3362 #endif /* ndef MAP_FILE */
3363 #ifdef MAP_FIXED
3364 if ((x & MAP_FIXED) == MAP_FIXED)
3365 *r |= Mono_Posix_MmapFlags_MAP_FIXED;
3366 #endif /* ndef MAP_FIXED */
3367 #ifdef MAP_GROWSDOWN
3368 if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
3369 *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
3370 #endif /* ndef MAP_GROWSDOWN */
3371 #ifdef MAP_LOCKED
3372 if ((x & MAP_LOCKED) == MAP_LOCKED)
3373 *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
3374 #endif /* ndef MAP_LOCKED */
3375 #ifdef MAP_NONBLOCK
3376 if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
3377 *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
3378 #endif /* ndef MAP_NONBLOCK */
3379 #ifdef MAP_NORESERVE
3380 if ((x & MAP_NORESERVE) == MAP_NORESERVE)
3381 *r |= Mono_Posix_MmapFlags_MAP_NORESERVE;
3382 #endif /* ndef MAP_NORESERVE */
3383 #ifdef MAP_POPULATE
3384 if ((x & MAP_POPULATE) == MAP_POPULATE)
3385 *r |= Mono_Posix_MmapFlags_MAP_POPULATE;
3386 #endif /* ndef MAP_POPULATE */
3387 #ifdef MAP_PRIVATE
3388 if ((x & MAP_PRIVATE) == MAP_PRIVATE)
3389 *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
3390 #endif /* ndef MAP_PRIVATE */
3391 #ifdef MAP_SHARED
3392 if ((x & MAP_SHARED) == MAP_SHARED)
3393 *r |= Mono_Posix_MmapFlags_MAP_SHARED;
3394 #endif /* ndef MAP_SHARED */
3395 #ifdef MAP_TYPE
3396 if ((x & MAP_TYPE) == MAP_TYPE)
3397 *r |= Mono_Posix_MmapFlags_MAP_TYPE;
3398 #endif /* ndef MAP_TYPE */
3399 return 0;
3402 int Mono_Posix_FromMmapProts (int x, int *r)
3404 *r = 0;
3405 if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
3406 #ifdef PROT_EXEC
3407 *r |= PROT_EXEC;
3408 #else /* def PROT_EXEC */
3409 {errno = EINVAL; return -1;}
3410 #endif /* ndef PROT_EXEC */
3411 if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
3412 #ifdef PROT_GROWSDOWN
3413 *r |= PROT_GROWSDOWN;
3414 #else /* def PROT_GROWSDOWN */
3415 {errno = EINVAL; return -1;}
3416 #endif /* ndef PROT_GROWSDOWN */
3417 if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
3418 #ifdef PROT_GROWSUP
3419 *r |= PROT_GROWSUP;
3420 #else /* def PROT_GROWSUP */
3421 {errno = EINVAL; return -1;}
3422 #endif /* ndef PROT_GROWSUP */
3423 if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
3424 #ifdef PROT_NONE
3425 *r |= PROT_NONE;
3426 #else /* def PROT_NONE */
3427 {errno = EINVAL; return -1;}
3428 #endif /* ndef PROT_NONE */
3429 if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
3430 #ifdef PROT_READ
3431 *r |= PROT_READ;
3432 #else /* def PROT_READ */
3433 {errno = EINVAL; return -1;}
3434 #endif /* ndef PROT_READ */
3435 if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
3436 #ifdef PROT_WRITE
3437 *r |= PROT_WRITE;
3438 #else /* def PROT_WRITE */
3439 {errno = EINVAL; return -1;}
3440 #endif /* ndef PROT_WRITE */
3441 if (x == 0)
3442 return 0;
3443 return 0;
3446 int Mono_Posix_ToMmapProts (int x, int *r)
3448 *r = 0;
3449 if (x == 0)
3450 return 0;
3451 #ifdef PROT_EXEC
3452 if ((x & PROT_EXEC) == PROT_EXEC)
3453 *r |= Mono_Posix_MmapProts_PROT_EXEC;
3454 #endif /* ndef PROT_EXEC */
3455 #ifdef PROT_GROWSDOWN
3456 if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
3457 *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
3458 #endif /* ndef PROT_GROWSDOWN */
3459 #ifdef PROT_GROWSUP
3460 if ((x & PROT_GROWSUP) == PROT_GROWSUP)
3461 *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
3462 #endif /* ndef PROT_GROWSUP */
3463 #ifdef PROT_NONE
3464 if ((x & PROT_NONE) == PROT_NONE)
3465 *r |= Mono_Posix_MmapProts_PROT_NONE;
3466 #endif /* ndef PROT_NONE */
3467 #ifdef PROT_READ
3468 if ((x & PROT_READ) == PROT_READ)
3469 *r |= Mono_Posix_MmapProts_PROT_READ;
3470 #endif /* ndef PROT_READ */
3471 #ifdef PROT_WRITE
3472 if ((x & PROT_WRITE) == PROT_WRITE)
3473 *r |= Mono_Posix_MmapProts_PROT_WRITE;
3474 #endif /* ndef PROT_WRITE */
3475 return 0;
3478 int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
3480 *r = 0;
3481 if ((x & Mono_Posix_MountFlags_ST_APPEND) == Mono_Posix_MountFlags_ST_APPEND)
3482 #ifdef ST_APPEND
3483 *r |= ST_APPEND;
3484 #else /* def ST_APPEND */
3485 {errno = EINVAL; return -1;}
3486 #endif /* ndef ST_APPEND */
3487 if ((x & Mono_Posix_MountFlags_ST_BIND) == Mono_Posix_MountFlags_ST_BIND)
3488 #ifdef ST_BIND
3489 *r |= ST_BIND;
3490 #else /* def ST_BIND */
3491 {errno = EINVAL; return -1;}
3492 #endif /* ndef ST_BIND */
3493 if ((x & Mono_Posix_MountFlags_ST_IMMUTABLE) == Mono_Posix_MountFlags_ST_IMMUTABLE)
3494 #ifdef ST_IMMUTABLE
3495 *r |= ST_IMMUTABLE;
3496 #else /* def ST_IMMUTABLE */
3497 {errno = EINVAL; return -1;}
3498 #endif /* ndef ST_IMMUTABLE */
3499 if ((x & Mono_Posix_MountFlags_ST_MANDLOCK) == Mono_Posix_MountFlags_ST_MANDLOCK)
3500 #ifdef ST_MANDLOCK
3501 *r |= ST_MANDLOCK;
3502 #else /* def ST_MANDLOCK */
3503 {errno = EINVAL; return -1;}
3504 #endif /* ndef ST_MANDLOCK */
3505 if ((x & Mono_Posix_MountFlags_ST_NOATIME) == Mono_Posix_MountFlags_ST_NOATIME)
3506 #ifdef ST_NOATIME
3507 *r |= ST_NOATIME;
3508 #else /* def ST_NOATIME */
3509 {errno = EINVAL; return -1;}
3510 #endif /* ndef ST_NOATIME */
3511 if ((x & Mono_Posix_MountFlags_ST_NODEV) == Mono_Posix_MountFlags_ST_NODEV)
3512 #ifdef ST_NODEV
3513 *r |= ST_NODEV;
3514 #else /* def ST_NODEV */
3515 {errno = EINVAL; return -1;}
3516 #endif /* ndef ST_NODEV */
3517 if ((x & Mono_Posix_MountFlags_ST_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME)
3518 #ifdef ST_NODIRATIME
3519 *r |= ST_NODIRATIME;
3520 #else /* def ST_NODIRATIME */
3521 {errno = EINVAL; return -1;}
3522 #endif /* ndef ST_NODIRATIME */
3523 if ((x & Mono_Posix_MountFlags_ST_NOEXEC) == Mono_Posix_MountFlags_ST_NOEXEC)
3524 #ifdef ST_NOEXEC
3525 *r |= ST_NOEXEC;
3526 #else /* def ST_NOEXEC */
3527 {errno = EINVAL; return -1;}
3528 #endif /* ndef ST_NOEXEC */
3529 if ((x & Mono_Posix_MountFlags_ST_NOSUID) == Mono_Posix_MountFlags_ST_NOSUID)
3530 #ifdef ST_NOSUID
3531 *r |= ST_NOSUID;
3532 #else /* def ST_NOSUID */
3533 {errno = EINVAL; return -1;}
3534 #endif /* ndef ST_NOSUID */
3535 if ((x & Mono_Posix_MountFlags_ST_RDONLY) == Mono_Posix_MountFlags_ST_RDONLY)
3536 #ifdef ST_RDONLY
3537 *r |= ST_RDONLY;
3538 #else /* def ST_RDONLY */
3539 {errno = EINVAL; return -1;}
3540 #endif /* ndef ST_RDONLY */
3541 if ((x & Mono_Posix_MountFlags_ST_REMOUNT) == Mono_Posix_MountFlags_ST_REMOUNT)
3542 #ifdef ST_REMOUNT
3543 *r |= ST_REMOUNT;
3544 #else /* def ST_REMOUNT */
3545 {errno = EINVAL; return -1;}
3546 #endif /* ndef ST_REMOUNT */
3547 if ((x & Mono_Posix_MountFlags_ST_SYNCHRONOUS) == Mono_Posix_MountFlags_ST_SYNCHRONOUS)
3548 #ifdef ST_SYNCHRONOUS
3549 *r |= ST_SYNCHRONOUS;
3550 #else /* def ST_SYNCHRONOUS */
3551 {errno = EINVAL; return -1;}
3552 #endif /* ndef ST_SYNCHRONOUS */
3553 if ((x & Mono_Posix_MountFlags_ST_WRITE) == Mono_Posix_MountFlags_ST_WRITE)
3554 #ifdef ST_WRITE
3555 *r |= ST_WRITE;
3556 #else /* def ST_WRITE */
3557 {errno = EINVAL; return -1;}
3558 #endif /* ndef ST_WRITE */
3559 if (x == 0)
3560 return 0;
3561 return 0;
3564 int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
3566 *r = 0;
3567 if (x == 0)
3568 return 0;
3569 #ifdef ST_APPEND
3570 if ((x & ST_APPEND) == ST_APPEND)
3571 *r |= Mono_Posix_MountFlags_ST_APPEND;
3572 #endif /* ndef ST_APPEND */
3573 #ifdef ST_BIND
3574 if ((x & ST_BIND) == ST_BIND)
3575 *r |= Mono_Posix_MountFlags_ST_BIND;
3576 #endif /* ndef ST_BIND */
3577 #ifdef ST_IMMUTABLE
3578 if ((x & ST_IMMUTABLE) == ST_IMMUTABLE)
3579 *r |= Mono_Posix_MountFlags_ST_IMMUTABLE;
3580 #endif /* ndef ST_IMMUTABLE */
3581 #ifdef ST_MANDLOCK
3582 if ((x & ST_MANDLOCK) == ST_MANDLOCK)
3583 *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
3584 #endif /* ndef ST_MANDLOCK */
3585 #ifdef ST_NOATIME
3586 if ((x & ST_NOATIME) == ST_NOATIME)
3587 *r |= Mono_Posix_MountFlags_ST_NOATIME;
3588 #endif /* ndef ST_NOATIME */
3589 #ifdef ST_NODEV
3590 if ((x & ST_NODEV) == ST_NODEV)
3591 *r |= Mono_Posix_MountFlags_ST_NODEV;
3592 #endif /* ndef ST_NODEV */
3593 #ifdef ST_NODIRATIME
3594 if ((x & ST_NODIRATIME) == ST_NODIRATIME)
3595 *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
3596 #endif /* ndef ST_NODIRATIME */
3597 #ifdef ST_NOEXEC
3598 if ((x & ST_NOEXEC) == ST_NOEXEC)
3599 *r |= Mono_Posix_MountFlags_ST_NOEXEC;
3600 #endif /* ndef ST_NOEXEC */
3601 #ifdef ST_NOSUID
3602 if ((x & ST_NOSUID) == ST_NOSUID)
3603 *r |= Mono_Posix_MountFlags_ST_NOSUID;
3604 #endif /* ndef ST_NOSUID */
3605 #ifdef ST_RDONLY
3606 if ((x & ST_RDONLY) == ST_RDONLY)
3607 *r |= Mono_Posix_MountFlags_ST_RDONLY;
3608 #endif /* ndef ST_RDONLY */
3609 #ifdef ST_REMOUNT
3610 if ((x & ST_REMOUNT) == ST_REMOUNT)
3611 *r |= Mono_Posix_MountFlags_ST_REMOUNT;
3612 #endif /* ndef ST_REMOUNT */
3613 #ifdef ST_SYNCHRONOUS
3614 if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
3615 *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
3616 #endif /* ndef ST_SYNCHRONOUS */
3617 #ifdef ST_WRITE
3618 if ((x & ST_WRITE) == ST_WRITE)
3619 *r |= Mono_Posix_MountFlags_ST_WRITE;
3620 #endif /* ndef ST_WRITE */
3621 return 0;
3624 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
3626 *r = 0;
3627 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3628 #ifdef MREMAP_MAYMOVE
3629 *r |= MREMAP_MAYMOVE;
3630 #else /* def MREMAP_MAYMOVE */
3631 {errno = EINVAL; return -1;}
3632 #endif /* ndef MREMAP_MAYMOVE */
3633 if (x == 0)
3634 return 0;
3635 return 0;
3638 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
3640 *r = 0;
3641 if (x == 0)
3642 return 0;
3643 #ifdef MREMAP_MAYMOVE
3644 if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
3645 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3646 #endif /* ndef MREMAP_MAYMOVE */
3647 return 0;
3650 int Mono_Posix_FromMsyncFlags (int x, int *r)
3652 *r = 0;
3653 if ((x & Mono_Posix_MsyncFlags_MS_ASYNC) == Mono_Posix_MsyncFlags_MS_ASYNC)
3654 #ifdef MS_ASYNC
3655 *r |= MS_ASYNC;
3656 #else /* def MS_ASYNC */
3657 {errno = EINVAL; return -1;}
3658 #endif /* ndef MS_ASYNC */
3659 if ((x & Mono_Posix_MsyncFlags_MS_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE)
3660 #ifdef MS_INVALIDATE
3661 *r |= MS_INVALIDATE;
3662 #else /* def MS_INVALIDATE */
3663 {errno = EINVAL; return -1;}
3664 #endif /* ndef MS_INVALIDATE */
3665 if ((x & Mono_Posix_MsyncFlags_MS_SYNC) == Mono_Posix_MsyncFlags_MS_SYNC)
3666 #ifdef MS_SYNC
3667 *r |= MS_SYNC;
3668 #else /* def MS_SYNC */
3669 {errno = EINVAL; return -1;}
3670 #endif /* ndef MS_SYNC */
3671 if (x == 0)
3672 return 0;
3673 return 0;
3676 int Mono_Posix_ToMsyncFlags (int x, int *r)
3678 *r = 0;
3679 if (x == 0)
3680 return 0;
3681 #ifdef MS_ASYNC
3682 if ((x & MS_ASYNC) == MS_ASYNC)
3683 *r |= Mono_Posix_MsyncFlags_MS_ASYNC;
3684 #endif /* ndef MS_ASYNC */
3685 #ifdef MS_INVALIDATE
3686 if ((x & MS_INVALIDATE) == MS_INVALIDATE)
3687 *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
3688 #endif /* ndef MS_INVALIDATE */
3689 #ifdef MS_SYNC
3690 if ((x & MS_SYNC) == MS_SYNC)
3691 *r |= Mono_Posix_MsyncFlags_MS_SYNC;
3692 #endif /* ndef MS_SYNC */
3693 return 0;
3696 int Mono_Posix_FromOpenFlags (int x, int *r)
3698 *r = 0;
3699 if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND)
3700 #ifdef O_APPEND
3701 *r |= O_APPEND;
3702 #else /* def O_APPEND */
3703 {errno = EINVAL; return -1;}
3704 #endif /* ndef O_APPEND */
3705 if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC)
3706 #ifdef O_ASYNC
3707 *r |= O_ASYNC;
3708 #else /* def O_ASYNC */
3709 {errno = EINVAL; return -1;}
3710 #endif /* ndef O_ASYNC */
3711 if ((x & Mono_Posix_OpenFlags_O_CLOEXEC) == Mono_Posix_OpenFlags_O_CLOEXEC)
3712 #ifdef O_CLOEXEC
3713 *r |= O_CLOEXEC;
3714 #else /* def O_CLOEXEC */
3715 {errno = EINVAL; return -1;}
3716 #endif /* ndef O_CLOEXEC */
3717 if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT)
3718 #ifdef O_CREAT
3719 *r |= O_CREAT;
3720 #else /* def O_CREAT */
3721 {errno = EINVAL; return -1;}
3722 #endif /* ndef O_CREAT */
3723 if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT)
3724 #ifdef O_DIRECT
3725 *r |= O_DIRECT;
3726 #else /* def O_DIRECT */
3727 {errno = EINVAL; return -1;}
3728 #endif /* ndef O_DIRECT */
3729 if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY)
3730 #ifdef O_DIRECTORY
3731 *r |= O_DIRECTORY;
3732 #else /* def O_DIRECTORY */
3733 {errno = EINVAL; return -1;}
3734 #endif /* ndef O_DIRECTORY */
3735 if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL)
3736 #ifdef O_EXCL
3737 *r |= O_EXCL;
3738 #else /* def O_EXCL */
3739 {errno = EINVAL; return -1;}
3740 #endif /* ndef O_EXCL */
3741 if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
3742 #ifdef O_LARGEFILE
3743 *r |= O_LARGEFILE;
3744 #else /* def O_LARGEFILE */
3745 {errno = EINVAL; return -1;}
3746 #endif /* ndef O_LARGEFILE */
3747 if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY)
3748 #ifdef O_NOCTTY
3749 *r |= O_NOCTTY;
3750 #else /* def O_NOCTTY */
3751 {errno = EINVAL; return -1;}
3752 #endif /* ndef O_NOCTTY */
3753 if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW)
3754 #ifdef O_NOFOLLOW
3755 *r |= O_NOFOLLOW;
3756 #else /* def O_NOFOLLOW */
3757 {errno = EINVAL; return -1;}
3758 #endif /* ndef O_NOFOLLOW */
3759 if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK)
3760 #ifdef O_NONBLOCK
3761 *r |= O_NONBLOCK;
3762 #else /* def O_NONBLOCK */
3763 {errno = EINVAL; return -1;}
3764 #endif /* ndef O_NONBLOCK */
3765 if ((x & Mono_Posix_OpenFlags_O_PATH) == Mono_Posix_OpenFlags_O_PATH)
3766 #ifdef O_PATH
3767 *r |= O_PATH;
3768 #else /* def O_PATH */
3769 {errno = EINVAL; return -1;}
3770 #endif /* ndef O_PATH */
3771 if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY)
3772 #ifdef O_RDONLY
3773 *r |= O_RDONLY;
3774 #else /* def O_RDONLY */
3775 {errno = EINVAL; return -1;}
3776 #endif /* ndef O_RDONLY */
3777 if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR)
3778 #ifdef O_RDWR
3779 *r |= O_RDWR;
3780 #else /* def O_RDWR */
3781 {errno = EINVAL; return -1;}
3782 #endif /* ndef O_RDWR */
3783 if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC)
3784 #ifdef O_SYNC
3785 *r |= O_SYNC;
3786 #else /* def O_SYNC */
3787 {errno = EINVAL; return -1;}
3788 #endif /* ndef O_SYNC */
3789 if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC)
3790 #ifdef O_TRUNC
3791 *r |= O_TRUNC;
3792 #else /* def O_TRUNC */
3793 {errno = EINVAL; return -1;}
3794 #endif /* ndef O_TRUNC */
3795 if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
3796 #ifdef O_WRONLY
3797 *r |= O_WRONLY;
3798 #else /* def O_WRONLY */
3799 {errno = EINVAL; return -1;}
3800 #endif /* ndef O_WRONLY */
3801 if (x == 0)
3802 return 0;
3803 return 0;
3806 int Mono_Posix_ToOpenFlags (int x, int *r)
3808 *r = 0;
3809 if (x == 0)
3810 return 0;
3811 #ifdef O_APPEND
3812 if ((x & O_APPEND) == O_APPEND)
3813 *r |= Mono_Posix_OpenFlags_O_APPEND;
3814 #endif /* ndef O_APPEND */
3815 #ifdef O_ASYNC
3816 if ((x & O_ASYNC) == O_ASYNC)
3817 *r |= Mono_Posix_OpenFlags_O_ASYNC;
3818 #endif /* ndef O_ASYNC */
3819 #ifdef O_CLOEXEC
3820 if ((x & O_CLOEXEC) == O_CLOEXEC)
3821 *r |= Mono_Posix_OpenFlags_O_CLOEXEC;
3822 #endif /* ndef O_CLOEXEC */
3823 #ifdef O_CREAT
3824 if ((x & O_CREAT) == O_CREAT)
3825 *r |= Mono_Posix_OpenFlags_O_CREAT;
3826 #endif /* ndef O_CREAT */
3827 #ifdef O_DIRECT
3828 if ((x & O_DIRECT) == O_DIRECT)
3829 *r |= Mono_Posix_OpenFlags_O_DIRECT;
3830 #endif /* ndef O_DIRECT */
3831 #ifdef O_DIRECTORY
3832 if ((x & O_DIRECTORY) == O_DIRECTORY)
3833 *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
3834 #endif /* ndef O_DIRECTORY */
3835 #ifdef O_EXCL
3836 if ((x & O_EXCL) == O_EXCL)
3837 *r |= Mono_Posix_OpenFlags_O_EXCL;
3838 #endif /* ndef O_EXCL */
3839 #ifdef O_LARGEFILE
3840 if ((x & O_LARGEFILE) == O_LARGEFILE)
3841 *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
3842 #endif /* ndef O_LARGEFILE */
3843 #ifdef O_NOCTTY
3844 if ((x & O_NOCTTY) == O_NOCTTY)
3845 *r |= Mono_Posix_OpenFlags_O_NOCTTY;
3846 #endif /* ndef O_NOCTTY */
3847 #ifdef O_NOFOLLOW
3848 if ((x & O_NOFOLLOW) == O_NOFOLLOW)
3849 *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
3850 #endif /* ndef O_NOFOLLOW */
3851 #ifdef O_NONBLOCK
3852 if ((x & O_NONBLOCK) == O_NONBLOCK)
3853 *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
3854 #endif /* ndef O_NONBLOCK */
3855 #ifdef O_PATH
3856 if ((x & O_PATH) == O_PATH)
3857 *r |= Mono_Posix_OpenFlags_O_PATH;
3858 #endif /* ndef O_PATH */
3859 #ifdef O_RDONLY
3860 if ((x & O_RDONLY) == O_RDONLY)
3861 *r |= Mono_Posix_OpenFlags_O_RDONLY;
3862 #endif /* ndef O_RDONLY */
3863 #ifdef O_RDWR
3864 if ((x & O_RDWR) == O_RDWR)
3865 *r |= Mono_Posix_OpenFlags_O_RDWR;
3866 #endif /* ndef O_RDWR */
3867 #ifdef O_SYNC
3868 if ((x & O_SYNC) == O_SYNC)
3869 *r |= Mono_Posix_OpenFlags_O_SYNC;
3870 #endif /* ndef O_SYNC */
3871 #ifdef O_TRUNC
3872 if ((x & O_TRUNC) == O_TRUNC)
3873 *r |= Mono_Posix_OpenFlags_O_TRUNC;
3874 #endif /* ndef O_TRUNC */
3875 #ifdef O_WRONLY
3876 if ((x & O_WRONLY) == O_WRONLY)
3877 *r |= Mono_Posix_OpenFlags_O_WRONLY;
3878 #endif /* ndef O_WRONLY */
3879 return 0;
3882 int Mono_Posix_FromPathconfName (int x, int *r)
3884 *r = 0;
3885 if (x == Mono_Posix_PathconfName__PC_2_SYMLINKS)
3886 #ifdef _PC_2_SYMLINKS
3887 {*r = _PC_2_SYMLINKS; return 0;}
3888 #else /* def _PC_2_SYMLINKS */
3889 {errno = EINVAL; return -1;}
3890 #endif /* ndef _PC_2_SYMLINKS */
3891 if (x == Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN)
3892 #ifdef _PC_ALLOC_SIZE_MIN
3893 {*r = _PC_ALLOC_SIZE_MIN; return 0;}
3894 #else /* def _PC_ALLOC_SIZE_MIN */
3895 {errno = EINVAL; return -1;}
3896 #endif /* ndef _PC_ALLOC_SIZE_MIN */
3897 if (x == Mono_Posix_PathconfName__PC_ASYNC_IO)
3898 #ifdef _PC_ASYNC_IO
3899 {*r = _PC_ASYNC_IO; return 0;}
3900 #else /* def _PC_ASYNC_IO */
3901 {errno = EINVAL; return -1;}
3902 #endif /* ndef _PC_ASYNC_IO */
3903 if (x == Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED)
3904 #ifdef _PC_CHOWN_RESTRICTED
3905 {*r = _PC_CHOWN_RESTRICTED; return 0;}
3906 #else /* def _PC_CHOWN_RESTRICTED */
3907 {errno = EINVAL; return -1;}
3908 #endif /* ndef _PC_CHOWN_RESTRICTED */
3909 if (x == Mono_Posix_PathconfName__PC_FILESIZEBITS)
3910 #ifdef _PC_FILESIZEBITS
3911 {*r = _PC_FILESIZEBITS; return 0;}
3912 #else /* def _PC_FILESIZEBITS */
3913 {errno = EINVAL; return -1;}
3914 #endif /* ndef _PC_FILESIZEBITS */
3915 if (x == Mono_Posix_PathconfName__PC_LINK_MAX)
3916 #ifdef _PC_LINK_MAX
3917 {*r = _PC_LINK_MAX; return 0;}
3918 #else /* def _PC_LINK_MAX */
3919 {errno = EINVAL; return -1;}
3920 #endif /* ndef _PC_LINK_MAX */
3921 if (x == Mono_Posix_PathconfName__PC_MAX_CANON)
3922 #ifdef _PC_MAX_CANON
3923 {*r = _PC_MAX_CANON; return 0;}
3924 #else /* def _PC_MAX_CANON */
3925 {errno = EINVAL; return -1;}
3926 #endif /* ndef _PC_MAX_CANON */
3927 if (x == Mono_Posix_PathconfName__PC_MAX_INPUT)
3928 #ifdef _PC_MAX_INPUT
3929 {*r = _PC_MAX_INPUT; return 0;}
3930 #else /* def _PC_MAX_INPUT */
3931 {errno = EINVAL; return -1;}
3932 #endif /* ndef _PC_MAX_INPUT */
3933 if (x == Mono_Posix_PathconfName__PC_NAME_MAX)
3934 #ifdef _PC_NAME_MAX
3935 {*r = _PC_NAME_MAX; return 0;}
3936 #else /* def _PC_NAME_MAX */
3937 {errno = EINVAL; return -1;}
3938 #endif /* ndef _PC_NAME_MAX */
3939 if (x == Mono_Posix_PathconfName__PC_NO_TRUNC)
3940 #ifdef _PC_NO_TRUNC
3941 {*r = _PC_NO_TRUNC; return 0;}
3942 #else /* def _PC_NO_TRUNC */
3943 {errno = EINVAL; return -1;}
3944 #endif /* ndef _PC_NO_TRUNC */
3945 if (x == Mono_Posix_PathconfName__PC_PATH_MAX)
3946 #ifdef _PC_PATH_MAX
3947 {*r = _PC_PATH_MAX; return 0;}
3948 #else /* def _PC_PATH_MAX */
3949 {errno = EINVAL; return -1;}
3950 #endif /* ndef _PC_PATH_MAX */
3951 if (x == Mono_Posix_PathconfName__PC_PIPE_BUF)
3952 #ifdef _PC_PIPE_BUF
3953 {*r = _PC_PIPE_BUF; return 0;}
3954 #else /* def _PC_PIPE_BUF */
3955 {errno = EINVAL; return -1;}
3956 #endif /* ndef _PC_PIPE_BUF */
3957 if (x == Mono_Posix_PathconfName__PC_PRIO_IO)
3958 #ifdef _PC_PRIO_IO
3959 {*r = _PC_PRIO_IO; return 0;}
3960 #else /* def _PC_PRIO_IO */
3961 {errno = EINVAL; return -1;}
3962 #endif /* ndef _PC_PRIO_IO */
3963 if (x == Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE)
3964 #ifdef _PC_REC_INCR_XFER_SIZE
3965 {*r = _PC_REC_INCR_XFER_SIZE; return 0;}
3966 #else /* def _PC_REC_INCR_XFER_SIZE */
3967 {errno = EINVAL; return -1;}
3968 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
3969 if (x == Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE)
3970 #ifdef _PC_REC_MAX_XFER_SIZE
3971 {*r = _PC_REC_MAX_XFER_SIZE; return 0;}
3972 #else /* def _PC_REC_MAX_XFER_SIZE */
3973 {errno = EINVAL; return -1;}
3974 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
3975 if (x == Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE)
3976 #ifdef _PC_REC_MIN_XFER_SIZE
3977 {*r = _PC_REC_MIN_XFER_SIZE; return 0;}
3978 #else /* def _PC_REC_MIN_XFER_SIZE */
3979 {errno = EINVAL; return -1;}
3980 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
3981 if (x == Mono_Posix_PathconfName__PC_REC_XFER_ALIGN)
3982 #ifdef _PC_REC_XFER_ALIGN
3983 {*r = _PC_REC_XFER_ALIGN; return 0;}
3984 #else /* def _PC_REC_XFER_ALIGN */
3985 {errno = EINVAL; return -1;}
3986 #endif /* ndef _PC_REC_XFER_ALIGN */
3987 if (x == Mono_Posix_PathconfName__PC_SOCK_MAXBUF)
3988 #ifdef _PC_SOCK_MAXBUF
3989 {*r = _PC_SOCK_MAXBUF; return 0;}
3990 #else /* def _PC_SOCK_MAXBUF */
3991 {errno = EINVAL; return -1;}
3992 #endif /* ndef _PC_SOCK_MAXBUF */
3993 if (x == Mono_Posix_PathconfName__PC_SYMLINK_MAX)
3994 #ifdef _PC_SYMLINK_MAX
3995 {*r = _PC_SYMLINK_MAX; return 0;}
3996 #else /* def _PC_SYMLINK_MAX */
3997 {errno = EINVAL; return -1;}
3998 #endif /* ndef _PC_SYMLINK_MAX */
3999 if (x == Mono_Posix_PathconfName__PC_SYNC_IO)
4000 #ifdef _PC_SYNC_IO
4001 {*r = _PC_SYNC_IO; return 0;}
4002 #else /* def _PC_SYNC_IO */
4003 {errno = EINVAL; return -1;}
4004 #endif /* ndef _PC_SYNC_IO */
4005 if (x == Mono_Posix_PathconfName__PC_VDISABLE)
4006 #ifdef _PC_VDISABLE
4007 {*r = _PC_VDISABLE; return 0;}
4008 #else /* def _PC_VDISABLE */
4009 {errno = EINVAL; return -1;}
4010 #endif /* ndef _PC_VDISABLE */
4011 if (x == 0)
4012 return 0;
4013 errno = EINVAL; return -1;
4016 int Mono_Posix_ToPathconfName (int x, int *r)
4018 *r = 0;
4019 if (x == 0)
4020 return 0;
4021 #ifdef _PC_2_SYMLINKS
4022 if (x == _PC_2_SYMLINKS)
4023 {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
4024 #endif /* ndef _PC_2_SYMLINKS */
4025 #ifdef _PC_ALLOC_SIZE_MIN
4026 if (x == _PC_ALLOC_SIZE_MIN)
4027 {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
4028 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4029 #ifdef _PC_ASYNC_IO
4030 if (x == _PC_ASYNC_IO)
4031 {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
4032 #endif /* ndef _PC_ASYNC_IO */
4033 #ifdef _PC_CHOWN_RESTRICTED
4034 if (x == _PC_CHOWN_RESTRICTED)
4035 {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
4036 #endif /* ndef _PC_CHOWN_RESTRICTED */
4037 #ifdef _PC_FILESIZEBITS
4038 if (x == _PC_FILESIZEBITS)
4039 {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
4040 #endif /* ndef _PC_FILESIZEBITS */
4041 #ifdef _PC_LINK_MAX
4042 if (x == _PC_LINK_MAX)
4043 {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
4044 #endif /* ndef _PC_LINK_MAX */
4045 #ifdef _PC_MAX_CANON
4046 if (x == _PC_MAX_CANON)
4047 {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
4048 #endif /* ndef _PC_MAX_CANON */
4049 #ifdef _PC_MAX_INPUT
4050 if (x == _PC_MAX_INPUT)
4051 {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
4052 #endif /* ndef _PC_MAX_INPUT */
4053 #ifdef _PC_NAME_MAX
4054 if (x == _PC_NAME_MAX)
4055 {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
4056 #endif /* ndef _PC_NAME_MAX */
4057 #ifdef _PC_NO_TRUNC
4058 if (x == _PC_NO_TRUNC)
4059 {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
4060 #endif /* ndef _PC_NO_TRUNC */
4061 #ifdef _PC_PATH_MAX
4062 if (x == _PC_PATH_MAX)
4063 {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
4064 #endif /* ndef _PC_PATH_MAX */
4065 #ifdef _PC_PIPE_BUF
4066 if (x == _PC_PIPE_BUF)
4067 {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
4068 #endif /* ndef _PC_PIPE_BUF */
4069 #ifdef _PC_PRIO_IO
4070 if (x == _PC_PRIO_IO)
4071 {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
4072 #endif /* ndef _PC_PRIO_IO */
4073 #ifdef _PC_REC_INCR_XFER_SIZE
4074 if (x == _PC_REC_INCR_XFER_SIZE)
4075 {*r = Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE; return 0;}
4076 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4077 #ifdef _PC_REC_MAX_XFER_SIZE
4078 if (x == _PC_REC_MAX_XFER_SIZE)
4079 {*r = Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE; return 0;}
4080 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4081 #ifdef _PC_REC_MIN_XFER_SIZE
4082 if (x == _PC_REC_MIN_XFER_SIZE)
4083 {*r = Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE; return 0;}
4084 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4085 #ifdef _PC_REC_XFER_ALIGN
4086 if (x == _PC_REC_XFER_ALIGN)
4087 {*r = Mono_Posix_PathconfName__PC_REC_XFER_ALIGN; return 0;}
4088 #endif /* ndef _PC_REC_XFER_ALIGN */
4089 #ifdef _PC_SOCK_MAXBUF
4090 if (x == _PC_SOCK_MAXBUF)
4091 {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
4092 #endif /* ndef _PC_SOCK_MAXBUF */
4093 #ifdef _PC_SYMLINK_MAX
4094 if (x == _PC_SYMLINK_MAX)
4095 {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
4096 #endif /* ndef _PC_SYMLINK_MAX */
4097 #ifdef _PC_SYNC_IO
4098 if (x == _PC_SYNC_IO)
4099 {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
4100 #endif /* ndef _PC_SYNC_IO */
4101 #ifdef _PC_VDISABLE
4102 if (x == _PC_VDISABLE)
4103 {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
4104 #endif /* ndef _PC_VDISABLE */
4105 errno = EINVAL; return -1;
4108 int Mono_Posix_FromPollEvents (short x, short *r)
4110 *r = 0;
4111 if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR)
4112 #ifdef POLLERR
4113 *r |= POLLERR;
4114 #else /* def POLLERR */
4115 {errno = EINVAL; return -1;}
4116 #endif /* ndef POLLERR */
4117 if ((x & Mono_Posix_PollEvents_POLLHUP) == Mono_Posix_PollEvents_POLLHUP)
4118 #ifdef POLLHUP
4119 *r |= POLLHUP;
4120 #else /* def POLLHUP */
4121 {errno = EINVAL; return -1;}
4122 #endif /* ndef POLLHUP */
4123 if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN)
4124 #ifdef POLLIN
4125 *r |= POLLIN;
4126 #else /* def POLLIN */
4127 {errno = EINVAL; return -1;}
4128 #endif /* ndef POLLIN */
4129 if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL)
4130 #ifdef POLLNVAL
4131 *r |= POLLNVAL;
4132 #else /* def POLLNVAL */
4133 {errno = EINVAL; return -1;}
4134 #endif /* ndef POLLNVAL */
4135 if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
4136 #ifdef POLLOUT
4137 *r |= POLLOUT;
4138 #else /* def POLLOUT */
4139 {errno = EINVAL; return -1;}
4140 #endif /* ndef POLLOUT */
4141 if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI)
4142 #ifdef POLLPRI
4143 *r |= POLLPRI;
4144 #else /* def POLLPRI */
4145 {errno = EINVAL; return -1;}
4146 #endif /* ndef POLLPRI */
4147 if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
4148 #ifdef POLLRDBAND
4149 *r |= POLLRDBAND;
4150 #else /* def POLLRDBAND */
4151 {errno = EINVAL; return -1;}
4152 #endif /* ndef POLLRDBAND */
4153 if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM)
4154 #ifdef POLLRDNORM
4155 *r |= POLLRDNORM;
4156 #else /* def POLLRDNORM */
4157 {errno = EINVAL; return -1;}
4158 #endif /* ndef POLLRDNORM */
4159 if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
4160 #ifdef POLLWRBAND
4161 *r |= POLLWRBAND;
4162 #else /* def POLLWRBAND */
4163 {errno = EINVAL; return -1;}
4164 #endif /* ndef POLLWRBAND */
4165 if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
4166 #ifdef POLLWRNORM
4167 *r |= POLLWRNORM;
4168 #else /* def POLLWRNORM */
4169 {errno = EINVAL; return -1;}
4170 #endif /* ndef POLLWRNORM */
4171 if (x == 0)
4172 return 0;
4173 return 0;
4176 int Mono_Posix_ToPollEvents (short x, short *r)
4178 *r = 0;
4179 if (x == 0)
4180 return 0;
4181 #ifdef POLLERR
4182 if ((x & POLLERR) == POLLERR)
4183 *r |= Mono_Posix_PollEvents_POLLERR;
4184 #endif /* ndef POLLERR */
4185 #ifdef POLLHUP
4186 if ((x & POLLHUP) == POLLHUP)
4187 *r |= Mono_Posix_PollEvents_POLLHUP;
4188 #endif /* ndef POLLHUP */
4189 #ifdef POLLIN
4190 if ((x & POLLIN) == POLLIN)
4191 *r |= Mono_Posix_PollEvents_POLLIN;
4192 #endif /* ndef POLLIN */
4193 #ifdef POLLNVAL
4194 if ((x & POLLNVAL) == POLLNVAL)
4195 *r |= Mono_Posix_PollEvents_POLLNVAL;
4196 #endif /* ndef POLLNVAL */
4197 #ifdef POLLOUT
4198 if ((x & POLLOUT) == POLLOUT)
4199 *r |= Mono_Posix_PollEvents_POLLOUT;
4200 #endif /* ndef POLLOUT */
4201 #ifdef POLLPRI
4202 if ((x & POLLPRI) == POLLPRI)
4203 *r |= Mono_Posix_PollEvents_POLLPRI;
4204 #endif /* ndef POLLPRI */
4205 #ifdef POLLRDBAND
4206 if ((x & POLLRDBAND) == POLLRDBAND)
4207 *r |= Mono_Posix_PollEvents_POLLRDBAND;
4208 #endif /* ndef POLLRDBAND */
4209 #ifdef POLLRDNORM
4210 if ((x & POLLRDNORM) == POLLRDNORM)
4211 *r |= Mono_Posix_PollEvents_POLLRDNORM;
4212 #endif /* ndef POLLRDNORM */
4213 #ifdef POLLWRBAND
4214 if ((x & POLLWRBAND) == POLLWRBAND)
4215 *r |= Mono_Posix_PollEvents_POLLWRBAND;
4216 #endif /* ndef POLLWRBAND */
4217 #ifdef POLLWRNORM
4218 if ((x & POLLWRNORM) == POLLWRNORM)
4219 *r |= Mono_Posix_PollEvents_POLLWRNORM;
4220 #endif /* ndef POLLWRNORM */
4221 return 0;
4224 #ifdef HAVE_STRUCT_POLLFD
4226 Mono_Posix_FromPollfd (struct Mono_Posix_Pollfd *from, struct pollfd *to)
4228 _cnm_return_val_if_overflow (int, from->fd, -1);
4230 memset (to, 0, sizeof(*to));
4232 to->fd = from->fd;
4233 if (Mono_Posix_FromPollEvents (from->events, &to->events) != 0) {
4234 return -1;
4236 if (Mono_Posix_FromPollEvents (from->revents, &to->revents) != 0) {
4237 return -1;
4240 return 0;
4242 #endif /* ndef HAVE_STRUCT_POLLFD */
4245 #ifdef HAVE_STRUCT_POLLFD
4247 Mono_Posix_ToPollfd (struct pollfd *from, struct Mono_Posix_Pollfd *to)
4249 _cnm_return_val_if_overflow (int, from->fd, -1);
4251 memset (to, 0, sizeof(*to));
4253 to->fd = from->fd;
4254 if (Mono_Posix_ToPollEvents (from->events, &to->events) != 0) {
4255 return -1;
4257 if (Mono_Posix_ToPollEvents (from->revents, &to->revents) != 0) {
4258 return -1;
4261 return 0;
4263 #endif /* ndef HAVE_STRUCT_POLLFD */
4266 int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
4268 *r = 0;
4269 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
4270 #ifdef POSIX_FADV_DONTNEED
4271 {*r = POSIX_FADV_DONTNEED; return 0;}
4272 #else /* def POSIX_FADV_DONTNEED */
4273 {errno = EINVAL; return -1;}
4274 #endif /* ndef POSIX_FADV_DONTNEED */
4275 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
4276 #ifdef POSIX_FADV_NOREUSE
4277 {*r = POSIX_FADV_NOREUSE; return 0;}
4278 #else /* def POSIX_FADV_NOREUSE */
4279 {errno = EINVAL; return -1;}
4280 #endif /* ndef POSIX_FADV_NOREUSE */
4281 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
4282 #ifdef POSIX_FADV_NORMAL
4283 {*r = POSIX_FADV_NORMAL; return 0;}
4284 #else /* def POSIX_FADV_NORMAL */
4285 {errno = EINVAL; return -1;}
4286 #endif /* ndef POSIX_FADV_NORMAL */
4287 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
4288 #ifdef POSIX_FADV_RANDOM
4289 {*r = POSIX_FADV_RANDOM; return 0;}
4290 #else /* def POSIX_FADV_RANDOM */
4291 {errno = EINVAL; return -1;}
4292 #endif /* ndef POSIX_FADV_RANDOM */
4293 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
4294 #ifdef POSIX_FADV_SEQUENTIAL
4295 {*r = POSIX_FADV_SEQUENTIAL; return 0;}
4296 #else /* def POSIX_FADV_SEQUENTIAL */
4297 {errno = EINVAL; return -1;}
4298 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4299 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
4300 #ifdef POSIX_FADV_WILLNEED
4301 {*r = POSIX_FADV_WILLNEED; return 0;}
4302 #else /* def POSIX_FADV_WILLNEED */
4303 {errno = EINVAL; return -1;}
4304 #endif /* ndef POSIX_FADV_WILLNEED */
4305 if (x == 0)
4306 return 0;
4307 errno = EINVAL; return -1;
4310 int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
4312 *r = 0;
4313 if (x == 0)
4314 return 0;
4315 #ifdef POSIX_FADV_DONTNEED
4316 if (x == POSIX_FADV_DONTNEED)
4317 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
4318 #endif /* ndef POSIX_FADV_DONTNEED */
4319 #ifdef POSIX_FADV_NOREUSE
4320 if (x == POSIX_FADV_NOREUSE)
4321 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
4322 #endif /* ndef POSIX_FADV_NOREUSE */
4323 #ifdef POSIX_FADV_NORMAL
4324 if (x == POSIX_FADV_NORMAL)
4325 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
4326 #endif /* ndef POSIX_FADV_NORMAL */
4327 #ifdef POSIX_FADV_RANDOM
4328 if (x == POSIX_FADV_RANDOM)
4329 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
4330 #endif /* ndef POSIX_FADV_RANDOM */
4331 #ifdef POSIX_FADV_SEQUENTIAL
4332 if (x == POSIX_FADV_SEQUENTIAL)
4333 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
4334 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4335 #ifdef POSIX_FADV_WILLNEED
4336 if (x == POSIX_FADV_WILLNEED)
4337 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
4338 #endif /* ndef POSIX_FADV_WILLNEED */
4339 errno = EINVAL; return -1;
4342 int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
4344 *r = 0;
4345 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
4346 #ifdef POSIX_MADV_DONTNEED
4347 {*r = POSIX_MADV_DONTNEED; return 0;}
4348 #else /* def POSIX_MADV_DONTNEED */
4349 {errno = EINVAL; return -1;}
4350 #endif /* ndef POSIX_MADV_DONTNEED */
4351 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
4352 #ifdef POSIX_MADV_NORMAL
4353 {*r = POSIX_MADV_NORMAL; return 0;}
4354 #else /* def POSIX_MADV_NORMAL */
4355 {errno = EINVAL; return -1;}
4356 #endif /* ndef POSIX_MADV_NORMAL */
4357 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
4358 #ifdef POSIX_MADV_RANDOM
4359 {*r = POSIX_MADV_RANDOM; return 0;}
4360 #else /* def POSIX_MADV_RANDOM */
4361 {errno = EINVAL; return -1;}
4362 #endif /* ndef POSIX_MADV_RANDOM */
4363 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
4364 #ifdef POSIX_MADV_SEQUENTIAL
4365 {*r = POSIX_MADV_SEQUENTIAL; return 0;}
4366 #else /* def POSIX_MADV_SEQUENTIAL */
4367 {errno = EINVAL; return -1;}
4368 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4369 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
4370 #ifdef POSIX_MADV_WILLNEED
4371 {*r = POSIX_MADV_WILLNEED; return 0;}
4372 #else /* def POSIX_MADV_WILLNEED */
4373 {errno = EINVAL; return -1;}
4374 #endif /* ndef POSIX_MADV_WILLNEED */
4375 if (x == 0)
4376 return 0;
4377 errno = EINVAL; return -1;
4380 int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
4382 *r = 0;
4383 if (x == 0)
4384 return 0;
4385 #ifdef POSIX_MADV_DONTNEED
4386 if (x == POSIX_MADV_DONTNEED)
4387 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
4388 #endif /* ndef POSIX_MADV_DONTNEED */
4389 #ifdef POSIX_MADV_NORMAL
4390 if (x == POSIX_MADV_NORMAL)
4391 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
4392 #endif /* ndef POSIX_MADV_NORMAL */
4393 #ifdef POSIX_MADV_RANDOM
4394 if (x == POSIX_MADV_RANDOM)
4395 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
4396 #endif /* ndef POSIX_MADV_RANDOM */
4397 #ifdef POSIX_MADV_SEQUENTIAL
4398 if (x == POSIX_MADV_SEQUENTIAL)
4399 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
4400 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4401 #ifdef POSIX_MADV_WILLNEED
4402 if (x == POSIX_MADV_WILLNEED)
4403 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
4404 #endif /* ndef POSIX_MADV_WILLNEED */
4405 errno = EINVAL; return -1;
4408 int Mono_Posix_FromSeekFlags (short x, short *r)
4410 *r = 0;
4411 if (x == Mono_Posix_SeekFlags_L_INCR)
4412 #ifdef L_INCR
4413 {*r = L_INCR; return 0;}
4414 #else /* def L_INCR */
4415 {errno = EINVAL; return -1;}
4416 #endif /* ndef L_INCR */
4417 if (x == Mono_Posix_SeekFlags_L_SET)
4418 #ifdef L_SET
4419 {*r = L_SET; return 0;}
4420 #else /* def L_SET */
4421 {errno = EINVAL; return -1;}
4422 #endif /* ndef L_SET */
4423 if (x == Mono_Posix_SeekFlags_L_XTND)
4424 #ifdef L_XTND
4425 {*r = L_XTND; return 0;}
4426 #else /* def L_XTND */
4427 {errno = EINVAL; return -1;}
4428 #endif /* ndef L_XTND */
4429 if (x == Mono_Posix_SeekFlags_SEEK_CUR)
4430 #ifdef SEEK_CUR
4431 {*r = SEEK_CUR; return 0;}
4432 #else /* def SEEK_CUR */
4433 {errno = EINVAL; return -1;}
4434 #endif /* ndef SEEK_CUR */
4435 if (x == Mono_Posix_SeekFlags_SEEK_END)
4436 #ifdef SEEK_END
4437 {*r = SEEK_END; return 0;}
4438 #else /* def SEEK_END */
4439 {errno = EINVAL; return -1;}
4440 #endif /* ndef SEEK_END */
4441 if (x == Mono_Posix_SeekFlags_SEEK_SET)
4442 #ifdef SEEK_SET
4443 {*r = SEEK_SET; return 0;}
4444 #else /* def SEEK_SET */
4445 {errno = EINVAL; return -1;}
4446 #endif /* ndef SEEK_SET */
4447 if (x == 0)
4448 return 0;
4449 errno = EINVAL; return -1;
4452 int Mono_Posix_ToSeekFlags (short x, short *r)
4454 *r = 0;
4455 if (x == 0)
4456 return 0;
4457 #ifdef L_INCR
4458 if (x == L_INCR)
4459 {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
4460 #endif /* ndef L_INCR */
4461 #ifdef L_SET
4462 if (x == L_SET)
4463 {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
4464 #endif /* ndef L_SET */
4465 #ifdef L_XTND
4466 if (x == L_XTND)
4467 {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
4468 #endif /* ndef L_XTND */
4469 #ifdef SEEK_CUR
4470 if (x == SEEK_CUR)
4471 {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
4472 #endif /* ndef SEEK_CUR */
4473 #ifdef SEEK_END
4474 if (x == SEEK_END)
4475 {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
4476 #endif /* ndef SEEK_END */
4477 #ifdef SEEK_SET
4478 if (x == SEEK_SET)
4479 {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
4480 #endif /* ndef SEEK_SET */
4481 errno = EINVAL; return -1;
4484 int Mono_Posix_FromSignum (int x, int *r)
4486 *r = 0;
4487 if (x == Mono_Posix_Signum_SIGABRT)
4488 #ifdef SIGABRT
4489 {*r = SIGABRT; return 0;}
4490 #else /* def SIGABRT */
4491 {errno = EINVAL; return -1;}
4492 #endif /* ndef SIGABRT */
4493 if (x == Mono_Posix_Signum_SIGALRM)
4494 #ifdef SIGALRM
4495 {*r = SIGALRM; return 0;}
4496 #else /* def SIGALRM */
4497 {errno = EINVAL; return -1;}
4498 #endif /* ndef SIGALRM */
4499 if (x == Mono_Posix_Signum_SIGBUS)
4500 #ifdef SIGBUS
4501 {*r = SIGBUS; return 0;}
4502 #else /* def SIGBUS */
4503 {errno = EINVAL; return -1;}
4504 #endif /* ndef SIGBUS */
4505 if (x == Mono_Posix_Signum_SIGCHLD)
4506 #ifdef SIGCHLD
4507 {*r = SIGCHLD; return 0;}
4508 #else /* def SIGCHLD */
4509 {errno = EINVAL; return -1;}
4510 #endif /* ndef SIGCHLD */
4511 if (x == Mono_Posix_Signum_SIGCLD)
4512 #ifdef SIGCLD
4513 {*r = SIGCLD; return 0;}
4514 #else /* def SIGCLD */
4515 {errno = EINVAL; return -1;}
4516 #endif /* ndef SIGCLD */
4517 if (x == Mono_Posix_Signum_SIGCONT)
4518 #ifdef SIGCONT
4519 {*r = SIGCONT; return 0;}
4520 #else /* def SIGCONT */
4521 {errno = EINVAL; return -1;}
4522 #endif /* ndef SIGCONT */
4523 if (x == Mono_Posix_Signum_SIGFPE)
4524 #ifdef SIGFPE
4525 {*r = SIGFPE; return 0;}
4526 #else /* def SIGFPE */
4527 {errno = EINVAL; return -1;}
4528 #endif /* ndef SIGFPE */
4529 if (x == Mono_Posix_Signum_SIGHUP)
4530 #ifdef SIGHUP
4531 {*r = SIGHUP; return 0;}
4532 #else /* def SIGHUP */
4533 {errno = EINVAL; return -1;}
4534 #endif /* ndef SIGHUP */
4535 if (x == Mono_Posix_Signum_SIGILL)
4536 #ifdef SIGILL
4537 {*r = SIGILL; return 0;}
4538 #else /* def SIGILL */
4539 {errno = EINVAL; return -1;}
4540 #endif /* ndef SIGILL */
4541 if (x == Mono_Posix_Signum_SIGINT)
4542 #ifdef SIGINT
4543 {*r = SIGINT; return 0;}
4544 #else /* def SIGINT */
4545 {errno = EINVAL; return -1;}
4546 #endif /* ndef SIGINT */
4547 if (x == Mono_Posix_Signum_SIGIO)
4548 #ifdef SIGIO
4549 {*r = SIGIO; return 0;}
4550 #else /* def SIGIO */
4551 {errno = EINVAL; return -1;}
4552 #endif /* ndef SIGIO */
4553 if (x == Mono_Posix_Signum_SIGIOT)
4554 #ifdef SIGIOT
4555 {*r = SIGIOT; return 0;}
4556 #else /* def SIGIOT */
4557 {errno = EINVAL; return -1;}
4558 #endif /* ndef SIGIOT */
4559 if (x == Mono_Posix_Signum_SIGKILL)
4560 #ifdef SIGKILL
4561 {*r = SIGKILL; return 0;}
4562 #else /* def SIGKILL */
4563 {errno = EINVAL; return -1;}
4564 #endif /* ndef SIGKILL */
4565 if (x == Mono_Posix_Signum_SIGPIPE)
4566 #ifdef SIGPIPE
4567 {*r = SIGPIPE; return 0;}
4568 #else /* def SIGPIPE */
4569 {errno = EINVAL; return -1;}
4570 #endif /* ndef SIGPIPE */
4571 if (x == Mono_Posix_Signum_SIGPOLL)
4572 #ifdef SIGPOLL
4573 {*r = SIGPOLL; return 0;}
4574 #else /* def SIGPOLL */
4575 {errno = EINVAL; return -1;}
4576 #endif /* ndef SIGPOLL */
4577 if (x == Mono_Posix_Signum_SIGPROF)
4578 #ifdef SIGPROF
4579 {*r = SIGPROF; return 0;}
4580 #else /* def SIGPROF */
4581 {errno = EINVAL; return -1;}
4582 #endif /* ndef SIGPROF */
4583 if (x == Mono_Posix_Signum_SIGPWR)
4584 #ifdef SIGPWR
4585 {*r = SIGPWR; return 0;}
4586 #else /* def SIGPWR */
4587 {errno = EINVAL; return -1;}
4588 #endif /* ndef SIGPWR */
4589 if (x == Mono_Posix_Signum_SIGQUIT)
4590 #ifdef SIGQUIT
4591 {*r = SIGQUIT; return 0;}
4592 #else /* def SIGQUIT */
4593 {errno = EINVAL; return -1;}
4594 #endif /* ndef SIGQUIT */
4595 if (x == Mono_Posix_Signum_SIGSEGV)
4596 #ifdef SIGSEGV
4597 {*r = SIGSEGV; return 0;}
4598 #else /* def SIGSEGV */
4599 {errno = EINVAL; return -1;}
4600 #endif /* ndef SIGSEGV */
4601 if (x == Mono_Posix_Signum_SIGSTKFLT)
4602 #ifdef SIGSTKFLT
4603 {*r = SIGSTKFLT; return 0;}
4604 #else /* def SIGSTKFLT */
4605 {errno = EINVAL; return -1;}
4606 #endif /* ndef SIGSTKFLT */
4607 if (x == Mono_Posix_Signum_SIGSTOP)
4608 #ifdef SIGSTOP
4609 {*r = SIGSTOP; return 0;}
4610 #else /* def SIGSTOP */
4611 {errno = EINVAL; return -1;}
4612 #endif /* ndef SIGSTOP */
4613 if (x == Mono_Posix_Signum_SIGSYS)
4614 #ifdef SIGSYS
4615 {*r = SIGSYS; return 0;}
4616 #else /* def SIGSYS */
4617 {errno = EINVAL; return -1;}
4618 #endif /* ndef SIGSYS */
4619 if (x == Mono_Posix_Signum_SIGTERM)
4620 #ifdef SIGTERM
4621 {*r = SIGTERM; return 0;}
4622 #else /* def SIGTERM */
4623 {errno = EINVAL; return -1;}
4624 #endif /* ndef SIGTERM */
4625 if (x == Mono_Posix_Signum_SIGTRAP)
4626 #ifdef SIGTRAP
4627 {*r = SIGTRAP; return 0;}
4628 #else /* def SIGTRAP */
4629 {errno = EINVAL; return -1;}
4630 #endif /* ndef SIGTRAP */
4631 if (x == Mono_Posix_Signum_SIGTSTP)
4632 #ifdef SIGTSTP
4633 {*r = SIGTSTP; return 0;}
4634 #else /* def SIGTSTP */
4635 {errno = EINVAL; return -1;}
4636 #endif /* ndef SIGTSTP */
4637 if (x == Mono_Posix_Signum_SIGTTIN)
4638 #ifdef SIGTTIN
4639 {*r = SIGTTIN; return 0;}
4640 #else /* def SIGTTIN */
4641 {errno = EINVAL; return -1;}
4642 #endif /* ndef SIGTTIN */
4643 if (x == Mono_Posix_Signum_SIGTTOU)
4644 #ifdef SIGTTOU
4645 {*r = SIGTTOU; return 0;}
4646 #else /* def SIGTTOU */
4647 {errno = EINVAL; return -1;}
4648 #endif /* ndef SIGTTOU */
4649 if (x == Mono_Posix_Signum_SIGUNUSED)
4650 #ifdef SIGUNUSED
4651 {*r = SIGUNUSED; return 0;}
4652 #else /* def SIGUNUSED */
4653 {errno = EINVAL; return -1;}
4654 #endif /* ndef SIGUNUSED */
4655 if (x == Mono_Posix_Signum_SIGURG)
4656 #ifdef SIGURG
4657 {*r = SIGURG; return 0;}
4658 #else /* def SIGURG */
4659 {errno = EINVAL; return -1;}
4660 #endif /* ndef SIGURG */
4661 if (x == Mono_Posix_Signum_SIGUSR1)
4662 #ifdef SIGUSR1
4663 {*r = SIGUSR1; return 0;}
4664 #else /* def SIGUSR1 */
4665 {errno = EINVAL; return -1;}
4666 #endif /* ndef SIGUSR1 */
4667 if (x == Mono_Posix_Signum_SIGUSR2)
4668 #ifdef SIGUSR2
4669 {*r = SIGUSR2; return 0;}
4670 #else /* def SIGUSR2 */
4671 {errno = EINVAL; return -1;}
4672 #endif /* ndef SIGUSR2 */
4673 if (x == Mono_Posix_Signum_SIGVTALRM)
4674 #ifdef SIGVTALRM
4675 {*r = SIGVTALRM; return 0;}
4676 #else /* def SIGVTALRM */
4677 {errno = EINVAL; return -1;}
4678 #endif /* ndef SIGVTALRM */
4679 if (x == Mono_Posix_Signum_SIGWINCH)
4680 #ifdef SIGWINCH
4681 {*r = SIGWINCH; return 0;}
4682 #else /* def SIGWINCH */
4683 {errno = EINVAL; return -1;}
4684 #endif /* ndef SIGWINCH */
4685 if (x == Mono_Posix_Signum_SIGXCPU)
4686 #ifdef SIGXCPU
4687 {*r = SIGXCPU; return 0;}
4688 #else /* def SIGXCPU */
4689 {errno = EINVAL; return -1;}
4690 #endif /* ndef SIGXCPU */
4691 if (x == Mono_Posix_Signum_SIGXFSZ)
4692 #ifdef SIGXFSZ
4693 {*r = SIGXFSZ; return 0;}
4694 #else /* def SIGXFSZ */
4695 {errno = EINVAL; return -1;}
4696 #endif /* ndef SIGXFSZ */
4697 if (x == 0)
4698 return 0;
4699 errno = EINVAL; return -1;
4702 int Mono_Posix_ToSignum (int x, int *r)
4704 *r = 0;
4705 if (x == 0)
4706 return 0;
4707 #ifdef SIGABRT
4708 if (x == SIGABRT)
4709 {*r = Mono_Posix_Signum_SIGABRT; return 0;}
4710 #endif /* ndef SIGABRT */
4711 #ifdef SIGALRM
4712 if (x == SIGALRM)
4713 {*r = Mono_Posix_Signum_SIGALRM; return 0;}
4714 #endif /* ndef SIGALRM */
4715 #ifdef SIGBUS
4716 if (x == SIGBUS)
4717 {*r = Mono_Posix_Signum_SIGBUS; return 0;}
4718 #endif /* ndef SIGBUS */
4719 #ifdef SIGCHLD
4720 if (x == SIGCHLD)
4721 {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
4722 #endif /* ndef SIGCHLD */
4723 #ifdef SIGCLD
4724 if (x == SIGCLD)
4725 {*r = Mono_Posix_Signum_SIGCLD; return 0;}
4726 #endif /* ndef SIGCLD */
4727 #ifdef SIGCONT
4728 if (x == SIGCONT)
4729 {*r = Mono_Posix_Signum_SIGCONT; return 0;}
4730 #endif /* ndef SIGCONT */
4731 #ifdef SIGFPE
4732 if (x == SIGFPE)
4733 {*r = Mono_Posix_Signum_SIGFPE; return 0;}
4734 #endif /* ndef SIGFPE */
4735 #ifdef SIGHUP
4736 if (x == SIGHUP)
4737 {*r = Mono_Posix_Signum_SIGHUP; return 0;}
4738 #endif /* ndef SIGHUP */
4739 #ifdef SIGILL
4740 if (x == SIGILL)
4741 {*r = Mono_Posix_Signum_SIGILL; return 0;}
4742 #endif /* ndef SIGILL */
4743 #ifdef SIGINT
4744 if (x == SIGINT)
4745 {*r = Mono_Posix_Signum_SIGINT; return 0;}
4746 #endif /* ndef SIGINT */
4747 #ifdef SIGIO
4748 if (x == SIGIO)
4749 {*r = Mono_Posix_Signum_SIGIO; return 0;}
4750 #endif /* ndef SIGIO */
4751 #ifdef SIGIOT
4752 if (x == SIGIOT)
4753 {*r = Mono_Posix_Signum_SIGIOT; return 0;}
4754 #endif /* ndef SIGIOT */
4755 #ifdef SIGKILL
4756 if (x == SIGKILL)
4757 {*r = Mono_Posix_Signum_SIGKILL; return 0;}
4758 #endif /* ndef SIGKILL */
4759 #ifdef SIGPIPE
4760 if (x == SIGPIPE)
4761 {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
4762 #endif /* ndef SIGPIPE */
4763 #ifdef SIGPOLL
4764 if (x == SIGPOLL)
4765 {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
4766 #endif /* ndef SIGPOLL */
4767 #ifdef SIGPROF
4768 if (x == SIGPROF)
4769 {*r = Mono_Posix_Signum_SIGPROF; return 0;}
4770 #endif /* ndef SIGPROF */
4771 #ifdef SIGPWR
4772 if (x == SIGPWR)
4773 {*r = Mono_Posix_Signum_SIGPWR; return 0;}
4774 #endif /* ndef SIGPWR */
4775 #ifdef SIGQUIT
4776 if (x == SIGQUIT)
4777 {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
4778 #endif /* ndef SIGQUIT */
4779 #ifdef SIGSEGV
4780 if (x == SIGSEGV)
4781 {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
4782 #endif /* ndef SIGSEGV */
4783 #ifdef SIGSTKFLT
4784 if (x == SIGSTKFLT)
4785 {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
4786 #endif /* ndef SIGSTKFLT */
4787 #ifdef SIGSTOP
4788 if (x == SIGSTOP)
4789 {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
4790 #endif /* ndef SIGSTOP */
4791 #ifdef SIGSYS
4792 if (x == SIGSYS)
4793 {*r = Mono_Posix_Signum_SIGSYS; return 0;}
4794 #endif /* ndef SIGSYS */
4795 #ifdef SIGTERM
4796 if (x == SIGTERM)
4797 {*r = Mono_Posix_Signum_SIGTERM; return 0;}
4798 #endif /* ndef SIGTERM */
4799 #ifdef SIGTRAP
4800 if (x == SIGTRAP)
4801 {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
4802 #endif /* ndef SIGTRAP */
4803 #ifdef SIGTSTP
4804 if (x == SIGTSTP)
4805 {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
4806 #endif /* ndef SIGTSTP */
4807 #ifdef SIGTTIN
4808 if (x == SIGTTIN)
4809 {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
4810 #endif /* ndef SIGTTIN */
4811 #ifdef SIGTTOU
4812 if (x == SIGTTOU)
4813 {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
4814 #endif /* ndef SIGTTOU */
4815 #ifdef SIGUNUSED
4816 if (x == SIGUNUSED)
4817 {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
4818 #endif /* ndef SIGUNUSED */
4819 #ifdef SIGURG
4820 if (x == SIGURG)
4821 {*r = Mono_Posix_Signum_SIGURG; return 0;}
4822 #endif /* ndef SIGURG */
4823 #ifdef SIGUSR1
4824 if (x == SIGUSR1)
4825 {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
4826 #endif /* ndef SIGUSR1 */
4827 #ifdef SIGUSR2
4828 if (x == SIGUSR2)
4829 {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
4830 #endif /* ndef SIGUSR2 */
4831 #ifdef SIGVTALRM
4832 if (x == SIGVTALRM)
4833 {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
4834 #endif /* ndef SIGVTALRM */
4835 #ifdef SIGWINCH
4836 if (x == SIGWINCH)
4837 {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
4838 #endif /* ndef SIGWINCH */
4839 #ifdef SIGXCPU
4840 if (x == SIGXCPU)
4841 {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
4842 #endif /* ndef SIGXCPU */
4843 #ifdef SIGXFSZ
4844 if (x == SIGXFSZ)
4845 {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
4846 #endif /* ndef SIGXFSZ */
4847 errno = EINVAL; return -1;
4850 int Mono_Posix_FromSysconfName (int x, int *r)
4852 *r = 0;
4853 if (x == Mono_Posix_SysconfName__SC_2_CHAR_TERM)
4854 #ifdef _SC_2_CHAR_TERM
4855 {*r = _SC_2_CHAR_TERM; return 0;}
4856 #else /* def _SC_2_CHAR_TERM */
4857 {errno = EINVAL; return -1;}
4858 #endif /* ndef _SC_2_CHAR_TERM */
4859 if (x == Mono_Posix_SysconfName__SC_2_C_BIND)
4860 #ifdef _SC_2_C_BIND
4861 {*r = _SC_2_C_BIND; return 0;}
4862 #else /* def _SC_2_C_BIND */
4863 {errno = EINVAL; return -1;}
4864 #endif /* ndef _SC_2_C_BIND */
4865 if (x == Mono_Posix_SysconfName__SC_2_C_DEV)
4866 #ifdef _SC_2_C_DEV
4867 {*r = _SC_2_C_DEV; return 0;}
4868 #else /* def _SC_2_C_DEV */
4869 {errno = EINVAL; return -1;}
4870 #endif /* ndef _SC_2_C_DEV */
4871 if (x == Mono_Posix_SysconfName__SC_2_C_VERSION)
4872 #ifdef _SC_2_C_VERSION
4873 {*r = _SC_2_C_VERSION; return 0;}
4874 #else /* def _SC_2_C_VERSION */
4875 {errno = EINVAL; return -1;}
4876 #endif /* ndef _SC_2_C_VERSION */
4877 if (x == Mono_Posix_SysconfName__SC_2_FORT_DEV)
4878 #ifdef _SC_2_FORT_DEV
4879 {*r = _SC_2_FORT_DEV; return 0;}
4880 #else /* def _SC_2_FORT_DEV */
4881 {errno = EINVAL; return -1;}
4882 #endif /* ndef _SC_2_FORT_DEV */
4883 if (x == Mono_Posix_SysconfName__SC_2_FORT_RUN)
4884 #ifdef _SC_2_FORT_RUN
4885 {*r = _SC_2_FORT_RUN; return 0;}
4886 #else /* def _SC_2_FORT_RUN */
4887 {errno = EINVAL; return -1;}
4888 #endif /* ndef _SC_2_FORT_RUN */
4889 if (x == Mono_Posix_SysconfName__SC_2_LOCALEDEF)
4890 #ifdef _SC_2_LOCALEDEF
4891 {*r = _SC_2_LOCALEDEF; return 0;}
4892 #else /* def _SC_2_LOCALEDEF */
4893 {errno = EINVAL; return -1;}
4894 #endif /* ndef _SC_2_LOCALEDEF */
4895 if (x == Mono_Posix_SysconfName__SC_2_PBS)
4896 #ifdef _SC_2_PBS
4897 {*r = _SC_2_PBS; return 0;}
4898 #else /* def _SC_2_PBS */
4899 {errno = EINVAL; return -1;}
4900 #endif /* ndef _SC_2_PBS */
4901 if (x == Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING)
4902 #ifdef _SC_2_PBS_ACCOUNTING
4903 {*r = _SC_2_PBS_ACCOUNTING; return 0;}
4904 #else /* def _SC_2_PBS_ACCOUNTING */
4905 {errno = EINVAL; return -1;}
4906 #endif /* ndef _SC_2_PBS_ACCOUNTING */
4907 if (x == Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT)
4908 #ifdef _SC_2_PBS_CHECKPOINT
4909 {*r = _SC_2_PBS_CHECKPOINT; return 0;}
4910 #else /* def _SC_2_PBS_CHECKPOINT */
4911 {errno = EINVAL; return -1;}
4912 #endif /* ndef _SC_2_PBS_CHECKPOINT */
4913 if (x == Mono_Posix_SysconfName__SC_2_PBS_LOCATE)
4914 #ifdef _SC_2_PBS_LOCATE
4915 {*r = _SC_2_PBS_LOCATE; return 0;}
4916 #else /* def _SC_2_PBS_LOCATE */
4917 {errno = EINVAL; return -1;}
4918 #endif /* ndef _SC_2_PBS_LOCATE */
4919 if (x == Mono_Posix_SysconfName__SC_2_PBS_MESSAGE)
4920 #ifdef _SC_2_PBS_MESSAGE
4921 {*r = _SC_2_PBS_MESSAGE; return 0;}
4922 #else /* def _SC_2_PBS_MESSAGE */
4923 {errno = EINVAL; return -1;}
4924 #endif /* ndef _SC_2_PBS_MESSAGE */
4925 if (x == Mono_Posix_SysconfName__SC_2_PBS_TRACK)
4926 #ifdef _SC_2_PBS_TRACK
4927 {*r = _SC_2_PBS_TRACK; return 0;}
4928 #else /* def _SC_2_PBS_TRACK */
4929 {errno = EINVAL; return -1;}
4930 #endif /* ndef _SC_2_PBS_TRACK */
4931 if (x == Mono_Posix_SysconfName__SC_2_SW_DEV)
4932 #ifdef _SC_2_SW_DEV
4933 {*r = _SC_2_SW_DEV; return 0;}
4934 #else /* def _SC_2_SW_DEV */
4935 {errno = EINVAL; return -1;}
4936 #endif /* ndef _SC_2_SW_DEV */
4937 if (x == Mono_Posix_SysconfName__SC_2_UPE)
4938 #ifdef _SC_2_UPE
4939 {*r = _SC_2_UPE; return 0;}
4940 #else /* def _SC_2_UPE */
4941 {errno = EINVAL; return -1;}
4942 #endif /* ndef _SC_2_UPE */
4943 if (x == Mono_Posix_SysconfName__SC_2_VERSION)
4944 #ifdef _SC_2_VERSION
4945 {*r = _SC_2_VERSION; return 0;}
4946 #else /* def _SC_2_VERSION */
4947 {errno = EINVAL; return -1;}
4948 #endif /* ndef _SC_2_VERSION */
4949 if (x == Mono_Posix_SysconfName__SC_ADVISORY_INFO)
4950 #ifdef _SC_ADVISORY_INFO
4951 {*r = _SC_ADVISORY_INFO; return 0;}
4952 #else /* def _SC_ADVISORY_INFO */
4953 {errno = EINVAL; return -1;}
4954 #endif /* ndef _SC_ADVISORY_INFO */
4955 if (x == Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX)
4956 #ifdef _SC_AIO_LISTIO_MAX
4957 {*r = _SC_AIO_LISTIO_MAX; return 0;}
4958 #else /* def _SC_AIO_LISTIO_MAX */
4959 {errno = EINVAL; return -1;}
4960 #endif /* ndef _SC_AIO_LISTIO_MAX */
4961 if (x == Mono_Posix_SysconfName__SC_AIO_MAX)
4962 #ifdef _SC_AIO_MAX
4963 {*r = _SC_AIO_MAX; return 0;}
4964 #else /* def _SC_AIO_MAX */
4965 {errno = EINVAL; return -1;}
4966 #endif /* ndef _SC_AIO_MAX */
4967 if (x == Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX)
4968 #ifdef _SC_AIO_PRIO_DELTA_MAX
4969 {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
4970 #else /* def _SC_AIO_PRIO_DELTA_MAX */
4971 {errno = EINVAL; return -1;}
4972 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
4973 if (x == Mono_Posix_SysconfName__SC_ARG_MAX)
4974 #ifdef _SC_ARG_MAX
4975 {*r = _SC_ARG_MAX; return 0;}
4976 #else /* def _SC_ARG_MAX */
4977 {errno = EINVAL; return -1;}
4978 #endif /* ndef _SC_ARG_MAX */
4979 if (x == Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO)
4980 #ifdef _SC_ASYNCHRONOUS_IO
4981 {*r = _SC_ASYNCHRONOUS_IO; return 0;}
4982 #else /* def _SC_ASYNCHRONOUS_IO */
4983 {errno = EINVAL; return -1;}
4984 #endif /* ndef _SC_ASYNCHRONOUS_IO */
4985 if (x == Mono_Posix_SysconfName__SC_ATEXIT_MAX)
4986 #ifdef _SC_ATEXIT_MAX
4987 {*r = _SC_ATEXIT_MAX; return 0;}
4988 #else /* def _SC_ATEXIT_MAX */
4989 {errno = EINVAL; return -1;}
4990 #endif /* ndef _SC_ATEXIT_MAX */
4991 if (x == Mono_Posix_SysconfName__SC_AVPHYS_PAGES)
4992 #ifdef _SC_AVPHYS_PAGES
4993 {*r = _SC_AVPHYS_PAGES; return 0;}
4994 #else /* def _SC_AVPHYS_PAGES */
4995 {errno = EINVAL; return -1;}
4996 #endif /* ndef _SC_AVPHYS_PAGES */
4997 if (x == Mono_Posix_SysconfName__SC_BARRIERS)
4998 #ifdef _SC_BARRIERS
4999 {*r = _SC_BARRIERS; return 0;}
5000 #else /* def _SC_BARRIERS */
5001 {errno = EINVAL; return -1;}
5002 #endif /* ndef _SC_BARRIERS */
5003 if (x == Mono_Posix_SysconfName__SC_BASE)
5004 #ifdef _SC_BASE
5005 {*r = _SC_BASE; return 0;}
5006 #else /* def _SC_BASE */
5007 {errno = EINVAL; return -1;}
5008 #endif /* ndef _SC_BASE */
5009 if (x == Mono_Posix_SysconfName__SC_BC_BASE_MAX)
5010 #ifdef _SC_BC_BASE_MAX
5011 {*r = _SC_BC_BASE_MAX; return 0;}
5012 #else /* def _SC_BC_BASE_MAX */
5013 {errno = EINVAL; return -1;}
5014 #endif /* ndef _SC_BC_BASE_MAX */
5015 if (x == Mono_Posix_SysconfName__SC_BC_DIM_MAX)
5016 #ifdef _SC_BC_DIM_MAX
5017 {*r = _SC_BC_DIM_MAX; return 0;}
5018 #else /* def _SC_BC_DIM_MAX */
5019 {errno = EINVAL; return -1;}
5020 #endif /* ndef _SC_BC_DIM_MAX */
5021 if (x == Mono_Posix_SysconfName__SC_BC_SCALE_MAX)
5022 #ifdef _SC_BC_SCALE_MAX
5023 {*r = _SC_BC_SCALE_MAX; return 0;}
5024 #else /* def _SC_BC_SCALE_MAX */
5025 {errno = EINVAL; return -1;}
5026 #endif /* ndef _SC_BC_SCALE_MAX */
5027 if (x == Mono_Posix_SysconfName__SC_BC_STRING_MAX)
5028 #ifdef _SC_BC_STRING_MAX
5029 {*r = _SC_BC_STRING_MAX; return 0;}
5030 #else /* def _SC_BC_STRING_MAX */
5031 {errno = EINVAL; return -1;}
5032 #endif /* ndef _SC_BC_STRING_MAX */
5033 if (x == Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX)
5034 #ifdef _SC_CHARCLASS_NAME_MAX
5035 {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
5036 #else /* def _SC_CHARCLASS_NAME_MAX */
5037 {errno = EINVAL; return -1;}
5038 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
5039 if (x == Mono_Posix_SysconfName__SC_CHAR_BIT)
5040 #ifdef _SC_CHAR_BIT
5041 {*r = _SC_CHAR_BIT; return 0;}
5042 #else /* def _SC_CHAR_BIT */
5043 {errno = EINVAL; return -1;}
5044 #endif /* ndef _SC_CHAR_BIT */
5045 if (x == Mono_Posix_SysconfName__SC_CHAR_MAX)
5046 #ifdef _SC_CHAR_MAX
5047 {*r = _SC_CHAR_MAX; return 0;}
5048 #else /* def _SC_CHAR_MAX */
5049 {errno = EINVAL; return -1;}
5050 #endif /* ndef _SC_CHAR_MAX */
5051 if (x == Mono_Posix_SysconfName__SC_CHAR_MIN)
5052 #ifdef _SC_CHAR_MIN
5053 {*r = _SC_CHAR_MIN; return 0;}
5054 #else /* def _SC_CHAR_MIN */
5055 {errno = EINVAL; return -1;}
5056 #endif /* ndef _SC_CHAR_MIN */
5057 if (x == Mono_Posix_SysconfName__SC_CHILD_MAX)
5058 #ifdef _SC_CHILD_MAX
5059 {*r = _SC_CHILD_MAX; return 0;}
5060 #else /* def _SC_CHILD_MAX */
5061 {errno = EINVAL; return -1;}
5062 #endif /* ndef _SC_CHILD_MAX */
5063 if (x == Mono_Posix_SysconfName__SC_CLK_TCK)
5064 #ifdef _SC_CLK_TCK
5065 {*r = _SC_CLK_TCK; return 0;}
5066 #else /* def _SC_CLK_TCK */
5067 {errno = EINVAL; return -1;}
5068 #endif /* ndef _SC_CLK_TCK */
5069 if (x == Mono_Posix_SysconfName__SC_CLOCK_SELECTION)
5070 #ifdef _SC_CLOCK_SELECTION
5071 {*r = _SC_CLOCK_SELECTION; return 0;}
5072 #else /* def _SC_CLOCK_SELECTION */
5073 {errno = EINVAL; return -1;}
5074 #endif /* ndef _SC_CLOCK_SELECTION */
5075 if (x == Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX)
5076 #ifdef _SC_COLL_WEIGHTS_MAX
5077 {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
5078 #else /* def _SC_COLL_WEIGHTS_MAX */
5079 {errno = EINVAL; return -1;}
5080 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
5081 if (x == Mono_Posix_SysconfName__SC_CPUTIME)
5082 #ifdef _SC_CPUTIME
5083 {*r = _SC_CPUTIME; return 0;}
5084 #else /* def _SC_CPUTIME */
5085 {errno = EINVAL; return -1;}
5086 #endif /* ndef _SC_CPUTIME */
5087 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT)
5088 #ifdef _SC_C_LANG_SUPPORT
5089 {*r = _SC_C_LANG_SUPPORT; return 0;}
5090 #else /* def _SC_C_LANG_SUPPORT */
5091 {errno = EINVAL; return -1;}
5092 #endif /* ndef _SC_C_LANG_SUPPORT */
5093 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R)
5094 #ifdef _SC_C_LANG_SUPPORT_R
5095 {*r = _SC_C_LANG_SUPPORT_R; return 0;}
5096 #else /* def _SC_C_LANG_SUPPORT_R */
5097 {errno = EINVAL; return -1;}
5098 #endif /* ndef _SC_C_LANG_SUPPORT_R */
5099 if (x == Mono_Posix_SysconfName__SC_DELAYTIMER_MAX)
5100 #ifdef _SC_DELAYTIMER_MAX
5101 {*r = _SC_DELAYTIMER_MAX; return 0;}
5102 #else /* def _SC_DELAYTIMER_MAX */
5103 {errno = EINVAL; return -1;}
5104 #endif /* ndef _SC_DELAYTIMER_MAX */
5105 if (x == Mono_Posix_SysconfName__SC_DEVICE_IO)
5106 #ifdef _SC_DEVICE_IO
5107 {*r = _SC_DEVICE_IO; return 0;}
5108 #else /* def _SC_DEVICE_IO */
5109 {errno = EINVAL; return -1;}
5110 #endif /* ndef _SC_DEVICE_IO */
5111 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC)
5112 #ifdef _SC_DEVICE_SPECIFIC
5113 {*r = _SC_DEVICE_SPECIFIC; return 0;}
5114 #else /* def _SC_DEVICE_SPECIFIC */
5115 {errno = EINVAL; return -1;}
5116 #endif /* ndef _SC_DEVICE_SPECIFIC */
5117 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R)
5118 #ifdef _SC_DEVICE_SPECIFIC_R
5119 {*r = _SC_DEVICE_SPECIFIC_R; return 0;}
5120 #else /* def _SC_DEVICE_SPECIFIC_R */
5121 {errno = EINVAL; return -1;}
5122 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
5123 if (x == Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX)
5124 #ifdef _SC_EQUIV_CLASS_MAX
5125 {*r = _SC_EQUIV_CLASS_MAX; return 0;}
5126 #else /* def _SC_EQUIV_CLASS_MAX */
5127 {errno = EINVAL; return -1;}
5128 #endif /* ndef _SC_EQUIV_CLASS_MAX */
5129 if (x == Mono_Posix_SysconfName__SC_EXPR_NEST_MAX)
5130 #ifdef _SC_EXPR_NEST_MAX
5131 {*r = _SC_EXPR_NEST_MAX; return 0;}
5132 #else /* def _SC_EXPR_NEST_MAX */
5133 {errno = EINVAL; return -1;}
5134 #endif /* ndef _SC_EXPR_NEST_MAX */
5135 if (x == Mono_Posix_SysconfName__SC_FD_MGMT)
5136 #ifdef _SC_FD_MGMT
5137 {*r = _SC_FD_MGMT; return 0;}
5138 #else /* def _SC_FD_MGMT */
5139 {errno = EINVAL; return -1;}
5140 #endif /* ndef _SC_FD_MGMT */
5141 if (x == Mono_Posix_SysconfName__SC_FIFO)
5142 #ifdef _SC_FIFO
5143 {*r = _SC_FIFO; return 0;}
5144 #else /* def _SC_FIFO */
5145 {errno = EINVAL; return -1;}
5146 #endif /* ndef _SC_FIFO */
5147 if (x == Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES)
5148 #ifdef _SC_FILE_ATTRIBUTES
5149 {*r = _SC_FILE_ATTRIBUTES; return 0;}
5150 #else /* def _SC_FILE_ATTRIBUTES */
5151 {errno = EINVAL; return -1;}
5152 #endif /* ndef _SC_FILE_ATTRIBUTES */
5153 if (x == Mono_Posix_SysconfName__SC_FILE_LOCKING)
5154 #ifdef _SC_FILE_LOCKING
5155 {*r = _SC_FILE_LOCKING; return 0;}
5156 #else /* def _SC_FILE_LOCKING */
5157 {errno = EINVAL; return -1;}
5158 #endif /* ndef _SC_FILE_LOCKING */
5159 if (x == Mono_Posix_SysconfName__SC_FILE_SYSTEM)
5160 #ifdef _SC_FILE_SYSTEM
5161 {*r = _SC_FILE_SYSTEM; return 0;}
5162 #else /* def _SC_FILE_SYSTEM */
5163 {errno = EINVAL; return -1;}
5164 #endif /* ndef _SC_FILE_SYSTEM */
5165 if (x == Mono_Posix_SysconfName__SC_FSYNC)
5166 #ifdef _SC_FSYNC
5167 {*r = _SC_FSYNC; return 0;}
5168 #else /* def _SC_FSYNC */
5169 {errno = EINVAL; return -1;}
5170 #endif /* ndef _SC_FSYNC */
5171 if (x == Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX)
5172 #ifdef _SC_GETGR_R_SIZE_MAX
5173 {*r = _SC_GETGR_R_SIZE_MAX; return 0;}
5174 #else /* def _SC_GETGR_R_SIZE_MAX */
5175 {errno = EINVAL; return -1;}
5176 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
5177 if (x == Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX)
5178 #ifdef _SC_GETPW_R_SIZE_MAX
5179 {*r = _SC_GETPW_R_SIZE_MAX; return 0;}
5180 #else /* def _SC_GETPW_R_SIZE_MAX */
5181 {errno = EINVAL; return -1;}
5182 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
5183 if (x == Mono_Posix_SysconfName__SC_HOST_NAME_MAX)
5184 #ifdef _SC_HOST_NAME_MAX
5185 {*r = _SC_HOST_NAME_MAX; return 0;}
5186 #else /* def _SC_HOST_NAME_MAX */
5187 {errno = EINVAL; return -1;}
5188 #endif /* ndef _SC_HOST_NAME_MAX */
5189 if (x == Mono_Posix_SysconfName__SC_INT_MAX)
5190 #ifdef _SC_INT_MAX
5191 {*r = _SC_INT_MAX; return 0;}
5192 #else /* def _SC_INT_MAX */
5193 {errno = EINVAL; return -1;}
5194 #endif /* ndef _SC_INT_MAX */
5195 if (x == Mono_Posix_SysconfName__SC_INT_MIN)
5196 #ifdef _SC_INT_MIN
5197 {*r = _SC_INT_MIN; return 0;}
5198 #else /* def _SC_INT_MIN */
5199 {errno = EINVAL; return -1;}
5200 #endif /* ndef _SC_INT_MIN */
5201 if (x == Mono_Posix_SysconfName__SC_IOV_MAX)
5202 #ifdef _SC_IOV_MAX
5203 {*r = _SC_IOV_MAX; return 0;}
5204 #else /* def _SC_IOV_MAX */
5205 {errno = EINVAL; return -1;}
5206 #endif /* ndef _SC_IOV_MAX */
5207 if (x == Mono_Posix_SysconfName__SC_JOB_CONTROL)
5208 #ifdef _SC_JOB_CONTROL
5209 {*r = _SC_JOB_CONTROL; return 0;}
5210 #else /* def _SC_JOB_CONTROL */
5211 {errno = EINVAL; return -1;}
5212 #endif /* ndef _SC_JOB_CONTROL */
5213 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC)
5214 #ifdef _SC_LEVEL1_DCACHE_ASSOC
5215 {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;}
5216 #else /* def _SC_LEVEL1_DCACHE_ASSOC */
5217 {errno = EINVAL; return -1;}
5218 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
5219 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE)
5220 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
5221 {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;}
5222 #else /* def _SC_LEVEL1_DCACHE_LINESIZE */
5223 {errno = EINVAL; return -1;}
5224 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
5225 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE)
5226 #ifdef _SC_LEVEL1_DCACHE_SIZE
5227 {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;}
5228 #else /* def _SC_LEVEL1_DCACHE_SIZE */
5229 {errno = EINVAL; return -1;}
5230 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
5231 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC)
5232 #ifdef _SC_LEVEL1_ICACHE_ASSOC
5233 {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;}
5234 #else /* def _SC_LEVEL1_ICACHE_ASSOC */
5235 {errno = EINVAL; return -1;}
5236 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
5237 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE)
5238 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
5239 {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;}
5240 #else /* def _SC_LEVEL1_ICACHE_LINESIZE */
5241 {errno = EINVAL; return -1;}
5242 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
5243 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE)
5244 #ifdef _SC_LEVEL1_ICACHE_SIZE
5245 {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;}
5246 #else /* def _SC_LEVEL1_ICACHE_SIZE */
5247 {errno = EINVAL; return -1;}
5248 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
5249 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC)
5250 #ifdef _SC_LEVEL2_CACHE_ASSOC
5251 {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;}
5252 #else /* def _SC_LEVEL2_CACHE_ASSOC */
5253 {errno = EINVAL; return -1;}
5254 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
5255 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE)
5256 #ifdef _SC_LEVEL2_CACHE_LINESIZE
5257 {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;}
5258 #else /* def _SC_LEVEL2_CACHE_LINESIZE */
5259 {errno = EINVAL; return -1;}
5260 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
5261 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE)
5262 #ifdef _SC_LEVEL2_CACHE_SIZE
5263 {*r = _SC_LEVEL2_CACHE_SIZE; return 0;}
5264 #else /* def _SC_LEVEL2_CACHE_SIZE */
5265 {errno = EINVAL; return -1;}
5266 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
5267 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC)
5268 #ifdef _SC_LEVEL3_CACHE_ASSOC
5269 {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;}
5270 #else /* def _SC_LEVEL3_CACHE_ASSOC */
5271 {errno = EINVAL; return -1;}
5272 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
5273 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE)
5274 #ifdef _SC_LEVEL3_CACHE_LINESIZE
5275 {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;}
5276 #else /* def _SC_LEVEL3_CACHE_LINESIZE */
5277 {errno = EINVAL; return -1;}
5278 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
5279 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE)
5280 #ifdef _SC_LEVEL3_CACHE_SIZE
5281 {*r = _SC_LEVEL3_CACHE_SIZE; return 0;}
5282 #else /* def _SC_LEVEL3_CACHE_SIZE */
5283 {errno = EINVAL; return -1;}
5284 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
5285 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC)
5286 #ifdef _SC_LEVEL4_CACHE_ASSOC
5287 {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;}
5288 #else /* def _SC_LEVEL4_CACHE_ASSOC */
5289 {errno = EINVAL; return -1;}
5290 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
5291 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE)
5292 #ifdef _SC_LEVEL4_CACHE_LINESIZE
5293 {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;}
5294 #else /* def _SC_LEVEL4_CACHE_LINESIZE */
5295 {errno = EINVAL; return -1;}
5296 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
5297 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE)
5298 #ifdef _SC_LEVEL4_CACHE_SIZE
5299 {*r = _SC_LEVEL4_CACHE_SIZE; return 0;}
5300 #else /* def _SC_LEVEL4_CACHE_SIZE */
5301 {errno = EINVAL; return -1;}
5302 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
5303 if (x == Mono_Posix_SysconfName__SC_LINE_MAX)
5304 #ifdef _SC_LINE_MAX
5305 {*r = _SC_LINE_MAX; return 0;}
5306 #else /* def _SC_LINE_MAX */
5307 {errno = EINVAL; return -1;}
5308 #endif /* ndef _SC_LINE_MAX */
5309 if (x == Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX)
5310 #ifdef _SC_LOGIN_NAME_MAX
5311 {*r = _SC_LOGIN_NAME_MAX; return 0;}
5312 #else /* def _SC_LOGIN_NAME_MAX */
5313 {errno = EINVAL; return -1;}
5314 #endif /* ndef _SC_LOGIN_NAME_MAX */
5315 if (x == Mono_Posix_SysconfName__SC_LONG_BIT)
5316 #ifdef _SC_LONG_BIT
5317 {*r = _SC_LONG_BIT; return 0;}
5318 #else /* def _SC_LONG_BIT */
5319 {errno = EINVAL; return -1;}
5320 #endif /* ndef _SC_LONG_BIT */
5321 if (x == Mono_Posix_SysconfName__SC_MAPPED_FILES)
5322 #ifdef _SC_MAPPED_FILES
5323 {*r = _SC_MAPPED_FILES; return 0;}
5324 #else /* def _SC_MAPPED_FILES */
5325 {errno = EINVAL; return -1;}
5326 #endif /* ndef _SC_MAPPED_FILES */
5327 if (x == Mono_Posix_SysconfName__SC_MB_LEN_MAX)
5328 #ifdef _SC_MB_LEN_MAX
5329 {*r = _SC_MB_LEN_MAX; return 0;}
5330 #else /* def _SC_MB_LEN_MAX */
5331 {errno = EINVAL; return -1;}
5332 #endif /* ndef _SC_MB_LEN_MAX */
5333 if (x == Mono_Posix_SysconfName__SC_MEMLOCK)
5334 #ifdef _SC_MEMLOCK
5335 {*r = _SC_MEMLOCK; return 0;}
5336 #else /* def _SC_MEMLOCK */
5337 {errno = EINVAL; return -1;}
5338 #endif /* ndef _SC_MEMLOCK */
5339 if (x == Mono_Posix_SysconfName__SC_MEMLOCK_RANGE)
5340 #ifdef _SC_MEMLOCK_RANGE
5341 {*r = _SC_MEMLOCK_RANGE; return 0;}
5342 #else /* def _SC_MEMLOCK_RANGE */
5343 {errno = EINVAL; return -1;}
5344 #endif /* ndef _SC_MEMLOCK_RANGE */
5345 if (x == Mono_Posix_SysconfName__SC_MEMORY_PROTECTION)
5346 #ifdef _SC_MEMORY_PROTECTION
5347 {*r = _SC_MEMORY_PROTECTION; return 0;}
5348 #else /* def _SC_MEMORY_PROTECTION */
5349 {errno = EINVAL; return -1;}
5350 #endif /* ndef _SC_MEMORY_PROTECTION */
5351 if (x == Mono_Posix_SysconfName__SC_MESSAGE_PASSING)
5352 #ifdef _SC_MESSAGE_PASSING
5353 {*r = _SC_MESSAGE_PASSING; return 0;}
5354 #else /* def _SC_MESSAGE_PASSING */
5355 {errno = EINVAL; return -1;}
5356 #endif /* ndef _SC_MESSAGE_PASSING */
5357 if (x == Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK)
5358 #ifdef _SC_MONOTONIC_CLOCK
5359 {*r = _SC_MONOTONIC_CLOCK; return 0;}
5360 #else /* def _SC_MONOTONIC_CLOCK */
5361 {errno = EINVAL; return -1;}
5362 #endif /* ndef _SC_MONOTONIC_CLOCK */
5363 if (x == Mono_Posix_SysconfName__SC_MQ_OPEN_MAX)
5364 #ifdef _SC_MQ_OPEN_MAX
5365 {*r = _SC_MQ_OPEN_MAX; return 0;}
5366 #else /* def _SC_MQ_OPEN_MAX */
5367 {errno = EINVAL; return -1;}
5368 #endif /* ndef _SC_MQ_OPEN_MAX */
5369 if (x == Mono_Posix_SysconfName__SC_MQ_PRIO_MAX)
5370 #ifdef _SC_MQ_PRIO_MAX
5371 {*r = _SC_MQ_PRIO_MAX; return 0;}
5372 #else /* def _SC_MQ_PRIO_MAX */
5373 {errno = EINVAL; return -1;}
5374 #endif /* ndef _SC_MQ_PRIO_MAX */
5375 if (x == Mono_Posix_SysconfName__SC_MULTI_PROCESS)
5376 #ifdef _SC_MULTI_PROCESS
5377 {*r = _SC_MULTI_PROCESS; return 0;}
5378 #else /* def _SC_MULTI_PROCESS */
5379 {errno = EINVAL; return -1;}
5380 #endif /* ndef _SC_MULTI_PROCESS */
5381 if (x == Mono_Posix_SysconfName__SC_NETWORKING)
5382 #ifdef _SC_NETWORKING
5383 {*r = _SC_NETWORKING; return 0;}
5384 #else /* def _SC_NETWORKING */
5385 {errno = EINVAL; return -1;}
5386 #endif /* ndef _SC_NETWORKING */
5387 if (x == Mono_Posix_SysconfName__SC_NGROUPS_MAX)
5388 #ifdef _SC_NGROUPS_MAX
5389 {*r = _SC_NGROUPS_MAX; return 0;}
5390 #else /* def _SC_NGROUPS_MAX */
5391 {errno = EINVAL; return -1;}
5392 #endif /* ndef _SC_NGROUPS_MAX */
5393 if (x == Mono_Posix_SysconfName__SC_NL_ARGMAX)
5394 #ifdef _SC_NL_ARGMAX
5395 {*r = _SC_NL_ARGMAX; return 0;}
5396 #else /* def _SC_NL_ARGMAX */
5397 {errno = EINVAL; return -1;}
5398 #endif /* ndef _SC_NL_ARGMAX */
5399 if (x == Mono_Posix_SysconfName__SC_NL_LANGMAX)
5400 #ifdef _SC_NL_LANGMAX
5401 {*r = _SC_NL_LANGMAX; return 0;}
5402 #else /* def _SC_NL_LANGMAX */
5403 {errno = EINVAL; return -1;}
5404 #endif /* ndef _SC_NL_LANGMAX */
5405 if (x == Mono_Posix_SysconfName__SC_NL_MSGMAX)
5406 #ifdef _SC_NL_MSGMAX
5407 {*r = _SC_NL_MSGMAX; return 0;}
5408 #else /* def _SC_NL_MSGMAX */
5409 {errno = EINVAL; return -1;}
5410 #endif /* ndef _SC_NL_MSGMAX */
5411 if (x == Mono_Posix_SysconfName__SC_NL_NMAX)
5412 #ifdef _SC_NL_NMAX
5413 {*r = _SC_NL_NMAX; return 0;}
5414 #else /* def _SC_NL_NMAX */
5415 {errno = EINVAL; return -1;}
5416 #endif /* ndef _SC_NL_NMAX */
5417 if (x == Mono_Posix_SysconfName__SC_NL_SETMAX)
5418 #ifdef _SC_NL_SETMAX
5419 {*r = _SC_NL_SETMAX; return 0;}
5420 #else /* def _SC_NL_SETMAX */
5421 {errno = EINVAL; return -1;}
5422 #endif /* ndef _SC_NL_SETMAX */
5423 if (x == Mono_Posix_SysconfName__SC_NL_TEXTMAX)
5424 #ifdef _SC_NL_TEXTMAX
5425 {*r = _SC_NL_TEXTMAX; return 0;}
5426 #else /* def _SC_NL_TEXTMAX */
5427 {errno = EINVAL; return -1;}
5428 #endif /* ndef _SC_NL_TEXTMAX */
5429 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_CONF)
5430 #ifdef _SC_NPROCESSORS_CONF
5431 {*r = _SC_NPROCESSORS_CONF; return 0;}
5432 #else /* def _SC_NPROCESSORS_CONF */
5433 {errno = EINVAL; return -1;}
5434 #endif /* ndef _SC_NPROCESSORS_CONF */
5435 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN)
5436 #ifdef _SC_NPROCESSORS_ONLN
5437 {*r = _SC_NPROCESSORS_ONLN; return 0;}
5438 #else /* def _SC_NPROCESSORS_ONLN */
5439 {errno = EINVAL; return -1;}
5440 #endif /* ndef _SC_NPROCESSORS_ONLN */
5441 if (x == Mono_Posix_SysconfName__SC_NZERO)
5442 #ifdef _SC_NZERO
5443 {*r = _SC_NZERO; return 0;}
5444 #else /* def _SC_NZERO */
5445 {errno = EINVAL; return -1;}
5446 #endif /* ndef _SC_NZERO */
5447 if (x == Mono_Posix_SysconfName__SC_OPEN_MAX)
5448 #ifdef _SC_OPEN_MAX
5449 {*r = _SC_OPEN_MAX; return 0;}
5450 #else /* def _SC_OPEN_MAX */
5451 {errno = EINVAL; return -1;}
5452 #endif /* ndef _SC_OPEN_MAX */
5453 if (x == Mono_Posix_SysconfName__SC_PAGESIZE)
5454 #ifdef _SC_PAGESIZE
5455 {*r = _SC_PAGESIZE; return 0;}
5456 #else /* def _SC_PAGESIZE */
5457 {errno = EINVAL; return -1;}
5458 #endif /* ndef _SC_PAGESIZE */
5459 if (x == Mono_Posix_SysconfName__SC_PASS_MAX)
5460 #ifdef _SC_PASS_MAX
5461 {*r = _SC_PASS_MAX; return 0;}
5462 #else /* def _SC_PASS_MAX */
5463 {errno = EINVAL; return -1;}
5464 #endif /* ndef _SC_PASS_MAX */
5465 if (x == Mono_Posix_SysconfName__SC_PHYS_PAGES)
5466 #ifdef _SC_PHYS_PAGES
5467 {*r = _SC_PHYS_PAGES; return 0;}
5468 #else /* def _SC_PHYS_PAGES */
5469 {errno = EINVAL; return -1;}
5470 #endif /* ndef _SC_PHYS_PAGES */
5471 if (x == Mono_Posix_SysconfName__SC_PII)
5472 #ifdef _SC_PII
5473 {*r = _SC_PII; return 0;}
5474 #else /* def _SC_PII */
5475 {errno = EINVAL; return -1;}
5476 #endif /* ndef _SC_PII */
5477 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET)
5478 #ifdef _SC_PII_INTERNET
5479 {*r = _SC_PII_INTERNET; return 0;}
5480 #else /* def _SC_PII_INTERNET */
5481 {errno = EINVAL; return -1;}
5482 #endif /* ndef _SC_PII_INTERNET */
5483 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM)
5484 #ifdef _SC_PII_INTERNET_DGRAM
5485 {*r = _SC_PII_INTERNET_DGRAM; return 0;}
5486 #else /* def _SC_PII_INTERNET_DGRAM */
5487 {errno = EINVAL; return -1;}
5488 #endif /* ndef _SC_PII_INTERNET_DGRAM */
5489 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM)
5490 #ifdef _SC_PII_INTERNET_STREAM
5491 {*r = _SC_PII_INTERNET_STREAM; return 0;}
5492 #else /* def _SC_PII_INTERNET_STREAM */
5493 {errno = EINVAL; return -1;}
5494 #endif /* ndef _SC_PII_INTERNET_STREAM */
5495 if (x == Mono_Posix_SysconfName__SC_PII_OSI)
5496 #ifdef _SC_PII_OSI
5497 {*r = _SC_PII_OSI; return 0;}
5498 #else /* def _SC_PII_OSI */
5499 {errno = EINVAL; return -1;}
5500 #endif /* ndef _SC_PII_OSI */
5501 if (x == Mono_Posix_SysconfName__SC_PII_OSI_CLTS)
5502 #ifdef _SC_PII_OSI_CLTS
5503 {*r = _SC_PII_OSI_CLTS; return 0;}
5504 #else /* def _SC_PII_OSI_CLTS */
5505 {errno = EINVAL; return -1;}
5506 #endif /* ndef _SC_PII_OSI_CLTS */
5507 if (x == Mono_Posix_SysconfName__SC_PII_OSI_COTS)
5508 #ifdef _SC_PII_OSI_COTS
5509 {*r = _SC_PII_OSI_COTS; return 0;}
5510 #else /* def _SC_PII_OSI_COTS */
5511 {errno = EINVAL; return -1;}
5512 #endif /* ndef _SC_PII_OSI_COTS */
5513 if (x == Mono_Posix_SysconfName__SC_PII_OSI_M)
5514 #ifdef _SC_PII_OSI_M
5515 {*r = _SC_PII_OSI_M; return 0;}
5516 #else /* def _SC_PII_OSI_M */
5517 {errno = EINVAL; return -1;}
5518 #endif /* ndef _SC_PII_OSI_M */
5519 if (x == Mono_Posix_SysconfName__SC_PII_SOCKET)
5520 #ifdef _SC_PII_SOCKET
5521 {*r = _SC_PII_SOCKET; return 0;}
5522 #else /* def _SC_PII_SOCKET */
5523 {errno = EINVAL; return -1;}
5524 #endif /* ndef _SC_PII_SOCKET */
5525 if (x == Mono_Posix_SysconfName__SC_PII_XTI)
5526 #ifdef _SC_PII_XTI
5527 {*r = _SC_PII_XTI; return 0;}
5528 #else /* def _SC_PII_XTI */
5529 {errno = EINVAL; return -1;}
5530 #endif /* ndef _SC_PII_XTI */
5531 if (x == Mono_Posix_SysconfName__SC_PIPE)
5532 #ifdef _SC_PIPE
5533 {*r = _SC_PIPE; return 0;}
5534 #else /* def _SC_PIPE */
5535 {errno = EINVAL; return -1;}
5536 #endif /* ndef _SC_PIPE */
5537 if (x == Mono_Posix_SysconfName__SC_POLL)
5538 #ifdef _SC_POLL
5539 {*r = _SC_POLL; return 0;}
5540 #else /* def _SC_POLL */
5541 {errno = EINVAL; return -1;}
5542 #endif /* ndef _SC_POLL */
5543 if (x == Mono_Posix_SysconfName__SC_PRIORITIZED_IO)
5544 #ifdef _SC_PRIORITIZED_IO
5545 {*r = _SC_PRIORITIZED_IO; return 0;}
5546 #else /* def _SC_PRIORITIZED_IO */
5547 {errno = EINVAL; return -1;}
5548 #endif /* ndef _SC_PRIORITIZED_IO */
5549 if (x == Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING)
5550 #ifdef _SC_PRIORITY_SCHEDULING
5551 {*r = _SC_PRIORITY_SCHEDULING; return 0;}
5552 #else /* def _SC_PRIORITY_SCHEDULING */
5553 {errno = EINVAL; return -1;}
5554 #endif /* ndef _SC_PRIORITY_SCHEDULING */
5555 if (x == Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS)
5556 #ifdef _SC_READER_WRITER_LOCKS
5557 {*r = _SC_READER_WRITER_LOCKS; return 0;}
5558 #else /* def _SC_READER_WRITER_LOCKS */
5559 {errno = EINVAL; return -1;}
5560 #endif /* ndef _SC_READER_WRITER_LOCKS */
5561 if (x == Mono_Posix_SysconfName__SC_REALTIME_SIGNALS)
5562 #ifdef _SC_REALTIME_SIGNALS
5563 {*r = _SC_REALTIME_SIGNALS; return 0;}
5564 #else /* def _SC_REALTIME_SIGNALS */
5565 {errno = EINVAL; return -1;}
5566 #endif /* ndef _SC_REALTIME_SIGNALS */
5567 if (x == Mono_Posix_SysconfName__SC_REGEXP)
5568 #ifdef _SC_REGEXP
5569 {*r = _SC_REGEXP; return 0;}
5570 #else /* def _SC_REGEXP */
5571 {errno = EINVAL; return -1;}
5572 #endif /* ndef _SC_REGEXP */
5573 if (x == Mono_Posix_SysconfName__SC_REGEX_VERSION)
5574 #ifdef _SC_REGEX_VERSION
5575 {*r = _SC_REGEX_VERSION; return 0;}
5576 #else /* def _SC_REGEX_VERSION */
5577 {errno = EINVAL; return -1;}
5578 #endif /* ndef _SC_REGEX_VERSION */
5579 if (x == Mono_Posix_SysconfName__SC_RE_DUP_MAX)
5580 #ifdef _SC_RE_DUP_MAX
5581 {*r = _SC_RE_DUP_MAX; return 0;}
5582 #else /* def _SC_RE_DUP_MAX */
5583 {errno = EINVAL; return -1;}
5584 #endif /* ndef _SC_RE_DUP_MAX */
5585 if (x == Mono_Posix_SysconfName__SC_RTSIG_MAX)
5586 #ifdef _SC_RTSIG_MAX
5587 {*r = _SC_RTSIG_MAX; return 0;}
5588 #else /* def _SC_RTSIG_MAX */
5589 {errno = EINVAL; return -1;}
5590 #endif /* ndef _SC_RTSIG_MAX */
5591 if (x == Mono_Posix_SysconfName__SC_SAVED_IDS)
5592 #ifdef _SC_SAVED_IDS
5593 {*r = _SC_SAVED_IDS; return 0;}
5594 #else /* def _SC_SAVED_IDS */
5595 {errno = EINVAL; return -1;}
5596 #endif /* ndef _SC_SAVED_IDS */
5597 if (x == Mono_Posix_SysconfName__SC_SCHAR_MAX)
5598 #ifdef _SC_SCHAR_MAX
5599 {*r = _SC_SCHAR_MAX; return 0;}
5600 #else /* def _SC_SCHAR_MAX */
5601 {errno = EINVAL; return -1;}
5602 #endif /* ndef _SC_SCHAR_MAX */
5603 if (x == Mono_Posix_SysconfName__SC_SCHAR_MIN)
5604 #ifdef _SC_SCHAR_MIN
5605 {*r = _SC_SCHAR_MIN; return 0;}
5606 #else /* def _SC_SCHAR_MIN */
5607 {errno = EINVAL; return -1;}
5608 #endif /* ndef _SC_SCHAR_MIN */
5609 if (x == Mono_Posix_SysconfName__SC_SELECT)
5610 #ifdef _SC_SELECT
5611 {*r = _SC_SELECT; return 0;}
5612 #else /* def _SC_SELECT */
5613 {errno = EINVAL; return -1;}
5614 #endif /* ndef _SC_SELECT */
5615 if (x == Mono_Posix_SysconfName__SC_SEMAPHORES)
5616 #ifdef _SC_SEMAPHORES
5617 {*r = _SC_SEMAPHORES; return 0;}
5618 #else /* def _SC_SEMAPHORES */
5619 {errno = EINVAL; return -1;}
5620 #endif /* ndef _SC_SEMAPHORES */
5621 if (x == Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX)
5622 #ifdef _SC_SEM_NSEMS_MAX
5623 {*r = _SC_SEM_NSEMS_MAX; return 0;}
5624 #else /* def _SC_SEM_NSEMS_MAX */
5625 {errno = EINVAL; return -1;}
5626 #endif /* ndef _SC_SEM_NSEMS_MAX */
5627 if (x == Mono_Posix_SysconfName__SC_SEM_VALUE_MAX)
5628 #ifdef _SC_SEM_VALUE_MAX
5629 {*r = _SC_SEM_VALUE_MAX; return 0;}
5630 #else /* def _SC_SEM_VALUE_MAX */
5631 {errno = EINVAL; return -1;}
5632 #endif /* ndef _SC_SEM_VALUE_MAX */
5633 if (x == Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS)
5634 #ifdef _SC_SHARED_MEMORY_OBJECTS
5635 {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
5636 #else /* def _SC_SHARED_MEMORY_OBJECTS */
5637 {errno = EINVAL; return -1;}
5638 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
5639 if (x == Mono_Posix_SysconfName__SC_SHELL)
5640 #ifdef _SC_SHELL
5641 {*r = _SC_SHELL; return 0;}
5642 #else /* def _SC_SHELL */
5643 {errno = EINVAL; return -1;}
5644 #endif /* ndef _SC_SHELL */
5645 if (x == Mono_Posix_SysconfName__SC_SHRT_MAX)
5646 #ifdef _SC_SHRT_MAX
5647 {*r = _SC_SHRT_MAX; return 0;}
5648 #else /* def _SC_SHRT_MAX */
5649 {errno = EINVAL; return -1;}
5650 #endif /* ndef _SC_SHRT_MAX */
5651 if (x == Mono_Posix_SysconfName__SC_SHRT_MIN)
5652 #ifdef _SC_SHRT_MIN
5653 {*r = _SC_SHRT_MIN; return 0;}
5654 #else /* def _SC_SHRT_MIN */
5655 {errno = EINVAL; return -1;}
5656 #endif /* ndef _SC_SHRT_MIN */
5657 if (x == Mono_Posix_SysconfName__SC_SIGNALS)
5658 #ifdef _SC_SIGNALS
5659 {*r = _SC_SIGNALS; return 0;}
5660 #else /* def _SC_SIGNALS */
5661 {errno = EINVAL; return -1;}
5662 #endif /* ndef _SC_SIGNALS */
5663 if (x == Mono_Posix_SysconfName__SC_SIGQUEUE_MAX)
5664 #ifdef _SC_SIGQUEUE_MAX
5665 {*r = _SC_SIGQUEUE_MAX; return 0;}
5666 #else /* def _SC_SIGQUEUE_MAX */
5667 {errno = EINVAL; return -1;}
5668 #endif /* ndef _SC_SIGQUEUE_MAX */
5669 if (x == Mono_Posix_SysconfName__SC_SINGLE_PROCESS)
5670 #ifdef _SC_SINGLE_PROCESS
5671 {*r = _SC_SINGLE_PROCESS; return 0;}
5672 #else /* def _SC_SINGLE_PROCESS */
5673 {errno = EINVAL; return -1;}
5674 #endif /* ndef _SC_SINGLE_PROCESS */
5675 if (x == Mono_Posix_SysconfName__SC_SPAWN)
5676 #ifdef _SC_SPAWN
5677 {*r = _SC_SPAWN; return 0;}
5678 #else /* def _SC_SPAWN */
5679 {errno = EINVAL; return -1;}
5680 #endif /* ndef _SC_SPAWN */
5681 if (x == Mono_Posix_SysconfName__SC_SPIN_LOCKS)
5682 #ifdef _SC_SPIN_LOCKS
5683 {*r = _SC_SPIN_LOCKS; return 0;}
5684 #else /* def _SC_SPIN_LOCKS */
5685 {errno = EINVAL; return -1;}
5686 #endif /* ndef _SC_SPIN_LOCKS */
5687 if (x == Mono_Posix_SysconfName__SC_SPORADIC_SERVER)
5688 #ifdef _SC_SPORADIC_SERVER
5689 {*r = _SC_SPORADIC_SERVER; return 0;}
5690 #else /* def _SC_SPORADIC_SERVER */
5691 {errno = EINVAL; return -1;}
5692 #endif /* ndef _SC_SPORADIC_SERVER */
5693 if (x == Mono_Posix_SysconfName__SC_SSIZE_MAX)
5694 #ifdef _SC_SSIZE_MAX
5695 {*r = _SC_SSIZE_MAX; return 0;}
5696 #else /* def _SC_SSIZE_MAX */
5697 {errno = EINVAL; return -1;}
5698 #endif /* ndef _SC_SSIZE_MAX */
5699 if (x == Mono_Posix_SysconfName__SC_STREAMS)
5700 #ifdef _SC_STREAMS
5701 {*r = _SC_STREAMS; return 0;}
5702 #else /* def _SC_STREAMS */
5703 {errno = EINVAL; return -1;}
5704 #endif /* ndef _SC_STREAMS */
5705 if (x == Mono_Posix_SysconfName__SC_STREAM_MAX)
5706 #ifdef _SC_STREAM_MAX
5707 {*r = _SC_STREAM_MAX; return 0;}
5708 #else /* def _SC_STREAM_MAX */
5709 {errno = EINVAL; return -1;}
5710 #endif /* ndef _SC_STREAM_MAX */
5711 if (x == Mono_Posix_SysconfName__SC_SYMLOOP_MAX)
5712 #ifdef _SC_SYMLOOP_MAX
5713 {*r = _SC_SYMLOOP_MAX; return 0;}
5714 #else /* def _SC_SYMLOOP_MAX */
5715 {errno = EINVAL; return -1;}
5716 #endif /* ndef _SC_SYMLOOP_MAX */
5717 if (x == Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO)
5718 #ifdef _SC_SYNCHRONIZED_IO
5719 {*r = _SC_SYNCHRONIZED_IO; return 0;}
5720 #else /* def _SC_SYNCHRONIZED_IO */
5721 {errno = EINVAL; return -1;}
5722 #endif /* ndef _SC_SYNCHRONIZED_IO */
5723 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE)
5724 #ifdef _SC_SYSTEM_DATABASE
5725 {*r = _SC_SYSTEM_DATABASE; return 0;}
5726 #else /* def _SC_SYSTEM_DATABASE */
5727 {errno = EINVAL; return -1;}
5728 #endif /* ndef _SC_SYSTEM_DATABASE */
5729 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R)
5730 #ifdef _SC_SYSTEM_DATABASE_R
5731 {*r = _SC_SYSTEM_DATABASE_R; return 0;}
5732 #else /* def _SC_SYSTEM_DATABASE_R */
5733 {errno = EINVAL; return -1;}
5734 #endif /* ndef _SC_SYSTEM_DATABASE_R */
5735 if (x == Mono_Posix_SysconfName__SC_THREADS)
5736 #ifdef _SC_THREADS
5737 {*r = _SC_THREADS; return 0;}
5738 #else /* def _SC_THREADS */
5739 {errno = EINVAL; return -1;}
5740 #endif /* ndef _SC_THREADS */
5741 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR)
5742 #ifdef _SC_THREAD_ATTR_STACKADDR
5743 {*r = _SC_THREAD_ATTR_STACKADDR; return 0;}
5744 #else /* def _SC_THREAD_ATTR_STACKADDR */
5745 {errno = EINVAL; return -1;}
5746 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
5747 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE)
5748 #ifdef _SC_THREAD_ATTR_STACKSIZE
5749 {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;}
5750 #else /* def _SC_THREAD_ATTR_STACKSIZE */
5751 {errno = EINVAL; return -1;}
5752 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
5753 if (x == Mono_Posix_SysconfName__SC_THREAD_CPUTIME)
5754 #ifdef _SC_THREAD_CPUTIME
5755 {*r = _SC_THREAD_CPUTIME; return 0;}
5756 #else /* def _SC_THREAD_CPUTIME */
5757 {errno = EINVAL; return -1;}
5758 #endif /* ndef _SC_THREAD_CPUTIME */
5759 if (x == Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS)
5760 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
5761 {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
5762 #else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */
5763 {errno = EINVAL; return -1;}
5764 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
5765 if (x == Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX)
5766 #ifdef _SC_THREAD_KEYS_MAX
5767 {*r = _SC_THREAD_KEYS_MAX; return 0;}
5768 #else /* def _SC_THREAD_KEYS_MAX */
5769 {errno = EINVAL; return -1;}
5770 #endif /* ndef _SC_THREAD_KEYS_MAX */
5771 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING)
5772 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
5773 {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;}
5774 #else /* def _SC_THREAD_PRIORITY_SCHEDULING */
5775 {errno = EINVAL; return -1;}
5776 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
5777 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT)
5778 #ifdef _SC_THREAD_PRIO_INHERIT
5779 {*r = _SC_THREAD_PRIO_INHERIT; return 0;}
5780 #else /* def _SC_THREAD_PRIO_INHERIT */
5781 {errno = EINVAL; return -1;}
5782 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
5783 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT)
5784 #ifdef _SC_THREAD_PRIO_PROTECT
5785 {*r = _SC_THREAD_PRIO_PROTECT; return 0;}
5786 #else /* def _SC_THREAD_PRIO_PROTECT */
5787 {errno = EINVAL; return -1;}
5788 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
5789 if (x == Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED)
5790 #ifdef _SC_THREAD_PROCESS_SHARED
5791 {*r = _SC_THREAD_PROCESS_SHARED; return 0;}
5792 #else /* def _SC_THREAD_PROCESS_SHARED */
5793 {errno = EINVAL; return -1;}
5794 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
5795 if (x == Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS)
5796 #ifdef _SC_THREAD_SAFE_FUNCTIONS
5797 {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;}
5798 #else /* def _SC_THREAD_SAFE_FUNCTIONS */
5799 {errno = EINVAL; return -1;}
5800 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
5801 if (x == Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER)
5802 #ifdef _SC_THREAD_SPORADIC_SERVER
5803 {*r = _SC_THREAD_SPORADIC_SERVER; return 0;}
5804 #else /* def _SC_THREAD_SPORADIC_SERVER */
5805 {errno = EINVAL; return -1;}
5806 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
5807 if (x == Mono_Posix_SysconfName__SC_THREAD_STACK_MIN)
5808 #ifdef _SC_THREAD_STACK_MIN
5809 {*r = _SC_THREAD_STACK_MIN; return 0;}
5810 #else /* def _SC_THREAD_STACK_MIN */
5811 {errno = EINVAL; return -1;}
5812 #endif /* ndef _SC_THREAD_STACK_MIN */
5813 if (x == Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX)
5814 #ifdef _SC_THREAD_THREADS_MAX
5815 {*r = _SC_THREAD_THREADS_MAX; return 0;}
5816 #else /* def _SC_THREAD_THREADS_MAX */
5817 {errno = EINVAL; return -1;}
5818 #endif /* ndef _SC_THREAD_THREADS_MAX */
5819 if (x == Mono_Posix_SysconfName__SC_TIMEOUTS)
5820 #ifdef _SC_TIMEOUTS
5821 {*r = _SC_TIMEOUTS; return 0;}
5822 #else /* def _SC_TIMEOUTS */
5823 {errno = EINVAL; return -1;}
5824 #endif /* ndef _SC_TIMEOUTS */
5825 if (x == Mono_Posix_SysconfName__SC_TIMERS)
5826 #ifdef _SC_TIMERS
5827 {*r = _SC_TIMERS; return 0;}
5828 #else /* def _SC_TIMERS */
5829 {errno = EINVAL; return -1;}
5830 #endif /* ndef _SC_TIMERS */
5831 if (x == Mono_Posix_SysconfName__SC_TIMER_MAX)
5832 #ifdef _SC_TIMER_MAX
5833 {*r = _SC_TIMER_MAX; return 0;}
5834 #else /* def _SC_TIMER_MAX */
5835 {errno = EINVAL; return -1;}
5836 #endif /* ndef _SC_TIMER_MAX */
5837 if (x == Mono_Posix_SysconfName__SC_TRACE)
5838 #ifdef _SC_TRACE
5839 {*r = _SC_TRACE; return 0;}
5840 #else /* def _SC_TRACE */
5841 {errno = EINVAL; return -1;}
5842 #endif /* ndef _SC_TRACE */
5843 if (x == Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER)
5844 #ifdef _SC_TRACE_EVENT_FILTER
5845 {*r = _SC_TRACE_EVENT_FILTER; return 0;}
5846 #else /* def _SC_TRACE_EVENT_FILTER */
5847 {errno = EINVAL; return -1;}
5848 #endif /* ndef _SC_TRACE_EVENT_FILTER */
5849 if (x == Mono_Posix_SysconfName__SC_TRACE_INHERIT)
5850 #ifdef _SC_TRACE_INHERIT
5851 {*r = _SC_TRACE_INHERIT; return 0;}
5852 #else /* def _SC_TRACE_INHERIT */
5853 {errno = EINVAL; return -1;}
5854 #endif /* ndef _SC_TRACE_INHERIT */
5855 if (x == Mono_Posix_SysconfName__SC_TRACE_LOG)
5856 #ifdef _SC_TRACE_LOG
5857 {*r = _SC_TRACE_LOG; return 0;}
5858 #else /* def _SC_TRACE_LOG */
5859 {errno = EINVAL; return -1;}
5860 #endif /* ndef _SC_TRACE_LOG */
5861 if (x == Mono_Posix_SysconfName__SC_TTY_NAME_MAX)
5862 #ifdef _SC_TTY_NAME_MAX
5863 {*r = _SC_TTY_NAME_MAX; return 0;}
5864 #else /* def _SC_TTY_NAME_MAX */
5865 {errno = EINVAL; return -1;}
5866 #endif /* ndef _SC_TTY_NAME_MAX */
5867 if (x == Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS)
5868 #ifdef _SC_TYPED_MEMORY_OBJECTS
5869 {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;}
5870 #else /* def _SC_TYPED_MEMORY_OBJECTS */
5871 {errno = EINVAL; return -1;}
5872 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
5873 if (x == Mono_Posix_SysconfName__SC_TZNAME_MAX)
5874 #ifdef _SC_TZNAME_MAX
5875 {*r = _SC_TZNAME_MAX; return 0;}
5876 #else /* def _SC_TZNAME_MAX */
5877 {errno = EINVAL; return -1;}
5878 #endif /* ndef _SC_TZNAME_MAX */
5879 if (x == Mono_Posix_SysconfName__SC_T_IOV_MAX)
5880 #ifdef _SC_T_IOV_MAX
5881 {*r = _SC_T_IOV_MAX; return 0;}
5882 #else /* def _SC_T_IOV_MAX */
5883 {errno = EINVAL; return -1;}
5884 #endif /* ndef _SC_T_IOV_MAX */
5885 if (x == Mono_Posix_SysconfName__SC_UCHAR_MAX)
5886 #ifdef _SC_UCHAR_MAX
5887 {*r = _SC_UCHAR_MAX; return 0;}
5888 #else /* def _SC_UCHAR_MAX */
5889 {errno = EINVAL; return -1;}
5890 #endif /* ndef _SC_UCHAR_MAX */
5891 if (x == Mono_Posix_SysconfName__SC_UINT_MAX)
5892 #ifdef _SC_UINT_MAX
5893 {*r = _SC_UINT_MAX; return 0;}
5894 #else /* def _SC_UINT_MAX */
5895 {errno = EINVAL; return -1;}
5896 #endif /* ndef _SC_UINT_MAX */
5897 if (x == Mono_Posix_SysconfName__SC_UIO_MAXIOV)
5898 #ifdef _SC_UIO_MAXIOV
5899 {*r = _SC_UIO_MAXIOV; return 0;}
5900 #else /* def _SC_UIO_MAXIOV */
5901 {errno = EINVAL; return -1;}
5902 #endif /* ndef _SC_UIO_MAXIOV */
5903 if (x == Mono_Posix_SysconfName__SC_ULONG_MAX)
5904 #ifdef _SC_ULONG_MAX
5905 {*r = _SC_ULONG_MAX; return 0;}
5906 #else /* def _SC_ULONG_MAX */
5907 {errno = EINVAL; return -1;}
5908 #endif /* ndef _SC_ULONG_MAX */
5909 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS)
5910 #ifdef _SC_USER_GROUPS
5911 {*r = _SC_USER_GROUPS; return 0;}
5912 #else /* def _SC_USER_GROUPS */
5913 {errno = EINVAL; return -1;}
5914 #endif /* ndef _SC_USER_GROUPS */
5915 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS_R)
5916 #ifdef _SC_USER_GROUPS_R
5917 {*r = _SC_USER_GROUPS_R; return 0;}
5918 #else /* def _SC_USER_GROUPS_R */
5919 {errno = EINVAL; return -1;}
5920 #endif /* ndef _SC_USER_GROUPS_R */
5921 if (x == Mono_Posix_SysconfName__SC_USHRT_MAX)
5922 #ifdef _SC_USHRT_MAX
5923 {*r = _SC_USHRT_MAX; return 0;}
5924 #else /* def _SC_USHRT_MAX */
5925 {errno = EINVAL; return -1;}
5926 #endif /* ndef _SC_USHRT_MAX */
5927 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFF32)
5928 #ifdef _SC_V6_ILP32_OFF32
5929 {*r = _SC_V6_ILP32_OFF32; return 0;}
5930 #else /* def _SC_V6_ILP32_OFF32 */
5931 {errno = EINVAL; return -1;}
5932 #endif /* ndef _SC_V6_ILP32_OFF32 */
5933 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG)
5934 #ifdef _SC_V6_ILP32_OFFBIG
5935 {*r = _SC_V6_ILP32_OFFBIG; return 0;}
5936 #else /* def _SC_V6_ILP32_OFFBIG */
5937 {errno = EINVAL; return -1;}
5938 #endif /* ndef _SC_V6_ILP32_OFFBIG */
5939 if (x == Mono_Posix_SysconfName__SC_V6_LP64_OFF64)
5940 #ifdef _SC_V6_LP64_OFF64
5941 {*r = _SC_V6_LP64_OFF64; return 0;}
5942 #else /* def _SC_V6_LP64_OFF64 */
5943 {errno = EINVAL; return -1;}
5944 #endif /* ndef _SC_V6_LP64_OFF64 */
5945 if (x == Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG)
5946 #ifdef _SC_V6_LPBIG_OFFBIG
5947 {*r = _SC_V6_LPBIG_OFFBIG; return 0;}
5948 #else /* def _SC_V6_LPBIG_OFFBIG */
5949 {errno = EINVAL; return -1;}
5950 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
5951 if (x == Mono_Posix_SysconfName__SC_VERSION)
5952 #ifdef _SC_VERSION
5953 {*r = _SC_VERSION; return 0;}
5954 #else /* def _SC_VERSION */
5955 {errno = EINVAL; return -1;}
5956 #endif /* ndef _SC_VERSION */
5957 if (x == Mono_Posix_SysconfName__SC_WORD_BIT)
5958 #ifdef _SC_WORD_BIT
5959 {*r = _SC_WORD_BIT; return 0;}
5960 #else /* def _SC_WORD_BIT */
5961 {errno = EINVAL; return -1;}
5962 #endif /* ndef _SC_WORD_BIT */
5963 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32)
5964 #ifdef _SC_XBS5_ILP32_OFF32
5965 {*r = _SC_XBS5_ILP32_OFF32; return 0;}
5966 #else /* def _SC_XBS5_ILP32_OFF32 */
5967 {errno = EINVAL; return -1;}
5968 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
5969 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG)
5970 #ifdef _SC_XBS5_ILP32_OFFBIG
5971 {*r = _SC_XBS5_ILP32_OFFBIG; return 0;}
5972 #else /* def _SC_XBS5_ILP32_OFFBIG */
5973 {errno = EINVAL; return -1;}
5974 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
5975 if (x == Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64)
5976 #ifdef _SC_XBS5_LP64_OFF64
5977 {*r = _SC_XBS5_LP64_OFF64; return 0;}
5978 #else /* def _SC_XBS5_LP64_OFF64 */
5979 {errno = EINVAL; return -1;}
5980 #endif /* ndef _SC_XBS5_LP64_OFF64 */
5981 if (x == Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG)
5982 #ifdef _SC_XBS5_LPBIG_OFFBIG
5983 {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;}
5984 #else /* def _SC_XBS5_LPBIG_OFFBIG */
5985 {errno = EINVAL; return -1;}
5986 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
5987 if (x == Mono_Posix_SysconfName__SC_XOPEN_CRYPT)
5988 #ifdef _SC_XOPEN_CRYPT
5989 {*r = _SC_XOPEN_CRYPT; return 0;}
5990 #else /* def _SC_XOPEN_CRYPT */
5991 {errno = EINVAL; return -1;}
5992 #endif /* ndef _SC_XOPEN_CRYPT */
5993 if (x == Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N)
5994 #ifdef _SC_XOPEN_ENH_I18N
5995 {*r = _SC_XOPEN_ENH_I18N; return 0;}
5996 #else /* def _SC_XOPEN_ENH_I18N */
5997 {errno = EINVAL; return -1;}
5998 #endif /* ndef _SC_XOPEN_ENH_I18N */
5999 if (x == Mono_Posix_SysconfName__SC_XOPEN_LEGACY)
6000 #ifdef _SC_XOPEN_LEGACY
6001 {*r = _SC_XOPEN_LEGACY; return 0;}
6002 #else /* def _SC_XOPEN_LEGACY */
6003 {errno = EINVAL; return -1;}
6004 #endif /* ndef _SC_XOPEN_LEGACY */
6005 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME)
6006 #ifdef _SC_XOPEN_REALTIME
6007 {*r = _SC_XOPEN_REALTIME; return 0;}
6008 #else /* def _SC_XOPEN_REALTIME */
6009 {errno = EINVAL; return -1;}
6010 #endif /* ndef _SC_XOPEN_REALTIME */
6011 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS)
6012 #ifdef _SC_XOPEN_REALTIME_THREADS
6013 {*r = _SC_XOPEN_REALTIME_THREADS; return 0;}
6014 #else /* def _SC_XOPEN_REALTIME_THREADS */
6015 {errno = EINVAL; return -1;}
6016 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6017 if (x == Mono_Posix_SysconfName__SC_XOPEN_SHM)
6018 #ifdef _SC_XOPEN_SHM
6019 {*r = _SC_XOPEN_SHM; return 0;}
6020 #else /* def _SC_XOPEN_SHM */
6021 {errno = EINVAL; return -1;}
6022 #endif /* ndef _SC_XOPEN_SHM */
6023 if (x == Mono_Posix_SysconfName__SC_XOPEN_UNIX)
6024 #ifdef _SC_XOPEN_UNIX
6025 {*r = _SC_XOPEN_UNIX; return 0;}
6026 #else /* def _SC_XOPEN_UNIX */
6027 {errno = EINVAL; return -1;}
6028 #endif /* ndef _SC_XOPEN_UNIX */
6029 if (x == Mono_Posix_SysconfName__SC_XOPEN_VERSION)
6030 #ifdef _SC_XOPEN_VERSION
6031 {*r = _SC_XOPEN_VERSION; return 0;}
6032 #else /* def _SC_XOPEN_VERSION */
6033 {errno = EINVAL; return -1;}
6034 #endif /* ndef _SC_XOPEN_VERSION */
6035 if (x == Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION)
6036 #ifdef _SC_XOPEN_XCU_VERSION
6037 {*r = _SC_XOPEN_XCU_VERSION; return 0;}
6038 #else /* def _SC_XOPEN_XCU_VERSION */
6039 {errno = EINVAL; return -1;}
6040 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6041 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG2)
6042 #ifdef _SC_XOPEN_XPG2
6043 {*r = _SC_XOPEN_XPG2; return 0;}
6044 #else /* def _SC_XOPEN_XPG2 */
6045 {errno = EINVAL; return -1;}
6046 #endif /* ndef _SC_XOPEN_XPG2 */
6047 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG3)
6048 #ifdef _SC_XOPEN_XPG3
6049 {*r = _SC_XOPEN_XPG3; return 0;}
6050 #else /* def _SC_XOPEN_XPG3 */
6051 {errno = EINVAL; return -1;}
6052 #endif /* ndef _SC_XOPEN_XPG3 */
6053 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG4)
6054 #ifdef _SC_XOPEN_XPG4
6055 {*r = _SC_XOPEN_XPG4; return 0;}
6056 #else /* def _SC_XOPEN_XPG4 */
6057 {errno = EINVAL; return -1;}
6058 #endif /* ndef _SC_XOPEN_XPG4 */
6059 if (x == 0)
6060 return 0;
6061 errno = EINVAL; return -1;
6064 int Mono_Posix_ToSysconfName (int x, int *r)
6066 *r = 0;
6067 if (x == 0)
6068 return 0;
6069 #ifdef _SC_2_CHAR_TERM
6070 if (x == _SC_2_CHAR_TERM)
6071 {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
6072 #endif /* ndef _SC_2_CHAR_TERM */
6073 #ifdef _SC_2_C_BIND
6074 if (x == _SC_2_C_BIND)
6075 {*r = Mono_Posix_SysconfName__SC_2_C_BIND; return 0;}
6076 #endif /* ndef _SC_2_C_BIND */
6077 #ifdef _SC_2_C_DEV
6078 if (x == _SC_2_C_DEV)
6079 {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
6080 #endif /* ndef _SC_2_C_DEV */
6081 #ifdef _SC_2_C_VERSION
6082 if (x == _SC_2_C_VERSION)
6083 {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
6084 #endif /* ndef _SC_2_C_VERSION */
6085 #ifdef _SC_2_FORT_DEV
6086 if (x == _SC_2_FORT_DEV)
6087 {*r = Mono_Posix_SysconfName__SC_2_FORT_DEV; return 0;}
6088 #endif /* ndef _SC_2_FORT_DEV */
6089 #ifdef _SC_2_FORT_RUN
6090 if (x == _SC_2_FORT_RUN)
6091 {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
6092 #endif /* ndef _SC_2_FORT_RUN */
6093 #ifdef _SC_2_LOCALEDEF
6094 if (x == _SC_2_LOCALEDEF)
6095 {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
6096 #endif /* ndef _SC_2_LOCALEDEF */
6097 #ifdef _SC_2_PBS
6098 if (x == _SC_2_PBS)
6099 {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
6100 #endif /* ndef _SC_2_PBS */
6101 #ifdef _SC_2_PBS_ACCOUNTING
6102 if (x == _SC_2_PBS_ACCOUNTING)
6103 {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
6104 #endif /* ndef _SC_2_PBS_ACCOUNTING */
6105 #ifdef _SC_2_PBS_CHECKPOINT
6106 if (x == _SC_2_PBS_CHECKPOINT)
6107 {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
6108 #endif /* ndef _SC_2_PBS_CHECKPOINT */
6109 #ifdef _SC_2_PBS_LOCATE
6110 if (x == _SC_2_PBS_LOCATE)
6111 {*r = Mono_Posix_SysconfName__SC_2_PBS_LOCATE; return 0;}
6112 #endif /* ndef _SC_2_PBS_LOCATE */
6113 #ifdef _SC_2_PBS_MESSAGE
6114 if (x == _SC_2_PBS_MESSAGE)
6115 {*r = Mono_Posix_SysconfName__SC_2_PBS_MESSAGE; return 0;}
6116 #endif /* ndef _SC_2_PBS_MESSAGE */
6117 #ifdef _SC_2_PBS_TRACK
6118 if (x == _SC_2_PBS_TRACK)
6119 {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
6120 #endif /* ndef _SC_2_PBS_TRACK */
6121 #ifdef _SC_2_SW_DEV
6122 if (x == _SC_2_SW_DEV)
6123 {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
6124 #endif /* ndef _SC_2_SW_DEV */
6125 #ifdef _SC_2_UPE
6126 if (x == _SC_2_UPE)
6127 {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
6128 #endif /* ndef _SC_2_UPE */
6129 #ifdef _SC_2_VERSION
6130 if (x == _SC_2_VERSION)
6131 {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
6132 #endif /* ndef _SC_2_VERSION */
6133 #ifdef _SC_ADVISORY_INFO
6134 if (x == _SC_ADVISORY_INFO)
6135 {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
6136 #endif /* ndef _SC_ADVISORY_INFO */
6137 #ifdef _SC_AIO_LISTIO_MAX
6138 if (x == _SC_AIO_LISTIO_MAX)
6139 {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
6140 #endif /* ndef _SC_AIO_LISTIO_MAX */
6141 #ifdef _SC_AIO_MAX
6142 if (x == _SC_AIO_MAX)
6143 {*r = Mono_Posix_SysconfName__SC_AIO_MAX; return 0;}
6144 #endif /* ndef _SC_AIO_MAX */
6145 #ifdef _SC_AIO_PRIO_DELTA_MAX
6146 if (x == _SC_AIO_PRIO_DELTA_MAX)
6147 {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
6148 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
6149 #ifdef _SC_ARG_MAX
6150 if (x == _SC_ARG_MAX)
6151 {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
6152 #endif /* ndef _SC_ARG_MAX */
6153 #ifdef _SC_ASYNCHRONOUS_IO
6154 if (x == _SC_ASYNCHRONOUS_IO)
6155 {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
6156 #endif /* ndef _SC_ASYNCHRONOUS_IO */
6157 #ifdef _SC_ATEXIT_MAX
6158 if (x == _SC_ATEXIT_MAX)
6159 {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
6160 #endif /* ndef _SC_ATEXIT_MAX */
6161 #ifdef _SC_AVPHYS_PAGES
6162 if (x == _SC_AVPHYS_PAGES)
6163 {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
6164 #endif /* ndef _SC_AVPHYS_PAGES */
6165 #ifdef _SC_BARRIERS
6166 if (x == _SC_BARRIERS)
6167 {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
6168 #endif /* ndef _SC_BARRIERS */
6169 #ifdef _SC_BASE
6170 if (x == _SC_BASE)
6171 {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
6172 #endif /* ndef _SC_BASE */
6173 #ifdef _SC_BC_BASE_MAX
6174 if (x == _SC_BC_BASE_MAX)
6175 {*r = Mono_Posix_SysconfName__SC_BC_BASE_MAX; return 0;}
6176 #endif /* ndef _SC_BC_BASE_MAX */
6177 #ifdef _SC_BC_DIM_MAX
6178 if (x == _SC_BC_DIM_MAX)
6179 {*r = Mono_Posix_SysconfName__SC_BC_DIM_MAX; return 0;}
6180 #endif /* ndef _SC_BC_DIM_MAX */
6181 #ifdef _SC_BC_SCALE_MAX
6182 if (x == _SC_BC_SCALE_MAX)
6183 {*r = Mono_Posix_SysconfName__SC_BC_SCALE_MAX; return 0;}
6184 #endif /* ndef _SC_BC_SCALE_MAX */
6185 #ifdef _SC_BC_STRING_MAX
6186 if (x == _SC_BC_STRING_MAX)
6187 {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
6188 #endif /* ndef _SC_BC_STRING_MAX */
6189 #ifdef _SC_CHARCLASS_NAME_MAX
6190 if (x == _SC_CHARCLASS_NAME_MAX)
6191 {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
6192 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
6193 #ifdef _SC_CHAR_BIT
6194 if (x == _SC_CHAR_BIT)
6195 {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
6196 #endif /* ndef _SC_CHAR_BIT */
6197 #ifdef _SC_CHAR_MAX
6198 if (x == _SC_CHAR_MAX)
6199 {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
6200 #endif /* ndef _SC_CHAR_MAX */
6201 #ifdef _SC_CHAR_MIN
6202 if (x == _SC_CHAR_MIN)
6203 {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
6204 #endif /* ndef _SC_CHAR_MIN */
6205 #ifdef _SC_CHILD_MAX
6206 if (x == _SC_CHILD_MAX)
6207 {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
6208 #endif /* ndef _SC_CHILD_MAX */
6209 #ifdef _SC_CLK_TCK
6210 if (x == _SC_CLK_TCK)
6211 {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
6212 #endif /* ndef _SC_CLK_TCK */
6213 #ifdef _SC_CLOCK_SELECTION
6214 if (x == _SC_CLOCK_SELECTION)
6215 {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
6216 #endif /* ndef _SC_CLOCK_SELECTION */
6217 #ifdef _SC_COLL_WEIGHTS_MAX
6218 if (x == _SC_COLL_WEIGHTS_MAX)
6219 {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
6220 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
6221 #ifdef _SC_CPUTIME
6222 if (x == _SC_CPUTIME)
6223 {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
6224 #endif /* ndef _SC_CPUTIME */
6225 #ifdef _SC_C_LANG_SUPPORT
6226 if (x == _SC_C_LANG_SUPPORT)
6227 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT; return 0;}
6228 #endif /* ndef _SC_C_LANG_SUPPORT */
6229 #ifdef _SC_C_LANG_SUPPORT_R
6230 if (x == _SC_C_LANG_SUPPORT_R)
6231 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
6232 #endif /* ndef _SC_C_LANG_SUPPORT_R */
6233 #ifdef _SC_DELAYTIMER_MAX
6234 if (x == _SC_DELAYTIMER_MAX)
6235 {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
6236 #endif /* ndef _SC_DELAYTIMER_MAX */
6237 #ifdef _SC_DEVICE_IO
6238 if (x == _SC_DEVICE_IO)
6239 {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
6240 #endif /* ndef _SC_DEVICE_IO */
6241 #ifdef _SC_DEVICE_SPECIFIC
6242 if (x == _SC_DEVICE_SPECIFIC)
6243 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
6244 #endif /* ndef _SC_DEVICE_SPECIFIC */
6245 #ifdef _SC_DEVICE_SPECIFIC_R
6246 if (x == _SC_DEVICE_SPECIFIC_R)
6247 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
6248 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
6249 #ifdef _SC_EQUIV_CLASS_MAX
6250 if (x == _SC_EQUIV_CLASS_MAX)
6251 {*r = Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX; return 0;}
6252 #endif /* ndef _SC_EQUIV_CLASS_MAX */
6253 #ifdef _SC_EXPR_NEST_MAX
6254 if (x == _SC_EXPR_NEST_MAX)
6255 {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
6256 #endif /* ndef _SC_EXPR_NEST_MAX */
6257 #ifdef _SC_FD_MGMT
6258 if (x == _SC_FD_MGMT)
6259 {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
6260 #endif /* ndef _SC_FD_MGMT */
6261 #ifdef _SC_FIFO
6262 if (x == _SC_FIFO)
6263 {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
6264 #endif /* ndef _SC_FIFO */
6265 #ifdef _SC_FILE_ATTRIBUTES
6266 if (x == _SC_FILE_ATTRIBUTES)
6267 {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
6268 #endif /* ndef _SC_FILE_ATTRIBUTES */
6269 #ifdef _SC_FILE_LOCKING
6270 if (x == _SC_FILE_LOCKING)
6271 {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
6272 #endif /* ndef _SC_FILE_LOCKING */
6273 #ifdef _SC_FILE_SYSTEM
6274 if (x == _SC_FILE_SYSTEM)
6275 {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
6276 #endif /* ndef _SC_FILE_SYSTEM */
6277 #ifdef _SC_FSYNC
6278 if (x == _SC_FSYNC)
6279 {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
6280 #endif /* ndef _SC_FSYNC */
6281 #ifdef _SC_GETGR_R_SIZE_MAX
6282 if (x == _SC_GETGR_R_SIZE_MAX)
6283 {*r = Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX; return 0;}
6284 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
6285 #ifdef _SC_GETPW_R_SIZE_MAX
6286 if (x == _SC_GETPW_R_SIZE_MAX)
6287 {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
6288 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
6289 #ifdef _SC_HOST_NAME_MAX
6290 if (x == _SC_HOST_NAME_MAX)
6291 {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
6292 #endif /* ndef _SC_HOST_NAME_MAX */
6293 #ifdef _SC_INT_MAX
6294 if (x == _SC_INT_MAX)
6295 {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
6296 #endif /* ndef _SC_INT_MAX */
6297 #ifdef _SC_INT_MIN
6298 if (x == _SC_INT_MIN)
6299 {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
6300 #endif /* ndef _SC_INT_MIN */
6301 #ifdef _SC_IOV_MAX
6302 if (x == _SC_IOV_MAX)
6303 {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
6304 #endif /* ndef _SC_IOV_MAX */
6305 #ifdef _SC_JOB_CONTROL
6306 if (x == _SC_JOB_CONTROL)
6307 {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
6308 #endif /* ndef _SC_JOB_CONTROL */
6309 #ifdef _SC_LEVEL1_DCACHE_ASSOC
6310 if (x == _SC_LEVEL1_DCACHE_ASSOC)
6311 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC; return 0;}
6312 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
6313 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
6314 if (x == _SC_LEVEL1_DCACHE_LINESIZE)
6315 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
6316 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
6317 #ifdef _SC_LEVEL1_DCACHE_SIZE
6318 if (x == _SC_LEVEL1_DCACHE_SIZE)
6319 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
6320 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
6321 #ifdef _SC_LEVEL1_ICACHE_ASSOC
6322 if (x == _SC_LEVEL1_ICACHE_ASSOC)
6323 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC; return 0;}
6324 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
6325 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
6326 if (x == _SC_LEVEL1_ICACHE_LINESIZE)
6327 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
6328 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
6329 #ifdef _SC_LEVEL1_ICACHE_SIZE
6330 if (x == _SC_LEVEL1_ICACHE_SIZE)
6331 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
6332 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
6333 #ifdef _SC_LEVEL2_CACHE_ASSOC
6334 if (x == _SC_LEVEL2_CACHE_ASSOC)
6335 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC; return 0;}
6336 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
6337 #ifdef _SC_LEVEL2_CACHE_LINESIZE
6338 if (x == _SC_LEVEL2_CACHE_LINESIZE)
6339 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
6340 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
6341 #ifdef _SC_LEVEL2_CACHE_SIZE
6342 if (x == _SC_LEVEL2_CACHE_SIZE)
6343 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
6344 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
6345 #ifdef _SC_LEVEL3_CACHE_ASSOC
6346 if (x == _SC_LEVEL3_CACHE_ASSOC)
6347 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC; return 0;}
6348 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
6349 #ifdef _SC_LEVEL3_CACHE_LINESIZE
6350 if (x == _SC_LEVEL3_CACHE_LINESIZE)
6351 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
6352 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
6353 #ifdef _SC_LEVEL3_CACHE_SIZE
6354 if (x == _SC_LEVEL3_CACHE_SIZE)
6355 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
6356 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
6357 #ifdef _SC_LEVEL4_CACHE_ASSOC
6358 if (x == _SC_LEVEL4_CACHE_ASSOC)
6359 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC; return 0;}
6360 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
6361 #ifdef _SC_LEVEL4_CACHE_LINESIZE
6362 if (x == _SC_LEVEL4_CACHE_LINESIZE)
6363 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
6364 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
6365 #ifdef _SC_LEVEL4_CACHE_SIZE
6366 if (x == _SC_LEVEL4_CACHE_SIZE)
6367 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
6368 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
6369 #ifdef _SC_LINE_MAX
6370 if (x == _SC_LINE_MAX)
6371 {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
6372 #endif /* ndef _SC_LINE_MAX */
6373 #ifdef _SC_LOGIN_NAME_MAX
6374 if (x == _SC_LOGIN_NAME_MAX)
6375 {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
6376 #endif /* ndef _SC_LOGIN_NAME_MAX */
6377 #ifdef _SC_LONG_BIT
6378 if (x == _SC_LONG_BIT)
6379 {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
6380 #endif /* ndef _SC_LONG_BIT */
6381 #ifdef _SC_MAPPED_FILES
6382 if (x == _SC_MAPPED_FILES)
6383 {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
6384 #endif /* ndef _SC_MAPPED_FILES */
6385 #ifdef _SC_MB_LEN_MAX
6386 if (x == _SC_MB_LEN_MAX)
6387 {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
6388 #endif /* ndef _SC_MB_LEN_MAX */
6389 #ifdef _SC_MEMLOCK
6390 if (x == _SC_MEMLOCK)
6391 {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
6392 #endif /* ndef _SC_MEMLOCK */
6393 #ifdef _SC_MEMLOCK_RANGE
6394 if (x == _SC_MEMLOCK_RANGE)
6395 {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
6396 #endif /* ndef _SC_MEMLOCK_RANGE */
6397 #ifdef _SC_MEMORY_PROTECTION
6398 if (x == _SC_MEMORY_PROTECTION)
6399 {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
6400 #endif /* ndef _SC_MEMORY_PROTECTION */
6401 #ifdef _SC_MESSAGE_PASSING
6402 if (x == _SC_MESSAGE_PASSING)
6403 {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
6404 #endif /* ndef _SC_MESSAGE_PASSING */
6405 #ifdef _SC_MONOTONIC_CLOCK
6406 if (x == _SC_MONOTONIC_CLOCK)
6407 {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
6408 #endif /* ndef _SC_MONOTONIC_CLOCK */
6409 #ifdef _SC_MQ_OPEN_MAX
6410 if (x == _SC_MQ_OPEN_MAX)
6411 {*r = Mono_Posix_SysconfName__SC_MQ_OPEN_MAX; return 0;}
6412 #endif /* ndef _SC_MQ_OPEN_MAX */
6413 #ifdef _SC_MQ_PRIO_MAX
6414 if (x == _SC_MQ_PRIO_MAX)
6415 {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
6416 #endif /* ndef _SC_MQ_PRIO_MAX */
6417 #ifdef _SC_MULTI_PROCESS
6418 if (x == _SC_MULTI_PROCESS)
6419 {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
6420 #endif /* ndef _SC_MULTI_PROCESS */
6421 #ifdef _SC_NETWORKING
6422 if (x == _SC_NETWORKING)
6423 {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
6424 #endif /* ndef _SC_NETWORKING */
6425 #ifdef _SC_NGROUPS_MAX
6426 if (x == _SC_NGROUPS_MAX)
6427 {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
6428 #endif /* ndef _SC_NGROUPS_MAX */
6429 #ifdef _SC_NL_ARGMAX
6430 if (x == _SC_NL_ARGMAX)
6431 {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
6432 #endif /* ndef _SC_NL_ARGMAX */
6433 #ifdef _SC_NL_LANGMAX
6434 if (x == _SC_NL_LANGMAX)
6435 {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
6436 #endif /* ndef _SC_NL_LANGMAX */
6437 #ifdef _SC_NL_MSGMAX
6438 if (x == _SC_NL_MSGMAX)
6439 {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
6440 #endif /* ndef _SC_NL_MSGMAX */
6441 #ifdef _SC_NL_NMAX
6442 if (x == _SC_NL_NMAX)
6443 {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
6444 #endif /* ndef _SC_NL_NMAX */
6445 #ifdef _SC_NL_SETMAX
6446 if (x == _SC_NL_SETMAX)
6447 {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
6448 #endif /* ndef _SC_NL_SETMAX */
6449 #ifdef _SC_NL_TEXTMAX
6450 if (x == _SC_NL_TEXTMAX)
6451 {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
6452 #endif /* ndef _SC_NL_TEXTMAX */
6453 #ifdef _SC_NPROCESSORS_CONF
6454 if (x == _SC_NPROCESSORS_CONF)
6455 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
6456 #endif /* ndef _SC_NPROCESSORS_CONF */
6457 #ifdef _SC_NPROCESSORS_ONLN
6458 if (x == _SC_NPROCESSORS_ONLN)
6459 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
6460 #endif /* ndef _SC_NPROCESSORS_ONLN */
6461 #ifdef _SC_NZERO
6462 if (x == _SC_NZERO)
6463 {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
6464 #endif /* ndef _SC_NZERO */
6465 #ifdef _SC_OPEN_MAX
6466 if (x == _SC_OPEN_MAX)
6467 {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
6468 #endif /* ndef _SC_OPEN_MAX */
6469 #ifdef _SC_PAGESIZE
6470 if (x == _SC_PAGESIZE)
6471 {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
6472 #endif /* ndef _SC_PAGESIZE */
6473 #ifdef _SC_PASS_MAX
6474 if (x == _SC_PASS_MAX)
6475 {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
6476 #endif /* ndef _SC_PASS_MAX */
6477 #ifdef _SC_PHYS_PAGES
6478 if (x == _SC_PHYS_PAGES)
6479 {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
6480 #endif /* ndef _SC_PHYS_PAGES */
6481 #ifdef _SC_PII
6482 if (x == _SC_PII)
6483 {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
6484 #endif /* ndef _SC_PII */
6485 #ifdef _SC_PII_INTERNET
6486 if (x == _SC_PII_INTERNET)
6487 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
6488 #endif /* ndef _SC_PII_INTERNET */
6489 #ifdef _SC_PII_INTERNET_DGRAM
6490 if (x == _SC_PII_INTERNET_DGRAM)
6491 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
6492 #endif /* ndef _SC_PII_INTERNET_DGRAM */
6493 #ifdef _SC_PII_INTERNET_STREAM
6494 if (x == _SC_PII_INTERNET_STREAM)
6495 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
6496 #endif /* ndef _SC_PII_INTERNET_STREAM */
6497 #ifdef _SC_PII_OSI
6498 if (x == _SC_PII_OSI)
6499 {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
6500 #endif /* ndef _SC_PII_OSI */
6501 #ifdef _SC_PII_OSI_CLTS
6502 if (x == _SC_PII_OSI_CLTS)
6503 {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
6504 #endif /* ndef _SC_PII_OSI_CLTS */
6505 #ifdef _SC_PII_OSI_COTS
6506 if (x == _SC_PII_OSI_COTS)
6507 {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
6508 #endif /* ndef _SC_PII_OSI_COTS */
6509 #ifdef _SC_PII_OSI_M
6510 if (x == _SC_PII_OSI_M)
6511 {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
6512 #endif /* ndef _SC_PII_OSI_M */
6513 #ifdef _SC_PII_SOCKET
6514 if (x == _SC_PII_SOCKET)
6515 {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
6516 #endif /* ndef _SC_PII_SOCKET */
6517 #ifdef _SC_PII_XTI
6518 if (x == _SC_PII_XTI)
6519 {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
6520 #endif /* ndef _SC_PII_XTI */
6521 #ifdef _SC_PIPE
6522 if (x == _SC_PIPE)
6523 {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
6524 #endif /* ndef _SC_PIPE */
6525 #ifdef _SC_POLL
6526 if (x == _SC_POLL)
6527 {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
6528 #endif /* ndef _SC_POLL */
6529 #ifdef _SC_PRIORITIZED_IO
6530 if (x == _SC_PRIORITIZED_IO)
6531 {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
6532 #endif /* ndef _SC_PRIORITIZED_IO */
6533 #ifdef _SC_PRIORITY_SCHEDULING
6534 if (x == _SC_PRIORITY_SCHEDULING)
6535 {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
6536 #endif /* ndef _SC_PRIORITY_SCHEDULING */
6537 #ifdef _SC_READER_WRITER_LOCKS
6538 if (x == _SC_READER_WRITER_LOCKS)
6539 {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
6540 #endif /* ndef _SC_READER_WRITER_LOCKS */
6541 #ifdef _SC_REALTIME_SIGNALS
6542 if (x == _SC_REALTIME_SIGNALS)
6543 {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
6544 #endif /* ndef _SC_REALTIME_SIGNALS */
6545 #ifdef _SC_REGEXP
6546 if (x == _SC_REGEXP)
6547 {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
6548 #endif /* ndef _SC_REGEXP */
6549 #ifdef _SC_REGEX_VERSION
6550 if (x == _SC_REGEX_VERSION)
6551 {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
6552 #endif /* ndef _SC_REGEX_VERSION */
6553 #ifdef _SC_RE_DUP_MAX
6554 if (x == _SC_RE_DUP_MAX)
6555 {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
6556 #endif /* ndef _SC_RE_DUP_MAX */
6557 #ifdef _SC_RTSIG_MAX
6558 if (x == _SC_RTSIG_MAX)
6559 {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
6560 #endif /* ndef _SC_RTSIG_MAX */
6561 #ifdef _SC_SAVED_IDS
6562 if (x == _SC_SAVED_IDS)
6563 {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
6564 #endif /* ndef _SC_SAVED_IDS */
6565 #ifdef _SC_SCHAR_MAX
6566 if (x == _SC_SCHAR_MAX)
6567 {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
6568 #endif /* ndef _SC_SCHAR_MAX */
6569 #ifdef _SC_SCHAR_MIN
6570 if (x == _SC_SCHAR_MIN)
6571 {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
6572 #endif /* ndef _SC_SCHAR_MIN */
6573 #ifdef _SC_SELECT
6574 if (x == _SC_SELECT)
6575 {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
6576 #endif /* ndef _SC_SELECT */
6577 #ifdef _SC_SEMAPHORES
6578 if (x == _SC_SEMAPHORES)
6579 {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
6580 #endif /* ndef _SC_SEMAPHORES */
6581 #ifdef _SC_SEM_NSEMS_MAX
6582 if (x == _SC_SEM_NSEMS_MAX)
6583 {*r = Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX; return 0;}
6584 #endif /* ndef _SC_SEM_NSEMS_MAX */
6585 #ifdef _SC_SEM_VALUE_MAX
6586 if (x == _SC_SEM_VALUE_MAX)
6587 {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
6588 #endif /* ndef _SC_SEM_VALUE_MAX */
6589 #ifdef _SC_SHARED_MEMORY_OBJECTS
6590 if (x == _SC_SHARED_MEMORY_OBJECTS)
6591 {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
6592 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
6593 #ifdef _SC_SHELL
6594 if (x == _SC_SHELL)
6595 {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
6596 #endif /* ndef _SC_SHELL */
6597 #ifdef _SC_SHRT_MAX
6598 if (x == _SC_SHRT_MAX)
6599 {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
6600 #endif /* ndef _SC_SHRT_MAX */
6601 #ifdef _SC_SHRT_MIN
6602 if (x == _SC_SHRT_MIN)
6603 {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
6604 #endif /* ndef _SC_SHRT_MIN */
6605 #ifdef _SC_SIGNALS
6606 if (x == _SC_SIGNALS)
6607 {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
6608 #endif /* ndef _SC_SIGNALS */
6609 #ifdef _SC_SIGQUEUE_MAX
6610 if (x == _SC_SIGQUEUE_MAX)
6611 {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
6612 #endif /* ndef _SC_SIGQUEUE_MAX */
6613 #ifdef _SC_SINGLE_PROCESS
6614 if (x == _SC_SINGLE_PROCESS)
6615 {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
6616 #endif /* ndef _SC_SINGLE_PROCESS */
6617 #ifdef _SC_SPAWN
6618 if (x == _SC_SPAWN)
6619 {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
6620 #endif /* ndef _SC_SPAWN */
6621 #ifdef _SC_SPIN_LOCKS
6622 if (x == _SC_SPIN_LOCKS)
6623 {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
6624 #endif /* ndef _SC_SPIN_LOCKS */
6625 #ifdef _SC_SPORADIC_SERVER
6626 if (x == _SC_SPORADIC_SERVER)
6627 {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
6628 #endif /* ndef _SC_SPORADIC_SERVER */
6629 #ifdef _SC_SSIZE_MAX
6630 if (x == _SC_SSIZE_MAX)
6631 {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
6632 #endif /* ndef _SC_SSIZE_MAX */
6633 #ifdef _SC_STREAMS
6634 if (x == _SC_STREAMS)
6635 {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
6636 #endif /* ndef _SC_STREAMS */
6637 #ifdef _SC_STREAM_MAX
6638 if (x == _SC_STREAM_MAX)
6639 {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
6640 #endif /* ndef _SC_STREAM_MAX */
6641 #ifdef _SC_SYMLOOP_MAX
6642 if (x == _SC_SYMLOOP_MAX)
6643 {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
6644 #endif /* ndef _SC_SYMLOOP_MAX */
6645 #ifdef _SC_SYNCHRONIZED_IO
6646 if (x == _SC_SYNCHRONIZED_IO)
6647 {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
6648 #endif /* ndef _SC_SYNCHRONIZED_IO */
6649 #ifdef _SC_SYSTEM_DATABASE
6650 if (x == _SC_SYSTEM_DATABASE)
6651 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
6652 #endif /* ndef _SC_SYSTEM_DATABASE */
6653 #ifdef _SC_SYSTEM_DATABASE_R
6654 if (x == _SC_SYSTEM_DATABASE_R)
6655 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
6656 #endif /* ndef _SC_SYSTEM_DATABASE_R */
6657 #ifdef _SC_THREADS
6658 if (x == _SC_THREADS)
6659 {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
6660 #endif /* ndef _SC_THREADS */
6661 #ifdef _SC_THREAD_ATTR_STACKADDR
6662 if (x == _SC_THREAD_ATTR_STACKADDR)
6663 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR; return 0;}
6664 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
6665 #ifdef _SC_THREAD_ATTR_STACKSIZE
6666 if (x == _SC_THREAD_ATTR_STACKSIZE)
6667 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
6668 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
6669 #ifdef _SC_THREAD_CPUTIME
6670 if (x == _SC_THREAD_CPUTIME)
6671 {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
6672 #endif /* ndef _SC_THREAD_CPUTIME */
6673 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
6674 if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
6675 {*r = Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
6676 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
6677 #ifdef _SC_THREAD_KEYS_MAX
6678 if (x == _SC_THREAD_KEYS_MAX)
6679 {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
6680 #endif /* ndef _SC_THREAD_KEYS_MAX */
6681 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
6682 if (x == _SC_THREAD_PRIORITY_SCHEDULING)
6683 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
6684 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
6685 #ifdef _SC_THREAD_PRIO_INHERIT
6686 if (x == _SC_THREAD_PRIO_INHERIT)
6687 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT; return 0;}
6688 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
6689 #ifdef _SC_THREAD_PRIO_PROTECT
6690 if (x == _SC_THREAD_PRIO_PROTECT)
6691 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT; return 0;}
6692 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
6693 #ifdef _SC_THREAD_PROCESS_SHARED
6694 if (x == _SC_THREAD_PROCESS_SHARED)
6695 {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
6696 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
6697 #ifdef _SC_THREAD_SAFE_FUNCTIONS
6698 if (x == _SC_THREAD_SAFE_FUNCTIONS)
6699 {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
6700 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
6701 #ifdef _SC_THREAD_SPORADIC_SERVER
6702 if (x == _SC_THREAD_SPORADIC_SERVER)
6703 {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
6704 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
6705 #ifdef _SC_THREAD_STACK_MIN
6706 if (x == _SC_THREAD_STACK_MIN)
6707 {*r = Mono_Posix_SysconfName__SC_THREAD_STACK_MIN; return 0;}
6708 #endif /* ndef _SC_THREAD_STACK_MIN */
6709 #ifdef _SC_THREAD_THREADS_MAX
6710 if (x == _SC_THREAD_THREADS_MAX)
6711 {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
6712 #endif /* ndef _SC_THREAD_THREADS_MAX */
6713 #ifdef _SC_TIMEOUTS
6714 if (x == _SC_TIMEOUTS)
6715 {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
6716 #endif /* ndef _SC_TIMEOUTS */
6717 #ifdef _SC_TIMERS
6718 if (x == _SC_TIMERS)
6719 {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
6720 #endif /* ndef _SC_TIMERS */
6721 #ifdef _SC_TIMER_MAX
6722 if (x == _SC_TIMER_MAX)
6723 {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
6724 #endif /* ndef _SC_TIMER_MAX */
6725 #ifdef _SC_TRACE
6726 if (x == _SC_TRACE)
6727 {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
6728 #endif /* ndef _SC_TRACE */
6729 #ifdef _SC_TRACE_EVENT_FILTER
6730 if (x == _SC_TRACE_EVENT_FILTER)
6731 {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
6732 #endif /* ndef _SC_TRACE_EVENT_FILTER */
6733 #ifdef _SC_TRACE_INHERIT
6734 if (x == _SC_TRACE_INHERIT)
6735 {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
6736 #endif /* ndef _SC_TRACE_INHERIT */
6737 #ifdef _SC_TRACE_LOG
6738 if (x == _SC_TRACE_LOG)
6739 {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
6740 #endif /* ndef _SC_TRACE_LOG */
6741 #ifdef _SC_TTY_NAME_MAX
6742 if (x == _SC_TTY_NAME_MAX)
6743 {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
6744 #endif /* ndef _SC_TTY_NAME_MAX */
6745 #ifdef _SC_TYPED_MEMORY_OBJECTS
6746 if (x == _SC_TYPED_MEMORY_OBJECTS)
6747 {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
6748 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
6749 #ifdef _SC_TZNAME_MAX
6750 if (x == _SC_TZNAME_MAX)
6751 {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
6752 #endif /* ndef _SC_TZNAME_MAX */
6753 #ifdef _SC_T_IOV_MAX
6754 if (x == _SC_T_IOV_MAX)
6755 {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
6756 #endif /* ndef _SC_T_IOV_MAX */
6757 #ifdef _SC_UCHAR_MAX
6758 if (x == _SC_UCHAR_MAX)
6759 {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
6760 #endif /* ndef _SC_UCHAR_MAX */
6761 #ifdef _SC_UINT_MAX
6762 if (x == _SC_UINT_MAX)
6763 {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
6764 #endif /* ndef _SC_UINT_MAX */
6765 #ifdef _SC_UIO_MAXIOV
6766 if (x == _SC_UIO_MAXIOV)
6767 {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
6768 #endif /* ndef _SC_UIO_MAXIOV */
6769 #ifdef _SC_ULONG_MAX
6770 if (x == _SC_ULONG_MAX)
6771 {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
6772 #endif /* ndef _SC_ULONG_MAX */
6773 #ifdef _SC_USER_GROUPS
6774 if (x == _SC_USER_GROUPS)
6775 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
6776 #endif /* ndef _SC_USER_GROUPS */
6777 #ifdef _SC_USER_GROUPS_R
6778 if (x == _SC_USER_GROUPS_R)
6779 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
6780 #endif /* ndef _SC_USER_GROUPS_R */
6781 #ifdef _SC_USHRT_MAX
6782 if (x == _SC_USHRT_MAX)
6783 {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
6784 #endif /* ndef _SC_USHRT_MAX */
6785 #ifdef _SC_V6_ILP32_OFF32
6786 if (x == _SC_V6_ILP32_OFF32)
6787 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFF32; return 0;}
6788 #endif /* ndef _SC_V6_ILP32_OFF32 */
6789 #ifdef _SC_V6_ILP32_OFFBIG
6790 if (x == _SC_V6_ILP32_OFFBIG)
6791 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG; return 0;}
6792 #endif /* ndef _SC_V6_ILP32_OFFBIG */
6793 #ifdef _SC_V6_LP64_OFF64
6794 if (x == _SC_V6_LP64_OFF64)
6795 {*r = Mono_Posix_SysconfName__SC_V6_LP64_OFF64; return 0;}
6796 #endif /* ndef _SC_V6_LP64_OFF64 */
6797 #ifdef _SC_V6_LPBIG_OFFBIG
6798 if (x == _SC_V6_LPBIG_OFFBIG)
6799 {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
6800 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
6801 #ifdef _SC_VERSION
6802 if (x == _SC_VERSION)
6803 {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
6804 #endif /* ndef _SC_VERSION */
6805 #ifdef _SC_WORD_BIT
6806 if (x == _SC_WORD_BIT)
6807 {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
6808 #endif /* ndef _SC_WORD_BIT */
6809 #ifdef _SC_XBS5_ILP32_OFF32
6810 if (x == _SC_XBS5_ILP32_OFF32)
6811 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32; return 0;}
6812 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
6813 #ifdef _SC_XBS5_ILP32_OFFBIG
6814 if (x == _SC_XBS5_ILP32_OFFBIG)
6815 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG; return 0;}
6816 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
6817 #ifdef _SC_XBS5_LP64_OFF64
6818 if (x == _SC_XBS5_LP64_OFF64)
6819 {*r = Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64; return 0;}
6820 #endif /* ndef _SC_XBS5_LP64_OFF64 */
6821 #ifdef _SC_XBS5_LPBIG_OFFBIG
6822 if (x == _SC_XBS5_LPBIG_OFFBIG)
6823 {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
6824 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
6825 #ifdef _SC_XOPEN_CRYPT
6826 if (x == _SC_XOPEN_CRYPT)
6827 {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
6828 #endif /* ndef _SC_XOPEN_CRYPT */
6829 #ifdef _SC_XOPEN_ENH_I18N
6830 if (x == _SC_XOPEN_ENH_I18N)
6831 {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
6832 #endif /* ndef _SC_XOPEN_ENH_I18N */
6833 #ifdef _SC_XOPEN_LEGACY
6834 if (x == _SC_XOPEN_LEGACY)
6835 {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
6836 #endif /* ndef _SC_XOPEN_LEGACY */
6837 #ifdef _SC_XOPEN_REALTIME
6838 if (x == _SC_XOPEN_REALTIME)
6839 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
6840 #endif /* ndef _SC_XOPEN_REALTIME */
6841 #ifdef _SC_XOPEN_REALTIME_THREADS
6842 if (x == _SC_XOPEN_REALTIME_THREADS)
6843 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
6844 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6845 #ifdef _SC_XOPEN_SHM
6846 if (x == _SC_XOPEN_SHM)
6847 {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
6848 #endif /* ndef _SC_XOPEN_SHM */
6849 #ifdef _SC_XOPEN_UNIX
6850 if (x == _SC_XOPEN_UNIX)
6851 {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
6852 #endif /* ndef _SC_XOPEN_UNIX */
6853 #ifdef _SC_XOPEN_VERSION
6854 if (x == _SC_XOPEN_VERSION)
6855 {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
6856 #endif /* ndef _SC_XOPEN_VERSION */
6857 #ifdef _SC_XOPEN_XCU_VERSION
6858 if (x == _SC_XOPEN_XCU_VERSION)
6859 {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
6860 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6861 #ifdef _SC_XOPEN_XPG2
6862 if (x == _SC_XOPEN_XPG2)
6863 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
6864 #endif /* ndef _SC_XOPEN_XPG2 */
6865 #ifdef _SC_XOPEN_XPG3
6866 if (x == _SC_XOPEN_XPG3)
6867 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
6868 #endif /* ndef _SC_XOPEN_XPG3 */
6869 #ifdef _SC_XOPEN_XPG4
6870 if (x == _SC_XOPEN_XPG4)
6871 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
6872 #endif /* ndef _SC_XOPEN_XPG4 */
6873 errno = EINVAL; return -1;
6876 int Mono_Posix_FromSyslogFacility (int x, int *r)
6878 *r = 0;
6879 if (x == Mono_Posix_SyslogFacility_LOG_AUTH)
6880 #ifdef LOG_AUTH
6881 {*r = LOG_AUTH; return 0;}
6882 #else /* def LOG_AUTH */
6883 {errno = EINVAL; return -1;}
6884 #endif /* ndef LOG_AUTH */
6885 if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
6886 #ifdef LOG_AUTHPRIV
6887 {*r = LOG_AUTHPRIV; return 0;}
6888 #else /* def LOG_AUTHPRIV */
6889 {errno = EINVAL; return -1;}
6890 #endif /* ndef LOG_AUTHPRIV */
6891 if (x == Mono_Posix_SyslogFacility_LOG_CRON)
6892 #ifdef LOG_CRON
6893 {*r = LOG_CRON; return 0;}
6894 #else /* def LOG_CRON */
6895 {errno = EINVAL; return -1;}
6896 #endif /* ndef LOG_CRON */
6897 if (x == Mono_Posix_SyslogFacility_LOG_DAEMON)
6898 #ifdef LOG_DAEMON
6899 {*r = LOG_DAEMON; return 0;}
6900 #else /* def LOG_DAEMON */
6901 {errno = EINVAL; return -1;}
6902 #endif /* ndef LOG_DAEMON */
6903 if (x == Mono_Posix_SyslogFacility_LOG_FTP)
6904 #ifdef LOG_FTP
6905 {*r = LOG_FTP; return 0;}
6906 #else /* def LOG_FTP */
6907 {errno = EINVAL; return -1;}
6908 #endif /* ndef LOG_FTP */
6909 if (x == Mono_Posix_SyslogFacility_LOG_KERN)
6910 #ifdef LOG_KERN
6911 {*r = LOG_KERN; return 0;}
6912 #else /* def LOG_KERN */
6913 {errno = EINVAL; return -1;}
6914 #endif /* ndef LOG_KERN */
6915 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0)
6916 #ifdef LOG_LOCAL0
6917 {*r = LOG_LOCAL0; return 0;}
6918 #else /* def LOG_LOCAL0 */
6919 {errno = EINVAL; return -1;}
6920 #endif /* ndef LOG_LOCAL0 */
6921 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1)
6922 #ifdef LOG_LOCAL1
6923 {*r = LOG_LOCAL1; return 0;}
6924 #else /* def LOG_LOCAL1 */
6925 {errno = EINVAL; return -1;}
6926 #endif /* ndef LOG_LOCAL1 */
6927 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2)
6928 #ifdef LOG_LOCAL2
6929 {*r = LOG_LOCAL2; return 0;}
6930 #else /* def LOG_LOCAL2 */
6931 {errno = EINVAL; return -1;}
6932 #endif /* ndef LOG_LOCAL2 */
6933 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3)
6934 #ifdef LOG_LOCAL3
6935 {*r = LOG_LOCAL3; return 0;}
6936 #else /* def LOG_LOCAL3 */
6937 {errno = EINVAL; return -1;}
6938 #endif /* ndef LOG_LOCAL3 */
6939 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4)
6940 #ifdef LOG_LOCAL4
6941 {*r = LOG_LOCAL4; return 0;}
6942 #else /* def LOG_LOCAL4 */
6943 {errno = EINVAL; return -1;}
6944 #endif /* ndef LOG_LOCAL4 */
6945 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5)
6946 #ifdef LOG_LOCAL5
6947 {*r = LOG_LOCAL5; return 0;}
6948 #else /* def LOG_LOCAL5 */
6949 {errno = EINVAL; return -1;}
6950 #endif /* ndef LOG_LOCAL5 */
6951 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6)
6952 #ifdef LOG_LOCAL6
6953 {*r = LOG_LOCAL6; return 0;}
6954 #else /* def LOG_LOCAL6 */
6955 {errno = EINVAL; return -1;}
6956 #endif /* ndef LOG_LOCAL6 */
6957 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7)
6958 #ifdef LOG_LOCAL7
6959 {*r = LOG_LOCAL7; return 0;}
6960 #else /* def LOG_LOCAL7 */
6961 {errno = EINVAL; return -1;}
6962 #endif /* ndef LOG_LOCAL7 */
6963 if (x == Mono_Posix_SyslogFacility_LOG_LPR)
6964 #ifdef LOG_LPR
6965 {*r = LOG_LPR; return 0;}
6966 #else /* def LOG_LPR */
6967 {errno = EINVAL; return -1;}
6968 #endif /* ndef LOG_LPR */
6969 if (x == Mono_Posix_SyslogFacility_LOG_MAIL)
6970 #ifdef LOG_MAIL
6971 {*r = LOG_MAIL; return 0;}
6972 #else /* def LOG_MAIL */
6973 {errno = EINVAL; return -1;}
6974 #endif /* ndef LOG_MAIL */
6975 if (x == Mono_Posix_SyslogFacility_LOG_NEWS)
6976 #ifdef LOG_NEWS
6977 {*r = LOG_NEWS; return 0;}
6978 #else /* def LOG_NEWS */
6979 {errno = EINVAL; return -1;}
6980 #endif /* ndef LOG_NEWS */
6981 if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG)
6982 #ifdef LOG_SYSLOG
6983 {*r = LOG_SYSLOG; return 0;}
6984 #else /* def LOG_SYSLOG */
6985 {errno = EINVAL; return -1;}
6986 #endif /* ndef LOG_SYSLOG */
6987 if (x == Mono_Posix_SyslogFacility_LOG_USER)
6988 #ifdef LOG_USER
6989 {*r = LOG_USER; return 0;}
6990 #else /* def LOG_USER */
6991 {errno = EINVAL; return -1;}
6992 #endif /* ndef LOG_USER */
6993 if (x == Mono_Posix_SyslogFacility_LOG_UUCP)
6994 #ifdef LOG_UUCP
6995 {*r = LOG_UUCP; return 0;}
6996 #else /* def LOG_UUCP */
6997 {errno = EINVAL; return -1;}
6998 #endif /* ndef LOG_UUCP */
6999 if (x == 0)
7000 return 0;
7001 errno = EINVAL; return -1;
7004 int Mono_Posix_ToSyslogFacility (int x, int *r)
7006 *r = 0;
7007 if (x == 0)
7008 return 0;
7009 #ifdef LOG_AUTH
7010 if (x == LOG_AUTH)
7011 {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
7012 #endif /* ndef LOG_AUTH */
7013 #ifdef LOG_AUTHPRIV
7014 if (x == LOG_AUTHPRIV)
7015 {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
7016 #endif /* ndef LOG_AUTHPRIV */
7017 #ifdef LOG_CRON
7018 if (x == LOG_CRON)
7019 {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
7020 #endif /* ndef LOG_CRON */
7021 #ifdef LOG_DAEMON
7022 if (x == LOG_DAEMON)
7023 {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
7024 #endif /* ndef LOG_DAEMON */
7025 #ifdef LOG_FTP
7026 if (x == LOG_FTP)
7027 {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
7028 #endif /* ndef LOG_FTP */
7029 #ifdef LOG_KERN
7030 if (x == LOG_KERN)
7031 {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
7032 #endif /* ndef LOG_KERN */
7033 #ifdef LOG_LOCAL0
7034 if (x == LOG_LOCAL0)
7035 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;}
7036 #endif /* ndef LOG_LOCAL0 */
7037 #ifdef LOG_LOCAL1
7038 if (x == LOG_LOCAL1)
7039 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;}
7040 #endif /* ndef LOG_LOCAL1 */
7041 #ifdef LOG_LOCAL2
7042 if (x == LOG_LOCAL2)
7043 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;}
7044 #endif /* ndef LOG_LOCAL2 */
7045 #ifdef LOG_LOCAL3
7046 if (x == LOG_LOCAL3)
7047 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;}
7048 #endif /* ndef LOG_LOCAL3 */
7049 #ifdef LOG_LOCAL4
7050 if (x == LOG_LOCAL4)
7051 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;}
7052 #endif /* ndef LOG_LOCAL4 */
7053 #ifdef LOG_LOCAL5
7054 if (x == LOG_LOCAL5)
7055 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;}
7056 #endif /* ndef LOG_LOCAL5 */
7057 #ifdef LOG_LOCAL6
7058 if (x == LOG_LOCAL6)
7059 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;}
7060 #endif /* ndef LOG_LOCAL6 */
7061 #ifdef LOG_LOCAL7
7062 if (x == LOG_LOCAL7)
7063 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;}
7064 #endif /* ndef LOG_LOCAL7 */
7065 #ifdef LOG_LPR
7066 if (x == LOG_LPR)
7067 {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
7068 #endif /* ndef LOG_LPR */
7069 #ifdef LOG_MAIL
7070 if (x == LOG_MAIL)
7071 {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
7072 #endif /* ndef LOG_MAIL */
7073 #ifdef LOG_NEWS
7074 if (x == LOG_NEWS)
7075 {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
7076 #endif /* ndef LOG_NEWS */
7077 #ifdef LOG_SYSLOG
7078 if (x == LOG_SYSLOG)
7079 {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
7080 #endif /* ndef LOG_SYSLOG */
7081 #ifdef LOG_USER
7082 if (x == LOG_USER)
7083 {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
7084 #endif /* ndef LOG_USER */
7085 #ifdef LOG_UUCP
7086 if (x == LOG_UUCP)
7087 {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
7088 #endif /* ndef LOG_UUCP */
7089 errno = EINVAL; return -1;
7092 int Mono_Posix_FromSyslogLevel (int x, int *r)
7094 *r = 0;
7095 if (x == Mono_Posix_SyslogLevel_LOG_ALERT)
7096 #ifdef LOG_ALERT
7097 {*r = LOG_ALERT; return 0;}
7098 #else /* def LOG_ALERT */
7099 {errno = EINVAL; return -1;}
7100 #endif /* ndef LOG_ALERT */
7101 if (x == Mono_Posix_SyslogLevel_LOG_CRIT)
7102 #ifdef LOG_CRIT
7103 {*r = LOG_CRIT; return 0;}
7104 #else /* def LOG_CRIT */
7105 {errno = EINVAL; return -1;}
7106 #endif /* ndef LOG_CRIT */
7107 if (x == Mono_Posix_SyslogLevel_LOG_DEBUG)
7108 #ifdef LOG_DEBUG
7109 {*r = LOG_DEBUG; return 0;}
7110 #else /* def LOG_DEBUG */
7111 {errno = EINVAL; return -1;}
7112 #endif /* ndef LOG_DEBUG */
7113 if (x == Mono_Posix_SyslogLevel_LOG_EMERG)
7114 #ifdef LOG_EMERG
7115 {*r = LOG_EMERG; return 0;}
7116 #else /* def LOG_EMERG */
7117 {errno = EINVAL; return -1;}
7118 #endif /* ndef LOG_EMERG */
7119 if (x == Mono_Posix_SyslogLevel_LOG_ERR)
7120 #ifdef LOG_ERR
7121 {*r = LOG_ERR; return 0;}
7122 #else /* def LOG_ERR */
7123 {errno = EINVAL; return -1;}
7124 #endif /* ndef LOG_ERR */
7125 if (x == Mono_Posix_SyslogLevel_LOG_INFO)
7126 #ifdef LOG_INFO
7127 {*r = LOG_INFO; return 0;}
7128 #else /* def LOG_INFO */
7129 {errno = EINVAL; return -1;}
7130 #endif /* ndef LOG_INFO */
7131 if (x == Mono_Posix_SyslogLevel_LOG_NOTICE)
7132 #ifdef LOG_NOTICE
7133 {*r = LOG_NOTICE; return 0;}
7134 #else /* def LOG_NOTICE */
7135 {errno = EINVAL; return -1;}
7136 #endif /* ndef LOG_NOTICE */
7137 if (x == Mono_Posix_SyslogLevel_LOG_WARNING)
7138 #ifdef LOG_WARNING
7139 {*r = LOG_WARNING; return 0;}
7140 #else /* def LOG_WARNING */
7141 {errno = EINVAL; return -1;}
7142 #endif /* ndef LOG_WARNING */
7143 if (x == 0)
7144 return 0;
7145 errno = EINVAL; return -1;
7148 int Mono_Posix_ToSyslogLevel (int x, int *r)
7150 *r = 0;
7151 if (x == 0)
7152 return 0;
7153 #ifdef LOG_ALERT
7154 if (x == LOG_ALERT)
7155 {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;}
7156 #endif /* ndef LOG_ALERT */
7157 #ifdef LOG_CRIT
7158 if (x == LOG_CRIT)
7159 {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;}
7160 #endif /* ndef LOG_CRIT */
7161 #ifdef LOG_DEBUG
7162 if (x == LOG_DEBUG)
7163 {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
7164 #endif /* ndef LOG_DEBUG */
7165 #ifdef LOG_EMERG
7166 if (x == LOG_EMERG)
7167 {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
7168 #endif /* ndef LOG_EMERG */
7169 #ifdef LOG_ERR
7170 if (x == LOG_ERR)
7171 {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
7172 #endif /* ndef LOG_ERR */
7173 #ifdef LOG_INFO
7174 if (x == LOG_INFO)
7175 {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
7176 #endif /* ndef LOG_INFO */
7177 #ifdef LOG_NOTICE
7178 if (x == LOG_NOTICE)
7179 {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
7180 #endif /* ndef LOG_NOTICE */
7181 #ifdef LOG_WARNING
7182 if (x == LOG_WARNING)
7183 {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
7184 #endif /* ndef LOG_WARNING */
7185 errno = EINVAL; return -1;
7188 int Mono_Posix_FromSyslogOptions (int x, int *r)
7190 *r = 0;
7191 if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
7192 #ifdef LOG_CONS
7193 *r |= LOG_CONS;
7194 #else /* def LOG_CONS */
7195 {errno = EINVAL; return -1;}
7196 #endif /* ndef LOG_CONS */
7197 if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
7198 #ifdef LOG_NDELAY
7199 *r |= LOG_NDELAY;
7200 #else /* def LOG_NDELAY */
7201 {errno = EINVAL; return -1;}
7202 #endif /* ndef LOG_NDELAY */
7203 if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
7204 #ifdef LOG_NOWAIT
7205 *r |= LOG_NOWAIT;
7206 #else /* def LOG_NOWAIT */
7207 {errno = EINVAL; return -1;}
7208 #endif /* ndef LOG_NOWAIT */
7209 if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
7210 #ifdef LOG_ODELAY
7211 *r |= LOG_ODELAY;
7212 #else /* def LOG_ODELAY */
7213 {errno = EINVAL; return -1;}
7214 #endif /* ndef LOG_ODELAY */
7215 if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
7216 #ifdef LOG_PERROR
7217 *r |= LOG_PERROR;
7218 #else /* def LOG_PERROR */
7219 {errno = EINVAL; return -1;}
7220 #endif /* ndef LOG_PERROR */
7221 if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
7222 #ifdef LOG_PID
7223 *r |= LOG_PID;
7224 #else /* def LOG_PID */
7225 {errno = EINVAL; return -1;}
7226 #endif /* ndef LOG_PID */
7227 if (x == 0)
7228 return 0;
7229 return 0;
7232 int Mono_Posix_ToSyslogOptions (int x, int *r)
7234 *r = 0;
7235 if (x == 0)
7236 return 0;
7237 #ifdef LOG_CONS
7238 if ((x & LOG_CONS) == LOG_CONS)
7239 *r |= Mono_Posix_SyslogOptions_LOG_CONS;
7240 #endif /* ndef LOG_CONS */
7241 #ifdef LOG_NDELAY
7242 if ((x & LOG_NDELAY) == LOG_NDELAY)
7243 *r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
7244 #endif /* ndef LOG_NDELAY */
7245 #ifdef LOG_NOWAIT
7246 if ((x & LOG_NOWAIT) == LOG_NOWAIT)
7247 *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
7248 #endif /* ndef LOG_NOWAIT */
7249 #ifdef LOG_ODELAY
7250 if ((x & LOG_ODELAY) == LOG_ODELAY)
7251 *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
7252 #endif /* ndef LOG_ODELAY */
7253 #ifdef LOG_PERROR
7254 if ((x & LOG_PERROR) == LOG_PERROR)
7255 *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
7256 #endif /* ndef LOG_PERROR */
7257 #ifdef LOG_PID
7258 if ((x & LOG_PID) == LOG_PID)
7259 *r |= Mono_Posix_SyslogOptions_LOG_PID;
7260 #endif /* ndef LOG_PID */
7261 return 0;
7264 #ifdef HAVE_STRUCT_TIMESPEC
7266 Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
7268 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7269 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7271 memset (to, 0, sizeof(*to));
7273 to->tv_sec = from->tv_sec;
7274 to->tv_nsec = from->tv_nsec;
7276 return 0;
7278 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7281 #ifdef HAVE_STRUCT_TIMESPEC
7283 Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
7285 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7286 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7288 memset (to, 0, sizeof(*to));
7290 to->tv_sec = from->tv_sec;
7291 to->tv_nsec = from->tv_nsec;
7293 return 0;
7295 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7298 #ifdef HAVE_STRUCT_TIMEVAL
7300 Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
7302 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7303 _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
7305 memset (to, 0, sizeof(*to));
7307 to->tv_sec = from->tv_sec;
7308 to->tv_usec = from->tv_usec;
7310 return 0;
7312 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7315 #ifdef HAVE_STRUCT_TIMEVAL
7317 Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
7319 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7320 _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
7322 memset (to, 0, sizeof(*to));
7324 to->tv_sec = from->tv_sec;
7325 to->tv_usec = from->tv_usec;
7327 return 0;
7329 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7332 #ifdef HAVE_STRUCT_TIMEZONE
7334 Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
7336 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7337 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7339 memset (to, 0, sizeof(*to));
7341 to->tz_minuteswest = from->tz_minuteswest;
7342 to->tz_dsttime = from->tz_dsttime;
7344 return 0;
7346 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7349 #ifdef HAVE_STRUCT_TIMEZONE
7351 Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
7353 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7354 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7356 memset (to, 0, sizeof(*to));
7358 to->tz_minuteswest = from->tz_minuteswest;
7359 to->tz_dsttime = from->tz_dsttime;
7361 return 0;
7363 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7366 #ifdef HAVE_STRUCT_UTIMBUF
7368 Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
7370 _cnm_return_val_if_overflow (time_t, from->actime, -1);
7371 _cnm_return_val_if_overflow (time_t, from->modtime, -1);
7373 memset (to, 0, sizeof(*to));
7375 to->actime = from->actime;
7376 to->modtime = from->modtime;
7378 return 0;
7380 #endif /* ndef HAVE_STRUCT_UTIMBUF */
7383 #ifdef HAVE_STRUCT_UTIMBUF
7385 Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
7387 _cnm_return_val_if_overflow (gint64, from->actime, -1);
7388 _cnm_return_val_if_overflow (gint64, from->modtime, -1);
7390 memset (to, 0, sizeof(*to));
7392 to->actime = from->actime;
7393 to->modtime = from->modtime;
7395 return 0;
7397 #endif /* ndef HAVE_STRUCT_UTIMBUF */
7400 int Mono_Posix_FromWaitOptions (int x, int *r)
7402 *r = 0;
7403 if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
7404 #ifdef WNOHANG
7405 *r |= WNOHANG;
7406 #else /* def WNOHANG */
7407 {errno = EINVAL; return -1;}
7408 #endif /* ndef WNOHANG */
7409 if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
7410 #ifdef WUNTRACED
7411 *r |= WUNTRACED;
7412 #else /* def WUNTRACED */
7413 {errno = EINVAL; return -1;}
7414 #endif /* ndef WUNTRACED */
7415 if (x == 0)
7416 return 0;
7417 return 0;
7420 int Mono_Posix_ToWaitOptions (int x, int *r)
7422 *r = 0;
7423 if (x == 0)
7424 return 0;
7425 #ifdef WNOHANG
7426 if ((x & WNOHANG) == WNOHANG)
7427 *r |= Mono_Posix_WaitOptions_WNOHANG;
7428 #endif /* ndef WNOHANG */
7429 #ifdef WUNTRACED
7430 if ((x & WUNTRACED) == WUNTRACED)
7431 *r |= Mono_Posix_WaitOptions_WUNTRACED;
7432 #endif /* ndef WUNTRACED */
7433 return 0;
7436 int Mono_Posix_FromXattrFlags (int x, int *r)
7438 *r = 0;
7439 if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO)
7440 #ifdef XATTR_AUTO
7441 *r |= XATTR_AUTO;
7442 #else /* def XATTR_AUTO */
7443 {errno = EINVAL; return -1;}
7444 #endif /* ndef XATTR_AUTO */
7445 if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE)
7446 #ifdef XATTR_CREATE
7447 *r |= XATTR_CREATE;
7448 #else /* def XATTR_CREATE */
7449 {errno = EINVAL; return -1;}
7450 #endif /* ndef XATTR_CREATE */
7451 if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE)
7452 #ifdef XATTR_REPLACE
7453 *r |= XATTR_REPLACE;
7454 #else /* def XATTR_REPLACE */
7455 {errno = EINVAL; return -1;}
7456 #endif /* ndef XATTR_REPLACE */
7457 if (x == 0)
7458 return 0;
7459 return 0;
7462 int Mono_Posix_ToXattrFlags (int x, int *r)
7464 *r = 0;
7465 if (x == 0)
7466 return 0;
7467 #ifdef XATTR_AUTO
7468 if ((x & XATTR_AUTO) == XATTR_AUTO)
7469 *r |= Mono_Posix_XattrFlags_XATTR_AUTO;
7470 #endif /* ndef XATTR_AUTO */
7471 #ifdef XATTR_CREATE
7472 if ((x & XATTR_CREATE) == XATTR_CREATE)
7473 *r |= Mono_Posix_XattrFlags_XATTR_CREATE;
7474 #endif /* ndef XATTR_CREATE */
7475 #ifdef XATTR_REPLACE
7476 if ((x & XATTR_REPLACE) == XATTR_REPLACE)
7477 *r |= Mono_Posix_XattrFlags_XATTR_REPLACE;
7478 #endif /* ndef XATTR_REPLACE */
7479 return 0;