Merge pull request #1861 from saper/home-override
[mono-project.git] / support / map.c
blob737c217727585521e981daf3f93ed8c7b5eb1f7b
1 /*
2 * This file was automatically generated by create-native-map from /cvs/mono/mcs/class/lib/net_4_5/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_NOCACHE)
2630 #ifdef F_NOCACHE
2631 {*r = F_NOCACHE; return 0;}
2632 #else /* def F_NOCACHE */
2633 {errno = EINVAL; return -1;}
2634 #endif /* ndef F_NOCACHE */
2635 if (x == Mono_Posix_FcntlCommand_F_NOTIFY)
2636 #ifdef F_NOTIFY
2637 {*r = F_NOTIFY; return 0;}
2638 #else /* def F_NOTIFY */
2639 {errno = EINVAL; return -1;}
2640 #endif /* ndef F_NOTIFY */
2641 if (x == Mono_Posix_FcntlCommand_F_SETFD)
2642 #ifdef F_SETFD
2643 {*r = F_SETFD; return 0;}
2644 #else /* def F_SETFD */
2645 {errno = EINVAL; return -1;}
2646 #endif /* ndef F_SETFD */
2647 if (x == Mono_Posix_FcntlCommand_F_SETFL)
2648 #ifdef F_SETFL
2649 {*r = F_SETFL; return 0;}
2650 #else /* def F_SETFL */
2651 {errno = EINVAL; return -1;}
2652 #endif /* ndef F_SETFL */
2653 if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
2654 #ifdef F_SETLEASE
2655 {*r = F_SETLEASE; return 0;}
2656 #else /* def F_SETLEASE */
2657 {errno = EINVAL; return -1;}
2658 #endif /* ndef F_SETLEASE */
2659 if (x == Mono_Posix_FcntlCommand_F_SETLK)
2660 #ifdef F_SETLK
2661 {*r = F_SETLK; return 0;}
2662 #else /* def F_SETLK */
2663 {errno = EINVAL; return -1;}
2664 #endif /* ndef F_SETLK */
2665 if (x == Mono_Posix_FcntlCommand_F_SETLKW)
2666 #ifdef F_SETLKW
2667 {*r = F_SETLKW; return 0;}
2668 #else /* def F_SETLKW */
2669 {errno = EINVAL; return -1;}
2670 #endif /* ndef F_SETLKW */
2671 if (x == Mono_Posix_FcntlCommand_F_SETOWN)
2672 #ifdef F_SETOWN
2673 {*r = F_SETOWN; return 0;}
2674 #else /* def F_SETOWN */
2675 {errno = EINVAL; return -1;}
2676 #endif /* ndef F_SETOWN */
2677 if (x == Mono_Posix_FcntlCommand_F_SETSIG)
2678 #ifdef F_SETSIG
2679 {*r = F_SETSIG; return 0;}
2680 #else /* def F_SETSIG */
2681 {errno = EINVAL; return -1;}
2682 #endif /* ndef F_SETSIG */
2683 if (x == 0)
2684 return 0;
2685 errno = EINVAL; return -1;
2688 int Mono_Posix_ToFcntlCommand (int x, int *r)
2690 *r = 0;
2691 if (x == 0)
2692 return 0;
2693 #ifdef F_DUPFD
2694 if (x == F_DUPFD)
2695 {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
2696 #endif /* ndef F_DUPFD */
2697 #ifdef F_GETFD
2698 if (x == F_GETFD)
2699 {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
2700 #endif /* ndef F_GETFD */
2701 #ifdef F_GETFL
2702 if (x == F_GETFL)
2703 {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
2704 #endif /* ndef F_GETFL */
2705 #ifdef F_GETLEASE
2706 if (x == F_GETLEASE)
2707 {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
2708 #endif /* ndef F_GETLEASE */
2709 #ifdef F_GETLK
2710 if (x == F_GETLK)
2711 {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
2712 #endif /* ndef F_GETLK */
2713 #ifdef F_GETOWN
2714 if (x == F_GETOWN)
2715 {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
2716 #endif /* ndef F_GETOWN */
2717 #ifdef F_GETSIG
2718 if (x == F_GETSIG)
2719 {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
2720 #endif /* ndef F_GETSIG */
2721 #ifdef F_NOCACHE
2722 if (x == F_NOCACHE)
2723 {*r = Mono_Posix_FcntlCommand_F_NOCACHE; return 0;}
2724 #endif /* ndef F_NOCACHE */
2725 #ifdef F_NOTIFY
2726 if (x == F_NOTIFY)
2727 {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
2728 #endif /* ndef F_NOTIFY */
2729 #ifdef F_SETFD
2730 if (x == F_SETFD)
2731 {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
2732 #endif /* ndef F_SETFD */
2733 #ifdef F_SETFL
2734 if (x == F_SETFL)
2735 {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
2736 #endif /* ndef F_SETFL */
2737 #ifdef F_SETLEASE
2738 if (x == F_SETLEASE)
2739 {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
2740 #endif /* ndef F_SETLEASE */
2741 #ifdef F_SETLK
2742 if (x == F_SETLK)
2743 {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
2744 #endif /* ndef F_SETLK */
2745 #ifdef F_SETLKW
2746 if (x == F_SETLKW)
2747 {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
2748 #endif /* ndef F_SETLKW */
2749 #ifdef F_SETOWN
2750 if (x == F_SETOWN)
2751 {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
2752 #endif /* ndef F_SETOWN */
2753 #ifdef F_SETSIG
2754 if (x == F_SETSIG)
2755 {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
2756 #endif /* ndef F_SETSIG */
2757 errno = EINVAL; return -1;
2760 int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
2762 *r = 0;
2763 if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
2764 #ifdef ACCESSPERMS
2765 *r |= ACCESSPERMS;
2766 #else /* def ACCESSPERMS */
2767 {/* Ignoring Mono_Posix_FilePermissions_ACCESSPERMS, as it is constructed from other values */}
2768 #endif /* ndef ACCESSPERMS */
2769 if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
2770 #ifdef ALLPERMS
2771 *r |= ALLPERMS;
2772 #else /* def ALLPERMS */
2773 {/* Ignoring Mono_Posix_FilePermissions_ALLPERMS, as it is constructed from other values */}
2774 #endif /* ndef ALLPERMS */
2775 if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
2776 #ifdef DEFFILEMODE
2777 *r |= DEFFILEMODE;
2778 #else /* def DEFFILEMODE */
2779 {/* Ignoring Mono_Posix_FilePermissions_DEFFILEMODE, as it is constructed from other values */}
2780 #endif /* ndef DEFFILEMODE */
2781 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFBLK)
2782 #ifdef S_IFBLK
2783 *r |= S_IFBLK;
2784 #else /* def S_IFBLK */
2785 {errno = EINVAL; return -1;}
2786 #endif /* ndef S_IFBLK */
2787 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFCHR)
2788 #ifdef S_IFCHR
2789 *r |= S_IFCHR;
2790 #else /* def S_IFCHR */
2791 {errno = EINVAL; return -1;}
2792 #endif /* ndef S_IFCHR */
2793 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFDIR)
2794 #ifdef S_IFDIR
2795 *r |= S_IFDIR;
2796 #else /* def S_IFDIR */
2797 {errno = EINVAL; return -1;}
2798 #endif /* ndef S_IFDIR */
2799 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFIFO)
2800 #ifdef S_IFIFO
2801 *r |= S_IFIFO;
2802 #else /* def S_IFIFO */
2803 {errno = EINVAL; return -1;}
2804 #endif /* ndef S_IFIFO */
2805 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFLNK)
2806 #ifdef S_IFLNK
2807 *r |= S_IFLNK;
2808 #else /* def S_IFLNK */
2809 {errno = EINVAL; return -1;}
2810 #endif /* ndef S_IFLNK */
2811 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
2812 #ifdef S_IFMT
2813 *r |= S_IFMT;
2814 #else /* def S_IFMT */
2815 {/* Ignoring Mono_Posix_FilePermissions_S_IFMT, as it is constructed from other values */}
2816 #endif /* ndef S_IFMT */
2817 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFREG)
2818 #ifdef S_IFREG
2819 *r |= S_IFREG;
2820 #else /* def S_IFREG */
2821 {errno = EINVAL; return -1;}
2822 #endif /* ndef S_IFREG */
2823 if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFSOCK)
2824 #ifdef S_IFSOCK
2825 *r |= S_IFSOCK;
2826 #else /* def S_IFSOCK */
2827 {errno = EINVAL; return -1;}
2828 #endif /* ndef S_IFSOCK */
2829 if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
2830 #ifdef S_IRGRP
2831 *r |= S_IRGRP;
2832 #else /* def S_IRGRP */
2833 {errno = EINVAL; return -1;}
2834 #endif /* ndef S_IRGRP */
2835 if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
2836 #ifdef S_IROTH
2837 *r |= S_IROTH;
2838 #else /* def S_IROTH */
2839 {errno = EINVAL; return -1;}
2840 #endif /* ndef S_IROTH */
2841 if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
2842 #ifdef S_IRUSR
2843 *r |= S_IRUSR;
2844 #else /* def S_IRUSR */
2845 {errno = EINVAL; return -1;}
2846 #endif /* ndef S_IRUSR */
2847 if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
2848 #ifdef S_IRWXG
2849 *r |= S_IRWXG;
2850 #else /* def S_IRWXG */
2851 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXG, as it is constructed from other values */}
2852 #endif /* ndef S_IRWXG */
2853 if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
2854 #ifdef S_IRWXO
2855 *r |= S_IRWXO;
2856 #else /* def S_IRWXO */
2857 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXO, as it is constructed from other values */}
2858 #endif /* ndef S_IRWXO */
2859 if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
2860 #ifdef S_IRWXU
2861 *r |= S_IRWXU;
2862 #else /* def S_IRWXU */
2863 {/* Ignoring Mono_Posix_FilePermissions_S_IRWXU, as it is constructed from other values */}
2864 #endif /* ndef S_IRWXU */
2865 if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
2866 #ifdef S_ISGID
2867 *r |= S_ISGID;
2868 #else /* def S_ISGID */
2869 {errno = EINVAL; return -1;}
2870 #endif /* ndef S_ISGID */
2871 if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
2872 #ifdef S_ISUID
2873 *r |= S_ISUID;
2874 #else /* def S_ISUID */
2875 {errno = EINVAL; return -1;}
2876 #endif /* ndef S_ISUID */
2877 if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
2878 #ifdef S_ISVTX
2879 *r |= S_ISVTX;
2880 #else /* def S_ISVTX */
2881 {errno = EINVAL; return -1;}
2882 #endif /* ndef S_ISVTX */
2883 if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
2884 #ifdef S_IWGRP
2885 *r |= S_IWGRP;
2886 #else /* def S_IWGRP */
2887 {errno = EINVAL; return -1;}
2888 #endif /* ndef S_IWGRP */
2889 if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
2890 #ifdef S_IWOTH
2891 *r |= S_IWOTH;
2892 #else /* def S_IWOTH */
2893 {errno = EINVAL; return -1;}
2894 #endif /* ndef S_IWOTH */
2895 if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
2896 #ifdef S_IWUSR
2897 *r |= S_IWUSR;
2898 #else /* def S_IWUSR */
2899 {errno = EINVAL; return -1;}
2900 #endif /* ndef S_IWUSR */
2901 if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
2902 #ifdef S_IXGRP
2903 *r |= S_IXGRP;
2904 #else /* def S_IXGRP */
2905 {errno = EINVAL; return -1;}
2906 #endif /* ndef S_IXGRP */
2907 if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
2908 #ifdef S_IXOTH
2909 *r |= S_IXOTH;
2910 #else /* def S_IXOTH */
2911 {errno = EINVAL; return -1;}
2912 #endif /* ndef S_IXOTH */
2913 if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
2914 #ifdef S_IXUSR
2915 *r |= S_IXUSR;
2916 #else /* def S_IXUSR */
2917 {errno = EINVAL; return -1;}
2918 #endif /* ndef S_IXUSR */
2919 if (x == 0)
2920 return 0;
2921 return 0;
2924 int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
2926 *r = 0;
2927 if (x == 0)
2928 return 0;
2929 #ifdef ACCESSPERMS
2930 if ((x & ACCESSPERMS) == ACCESSPERMS)
2931 *r |= Mono_Posix_FilePermissions_ACCESSPERMS;
2932 #endif /* ndef ACCESSPERMS */
2933 #ifdef ALLPERMS
2934 if ((x & ALLPERMS) == ALLPERMS)
2935 *r |= Mono_Posix_FilePermissions_ALLPERMS;
2936 #endif /* ndef ALLPERMS */
2937 #ifdef DEFFILEMODE
2938 if ((x & DEFFILEMODE) == DEFFILEMODE)
2939 *r |= Mono_Posix_FilePermissions_DEFFILEMODE;
2940 #endif /* ndef DEFFILEMODE */
2941 #ifdef S_IFBLK
2942 if ((x & S_IFMT) == S_IFBLK)
2943 *r |= Mono_Posix_FilePermissions_S_IFBLK;
2944 #endif /* ndef S_IFBLK */
2945 #ifdef S_IFCHR
2946 if ((x & S_IFMT) == S_IFCHR)
2947 *r |= Mono_Posix_FilePermissions_S_IFCHR;
2948 #endif /* ndef S_IFCHR */
2949 #ifdef S_IFDIR
2950 if ((x & S_IFMT) == S_IFDIR)
2951 *r |= Mono_Posix_FilePermissions_S_IFDIR;
2952 #endif /* ndef S_IFDIR */
2953 #ifdef S_IFIFO
2954 if ((x & S_IFMT) == S_IFIFO)
2955 *r |= Mono_Posix_FilePermissions_S_IFIFO;
2956 #endif /* ndef S_IFIFO */
2957 #ifdef S_IFLNK
2958 if ((x & S_IFMT) == S_IFLNK)
2959 *r |= Mono_Posix_FilePermissions_S_IFLNK;
2960 #endif /* ndef S_IFLNK */
2961 #ifdef S_IFMT
2962 if ((x & S_IFMT) == S_IFMT)
2963 *r |= Mono_Posix_FilePermissions_S_IFMT;
2964 #endif /* ndef S_IFMT */
2965 #ifdef S_IFREG
2966 if ((x & S_IFMT) == S_IFREG)
2967 *r |= Mono_Posix_FilePermissions_S_IFREG;
2968 #endif /* ndef S_IFREG */
2969 #ifdef S_IFSOCK
2970 if ((x & S_IFMT) == S_IFSOCK)
2971 *r |= Mono_Posix_FilePermissions_S_IFSOCK;
2972 #endif /* ndef S_IFSOCK */
2973 #ifdef S_IRGRP
2974 if ((x & S_IRGRP) == S_IRGRP)
2975 *r |= Mono_Posix_FilePermissions_S_IRGRP;
2976 #endif /* ndef S_IRGRP */
2977 #ifdef S_IROTH
2978 if ((x & S_IROTH) == S_IROTH)
2979 *r |= Mono_Posix_FilePermissions_S_IROTH;
2980 #endif /* ndef S_IROTH */
2981 #ifdef S_IRUSR
2982 if ((x & S_IRUSR) == S_IRUSR)
2983 *r |= Mono_Posix_FilePermissions_S_IRUSR;
2984 #endif /* ndef S_IRUSR */
2985 #ifdef S_IRWXG
2986 if ((x & S_IRWXG) == S_IRWXG)
2987 *r |= Mono_Posix_FilePermissions_S_IRWXG;
2988 #endif /* ndef S_IRWXG */
2989 #ifdef S_IRWXO
2990 if ((x & S_IRWXO) == S_IRWXO)
2991 *r |= Mono_Posix_FilePermissions_S_IRWXO;
2992 #endif /* ndef S_IRWXO */
2993 #ifdef S_IRWXU
2994 if ((x & S_IRWXU) == S_IRWXU)
2995 *r |= Mono_Posix_FilePermissions_S_IRWXU;
2996 #endif /* ndef S_IRWXU */
2997 #ifdef S_ISGID
2998 if ((x & S_ISGID) == S_ISGID)
2999 *r |= Mono_Posix_FilePermissions_S_ISGID;
3000 #endif /* ndef S_ISGID */
3001 #ifdef S_ISUID
3002 if ((x & S_ISUID) == S_ISUID)
3003 *r |= Mono_Posix_FilePermissions_S_ISUID;
3004 #endif /* ndef S_ISUID */
3005 #ifdef S_ISVTX
3006 if ((x & S_ISVTX) == S_ISVTX)
3007 *r |= Mono_Posix_FilePermissions_S_ISVTX;
3008 #endif /* ndef S_ISVTX */
3009 #ifdef S_IWGRP
3010 if ((x & S_IWGRP) == S_IWGRP)
3011 *r |= Mono_Posix_FilePermissions_S_IWGRP;
3012 #endif /* ndef S_IWGRP */
3013 #ifdef S_IWOTH
3014 if ((x & S_IWOTH) == S_IWOTH)
3015 *r |= Mono_Posix_FilePermissions_S_IWOTH;
3016 #endif /* ndef S_IWOTH */
3017 #ifdef S_IWUSR
3018 if ((x & S_IWUSR) == S_IWUSR)
3019 *r |= Mono_Posix_FilePermissions_S_IWUSR;
3020 #endif /* ndef S_IWUSR */
3021 #ifdef S_IXGRP
3022 if ((x & S_IXGRP) == S_IXGRP)
3023 *r |= Mono_Posix_FilePermissions_S_IXGRP;
3024 #endif /* ndef S_IXGRP */
3025 #ifdef S_IXOTH
3026 if ((x & S_IXOTH) == S_IXOTH)
3027 *r |= Mono_Posix_FilePermissions_S_IXOTH;
3028 #endif /* ndef S_IXOTH */
3029 #ifdef S_IXUSR
3030 if ((x & S_IXUSR) == S_IXUSR)
3031 *r |= Mono_Posix_FilePermissions_S_IXUSR;
3032 #endif /* ndef S_IXUSR */
3033 return 0;
3036 #ifdef HAVE_STRUCT_FLOCK
3038 Mono_Posix_FromFlock (struct Mono_Posix_Flock *from, struct flock *to)
3040 _cnm_return_val_if_overflow (off_t, from->l_start, -1);
3041 _cnm_return_val_if_overflow (off_t, from->l_len, -1);
3042 _cnm_return_val_if_overflow (pid_t, from->l_pid, -1);
3044 memset (to, 0, sizeof(*to));
3046 if (Mono_Posix_FromLockType (from->l_type, &to->l_type) != 0) {
3047 return -1;
3049 if (Mono_Posix_FromSeekFlags (from->l_whence, &to->l_whence) != 0) {
3050 return -1;
3052 to->l_start = from->l_start;
3053 to->l_len = from->l_len;
3054 to->l_pid = from->l_pid;
3056 return 0;
3058 #endif /* ndef HAVE_STRUCT_FLOCK */
3061 #ifdef HAVE_STRUCT_FLOCK
3063 Mono_Posix_ToFlock (struct flock *from, struct Mono_Posix_Flock *to)
3065 _cnm_return_val_if_overflow (gint64, from->l_start, -1);
3066 _cnm_return_val_if_overflow (gint64, from->l_len, -1);
3067 _cnm_return_val_if_overflow (int, from->l_pid, -1);
3069 memset (to, 0, sizeof(*to));
3071 if (Mono_Posix_ToLockType (from->l_type, &to->l_type) != 0) {
3072 return -1;
3074 if (Mono_Posix_ToSeekFlags (from->l_whence, &to->l_whence) != 0) {
3075 return -1;
3077 to->l_start = from->l_start;
3078 to->l_len = from->l_len;
3079 to->l_pid = from->l_pid;
3081 return 0;
3083 #endif /* ndef HAVE_STRUCT_FLOCK */
3086 #ifdef HAVE_STRUCT_IOVEC
3088 Mono_Posix_FromIovec (struct Mono_Posix_Iovec *from, struct iovec *to)
3090 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3092 memset (to, 0, sizeof(*to));
3094 to->iov_base = from->iov_base;
3095 to->iov_len = from->iov_len;
3097 return 0;
3099 #endif /* ndef HAVE_STRUCT_IOVEC */
3102 #ifdef HAVE_STRUCT_IOVEC
3104 Mono_Posix_ToIovec (struct iovec *from, struct Mono_Posix_Iovec *to)
3106 _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
3108 memset (to, 0, sizeof(*to));
3110 to->iov_base = from->iov_base;
3111 to->iov_len = from->iov_len;
3113 return 0;
3115 #endif /* ndef HAVE_STRUCT_IOVEC */
3118 int Mono_Posix_FromLockType (short x, short *r)
3120 *r = 0;
3121 if (x == Mono_Posix_LockType_F_RDLCK)
3122 #ifdef F_RDLCK
3123 {*r = F_RDLCK; return 0;}
3124 #else /* def F_RDLCK */
3125 {errno = EINVAL; return -1;}
3126 #endif /* ndef F_RDLCK */
3127 if (x == Mono_Posix_LockType_F_UNLCK)
3128 #ifdef F_UNLCK
3129 {*r = F_UNLCK; return 0;}
3130 #else /* def F_UNLCK */
3131 {errno = EINVAL; return -1;}
3132 #endif /* ndef F_UNLCK */
3133 if (x == Mono_Posix_LockType_F_WRLCK)
3134 #ifdef F_WRLCK
3135 {*r = F_WRLCK; return 0;}
3136 #else /* def F_WRLCK */
3137 {errno = EINVAL; return -1;}
3138 #endif /* ndef F_WRLCK */
3139 if (x == 0)
3140 return 0;
3141 errno = EINVAL; return -1;
3144 int Mono_Posix_ToLockType (short x, short *r)
3146 *r = 0;
3147 if (x == 0)
3148 return 0;
3149 #ifdef F_RDLCK
3150 if (x == F_RDLCK)
3151 {*r = Mono_Posix_LockType_F_RDLCK; return 0;}
3152 #endif /* ndef F_RDLCK */
3153 #ifdef F_UNLCK
3154 if (x == F_UNLCK)
3155 {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
3156 #endif /* ndef F_UNLCK */
3157 #ifdef F_WRLCK
3158 if (x == F_WRLCK)
3159 {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
3160 #endif /* ndef F_WRLCK */
3161 errno = EINVAL; return -1;
3164 int Mono_Posix_FromLockfCommand (int x, int *r)
3166 *r = 0;
3167 if (x == Mono_Posix_LockfCommand_F_LOCK)
3168 #ifdef F_LOCK
3169 {*r = F_LOCK; return 0;}
3170 #else /* def F_LOCK */
3171 {errno = EINVAL; return -1;}
3172 #endif /* ndef F_LOCK */
3173 if (x == Mono_Posix_LockfCommand_F_TEST)
3174 #ifdef F_TEST
3175 {*r = F_TEST; return 0;}
3176 #else /* def F_TEST */
3177 {errno = EINVAL; return -1;}
3178 #endif /* ndef F_TEST */
3179 if (x == Mono_Posix_LockfCommand_F_TLOCK)
3180 #ifdef F_TLOCK
3181 {*r = F_TLOCK; return 0;}
3182 #else /* def F_TLOCK */
3183 {errno = EINVAL; return -1;}
3184 #endif /* ndef F_TLOCK */
3185 if (x == Mono_Posix_LockfCommand_F_ULOCK)
3186 #ifdef F_ULOCK
3187 {*r = F_ULOCK; return 0;}
3188 #else /* def F_ULOCK */
3189 {errno = EINVAL; return -1;}
3190 #endif /* ndef F_ULOCK */
3191 if (x == 0)
3192 return 0;
3193 errno = EINVAL; return -1;
3196 int Mono_Posix_ToLockfCommand (int x, int *r)
3198 *r = 0;
3199 if (x == 0)
3200 return 0;
3201 #ifdef F_LOCK
3202 if (x == F_LOCK)
3203 {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
3204 #endif /* ndef F_LOCK */
3205 #ifdef F_TEST
3206 if (x == F_TEST)
3207 {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
3208 #endif /* ndef F_TEST */
3209 #ifdef F_TLOCK
3210 if (x == F_TLOCK)
3211 {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
3212 #endif /* ndef F_TLOCK */
3213 #ifdef F_ULOCK
3214 if (x == F_ULOCK)
3215 {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
3216 #endif /* ndef F_ULOCK */
3217 errno = EINVAL; return -1;
3220 int Mono_Posix_FromMlockallFlags (int x, int *r)
3222 *r = 0;
3223 if ((x & Mono_Posix_MlockallFlags_MCL_CURRENT) == Mono_Posix_MlockallFlags_MCL_CURRENT)
3224 #ifdef MCL_CURRENT
3225 *r |= MCL_CURRENT;
3226 #else /* def MCL_CURRENT */
3227 {errno = EINVAL; return -1;}
3228 #endif /* ndef MCL_CURRENT */
3229 if ((x & Mono_Posix_MlockallFlags_MCL_FUTURE) == Mono_Posix_MlockallFlags_MCL_FUTURE)
3230 #ifdef MCL_FUTURE
3231 *r |= MCL_FUTURE;
3232 #else /* def MCL_FUTURE */
3233 {errno = EINVAL; return -1;}
3234 #endif /* ndef MCL_FUTURE */
3235 if (x == 0)
3236 return 0;
3237 return 0;
3240 int Mono_Posix_ToMlockallFlags (int x, int *r)
3242 *r = 0;
3243 if (x == 0)
3244 return 0;
3245 #ifdef MCL_CURRENT
3246 if ((x & MCL_CURRENT) == MCL_CURRENT)
3247 *r |= Mono_Posix_MlockallFlags_MCL_CURRENT;
3248 #endif /* ndef MCL_CURRENT */
3249 #ifdef MCL_FUTURE
3250 if ((x & MCL_FUTURE) == MCL_FUTURE)
3251 *r |= Mono_Posix_MlockallFlags_MCL_FUTURE;
3252 #endif /* ndef MCL_FUTURE */
3253 return 0;
3256 int Mono_Posix_FromMmapFlags (int x, int *r)
3258 *r = 0;
3259 if ((x & Mono_Posix_MmapFlags_MAP_ANON) == Mono_Posix_MmapFlags_MAP_ANON)
3260 #ifdef MAP_ANON
3261 *r |= MAP_ANON;
3262 #else /* def MAP_ANON */
3263 {errno = EINVAL; return -1;}
3264 #endif /* ndef MAP_ANON */
3265 if ((x & Mono_Posix_MmapFlags_MAP_ANONYMOUS) == Mono_Posix_MmapFlags_MAP_ANONYMOUS)
3266 #ifdef MAP_ANONYMOUS
3267 *r |= MAP_ANONYMOUS;
3268 #else /* def MAP_ANONYMOUS */
3269 {errno = EINVAL; return -1;}
3270 #endif /* ndef MAP_ANONYMOUS */
3271 if ((x & Mono_Posix_MmapFlags_MAP_DENYWRITE) == Mono_Posix_MmapFlags_MAP_DENYWRITE)
3272 #ifdef MAP_DENYWRITE
3273 *r |= MAP_DENYWRITE;
3274 #else /* def MAP_DENYWRITE */
3275 {errno = EINVAL; return -1;}
3276 #endif /* ndef MAP_DENYWRITE */
3277 if ((x & Mono_Posix_MmapFlags_MAP_EXECUTABLE) == Mono_Posix_MmapFlags_MAP_EXECUTABLE)
3278 #ifdef MAP_EXECUTABLE
3279 *r |= MAP_EXECUTABLE;
3280 #else /* def MAP_EXECUTABLE */
3281 {errno = EINVAL; return -1;}
3282 #endif /* ndef MAP_EXECUTABLE */
3283 if ((x & Mono_Posix_MmapFlags_MAP_FILE) == Mono_Posix_MmapFlags_MAP_FILE)
3284 #ifdef MAP_FILE
3285 *r |= MAP_FILE;
3286 #else /* def MAP_FILE */
3287 {errno = EINVAL; return -1;}
3288 #endif /* ndef MAP_FILE */
3289 if ((x & Mono_Posix_MmapFlags_MAP_FIXED) == Mono_Posix_MmapFlags_MAP_FIXED)
3290 #ifdef MAP_FIXED
3291 *r |= MAP_FIXED;
3292 #else /* def MAP_FIXED */
3293 {errno = EINVAL; return -1;}
3294 #endif /* ndef MAP_FIXED */
3295 if ((x & Mono_Posix_MmapFlags_MAP_GROWSDOWN) == Mono_Posix_MmapFlags_MAP_GROWSDOWN)
3296 #ifdef MAP_GROWSDOWN
3297 *r |= MAP_GROWSDOWN;
3298 #else /* def MAP_GROWSDOWN */
3299 {errno = EINVAL; return -1;}
3300 #endif /* ndef MAP_GROWSDOWN */
3301 if ((x & Mono_Posix_MmapFlags_MAP_LOCKED) == Mono_Posix_MmapFlags_MAP_LOCKED)
3302 #ifdef MAP_LOCKED
3303 *r |= MAP_LOCKED;
3304 #else /* def MAP_LOCKED */
3305 {errno = EINVAL; return -1;}
3306 #endif /* ndef MAP_LOCKED */
3307 if ((x & Mono_Posix_MmapFlags_MAP_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK)
3308 #ifdef MAP_NONBLOCK
3309 *r |= MAP_NONBLOCK;
3310 #else /* def MAP_NONBLOCK */
3311 {errno = EINVAL; return -1;}
3312 #endif /* ndef MAP_NONBLOCK */
3313 if ((x & Mono_Posix_MmapFlags_MAP_NORESERVE) == Mono_Posix_MmapFlags_MAP_NORESERVE)
3314 #ifdef MAP_NORESERVE
3315 *r |= MAP_NORESERVE;
3316 #else /* def MAP_NORESERVE */
3317 {errno = EINVAL; return -1;}
3318 #endif /* ndef MAP_NORESERVE */
3319 if ((x & Mono_Posix_MmapFlags_MAP_POPULATE) == Mono_Posix_MmapFlags_MAP_POPULATE)
3320 #ifdef MAP_POPULATE
3321 *r |= MAP_POPULATE;
3322 #else /* def MAP_POPULATE */
3323 {errno = EINVAL; return -1;}
3324 #endif /* ndef MAP_POPULATE */
3325 if ((x & Mono_Posix_MmapFlags_MAP_PRIVATE) == Mono_Posix_MmapFlags_MAP_PRIVATE)
3326 #ifdef MAP_PRIVATE
3327 *r |= MAP_PRIVATE;
3328 #else /* def MAP_PRIVATE */
3329 {errno = EINVAL; return -1;}
3330 #endif /* ndef MAP_PRIVATE */
3331 if ((x & Mono_Posix_MmapFlags_MAP_SHARED) == Mono_Posix_MmapFlags_MAP_SHARED)
3332 #ifdef MAP_SHARED
3333 *r |= MAP_SHARED;
3334 #else /* def MAP_SHARED */
3335 {errno = EINVAL; return -1;}
3336 #endif /* ndef MAP_SHARED */
3337 if ((x & Mono_Posix_MmapFlags_MAP_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE)
3338 #ifdef MAP_TYPE
3339 *r |= MAP_TYPE;
3340 #else /* def MAP_TYPE */
3341 {errno = EINVAL; return -1;}
3342 #endif /* ndef MAP_TYPE */
3343 if (x == 0)
3344 return 0;
3345 return 0;
3348 int Mono_Posix_ToMmapFlags (int x, int *r)
3350 *r = 0;
3351 if (x == 0)
3352 return 0;
3353 #ifdef MAP_ANON
3354 if ((x & MAP_ANON) == MAP_ANON)
3355 *r |= Mono_Posix_MmapFlags_MAP_ANON;
3356 #endif /* ndef MAP_ANON */
3357 #ifdef MAP_ANONYMOUS
3358 if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
3359 *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
3360 #endif /* ndef MAP_ANONYMOUS */
3361 #ifdef MAP_DENYWRITE
3362 if ((x & MAP_DENYWRITE) == MAP_DENYWRITE)
3363 *r |= Mono_Posix_MmapFlags_MAP_DENYWRITE;
3364 #endif /* ndef MAP_DENYWRITE */
3365 #ifdef MAP_EXECUTABLE
3366 if ((x & MAP_EXECUTABLE) == MAP_EXECUTABLE)
3367 *r |= Mono_Posix_MmapFlags_MAP_EXECUTABLE;
3368 #endif /* ndef MAP_EXECUTABLE */
3369 #ifdef MAP_FILE
3370 if ((x & MAP_FILE) == MAP_FILE)
3371 *r |= Mono_Posix_MmapFlags_MAP_FILE;
3372 #endif /* ndef MAP_FILE */
3373 #ifdef MAP_FIXED
3374 if ((x & MAP_FIXED) == MAP_FIXED)
3375 *r |= Mono_Posix_MmapFlags_MAP_FIXED;
3376 #endif /* ndef MAP_FIXED */
3377 #ifdef MAP_GROWSDOWN
3378 if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
3379 *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
3380 #endif /* ndef MAP_GROWSDOWN */
3381 #ifdef MAP_LOCKED
3382 if ((x & MAP_LOCKED) == MAP_LOCKED)
3383 *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
3384 #endif /* ndef MAP_LOCKED */
3385 #ifdef MAP_NONBLOCK
3386 if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
3387 *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
3388 #endif /* ndef MAP_NONBLOCK */
3389 #ifdef MAP_NORESERVE
3390 if ((x & MAP_NORESERVE) == MAP_NORESERVE)
3391 *r |= Mono_Posix_MmapFlags_MAP_NORESERVE;
3392 #endif /* ndef MAP_NORESERVE */
3393 #ifdef MAP_POPULATE
3394 if ((x & MAP_POPULATE) == MAP_POPULATE)
3395 *r |= Mono_Posix_MmapFlags_MAP_POPULATE;
3396 #endif /* ndef MAP_POPULATE */
3397 #ifdef MAP_PRIVATE
3398 if ((x & MAP_PRIVATE) == MAP_PRIVATE)
3399 *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
3400 #endif /* ndef MAP_PRIVATE */
3401 #ifdef MAP_SHARED
3402 if ((x & MAP_SHARED) == MAP_SHARED)
3403 *r |= Mono_Posix_MmapFlags_MAP_SHARED;
3404 #endif /* ndef MAP_SHARED */
3405 #ifdef MAP_TYPE
3406 if ((x & MAP_TYPE) == MAP_TYPE)
3407 *r |= Mono_Posix_MmapFlags_MAP_TYPE;
3408 #endif /* ndef MAP_TYPE */
3409 return 0;
3412 int Mono_Posix_FromMmapProts (int x, int *r)
3414 *r = 0;
3415 if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
3416 #ifdef PROT_EXEC
3417 *r |= PROT_EXEC;
3418 #else /* def PROT_EXEC */
3419 {errno = EINVAL; return -1;}
3420 #endif /* ndef PROT_EXEC */
3421 if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
3422 #ifdef PROT_GROWSDOWN
3423 *r |= PROT_GROWSDOWN;
3424 #else /* def PROT_GROWSDOWN */
3425 {errno = EINVAL; return -1;}
3426 #endif /* ndef PROT_GROWSDOWN */
3427 if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
3428 #ifdef PROT_GROWSUP
3429 *r |= PROT_GROWSUP;
3430 #else /* def PROT_GROWSUP */
3431 {errno = EINVAL; return -1;}
3432 #endif /* ndef PROT_GROWSUP */
3433 if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
3434 #ifdef PROT_NONE
3435 *r |= PROT_NONE;
3436 #else /* def PROT_NONE */
3437 {errno = EINVAL; return -1;}
3438 #endif /* ndef PROT_NONE */
3439 if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
3440 #ifdef PROT_READ
3441 *r |= PROT_READ;
3442 #else /* def PROT_READ */
3443 {errno = EINVAL; return -1;}
3444 #endif /* ndef PROT_READ */
3445 if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
3446 #ifdef PROT_WRITE
3447 *r |= PROT_WRITE;
3448 #else /* def PROT_WRITE */
3449 {errno = EINVAL; return -1;}
3450 #endif /* ndef PROT_WRITE */
3451 if (x == 0)
3452 return 0;
3453 return 0;
3456 int Mono_Posix_ToMmapProts (int x, int *r)
3458 *r = 0;
3459 if (x == 0)
3460 return 0;
3461 #ifdef PROT_EXEC
3462 if ((x & PROT_EXEC) == PROT_EXEC)
3463 *r |= Mono_Posix_MmapProts_PROT_EXEC;
3464 #endif /* ndef PROT_EXEC */
3465 #ifdef PROT_GROWSDOWN
3466 if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
3467 *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
3468 #endif /* ndef PROT_GROWSDOWN */
3469 #ifdef PROT_GROWSUP
3470 if ((x & PROT_GROWSUP) == PROT_GROWSUP)
3471 *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
3472 #endif /* ndef PROT_GROWSUP */
3473 #ifdef PROT_NONE
3474 if ((x & PROT_NONE) == PROT_NONE)
3475 *r |= Mono_Posix_MmapProts_PROT_NONE;
3476 #endif /* ndef PROT_NONE */
3477 #ifdef PROT_READ
3478 if ((x & PROT_READ) == PROT_READ)
3479 *r |= Mono_Posix_MmapProts_PROT_READ;
3480 #endif /* ndef PROT_READ */
3481 #ifdef PROT_WRITE
3482 if ((x & PROT_WRITE) == PROT_WRITE)
3483 *r |= Mono_Posix_MmapProts_PROT_WRITE;
3484 #endif /* ndef PROT_WRITE */
3485 return 0;
3488 int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
3490 *r = 0;
3491 if ((x & Mono_Posix_MountFlags_ST_APPEND) == Mono_Posix_MountFlags_ST_APPEND)
3492 #ifdef ST_APPEND
3493 *r |= ST_APPEND;
3494 #else /* def ST_APPEND */
3495 {errno = EINVAL; return -1;}
3496 #endif /* ndef ST_APPEND */
3497 if ((x & Mono_Posix_MountFlags_ST_BIND) == Mono_Posix_MountFlags_ST_BIND)
3498 #ifdef ST_BIND
3499 *r |= ST_BIND;
3500 #else /* def ST_BIND */
3501 {errno = EINVAL; return -1;}
3502 #endif /* ndef ST_BIND */
3503 if ((x & Mono_Posix_MountFlags_ST_IMMUTABLE) == Mono_Posix_MountFlags_ST_IMMUTABLE)
3504 #ifdef ST_IMMUTABLE
3505 *r |= ST_IMMUTABLE;
3506 #else /* def ST_IMMUTABLE */
3507 {errno = EINVAL; return -1;}
3508 #endif /* ndef ST_IMMUTABLE */
3509 if ((x & Mono_Posix_MountFlags_ST_MANDLOCK) == Mono_Posix_MountFlags_ST_MANDLOCK)
3510 #ifdef ST_MANDLOCK
3511 *r |= ST_MANDLOCK;
3512 #else /* def ST_MANDLOCK */
3513 {errno = EINVAL; return -1;}
3514 #endif /* ndef ST_MANDLOCK */
3515 if ((x & Mono_Posix_MountFlags_ST_NOATIME) == Mono_Posix_MountFlags_ST_NOATIME)
3516 #ifdef ST_NOATIME
3517 *r |= ST_NOATIME;
3518 #else /* def ST_NOATIME */
3519 {errno = EINVAL; return -1;}
3520 #endif /* ndef ST_NOATIME */
3521 if ((x & Mono_Posix_MountFlags_ST_NODEV) == Mono_Posix_MountFlags_ST_NODEV)
3522 #ifdef ST_NODEV
3523 *r |= ST_NODEV;
3524 #else /* def ST_NODEV */
3525 {errno = EINVAL; return -1;}
3526 #endif /* ndef ST_NODEV */
3527 if ((x & Mono_Posix_MountFlags_ST_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME)
3528 #ifdef ST_NODIRATIME
3529 *r |= ST_NODIRATIME;
3530 #else /* def ST_NODIRATIME */
3531 {errno = EINVAL; return -1;}
3532 #endif /* ndef ST_NODIRATIME */
3533 if ((x & Mono_Posix_MountFlags_ST_NOEXEC) == Mono_Posix_MountFlags_ST_NOEXEC)
3534 #ifdef ST_NOEXEC
3535 *r |= ST_NOEXEC;
3536 #else /* def ST_NOEXEC */
3537 {errno = EINVAL; return -1;}
3538 #endif /* ndef ST_NOEXEC */
3539 if ((x & Mono_Posix_MountFlags_ST_NOSUID) == Mono_Posix_MountFlags_ST_NOSUID)
3540 #ifdef ST_NOSUID
3541 *r |= ST_NOSUID;
3542 #else /* def ST_NOSUID */
3543 {errno = EINVAL; return -1;}
3544 #endif /* ndef ST_NOSUID */
3545 if ((x & Mono_Posix_MountFlags_ST_RDONLY) == Mono_Posix_MountFlags_ST_RDONLY)
3546 #ifdef ST_RDONLY
3547 *r |= ST_RDONLY;
3548 #else /* def ST_RDONLY */
3549 {errno = EINVAL; return -1;}
3550 #endif /* ndef ST_RDONLY */
3551 if ((x & Mono_Posix_MountFlags_ST_REMOUNT) == Mono_Posix_MountFlags_ST_REMOUNT)
3552 #ifdef ST_REMOUNT
3553 *r |= ST_REMOUNT;
3554 #else /* def ST_REMOUNT */
3555 {errno = EINVAL; return -1;}
3556 #endif /* ndef ST_REMOUNT */
3557 if ((x & Mono_Posix_MountFlags_ST_SYNCHRONOUS) == Mono_Posix_MountFlags_ST_SYNCHRONOUS)
3558 #ifdef ST_SYNCHRONOUS
3559 *r |= ST_SYNCHRONOUS;
3560 #else /* def ST_SYNCHRONOUS */
3561 {errno = EINVAL; return -1;}
3562 #endif /* ndef ST_SYNCHRONOUS */
3563 if ((x & Mono_Posix_MountFlags_ST_WRITE) == Mono_Posix_MountFlags_ST_WRITE)
3564 #ifdef ST_WRITE
3565 *r |= ST_WRITE;
3566 #else /* def ST_WRITE */
3567 {errno = EINVAL; return -1;}
3568 #endif /* ndef ST_WRITE */
3569 if (x == 0)
3570 return 0;
3571 return 0;
3574 int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
3576 *r = 0;
3577 if (x == 0)
3578 return 0;
3579 #ifdef ST_APPEND
3580 if ((x & ST_APPEND) == ST_APPEND)
3581 *r |= Mono_Posix_MountFlags_ST_APPEND;
3582 #endif /* ndef ST_APPEND */
3583 #ifdef ST_BIND
3584 if ((x & ST_BIND) == ST_BIND)
3585 *r |= Mono_Posix_MountFlags_ST_BIND;
3586 #endif /* ndef ST_BIND */
3587 #ifdef ST_IMMUTABLE
3588 if ((x & ST_IMMUTABLE) == ST_IMMUTABLE)
3589 *r |= Mono_Posix_MountFlags_ST_IMMUTABLE;
3590 #endif /* ndef ST_IMMUTABLE */
3591 #ifdef ST_MANDLOCK
3592 if ((x & ST_MANDLOCK) == ST_MANDLOCK)
3593 *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
3594 #endif /* ndef ST_MANDLOCK */
3595 #ifdef ST_NOATIME
3596 if ((x & ST_NOATIME) == ST_NOATIME)
3597 *r |= Mono_Posix_MountFlags_ST_NOATIME;
3598 #endif /* ndef ST_NOATIME */
3599 #ifdef ST_NODEV
3600 if ((x & ST_NODEV) == ST_NODEV)
3601 *r |= Mono_Posix_MountFlags_ST_NODEV;
3602 #endif /* ndef ST_NODEV */
3603 #ifdef ST_NODIRATIME
3604 if ((x & ST_NODIRATIME) == ST_NODIRATIME)
3605 *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
3606 #endif /* ndef ST_NODIRATIME */
3607 #ifdef ST_NOEXEC
3608 if ((x & ST_NOEXEC) == ST_NOEXEC)
3609 *r |= Mono_Posix_MountFlags_ST_NOEXEC;
3610 #endif /* ndef ST_NOEXEC */
3611 #ifdef ST_NOSUID
3612 if ((x & ST_NOSUID) == ST_NOSUID)
3613 *r |= Mono_Posix_MountFlags_ST_NOSUID;
3614 #endif /* ndef ST_NOSUID */
3615 #ifdef ST_RDONLY
3616 if ((x & ST_RDONLY) == ST_RDONLY)
3617 *r |= Mono_Posix_MountFlags_ST_RDONLY;
3618 #endif /* ndef ST_RDONLY */
3619 #ifdef ST_REMOUNT
3620 if ((x & ST_REMOUNT) == ST_REMOUNT)
3621 *r |= Mono_Posix_MountFlags_ST_REMOUNT;
3622 #endif /* ndef ST_REMOUNT */
3623 #ifdef ST_SYNCHRONOUS
3624 if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
3625 *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
3626 #endif /* ndef ST_SYNCHRONOUS */
3627 #ifdef ST_WRITE
3628 if ((x & ST_WRITE) == ST_WRITE)
3629 *r |= Mono_Posix_MountFlags_ST_WRITE;
3630 #endif /* ndef ST_WRITE */
3631 return 0;
3634 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
3636 *r = 0;
3637 if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
3638 #ifdef MREMAP_MAYMOVE
3639 *r |= MREMAP_MAYMOVE;
3640 #else /* def MREMAP_MAYMOVE */
3641 {errno = EINVAL; return -1;}
3642 #endif /* ndef MREMAP_MAYMOVE */
3643 if (x == 0)
3644 return 0;
3645 return 0;
3648 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
3650 *r = 0;
3651 if (x == 0)
3652 return 0;
3653 #ifdef MREMAP_MAYMOVE
3654 if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
3655 *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
3656 #endif /* ndef MREMAP_MAYMOVE */
3657 return 0;
3660 int Mono_Posix_FromMsyncFlags (int x, int *r)
3662 *r = 0;
3663 if ((x & Mono_Posix_MsyncFlags_MS_ASYNC) == Mono_Posix_MsyncFlags_MS_ASYNC)
3664 #ifdef MS_ASYNC
3665 *r |= MS_ASYNC;
3666 #else /* def MS_ASYNC */
3667 {errno = EINVAL; return -1;}
3668 #endif /* ndef MS_ASYNC */
3669 if ((x & Mono_Posix_MsyncFlags_MS_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE)
3670 #ifdef MS_INVALIDATE
3671 *r |= MS_INVALIDATE;
3672 #else /* def MS_INVALIDATE */
3673 {errno = EINVAL; return -1;}
3674 #endif /* ndef MS_INVALIDATE */
3675 if ((x & Mono_Posix_MsyncFlags_MS_SYNC) == Mono_Posix_MsyncFlags_MS_SYNC)
3676 #ifdef MS_SYNC
3677 *r |= MS_SYNC;
3678 #else /* def MS_SYNC */
3679 {errno = EINVAL; return -1;}
3680 #endif /* ndef MS_SYNC */
3681 if (x == 0)
3682 return 0;
3683 return 0;
3686 int Mono_Posix_ToMsyncFlags (int x, int *r)
3688 *r = 0;
3689 if (x == 0)
3690 return 0;
3691 #ifdef MS_ASYNC
3692 if ((x & MS_ASYNC) == MS_ASYNC)
3693 *r |= Mono_Posix_MsyncFlags_MS_ASYNC;
3694 #endif /* ndef MS_ASYNC */
3695 #ifdef MS_INVALIDATE
3696 if ((x & MS_INVALIDATE) == MS_INVALIDATE)
3697 *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
3698 #endif /* ndef MS_INVALIDATE */
3699 #ifdef MS_SYNC
3700 if ((x & MS_SYNC) == MS_SYNC)
3701 *r |= Mono_Posix_MsyncFlags_MS_SYNC;
3702 #endif /* ndef MS_SYNC */
3703 return 0;
3706 int Mono_Posix_FromOpenFlags (int x, int *r)
3708 *r = 0;
3709 if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND)
3710 #ifdef O_APPEND
3711 *r |= O_APPEND;
3712 #else /* def O_APPEND */
3713 {errno = EINVAL; return -1;}
3714 #endif /* ndef O_APPEND */
3715 if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC)
3716 #ifdef O_ASYNC
3717 *r |= O_ASYNC;
3718 #else /* def O_ASYNC */
3719 {errno = EINVAL; return -1;}
3720 #endif /* ndef O_ASYNC */
3721 if ((x & Mono_Posix_OpenFlags_O_CLOEXEC) == Mono_Posix_OpenFlags_O_CLOEXEC)
3722 #ifdef O_CLOEXEC
3723 *r |= O_CLOEXEC;
3724 #else /* def O_CLOEXEC */
3725 {errno = EINVAL; return -1;}
3726 #endif /* ndef O_CLOEXEC */
3727 if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT)
3728 #ifdef O_CREAT
3729 *r |= O_CREAT;
3730 #else /* def O_CREAT */
3731 {errno = EINVAL; return -1;}
3732 #endif /* ndef O_CREAT */
3733 if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT)
3734 #ifdef O_DIRECT
3735 *r |= O_DIRECT;
3736 #else /* def O_DIRECT */
3737 {errno = EINVAL; return -1;}
3738 #endif /* ndef O_DIRECT */
3739 if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY)
3740 #ifdef O_DIRECTORY
3741 *r |= O_DIRECTORY;
3742 #else /* def O_DIRECTORY */
3743 {errno = EINVAL; return -1;}
3744 #endif /* ndef O_DIRECTORY */
3745 if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL)
3746 #ifdef O_EXCL
3747 *r |= O_EXCL;
3748 #else /* def O_EXCL */
3749 {errno = EINVAL; return -1;}
3750 #endif /* ndef O_EXCL */
3751 if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
3752 #ifdef O_LARGEFILE
3753 *r |= O_LARGEFILE;
3754 #else /* def O_LARGEFILE */
3755 {errno = EINVAL; return -1;}
3756 #endif /* ndef O_LARGEFILE */
3757 if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY)
3758 #ifdef O_NOCTTY
3759 *r |= O_NOCTTY;
3760 #else /* def O_NOCTTY */
3761 {errno = EINVAL; return -1;}
3762 #endif /* ndef O_NOCTTY */
3763 if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW)
3764 #ifdef O_NOFOLLOW
3765 *r |= O_NOFOLLOW;
3766 #else /* def O_NOFOLLOW */
3767 {errno = EINVAL; return -1;}
3768 #endif /* ndef O_NOFOLLOW */
3769 if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK)
3770 #ifdef O_NONBLOCK
3771 *r |= O_NONBLOCK;
3772 #else /* def O_NONBLOCK */
3773 {errno = EINVAL; return -1;}
3774 #endif /* ndef O_NONBLOCK */
3775 if ((x & Mono_Posix_OpenFlags_O_PATH) == Mono_Posix_OpenFlags_O_PATH)
3776 #ifdef O_PATH
3777 *r |= O_PATH;
3778 #else /* def O_PATH */
3779 {errno = EINVAL; return -1;}
3780 #endif /* ndef O_PATH */
3781 if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY)
3782 #ifdef O_RDONLY
3783 *r |= O_RDONLY;
3784 #else /* def O_RDONLY */
3785 {errno = EINVAL; return -1;}
3786 #endif /* ndef O_RDONLY */
3787 if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR)
3788 #ifdef O_RDWR
3789 *r |= O_RDWR;
3790 #else /* def O_RDWR */
3791 {errno = EINVAL; return -1;}
3792 #endif /* ndef O_RDWR */
3793 if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC)
3794 #ifdef O_SYNC
3795 *r |= O_SYNC;
3796 #else /* def O_SYNC */
3797 {errno = EINVAL; return -1;}
3798 #endif /* ndef O_SYNC */
3799 if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC)
3800 #ifdef O_TRUNC
3801 *r |= O_TRUNC;
3802 #else /* def O_TRUNC */
3803 {errno = EINVAL; return -1;}
3804 #endif /* ndef O_TRUNC */
3805 if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
3806 #ifdef O_WRONLY
3807 *r |= O_WRONLY;
3808 #else /* def O_WRONLY */
3809 {errno = EINVAL; return -1;}
3810 #endif /* ndef O_WRONLY */
3811 if (x == 0)
3812 return 0;
3813 return 0;
3816 int Mono_Posix_ToOpenFlags (int x, int *r)
3818 *r = 0;
3819 if (x == 0)
3820 return 0;
3821 #ifdef O_APPEND
3822 if ((x & O_APPEND) == O_APPEND)
3823 *r |= Mono_Posix_OpenFlags_O_APPEND;
3824 #endif /* ndef O_APPEND */
3825 #ifdef O_ASYNC
3826 if ((x & O_ASYNC) == O_ASYNC)
3827 *r |= Mono_Posix_OpenFlags_O_ASYNC;
3828 #endif /* ndef O_ASYNC */
3829 #ifdef O_CLOEXEC
3830 if ((x & O_CLOEXEC) == O_CLOEXEC)
3831 *r |= Mono_Posix_OpenFlags_O_CLOEXEC;
3832 #endif /* ndef O_CLOEXEC */
3833 #ifdef O_CREAT
3834 if ((x & O_CREAT) == O_CREAT)
3835 *r |= Mono_Posix_OpenFlags_O_CREAT;
3836 #endif /* ndef O_CREAT */
3837 #ifdef O_DIRECT
3838 if ((x & O_DIRECT) == O_DIRECT)
3839 *r |= Mono_Posix_OpenFlags_O_DIRECT;
3840 #endif /* ndef O_DIRECT */
3841 #ifdef O_DIRECTORY
3842 if ((x & O_DIRECTORY) == O_DIRECTORY)
3843 *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
3844 #endif /* ndef O_DIRECTORY */
3845 #ifdef O_EXCL
3846 if ((x & O_EXCL) == O_EXCL)
3847 *r |= Mono_Posix_OpenFlags_O_EXCL;
3848 #endif /* ndef O_EXCL */
3849 #ifdef O_LARGEFILE
3850 if ((x & O_LARGEFILE) == O_LARGEFILE)
3851 *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
3852 #endif /* ndef O_LARGEFILE */
3853 #ifdef O_NOCTTY
3854 if ((x & O_NOCTTY) == O_NOCTTY)
3855 *r |= Mono_Posix_OpenFlags_O_NOCTTY;
3856 #endif /* ndef O_NOCTTY */
3857 #ifdef O_NOFOLLOW
3858 if ((x & O_NOFOLLOW) == O_NOFOLLOW)
3859 *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
3860 #endif /* ndef O_NOFOLLOW */
3861 #ifdef O_NONBLOCK
3862 if ((x & O_NONBLOCK) == O_NONBLOCK)
3863 *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
3864 #endif /* ndef O_NONBLOCK */
3865 #ifdef O_PATH
3866 if ((x & O_PATH) == O_PATH)
3867 *r |= Mono_Posix_OpenFlags_O_PATH;
3868 #endif /* ndef O_PATH */
3869 #ifdef O_RDONLY
3870 if ((x & O_RDONLY) == O_RDONLY)
3871 *r |= Mono_Posix_OpenFlags_O_RDONLY;
3872 #endif /* ndef O_RDONLY */
3873 #ifdef O_RDWR
3874 if ((x & O_RDWR) == O_RDWR)
3875 *r |= Mono_Posix_OpenFlags_O_RDWR;
3876 #endif /* ndef O_RDWR */
3877 #ifdef O_SYNC
3878 if ((x & O_SYNC) == O_SYNC)
3879 *r |= Mono_Posix_OpenFlags_O_SYNC;
3880 #endif /* ndef O_SYNC */
3881 #ifdef O_TRUNC
3882 if ((x & O_TRUNC) == O_TRUNC)
3883 *r |= Mono_Posix_OpenFlags_O_TRUNC;
3884 #endif /* ndef O_TRUNC */
3885 #ifdef O_WRONLY
3886 if ((x & O_WRONLY) == O_WRONLY)
3887 *r |= Mono_Posix_OpenFlags_O_WRONLY;
3888 #endif /* ndef O_WRONLY */
3889 return 0;
3892 int Mono_Posix_FromPathconfName (int x, int *r)
3894 *r = 0;
3895 if (x == Mono_Posix_PathconfName__PC_2_SYMLINKS)
3896 #ifdef _PC_2_SYMLINKS
3897 {*r = _PC_2_SYMLINKS; return 0;}
3898 #else /* def _PC_2_SYMLINKS */
3899 {errno = EINVAL; return -1;}
3900 #endif /* ndef _PC_2_SYMLINKS */
3901 if (x == Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN)
3902 #ifdef _PC_ALLOC_SIZE_MIN
3903 {*r = _PC_ALLOC_SIZE_MIN; return 0;}
3904 #else /* def _PC_ALLOC_SIZE_MIN */
3905 {errno = EINVAL; return -1;}
3906 #endif /* ndef _PC_ALLOC_SIZE_MIN */
3907 if (x == Mono_Posix_PathconfName__PC_ASYNC_IO)
3908 #ifdef _PC_ASYNC_IO
3909 {*r = _PC_ASYNC_IO; return 0;}
3910 #else /* def _PC_ASYNC_IO */
3911 {errno = EINVAL; return -1;}
3912 #endif /* ndef _PC_ASYNC_IO */
3913 if (x == Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED)
3914 #ifdef _PC_CHOWN_RESTRICTED
3915 {*r = _PC_CHOWN_RESTRICTED; return 0;}
3916 #else /* def _PC_CHOWN_RESTRICTED */
3917 {errno = EINVAL; return -1;}
3918 #endif /* ndef _PC_CHOWN_RESTRICTED */
3919 if (x == Mono_Posix_PathconfName__PC_FILESIZEBITS)
3920 #ifdef _PC_FILESIZEBITS
3921 {*r = _PC_FILESIZEBITS; return 0;}
3922 #else /* def _PC_FILESIZEBITS */
3923 {errno = EINVAL; return -1;}
3924 #endif /* ndef _PC_FILESIZEBITS */
3925 if (x == Mono_Posix_PathconfName__PC_LINK_MAX)
3926 #ifdef _PC_LINK_MAX
3927 {*r = _PC_LINK_MAX; return 0;}
3928 #else /* def _PC_LINK_MAX */
3929 {errno = EINVAL; return -1;}
3930 #endif /* ndef _PC_LINK_MAX */
3931 if (x == Mono_Posix_PathconfName__PC_MAX_CANON)
3932 #ifdef _PC_MAX_CANON
3933 {*r = _PC_MAX_CANON; return 0;}
3934 #else /* def _PC_MAX_CANON */
3935 {errno = EINVAL; return -1;}
3936 #endif /* ndef _PC_MAX_CANON */
3937 if (x == Mono_Posix_PathconfName__PC_MAX_INPUT)
3938 #ifdef _PC_MAX_INPUT
3939 {*r = _PC_MAX_INPUT; return 0;}
3940 #else /* def _PC_MAX_INPUT */
3941 {errno = EINVAL; return -1;}
3942 #endif /* ndef _PC_MAX_INPUT */
3943 if (x == Mono_Posix_PathconfName__PC_NAME_MAX)
3944 #ifdef _PC_NAME_MAX
3945 {*r = _PC_NAME_MAX; return 0;}
3946 #else /* def _PC_NAME_MAX */
3947 {errno = EINVAL; return -1;}
3948 #endif /* ndef _PC_NAME_MAX */
3949 if (x == Mono_Posix_PathconfName__PC_NO_TRUNC)
3950 #ifdef _PC_NO_TRUNC
3951 {*r = _PC_NO_TRUNC; return 0;}
3952 #else /* def _PC_NO_TRUNC */
3953 {errno = EINVAL; return -1;}
3954 #endif /* ndef _PC_NO_TRUNC */
3955 if (x == Mono_Posix_PathconfName__PC_PATH_MAX)
3956 #ifdef _PC_PATH_MAX
3957 {*r = _PC_PATH_MAX; return 0;}
3958 #else /* def _PC_PATH_MAX */
3959 {errno = EINVAL; return -1;}
3960 #endif /* ndef _PC_PATH_MAX */
3961 if (x == Mono_Posix_PathconfName__PC_PIPE_BUF)
3962 #ifdef _PC_PIPE_BUF
3963 {*r = _PC_PIPE_BUF; return 0;}
3964 #else /* def _PC_PIPE_BUF */
3965 {errno = EINVAL; return -1;}
3966 #endif /* ndef _PC_PIPE_BUF */
3967 if (x == Mono_Posix_PathconfName__PC_PRIO_IO)
3968 #ifdef _PC_PRIO_IO
3969 {*r = _PC_PRIO_IO; return 0;}
3970 #else /* def _PC_PRIO_IO */
3971 {errno = EINVAL; return -1;}
3972 #endif /* ndef _PC_PRIO_IO */
3973 if (x == Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE)
3974 #ifdef _PC_REC_INCR_XFER_SIZE
3975 {*r = _PC_REC_INCR_XFER_SIZE; return 0;}
3976 #else /* def _PC_REC_INCR_XFER_SIZE */
3977 {errno = EINVAL; return -1;}
3978 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
3979 if (x == Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE)
3980 #ifdef _PC_REC_MAX_XFER_SIZE
3981 {*r = _PC_REC_MAX_XFER_SIZE; return 0;}
3982 #else /* def _PC_REC_MAX_XFER_SIZE */
3983 {errno = EINVAL; return -1;}
3984 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
3985 if (x == Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE)
3986 #ifdef _PC_REC_MIN_XFER_SIZE
3987 {*r = _PC_REC_MIN_XFER_SIZE; return 0;}
3988 #else /* def _PC_REC_MIN_XFER_SIZE */
3989 {errno = EINVAL; return -1;}
3990 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
3991 if (x == Mono_Posix_PathconfName__PC_REC_XFER_ALIGN)
3992 #ifdef _PC_REC_XFER_ALIGN
3993 {*r = _PC_REC_XFER_ALIGN; return 0;}
3994 #else /* def _PC_REC_XFER_ALIGN */
3995 {errno = EINVAL; return -1;}
3996 #endif /* ndef _PC_REC_XFER_ALIGN */
3997 if (x == Mono_Posix_PathconfName__PC_SOCK_MAXBUF)
3998 #ifdef _PC_SOCK_MAXBUF
3999 {*r = _PC_SOCK_MAXBUF; return 0;}
4000 #else /* def _PC_SOCK_MAXBUF */
4001 {errno = EINVAL; return -1;}
4002 #endif /* ndef _PC_SOCK_MAXBUF */
4003 if (x == Mono_Posix_PathconfName__PC_SYMLINK_MAX)
4004 #ifdef _PC_SYMLINK_MAX
4005 {*r = _PC_SYMLINK_MAX; return 0;}
4006 #else /* def _PC_SYMLINK_MAX */
4007 {errno = EINVAL; return -1;}
4008 #endif /* ndef _PC_SYMLINK_MAX */
4009 if (x == Mono_Posix_PathconfName__PC_SYNC_IO)
4010 #ifdef _PC_SYNC_IO
4011 {*r = _PC_SYNC_IO; return 0;}
4012 #else /* def _PC_SYNC_IO */
4013 {errno = EINVAL; return -1;}
4014 #endif /* ndef _PC_SYNC_IO */
4015 if (x == Mono_Posix_PathconfName__PC_VDISABLE)
4016 #ifdef _PC_VDISABLE
4017 {*r = _PC_VDISABLE; return 0;}
4018 #else /* def _PC_VDISABLE */
4019 {errno = EINVAL; return -1;}
4020 #endif /* ndef _PC_VDISABLE */
4021 if (x == 0)
4022 return 0;
4023 errno = EINVAL; return -1;
4026 int Mono_Posix_ToPathconfName (int x, int *r)
4028 *r = 0;
4029 if (x == 0)
4030 return 0;
4031 #ifdef _PC_2_SYMLINKS
4032 if (x == _PC_2_SYMLINKS)
4033 {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
4034 #endif /* ndef _PC_2_SYMLINKS */
4035 #ifdef _PC_ALLOC_SIZE_MIN
4036 if (x == _PC_ALLOC_SIZE_MIN)
4037 {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
4038 #endif /* ndef _PC_ALLOC_SIZE_MIN */
4039 #ifdef _PC_ASYNC_IO
4040 if (x == _PC_ASYNC_IO)
4041 {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
4042 #endif /* ndef _PC_ASYNC_IO */
4043 #ifdef _PC_CHOWN_RESTRICTED
4044 if (x == _PC_CHOWN_RESTRICTED)
4045 {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
4046 #endif /* ndef _PC_CHOWN_RESTRICTED */
4047 #ifdef _PC_FILESIZEBITS
4048 if (x == _PC_FILESIZEBITS)
4049 {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
4050 #endif /* ndef _PC_FILESIZEBITS */
4051 #ifdef _PC_LINK_MAX
4052 if (x == _PC_LINK_MAX)
4053 {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
4054 #endif /* ndef _PC_LINK_MAX */
4055 #ifdef _PC_MAX_CANON
4056 if (x == _PC_MAX_CANON)
4057 {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
4058 #endif /* ndef _PC_MAX_CANON */
4059 #ifdef _PC_MAX_INPUT
4060 if (x == _PC_MAX_INPUT)
4061 {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
4062 #endif /* ndef _PC_MAX_INPUT */
4063 #ifdef _PC_NAME_MAX
4064 if (x == _PC_NAME_MAX)
4065 {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
4066 #endif /* ndef _PC_NAME_MAX */
4067 #ifdef _PC_NO_TRUNC
4068 if (x == _PC_NO_TRUNC)
4069 {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
4070 #endif /* ndef _PC_NO_TRUNC */
4071 #ifdef _PC_PATH_MAX
4072 if (x == _PC_PATH_MAX)
4073 {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
4074 #endif /* ndef _PC_PATH_MAX */
4075 #ifdef _PC_PIPE_BUF
4076 if (x == _PC_PIPE_BUF)
4077 {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
4078 #endif /* ndef _PC_PIPE_BUF */
4079 #ifdef _PC_PRIO_IO
4080 if (x == _PC_PRIO_IO)
4081 {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
4082 #endif /* ndef _PC_PRIO_IO */
4083 #ifdef _PC_REC_INCR_XFER_SIZE
4084 if (x == _PC_REC_INCR_XFER_SIZE)
4085 {*r = Mono_Posix_PathconfName__PC_REC_INCR_XFER_SIZE; return 0;}
4086 #endif /* ndef _PC_REC_INCR_XFER_SIZE */
4087 #ifdef _PC_REC_MAX_XFER_SIZE
4088 if (x == _PC_REC_MAX_XFER_SIZE)
4089 {*r = Mono_Posix_PathconfName__PC_REC_MAX_XFER_SIZE; return 0;}
4090 #endif /* ndef _PC_REC_MAX_XFER_SIZE */
4091 #ifdef _PC_REC_MIN_XFER_SIZE
4092 if (x == _PC_REC_MIN_XFER_SIZE)
4093 {*r = Mono_Posix_PathconfName__PC_REC_MIN_XFER_SIZE; return 0;}
4094 #endif /* ndef _PC_REC_MIN_XFER_SIZE */
4095 #ifdef _PC_REC_XFER_ALIGN
4096 if (x == _PC_REC_XFER_ALIGN)
4097 {*r = Mono_Posix_PathconfName__PC_REC_XFER_ALIGN; return 0;}
4098 #endif /* ndef _PC_REC_XFER_ALIGN */
4099 #ifdef _PC_SOCK_MAXBUF
4100 if (x == _PC_SOCK_MAXBUF)
4101 {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
4102 #endif /* ndef _PC_SOCK_MAXBUF */
4103 #ifdef _PC_SYMLINK_MAX
4104 if (x == _PC_SYMLINK_MAX)
4105 {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
4106 #endif /* ndef _PC_SYMLINK_MAX */
4107 #ifdef _PC_SYNC_IO
4108 if (x == _PC_SYNC_IO)
4109 {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
4110 #endif /* ndef _PC_SYNC_IO */
4111 #ifdef _PC_VDISABLE
4112 if (x == _PC_VDISABLE)
4113 {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
4114 #endif /* ndef _PC_VDISABLE */
4115 errno = EINVAL; return -1;
4118 int Mono_Posix_FromPollEvents (short x, short *r)
4120 *r = 0;
4121 if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR)
4122 #ifdef POLLERR
4123 *r |= POLLERR;
4124 #else /* def POLLERR */
4125 {errno = EINVAL; return -1;}
4126 #endif /* ndef POLLERR */
4127 if ((x & Mono_Posix_PollEvents_POLLHUP) == Mono_Posix_PollEvents_POLLHUP)
4128 #ifdef POLLHUP
4129 *r |= POLLHUP;
4130 #else /* def POLLHUP */
4131 {errno = EINVAL; return -1;}
4132 #endif /* ndef POLLHUP */
4133 if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN)
4134 #ifdef POLLIN
4135 *r |= POLLIN;
4136 #else /* def POLLIN */
4137 {errno = EINVAL; return -1;}
4138 #endif /* ndef POLLIN */
4139 if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL)
4140 #ifdef POLLNVAL
4141 *r |= POLLNVAL;
4142 #else /* def POLLNVAL */
4143 {errno = EINVAL; return -1;}
4144 #endif /* ndef POLLNVAL */
4145 if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
4146 #ifdef POLLOUT
4147 *r |= POLLOUT;
4148 #else /* def POLLOUT */
4149 {errno = EINVAL; return -1;}
4150 #endif /* ndef POLLOUT */
4151 if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI)
4152 #ifdef POLLPRI
4153 *r |= POLLPRI;
4154 #else /* def POLLPRI */
4155 {errno = EINVAL; return -1;}
4156 #endif /* ndef POLLPRI */
4157 if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
4158 #ifdef POLLRDBAND
4159 *r |= POLLRDBAND;
4160 #else /* def POLLRDBAND */
4161 {errno = EINVAL; return -1;}
4162 #endif /* ndef POLLRDBAND */
4163 if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM)
4164 #ifdef POLLRDNORM
4165 *r |= POLLRDNORM;
4166 #else /* def POLLRDNORM */
4167 {errno = EINVAL; return -1;}
4168 #endif /* ndef POLLRDNORM */
4169 if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
4170 #ifdef POLLWRBAND
4171 *r |= POLLWRBAND;
4172 #else /* def POLLWRBAND */
4173 {errno = EINVAL; return -1;}
4174 #endif /* ndef POLLWRBAND */
4175 if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
4176 #ifdef POLLWRNORM
4177 *r |= POLLWRNORM;
4178 #else /* def POLLWRNORM */
4179 {errno = EINVAL; return -1;}
4180 #endif /* ndef POLLWRNORM */
4181 if (x == 0)
4182 return 0;
4183 return 0;
4186 int Mono_Posix_ToPollEvents (short x, short *r)
4188 *r = 0;
4189 if (x == 0)
4190 return 0;
4191 #ifdef POLLERR
4192 if ((x & POLLERR) == POLLERR)
4193 *r |= Mono_Posix_PollEvents_POLLERR;
4194 #endif /* ndef POLLERR */
4195 #ifdef POLLHUP
4196 if ((x & POLLHUP) == POLLHUP)
4197 *r |= Mono_Posix_PollEvents_POLLHUP;
4198 #endif /* ndef POLLHUP */
4199 #ifdef POLLIN
4200 if ((x & POLLIN) == POLLIN)
4201 *r |= Mono_Posix_PollEvents_POLLIN;
4202 #endif /* ndef POLLIN */
4203 #ifdef POLLNVAL
4204 if ((x & POLLNVAL) == POLLNVAL)
4205 *r |= Mono_Posix_PollEvents_POLLNVAL;
4206 #endif /* ndef POLLNVAL */
4207 #ifdef POLLOUT
4208 if ((x & POLLOUT) == POLLOUT)
4209 *r |= Mono_Posix_PollEvents_POLLOUT;
4210 #endif /* ndef POLLOUT */
4211 #ifdef POLLPRI
4212 if ((x & POLLPRI) == POLLPRI)
4213 *r |= Mono_Posix_PollEvents_POLLPRI;
4214 #endif /* ndef POLLPRI */
4215 #ifdef POLLRDBAND
4216 if ((x & POLLRDBAND) == POLLRDBAND)
4217 *r |= Mono_Posix_PollEvents_POLLRDBAND;
4218 #endif /* ndef POLLRDBAND */
4219 #ifdef POLLRDNORM
4220 if ((x & POLLRDNORM) == POLLRDNORM)
4221 *r |= Mono_Posix_PollEvents_POLLRDNORM;
4222 #endif /* ndef POLLRDNORM */
4223 #ifdef POLLWRBAND
4224 if ((x & POLLWRBAND) == POLLWRBAND)
4225 *r |= Mono_Posix_PollEvents_POLLWRBAND;
4226 #endif /* ndef POLLWRBAND */
4227 #ifdef POLLWRNORM
4228 if ((x & POLLWRNORM) == POLLWRNORM)
4229 *r |= Mono_Posix_PollEvents_POLLWRNORM;
4230 #endif /* ndef POLLWRNORM */
4231 return 0;
4234 #ifdef HAVE_STRUCT_POLLFD
4236 Mono_Posix_FromPollfd (struct Mono_Posix_Pollfd *from, struct pollfd *to)
4238 _cnm_return_val_if_overflow (int, from->fd, -1);
4240 memset (to, 0, sizeof(*to));
4242 to->fd = from->fd;
4243 if (Mono_Posix_FromPollEvents (from->events, &to->events) != 0) {
4244 return -1;
4246 if (Mono_Posix_FromPollEvents (from->revents, &to->revents) != 0) {
4247 return -1;
4250 return 0;
4252 #endif /* ndef HAVE_STRUCT_POLLFD */
4255 #ifdef HAVE_STRUCT_POLLFD
4257 Mono_Posix_ToPollfd (struct pollfd *from, struct Mono_Posix_Pollfd *to)
4259 _cnm_return_val_if_overflow (int, from->fd, -1);
4261 memset (to, 0, sizeof(*to));
4263 to->fd = from->fd;
4264 if (Mono_Posix_ToPollEvents (from->events, &to->events) != 0) {
4265 return -1;
4267 if (Mono_Posix_ToPollEvents (from->revents, &to->revents) != 0) {
4268 return -1;
4271 return 0;
4273 #endif /* ndef HAVE_STRUCT_POLLFD */
4276 int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
4278 *r = 0;
4279 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
4280 #ifdef POSIX_FADV_DONTNEED
4281 {*r = POSIX_FADV_DONTNEED; return 0;}
4282 #else /* def POSIX_FADV_DONTNEED */
4283 {errno = EINVAL; return -1;}
4284 #endif /* ndef POSIX_FADV_DONTNEED */
4285 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
4286 #ifdef POSIX_FADV_NOREUSE
4287 {*r = POSIX_FADV_NOREUSE; return 0;}
4288 #else /* def POSIX_FADV_NOREUSE */
4289 {errno = EINVAL; return -1;}
4290 #endif /* ndef POSIX_FADV_NOREUSE */
4291 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
4292 #ifdef POSIX_FADV_NORMAL
4293 {*r = POSIX_FADV_NORMAL; return 0;}
4294 #else /* def POSIX_FADV_NORMAL */
4295 {errno = EINVAL; return -1;}
4296 #endif /* ndef POSIX_FADV_NORMAL */
4297 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
4298 #ifdef POSIX_FADV_RANDOM
4299 {*r = POSIX_FADV_RANDOM; return 0;}
4300 #else /* def POSIX_FADV_RANDOM */
4301 {errno = EINVAL; return -1;}
4302 #endif /* ndef POSIX_FADV_RANDOM */
4303 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
4304 #ifdef POSIX_FADV_SEQUENTIAL
4305 {*r = POSIX_FADV_SEQUENTIAL; return 0;}
4306 #else /* def POSIX_FADV_SEQUENTIAL */
4307 {errno = EINVAL; return -1;}
4308 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4309 if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
4310 #ifdef POSIX_FADV_WILLNEED
4311 {*r = POSIX_FADV_WILLNEED; return 0;}
4312 #else /* def POSIX_FADV_WILLNEED */
4313 {errno = EINVAL; return -1;}
4314 #endif /* ndef POSIX_FADV_WILLNEED */
4315 if (x == 0)
4316 return 0;
4317 errno = EINVAL; return -1;
4320 int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
4322 *r = 0;
4323 if (x == 0)
4324 return 0;
4325 #ifdef POSIX_FADV_DONTNEED
4326 if (x == POSIX_FADV_DONTNEED)
4327 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
4328 #endif /* ndef POSIX_FADV_DONTNEED */
4329 #ifdef POSIX_FADV_NOREUSE
4330 if (x == POSIX_FADV_NOREUSE)
4331 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
4332 #endif /* ndef POSIX_FADV_NOREUSE */
4333 #ifdef POSIX_FADV_NORMAL
4334 if (x == POSIX_FADV_NORMAL)
4335 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
4336 #endif /* ndef POSIX_FADV_NORMAL */
4337 #ifdef POSIX_FADV_RANDOM
4338 if (x == POSIX_FADV_RANDOM)
4339 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
4340 #endif /* ndef POSIX_FADV_RANDOM */
4341 #ifdef POSIX_FADV_SEQUENTIAL
4342 if (x == POSIX_FADV_SEQUENTIAL)
4343 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
4344 #endif /* ndef POSIX_FADV_SEQUENTIAL */
4345 #ifdef POSIX_FADV_WILLNEED
4346 if (x == POSIX_FADV_WILLNEED)
4347 {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
4348 #endif /* ndef POSIX_FADV_WILLNEED */
4349 errno = EINVAL; return -1;
4352 int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
4354 *r = 0;
4355 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
4356 #ifdef POSIX_MADV_DONTNEED
4357 {*r = POSIX_MADV_DONTNEED; return 0;}
4358 #else /* def POSIX_MADV_DONTNEED */
4359 {errno = EINVAL; return -1;}
4360 #endif /* ndef POSIX_MADV_DONTNEED */
4361 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
4362 #ifdef POSIX_MADV_NORMAL
4363 {*r = POSIX_MADV_NORMAL; return 0;}
4364 #else /* def POSIX_MADV_NORMAL */
4365 {errno = EINVAL; return -1;}
4366 #endif /* ndef POSIX_MADV_NORMAL */
4367 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
4368 #ifdef POSIX_MADV_RANDOM
4369 {*r = POSIX_MADV_RANDOM; return 0;}
4370 #else /* def POSIX_MADV_RANDOM */
4371 {errno = EINVAL; return -1;}
4372 #endif /* ndef POSIX_MADV_RANDOM */
4373 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
4374 #ifdef POSIX_MADV_SEQUENTIAL
4375 {*r = POSIX_MADV_SEQUENTIAL; return 0;}
4376 #else /* def POSIX_MADV_SEQUENTIAL */
4377 {errno = EINVAL; return -1;}
4378 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4379 if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
4380 #ifdef POSIX_MADV_WILLNEED
4381 {*r = POSIX_MADV_WILLNEED; return 0;}
4382 #else /* def POSIX_MADV_WILLNEED */
4383 {errno = EINVAL; return -1;}
4384 #endif /* ndef POSIX_MADV_WILLNEED */
4385 if (x == 0)
4386 return 0;
4387 errno = EINVAL; return -1;
4390 int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
4392 *r = 0;
4393 if (x == 0)
4394 return 0;
4395 #ifdef POSIX_MADV_DONTNEED
4396 if (x == POSIX_MADV_DONTNEED)
4397 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
4398 #endif /* ndef POSIX_MADV_DONTNEED */
4399 #ifdef POSIX_MADV_NORMAL
4400 if (x == POSIX_MADV_NORMAL)
4401 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
4402 #endif /* ndef POSIX_MADV_NORMAL */
4403 #ifdef POSIX_MADV_RANDOM
4404 if (x == POSIX_MADV_RANDOM)
4405 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
4406 #endif /* ndef POSIX_MADV_RANDOM */
4407 #ifdef POSIX_MADV_SEQUENTIAL
4408 if (x == POSIX_MADV_SEQUENTIAL)
4409 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
4410 #endif /* ndef POSIX_MADV_SEQUENTIAL */
4411 #ifdef POSIX_MADV_WILLNEED
4412 if (x == POSIX_MADV_WILLNEED)
4413 {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
4414 #endif /* ndef POSIX_MADV_WILLNEED */
4415 errno = EINVAL; return -1;
4418 int Mono_Posix_FromSeekFlags (short x, short *r)
4420 *r = 0;
4421 if (x == Mono_Posix_SeekFlags_L_INCR)
4422 #ifdef L_INCR
4423 {*r = L_INCR; return 0;}
4424 #else /* def L_INCR */
4425 {errno = EINVAL; return -1;}
4426 #endif /* ndef L_INCR */
4427 if (x == Mono_Posix_SeekFlags_L_SET)
4428 #ifdef L_SET
4429 {*r = L_SET; return 0;}
4430 #else /* def L_SET */
4431 {errno = EINVAL; return -1;}
4432 #endif /* ndef L_SET */
4433 if (x == Mono_Posix_SeekFlags_L_XTND)
4434 #ifdef L_XTND
4435 {*r = L_XTND; return 0;}
4436 #else /* def L_XTND */
4437 {errno = EINVAL; return -1;}
4438 #endif /* ndef L_XTND */
4439 if (x == Mono_Posix_SeekFlags_SEEK_CUR)
4440 #ifdef SEEK_CUR
4441 {*r = SEEK_CUR; return 0;}
4442 #else /* def SEEK_CUR */
4443 {errno = EINVAL; return -1;}
4444 #endif /* ndef SEEK_CUR */
4445 if (x == Mono_Posix_SeekFlags_SEEK_END)
4446 #ifdef SEEK_END
4447 {*r = SEEK_END; return 0;}
4448 #else /* def SEEK_END */
4449 {errno = EINVAL; return -1;}
4450 #endif /* ndef SEEK_END */
4451 if (x == Mono_Posix_SeekFlags_SEEK_SET)
4452 #ifdef SEEK_SET
4453 {*r = SEEK_SET; return 0;}
4454 #else /* def SEEK_SET */
4455 {errno = EINVAL; return -1;}
4456 #endif /* ndef SEEK_SET */
4457 if (x == 0)
4458 return 0;
4459 errno = EINVAL; return -1;
4462 int Mono_Posix_ToSeekFlags (short x, short *r)
4464 *r = 0;
4465 if (x == 0)
4466 return 0;
4467 #ifdef L_INCR
4468 if (x == L_INCR)
4469 {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
4470 #endif /* ndef L_INCR */
4471 #ifdef L_SET
4472 if (x == L_SET)
4473 {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
4474 #endif /* ndef L_SET */
4475 #ifdef L_XTND
4476 if (x == L_XTND)
4477 {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
4478 #endif /* ndef L_XTND */
4479 #ifdef SEEK_CUR
4480 if (x == SEEK_CUR)
4481 {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
4482 #endif /* ndef SEEK_CUR */
4483 #ifdef SEEK_END
4484 if (x == SEEK_END)
4485 {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
4486 #endif /* ndef SEEK_END */
4487 #ifdef SEEK_SET
4488 if (x == SEEK_SET)
4489 {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
4490 #endif /* ndef SEEK_SET */
4491 errno = EINVAL; return -1;
4494 int Mono_Posix_FromSignum (int x, int *r)
4496 *r = 0;
4497 if (x == Mono_Posix_Signum_SIGABRT)
4498 #ifdef SIGABRT
4499 {*r = SIGABRT; return 0;}
4500 #else /* def SIGABRT */
4501 {errno = EINVAL; return -1;}
4502 #endif /* ndef SIGABRT */
4503 if (x == Mono_Posix_Signum_SIGALRM)
4504 #ifdef SIGALRM
4505 {*r = SIGALRM; return 0;}
4506 #else /* def SIGALRM */
4507 {errno = EINVAL; return -1;}
4508 #endif /* ndef SIGALRM */
4509 if (x == Mono_Posix_Signum_SIGBUS)
4510 #ifdef SIGBUS
4511 {*r = SIGBUS; return 0;}
4512 #else /* def SIGBUS */
4513 {errno = EINVAL; return -1;}
4514 #endif /* ndef SIGBUS */
4515 if (x == Mono_Posix_Signum_SIGCHLD)
4516 #ifdef SIGCHLD
4517 {*r = SIGCHLD; return 0;}
4518 #else /* def SIGCHLD */
4519 {errno = EINVAL; return -1;}
4520 #endif /* ndef SIGCHLD */
4521 if (x == Mono_Posix_Signum_SIGCLD)
4522 #ifdef SIGCLD
4523 {*r = SIGCLD; return 0;}
4524 #else /* def SIGCLD */
4525 {errno = EINVAL; return -1;}
4526 #endif /* ndef SIGCLD */
4527 if (x == Mono_Posix_Signum_SIGCONT)
4528 #ifdef SIGCONT
4529 {*r = SIGCONT; return 0;}
4530 #else /* def SIGCONT */
4531 {errno = EINVAL; return -1;}
4532 #endif /* ndef SIGCONT */
4533 if (x == Mono_Posix_Signum_SIGFPE)
4534 #ifdef SIGFPE
4535 {*r = SIGFPE; return 0;}
4536 #else /* def SIGFPE */
4537 {errno = EINVAL; return -1;}
4538 #endif /* ndef SIGFPE */
4539 if (x == Mono_Posix_Signum_SIGHUP)
4540 #ifdef SIGHUP
4541 {*r = SIGHUP; return 0;}
4542 #else /* def SIGHUP */
4543 {errno = EINVAL; return -1;}
4544 #endif /* ndef SIGHUP */
4545 if (x == Mono_Posix_Signum_SIGILL)
4546 #ifdef SIGILL
4547 {*r = SIGILL; return 0;}
4548 #else /* def SIGILL */
4549 {errno = EINVAL; return -1;}
4550 #endif /* ndef SIGILL */
4551 if (x == Mono_Posix_Signum_SIGINT)
4552 #ifdef SIGINT
4553 {*r = SIGINT; return 0;}
4554 #else /* def SIGINT */
4555 {errno = EINVAL; return -1;}
4556 #endif /* ndef SIGINT */
4557 if (x == Mono_Posix_Signum_SIGIO)
4558 #ifdef SIGIO
4559 {*r = SIGIO; return 0;}
4560 #else /* def SIGIO */
4561 {errno = EINVAL; return -1;}
4562 #endif /* ndef SIGIO */
4563 if (x == Mono_Posix_Signum_SIGIOT)
4564 #ifdef SIGIOT
4565 {*r = SIGIOT; return 0;}
4566 #else /* def SIGIOT */
4567 {errno = EINVAL; return -1;}
4568 #endif /* ndef SIGIOT */
4569 if (x == Mono_Posix_Signum_SIGKILL)
4570 #ifdef SIGKILL
4571 {*r = SIGKILL; return 0;}
4572 #else /* def SIGKILL */
4573 {errno = EINVAL; return -1;}
4574 #endif /* ndef SIGKILL */
4575 if (x == Mono_Posix_Signum_SIGPIPE)
4576 #ifdef SIGPIPE
4577 {*r = SIGPIPE; return 0;}
4578 #else /* def SIGPIPE */
4579 {errno = EINVAL; return -1;}
4580 #endif /* ndef SIGPIPE */
4581 if (x == Mono_Posix_Signum_SIGPOLL)
4582 #ifdef SIGPOLL
4583 {*r = SIGPOLL; return 0;}
4584 #else /* def SIGPOLL */
4585 {errno = EINVAL; return -1;}
4586 #endif /* ndef SIGPOLL */
4587 if (x == Mono_Posix_Signum_SIGPROF)
4588 #ifdef SIGPROF
4589 {*r = SIGPROF; return 0;}
4590 #else /* def SIGPROF */
4591 {errno = EINVAL; return -1;}
4592 #endif /* ndef SIGPROF */
4593 if (x == Mono_Posix_Signum_SIGPWR)
4594 #ifdef SIGPWR
4595 {*r = SIGPWR; return 0;}
4596 #else /* def SIGPWR */
4597 {errno = EINVAL; return -1;}
4598 #endif /* ndef SIGPWR */
4599 if (x == Mono_Posix_Signum_SIGQUIT)
4600 #ifdef SIGQUIT
4601 {*r = SIGQUIT; return 0;}
4602 #else /* def SIGQUIT */
4603 {errno = EINVAL; return -1;}
4604 #endif /* ndef SIGQUIT */
4605 if (x == Mono_Posix_Signum_SIGSEGV)
4606 #ifdef SIGSEGV
4607 {*r = SIGSEGV; return 0;}
4608 #else /* def SIGSEGV */
4609 {errno = EINVAL; return -1;}
4610 #endif /* ndef SIGSEGV */
4611 if (x == Mono_Posix_Signum_SIGSTKFLT)
4612 #ifdef SIGSTKFLT
4613 {*r = SIGSTKFLT; return 0;}
4614 #else /* def SIGSTKFLT */
4615 {errno = EINVAL; return -1;}
4616 #endif /* ndef SIGSTKFLT */
4617 if (x == Mono_Posix_Signum_SIGSTOP)
4618 #ifdef SIGSTOP
4619 {*r = SIGSTOP; return 0;}
4620 #else /* def SIGSTOP */
4621 {errno = EINVAL; return -1;}
4622 #endif /* ndef SIGSTOP */
4623 if (x == Mono_Posix_Signum_SIGSYS)
4624 #ifdef SIGSYS
4625 {*r = SIGSYS; return 0;}
4626 #else /* def SIGSYS */
4627 {errno = EINVAL; return -1;}
4628 #endif /* ndef SIGSYS */
4629 if (x == Mono_Posix_Signum_SIGTERM)
4630 #ifdef SIGTERM
4631 {*r = SIGTERM; return 0;}
4632 #else /* def SIGTERM */
4633 {errno = EINVAL; return -1;}
4634 #endif /* ndef SIGTERM */
4635 if (x == Mono_Posix_Signum_SIGTRAP)
4636 #ifdef SIGTRAP
4637 {*r = SIGTRAP; return 0;}
4638 #else /* def SIGTRAP */
4639 {errno = EINVAL; return -1;}
4640 #endif /* ndef SIGTRAP */
4641 if (x == Mono_Posix_Signum_SIGTSTP)
4642 #ifdef SIGTSTP
4643 {*r = SIGTSTP; return 0;}
4644 #else /* def SIGTSTP */
4645 {errno = EINVAL; return -1;}
4646 #endif /* ndef SIGTSTP */
4647 if (x == Mono_Posix_Signum_SIGTTIN)
4648 #ifdef SIGTTIN
4649 {*r = SIGTTIN; return 0;}
4650 #else /* def SIGTTIN */
4651 {errno = EINVAL; return -1;}
4652 #endif /* ndef SIGTTIN */
4653 if (x == Mono_Posix_Signum_SIGTTOU)
4654 #ifdef SIGTTOU
4655 {*r = SIGTTOU; return 0;}
4656 #else /* def SIGTTOU */
4657 {errno = EINVAL; return -1;}
4658 #endif /* ndef SIGTTOU */
4659 if (x == Mono_Posix_Signum_SIGUNUSED)
4660 #ifdef SIGUNUSED
4661 {*r = SIGUNUSED; return 0;}
4662 #else /* def SIGUNUSED */
4663 {errno = EINVAL; return -1;}
4664 #endif /* ndef SIGUNUSED */
4665 if (x == Mono_Posix_Signum_SIGURG)
4666 #ifdef SIGURG
4667 {*r = SIGURG; return 0;}
4668 #else /* def SIGURG */
4669 {errno = EINVAL; return -1;}
4670 #endif /* ndef SIGURG */
4671 if (x == Mono_Posix_Signum_SIGUSR1)
4672 #ifdef SIGUSR1
4673 {*r = SIGUSR1; return 0;}
4674 #else /* def SIGUSR1 */
4675 {errno = EINVAL; return -1;}
4676 #endif /* ndef SIGUSR1 */
4677 if (x == Mono_Posix_Signum_SIGUSR2)
4678 #ifdef SIGUSR2
4679 {*r = SIGUSR2; return 0;}
4680 #else /* def SIGUSR2 */
4681 {errno = EINVAL; return -1;}
4682 #endif /* ndef SIGUSR2 */
4683 if (x == Mono_Posix_Signum_SIGVTALRM)
4684 #ifdef SIGVTALRM
4685 {*r = SIGVTALRM; return 0;}
4686 #else /* def SIGVTALRM */
4687 {errno = EINVAL; return -1;}
4688 #endif /* ndef SIGVTALRM */
4689 if (x == Mono_Posix_Signum_SIGWINCH)
4690 #ifdef SIGWINCH
4691 {*r = SIGWINCH; return 0;}
4692 #else /* def SIGWINCH */
4693 {errno = EINVAL; return -1;}
4694 #endif /* ndef SIGWINCH */
4695 if (x == Mono_Posix_Signum_SIGXCPU)
4696 #ifdef SIGXCPU
4697 {*r = SIGXCPU; return 0;}
4698 #else /* def SIGXCPU */
4699 {errno = EINVAL; return -1;}
4700 #endif /* ndef SIGXCPU */
4701 if (x == Mono_Posix_Signum_SIGXFSZ)
4702 #ifdef SIGXFSZ
4703 {*r = SIGXFSZ; return 0;}
4704 #else /* def SIGXFSZ */
4705 {errno = EINVAL; return -1;}
4706 #endif /* ndef SIGXFSZ */
4707 if (x == 0)
4708 return 0;
4709 errno = EINVAL; return -1;
4712 int Mono_Posix_ToSignum (int x, int *r)
4714 *r = 0;
4715 if (x == 0)
4716 return 0;
4717 #ifdef SIGABRT
4718 if (x == SIGABRT)
4719 {*r = Mono_Posix_Signum_SIGABRT; return 0;}
4720 #endif /* ndef SIGABRT */
4721 #ifdef SIGALRM
4722 if (x == SIGALRM)
4723 {*r = Mono_Posix_Signum_SIGALRM; return 0;}
4724 #endif /* ndef SIGALRM */
4725 #ifdef SIGBUS
4726 if (x == SIGBUS)
4727 {*r = Mono_Posix_Signum_SIGBUS; return 0;}
4728 #endif /* ndef SIGBUS */
4729 #ifdef SIGCHLD
4730 if (x == SIGCHLD)
4731 {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
4732 #endif /* ndef SIGCHLD */
4733 #ifdef SIGCLD
4734 if (x == SIGCLD)
4735 {*r = Mono_Posix_Signum_SIGCLD; return 0;}
4736 #endif /* ndef SIGCLD */
4737 #ifdef SIGCONT
4738 if (x == SIGCONT)
4739 {*r = Mono_Posix_Signum_SIGCONT; return 0;}
4740 #endif /* ndef SIGCONT */
4741 #ifdef SIGFPE
4742 if (x == SIGFPE)
4743 {*r = Mono_Posix_Signum_SIGFPE; return 0;}
4744 #endif /* ndef SIGFPE */
4745 #ifdef SIGHUP
4746 if (x == SIGHUP)
4747 {*r = Mono_Posix_Signum_SIGHUP; return 0;}
4748 #endif /* ndef SIGHUP */
4749 #ifdef SIGILL
4750 if (x == SIGILL)
4751 {*r = Mono_Posix_Signum_SIGILL; return 0;}
4752 #endif /* ndef SIGILL */
4753 #ifdef SIGINT
4754 if (x == SIGINT)
4755 {*r = Mono_Posix_Signum_SIGINT; return 0;}
4756 #endif /* ndef SIGINT */
4757 #ifdef SIGIO
4758 if (x == SIGIO)
4759 {*r = Mono_Posix_Signum_SIGIO; return 0;}
4760 #endif /* ndef SIGIO */
4761 #ifdef SIGIOT
4762 if (x == SIGIOT)
4763 {*r = Mono_Posix_Signum_SIGIOT; return 0;}
4764 #endif /* ndef SIGIOT */
4765 #ifdef SIGKILL
4766 if (x == SIGKILL)
4767 {*r = Mono_Posix_Signum_SIGKILL; return 0;}
4768 #endif /* ndef SIGKILL */
4769 #ifdef SIGPIPE
4770 if (x == SIGPIPE)
4771 {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
4772 #endif /* ndef SIGPIPE */
4773 #ifdef SIGPOLL
4774 if (x == SIGPOLL)
4775 {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
4776 #endif /* ndef SIGPOLL */
4777 #ifdef SIGPROF
4778 if (x == SIGPROF)
4779 {*r = Mono_Posix_Signum_SIGPROF; return 0;}
4780 #endif /* ndef SIGPROF */
4781 #ifdef SIGPWR
4782 if (x == SIGPWR)
4783 {*r = Mono_Posix_Signum_SIGPWR; return 0;}
4784 #endif /* ndef SIGPWR */
4785 #ifdef SIGQUIT
4786 if (x == SIGQUIT)
4787 {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
4788 #endif /* ndef SIGQUIT */
4789 #ifdef SIGSEGV
4790 if (x == SIGSEGV)
4791 {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
4792 #endif /* ndef SIGSEGV */
4793 #ifdef SIGSTKFLT
4794 if (x == SIGSTKFLT)
4795 {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
4796 #endif /* ndef SIGSTKFLT */
4797 #ifdef SIGSTOP
4798 if (x == SIGSTOP)
4799 {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
4800 #endif /* ndef SIGSTOP */
4801 #ifdef SIGSYS
4802 if (x == SIGSYS)
4803 {*r = Mono_Posix_Signum_SIGSYS; return 0;}
4804 #endif /* ndef SIGSYS */
4805 #ifdef SIGTERM
4806 if (x == SIGTERM)
4807 {*r = Mono_Posix_Signum_SIGTERM; return 0;}
4808 #endif /* ndef SIGTERM */
4809 #ifdef SIGTRAP
4810 if (x == SIGTRAP)
4811 {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
4812 #endif /* ndef SIGTRAP */
4813 #ifdef SIGTSTP
4814 if (x == SIGTSTP)
4815 {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
4816 #endif /* ndef SIGTSTP */
4817 #ifdef SIGTTIN
4818 if (x == SIGTTIN)
4819 {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
4820 #endif /* ndef SIGTTIN */
4821 #ifdef SIGTTOU
4822 if (x == SIGTTOU)
4823 {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
4824 #endif /* ndef SIGTTOU */
4825 #ifdef SIGUNUSED
4826 if (x == SIGUNUSED)
4827 {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
4828 #endif /* ndef SIGUNUSED */
4829 #ifdef SIGURG
4830 if (x == SIGURG)
4831 {*r = Mono_Posix_Signum_SIGURG; return 0;}
4832 #endif /* ndef SIGURG */
4833 #ifdef SIGUSR1
4834 if (x == SIGUSR1)
4835 {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
4836 #endif /* ndef SIGUSR1 */
4837 #ifdef SIGUSR2
4838 if (x == SIGUSR2)
4839 {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
4840 #endif /* ndef SIGUSR2 */
4841 #ifdef SIGVTALRM
4842 if (x == SIGVTALRM)
4843 {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
4844 #endif /* ndef SIGVTALRM */
4845 #ifdef SIGWINCH
4846 if (x == SIGWINCH)
4847 {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
4848 #endif /* ndef SIGWINCH */
4849 #ifdef SIGXCPU
4850 if (x == SIGXCPU)
4851 {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
4852 #endif /* ndef SIGXCPU */
4853 #ifdef SIGXFSZ
4854 if (x == SIGXFSZ)
4855 {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
4856 #endif /* ndef SIGXFSZ */
4857 errno = EINVAL; return -1;
4860 int Mono_Posix_FromSysconfName (int x, int *r)
4862 *r = 0;
4863 if (x == Mono_Posix_SysconfName__SC_2_CHAR_TERM)
4864 #ifdef _SC_2_CHAR_TERM
4865 {*r = _SC_2_CHAR_TERM; return 0;}
4866 #else /* def _SC_2_CHAR_TERM */
4867 {errno = EINVAL; return -1;}
4868 #endif /* ndef _SC_2_CHAR_TERM */
4869 if (x == Mono_Posix_SysconfName__SC_2_C_BIND)
4870 #ifdef _SC_2_C_BIND
4871 {*r = _SC_2_C_BIND; return 0;}
4872 #else /* def _SC_2_C_BIND */
4873 {errno = EINVAL; return -1;}
4874 #endif /* ndef _SC_2_C_BIND */
4875 if (x == Mono_Posix_SysconfName__SC_2_C_DEV)
4876 #ifdef _SC_2_C_DEV
4877 {*r = _SC_2_C_DEV; return 0;}
4878 #else /* def _SC_2_C_DEV */
4879 {errno = EINVAL; return -1;}
4880 #endif /* ndef _SC_2_C_DEV */
4881 if (x == Mono_Posix_SysconfName__SC_2_C_VERSION)
4882 #ifdef _SC_2_C_VERSION
4883 {*r = _SC_2_C_VERSION; return 0;}
4884 #else /* def _SC_2_C_VERSION */
4885 {errno = EINVAL; return -1;}
4886 #endif /* ndef _SC_2_C_VERSION */
4887 if (x == Mono_Posix_SysconfName__SC_2_FORT_DEV)
4888 #ifdef _SC_2_FORT_DEV
4889 {*r = _SC_2_FORT_DEV; return 0;}
4890 #else /* def _SC_2_FORT_DEV */
4891 {errno = EINVAL; return -1;}
4892 #endif /* ndef _SC_2_FORT_DEV */
4893 if (x == Mono_Posix_SysconfName__SC_2_FORT_RUN)
4894 #ifdef _SC_2_FORT_RUN
4895 {*r = _SC_2_FORT_RUN; return 0;}
4896 #else /* def _SC_2_FORT_RUN */
4897 {errno = EINVAL; return -1;}
4898 #endif /* ndef _SC_2_FORT_RUN */
4899 if (x == Mono_Posix_SysconfName__SC_2_LOCALEDEF)
4900 #ifdef _SC_2_LOCALEDEF
4901 {*r = _SC_2_LOCALEDEF; return 0;}
4902 #else /* def _SC_2_LOCALEDEF */
4903 {errno = EINVAL; return -1;}
4904 #endif /* ndef _SC_2_LOCALEDEF */
4905 if (x == Mono_Posix_SysconfName__SC_2_PBS)
4906 #ifdef _SC_2_PBS
4907 {*r = _SC_2_PBS; return 0;}
4908 #else /* def _SC_2_PBS */
4909 {errno = EINVAL; return -1;}
4910 #endif /* ndef _SC_2_PBS */
4911 if (x == Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING)
4912 #ifdef _SC_2_PBS_ACCOUNTING
4913 {*r = _SC_2_PBS_ACCOUNTING; return 0;}
4914 #else /* def _SC_2_PBS_ACCOUNTING */
4915 {errno = EINVAL; return -1;}
4916 #endif /* ndef _SC_2_PBS_ACCOUNTING */
4917 if (x == Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT)
4918 #ifdef _SC_2_PBS_CHECKPOINT
4919 {*r = _SC_2_PBS_CHECKPOINT; return 0;}
4920 #else /* def _SC_2_PBS_CHECKPOINT */
4921 {errno = EINVAL; return -1;}
4922 #endif /* ndef _SC_2_PBS_CHECKPOINT */
4923 if (x == Mono_Posix_SysconfName__SC_2_PBS_LOCATE)
4924 #ifdef _SC_2_PBS_LOCATE
4925 {*r = _SC_2_PBS_LOCATE; return 0;}
4926 #else /* def _SC_2_PBS_LOCATE */
4927 {errno = EINVAL; return -1;}
4928 #endif /* ndef _SC_2_PBS_LOCATE */
4929 if (x == Mono_Posix_SysconfName__SC_2_PBS_MESSAGE)
4930 #ifdef _SC_2_PBS_MESSAGE
4931 {*r = _SC_2_PBS_MESSAGE; return 0;}
4932 #else /* def _SC_2_PBS_MESSAGE */
4933 {errno = EINVAL; return -1;}
4934 #endif /* ndef _SC_2_PBS_MESSAGE */
4935 if (x == Mono_Posix_SysconfName__SC_2_PBS_TRACK)
4936 #ifdef _SC_2_PBS_TRACK
4937 {*r = _SC_2_PBS_TRACK; return 0;}
4938 #else /* def _SC_2_PBS_TRACK */
4939 {errno = EINVAL; return -1;}
4940 #endif /* ndef _SC_2_PBS_TRACK */
4941 if (x == Mono_Posix_SysconfName__SC_2_SW_DEV)
4942 #ifdef _SC_2_SW_DEV
4943 {*r = _SC_2_SW_DEV; return 0;}
4944 #else /* def _SC_2_SW_DEV */
4945 {errno = EINVAL; return -1;}
4946 #endif /* ndef _SC_2_SW_DEV */
4947 if (x == Mono_Posix_SysconfName__SC_2_UPE)
4948 #ifdef _SC_2_UPE
4949 {*r = _SC_2_UPE; return 0;}
4950 #else /* def _SC_2_UPE */
4951 {errno = EINVAL; return -1;}
4952 #endif /* ndef _SC_2_UPE */
4953 if (x == Mono_Posix_SysconfName__SC_2_VERSION)
4954 #ifdef _SC_2_VERSION
4955 {*r = _SC_2_VERSION; return 0;}
4956 #else /* def _SC_2_VERSION */
4957 {errno = EINVAL; return -1;}
4958 #endif /* ndef _SC_2_VERSION */
4959 if (x == Mono_Posix_SysconfName__SC_ADVISORY_INFO)
4960 #ifdef _SC_ADVISORY_INFO
4961 {*r = _SC_ADVISORY_INFO; return 0;}
4962 #else /* def _SC_ADVISORY_INFO */
4963 {errno = EINVAL; return -1;}
4964 #endif /* ndef _SC_ADVISORY_INFO */
4965 if (x == Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX)
4966 #ifdef _SC_AIO_LISTIO_MAX
4967 {*r = _SC_AIO_LISTIO_MAX; return 0;}
4968 #else /* def _SC_AIO_LISTIO_MAX */
4969 {errno = EINVAL; return -1;}
4970 #endif /* ndef _SC_AIO_LISTIO_MAX */
4971 if (x == Mono_Posix_SysconfName__SC_AIO_MAX)
4972 #ifdef _SC_AIO_MAX
4973 {*r = _SC_AIO_MAX; return 0;}
4974 #else /* def _SC_AIO_MAX */
4975 {errno = EINVAL; return -1;}
4976 #endif /* ndef _SC_AIO_MAX */
4977 if (x == Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX)
4978 #ifdef _SC_AIO_PRIO_DELTA_MAX
4979 {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
4980 #else /* def _SC_AIO_PRIO_DELTA_MAX */
4981 {errno = EINVAL; return -1;}
4982 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
4983 if (x == Mono_Posix_SysconfName__SC_ARG_MAX)
4984 #ifdef _SC_ARG_MAX
4985 {*r = _SC_ARG_MAX; return 0;}
4986 #else /* def _SC_ARG_MAX */
4987 {errno = EINVAL; return -1;}
4988 #endif /* ndef _SC_ARG_MAX */
4989 if (x == Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO)
4990 #ifdef _SC_ASYNCHRONOUS_IO
4991 {*r = _SC_ASYNCHRONOUS_IO; return 0;}
4992 #else /* def _SC_ASYNCHRONOUS_IO */
4993 {errno = EINVAL; return -1;}
4994 #endif /* ndef _SC_ASYNCHRONOUS_IO */
4995 if (x == Mono_Posix_SysconfName__SC_ATEXIT_MAX)
4996 #ifdef _SC_ATEXIT_MAX
4997 {*r = _SC_ATEXIT_MAX; return 0;}
4998 #else /* def _SC_ATEXIT_MAX */
4999 {errno = EINVAL; return -1;}
5000 #endif /* ndef _SC_ATEXIT_MAX */
5001 if (x == Mono_Posix_SysconfName__SC_AVPHYS_PAGES)
5002 #ifdef _SC_AVPHYS_PAGES
5003 {*r = _SC_AVPHYS_PAGES; return 0;}
5004 #else /* def _SC_AVPHYS_PAGES */
5005 {errno = EINVAL; return -1;}
5006 #endif /* ndef _SC_AVPHYS_PAGES */
5007 if (x == Mono_Posix_SysconfName__SC_BARRIERS)
5008 #ifdef _SC_BARRIERS
5009 {*r = _SC_BARRIERS; return 0;}
5010 #else /* def _SC_BARRIERS */
5011 {errno = EINVAL; return -1;}
5012 #endif /* ndef _SC_BARRIERS */
5013 if (x == Mono_Posix_SysconfName__SC_BASE)
5014 #ifdef _SC_BASE
5015 {*r = _SC_BASE; return 0;}
5016 #else /* def _SC_BASE */
5017 {errno = EINVAL; return -1;}
5018 #endif /* ndef _SC_BASE */
5019 if (x == Mono_Posix_SysconfName__SC_BC_BASE_MAX)
5020 #ifdef _SC_BC_BASE_MAX
5021 {*r = _SC_BC_BASE_MAX; return 0;}
5022 #else /* def _SC_BC_BASE_MAX */
5023 {errno = EINVAL; return -1;}
5024 #endif /* ndef _SC_BC_BASE_MAX */
5025 if (x == Mono_Posix_SysconfName__SC_BC_DIM_MAX)
5026 #ifdef _SC_BC_DIM_MAX
5027 {*r = _SC_BC_DIM_MAX; return 0;}
5028 #else /* def _SC_BC_DIM_MAX */
5029 {errno = EINVAL; return -1;}
5030 #endif /* ndef _SC_BC_DIM_MAX */
5031 if (x == Mono_Posix_SysconfName__SC_BC_SCALE_MAX)
5032 #ifdef _SC_BC_SCALE_MAX
5033 {*r = _SC_BC_SCALE_MAX; return 0;}
5034 #else /* def _SC_BC_SCALE_MAX */
5035 {errno = EINVAL; return -1;}
5036 #endif /* ndef _SC_BC_SCALE_MAX */
5037 if (x == Mono_Posix_SysconfName__SC_BC_STRING_MAX)
5038 #ifdef _SC_BC_STRING_MAX
5039 {*r = _SC_BC_STRING_MAX; return 0;}
5040 #else /* def _SC_BC_STRING_MAX */
5041 {errno = EINVAL; return -1;}
5042 #endif /* ndef _SC_BC_STRING_MAX */
5043 if (x == Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX)
5044 #ifdef _SC_CHARCLASS_NAME_MAX
5045 {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
5046 #else /* def _SC_CHARCLASS_NAME_MAX */
5047 {errno = EINVAL; return -1;}
5048 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
5049 if (x == Mono_Posix_SysconfName__SC_CHAR_BIT)
5050 #ifdef _SC_CHAR_BIT
5051 {*r = _SC_CHAR_BIT; return 0;}
5052 #else /* def _SC_CHAR_BIT */
5053 {errno = EINVAL; return -1;}
5054 #endif /* ndef _SC_CHAR_BIT */
5055 if (x == Mono_Posix_SysconfName__SC_CHAR_MAX)
5056 #ifdef _SC_CHAR_MAX
5057 {*r = _SC_CHAR_MAX; return 0;}
5058 #else /* def _SC_CHAR_MAX */
5059 {errno = EINVAL; return -1;}
5060 #endif /* ndef _SC_CHAR_MAX */
5061 if (x == Mono_Posix_SysconfName__SC_CHAR_MIN)
5062 #ifdef _SC_CHAR_MIN
5063 {*r = _SC_CHAR_MIN; return 0;}
5064 #else /* def _SC_CHAR_MIN */
5065 {errno = EINVAL; return -1;}
5066 #endif /* ndef _SC_CHAR_MIN */
5067 if (x == Mono_Posix_SysconfName__SC_CHILD_MAX)
5068 #ifdef _SC_CHILD_MAX
5069 {*r = _SC_CHILD_MAX; return 0;}
5070 #else /* def _SC_CHILD_MAX */
5071 {errno = EINVAL; return -1;}
5072 #endif /* ndef _SC_CHILD_MAX */
5073 if (x == Mono_Posix_SysconfName__SC_CLK_TCK)
5074 #ifdef _SC_CLK_TCK
5075 {*r = _SC_CLK_TCK; return 0;}
5076 #else /* def _SC_CLK_TCK */
5077 {errno = EINVAL; return -1;}
5078 #endif /* ndef _SC_CLK_TCK */
5079 if (x == Mono_Posix_SysconfName__SC_CLOCK_SELECTION)
5080 #ifdef _SC_CLOCK_SELECTION
5081 {*r = _SC_CLOCK_SELECTION; return 0;}
5082 #else /* def _SC_CLOCK_SELECTION */
5083 {errno = EINVAL; return -1;}
5084 #endif /* ndef _SC_CLOCK_SELECTION */
5085 if (x == Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX)
5086 #ifdef _SC_COLL_WEIGHTS_MAX
5087 {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
5088 #else /* def _SC_COLL_WEIGHTS_MAX */
5089 {errno = EINVAL; return -1;}
5090 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
5091 if (x == Mono_Posix_SysconfName__SC_CPUTIME)
5092 #ifdef _SC_CPUTIME
5093 {*r = _SC_CPUTIME; return 0;}
5094 #else /* def _SC_CPUTIME */
5095 {errno = EINVAL; return -1;}
5096 #endif /* ndef _SC_CPUTIME */
5097 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT)
5098 #ifdef _SC_C_LANG_SUPPORT
5099 {*r = _SC_C_LANG_SUPPORT; return 0;}
5100 #else /* def _SC_C_LANG_SUPPORT */
5101 {errno = EINVAL; return -1;}
5102 #endif /* ndef _SC_C_LANG_SUPPORT */
5103 if (x == Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R)
5104 #ifdef _SC_C_LANG_SUPPORT_R
5105 {*r = _SC_C_LANG_SUPPORT_R; return 0;}
5106 #else /* def _SC_C_LANG_SUPPORT_R */
5107 {errno = EINVAL; return -1;}
5108 #endif /* ndef _SC_C_LANG_SUPPORT_R */
5109 if (x == Mono_Posix_SysconfName__SC_DELAYTIMER_MAX)
5110 #ifdef _SC_DELAYTIMER_MAX
5111 {*r = _SC_DELAYTIMER_MAX; return 0;}
5112 #else /* def _SC_DELAYTIMER_MAX */
5113 {errno = EINVAL; return -1;}
5114 #endif /* ndef _SC_DELAYTIMER_MAX */
5115 if (x == Mono_Posix_SysconfName__SC_DEVICE_IO)
5116 #ifdef _SC_DEVICE_IO
5117 {*r = _SC_DEVICE_IO; return 0;}
5118 #else /* def _SC_DEVICE_IO */
5119 {errno = EINVAL; return -1;}
5120 #endif /* ndef _SC_DEVICE_IO */
5121 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC)
5122 #ifdef _SC_DEVICE_SPECIFIC
5123 {*r = _SC_DEVICE_SPECIFIC; return 0;}
5124 #else /* def _SC_DEVICE_SPECIFIC */
5125 {errno = EINVAL; return -1;}
5126 #endif /* ndef _SC_DEVICE_SPECIFIC */
5127 if (x == Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R)
5128 #ifdef _SC_DEVICE_SPECIFIC_R
5129 {*r = _SC_DEVICE_SPECIFIC_R; return 0;}
5130 #else /* def _SC_DEVICE_SPECIFIC_R */
5131 {errno = EINVAL; return -1;}
5132 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
5133 if (x == Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX)
5134 #ifdef _SC_EQUIV_CLASS_MAX
5135 {*r = _SC_EQUIV_CLASS_MAX; return 0;}
5136 #else /* def _SC_EQUIV_CLASS_MAX */
5137 {errno = EINVAL; return -1;}
5138 #endif /* ndef _SC_EQUIV_CLASS_MAX */
5139 if (x == Mono_Posix_SysconfName__SC_EXPR_NEST_MAX)
5140 #ifdef _SC_EXPR_NEST_MAX
5141 {*r = _SC_EXPR_NEST_MAX; return 0;}
5142 #else /* def _SC_EXPR_NEST_MAX */
5143 {errno = EINVAL; return -1;}
5144 #endif /* ndef _SC_EXPR_NEST_MAX */
5145 if (x == Mono_Posix_SysconfName__SC_FD_MGMT)
5146 #ifdef _SC_FD_MGMT
5147 {*r = _SC_FD_MGMT; return 0;}
5148 #else /* def _SC_FD_MGMT */
5149 {errno = EINVAL; return -1;}
5150 #endif /* ndef _SC_FD_MGMT */
5151 if (x == Mono_Posix_SysconfName__SC_FIFO)
5152 #ifdef _SC_FIFO
5153 {*r = _SC_FIFO; return 0;}
5154 #else /* def _SC_FIFO */
5155 {errno = EINVAL; return -1;}
5156 #endif /* ndef _SC_FIFO */
5157 if (x == Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES)
5158 #ifdef _SC_FILE_ATTRIBUTES
5159 {*r = _SC_FILE_ATTRIBUTES; return 0;}
5160 #else /* def _SC_FILE_ATTRIBUTES */
5161 {errno = EINVAL; return -1;}
5162 #endif /* ndef _SC_FILE_ATTRIBUTES */
5163 if (x == Mono_Posix_SysconfName__SC_FILE_LOCKING)
5164 #ifdef _SC_FILE_LOCKING
5165 {*r = _SC_FILE_LOCKING; return 0;}
5166 #else /* def _SC_FILE_LOCKING */
5167 {errno = EINVAL; return -1;}
5168 #endif /* ndef _SC_FILE_LOCKING */
5169 if (x == Mono_Posix_SysconfName__SC_FILE_SYSTEM)
5170 #ifdef _SC_FILE_SYSTEM
5171 {*r = _SC_FILE_SYSTEM; return 0;}
5172 #else /* def _SC_FILE_SYSTEM */
5173 {errno = EINVAL; return -1;}
5174 #endif /* ndef _SC_FILE_SYSTEM */
5175 if (x == Mono_Posix_SysconfName__SC_FSYNC)
5176 #ifdef _SC_FSYNC
5177 {*r = _SC_FSYNC; return 0;}
5178 #else /* def _SC_FSYNC */
5179 {errno = EINVAL; return -1;}
5180 #endif /* ndef _SC_FSYNC */
5181 if (x == Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX)
5182 #ifdef _SC_GETGR_R_SIZE_MAX
5183 {*r = _SC_GETGR_R_SIZE_MAX; return 0;}
5184 #else /* def _SC_GETGR_R_SIZE_MAX */
5185 {errno = EINVAL; return -1;}
5186 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
5187 if (x == Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX)
5188 #ifdef _SC_GETPW_R_SIZE_MAX
5189 {*r = _SC_GETPW_R_SIZE_MAX; return 0;}
5190 #else /* def _SC_GETPW_R_SIZE_MAX */
5191 {errno = EINVAL; return -1;}
5192 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
5193 if (x == Mono_Posix_SysconfName__SC_HOST_NAME_MAX)
5194 #ifdef _SC_HOST_NAME_MAX
5195 {*r = _SC_HOST_NAME_MAX; return 0;}
5196 #else /* def _SC_HOST_NAME_MAX */
5197 {errno = EINVAL; return -1;}
5198 #endif /* ndef _SC_HOST_NAME_MAX */
5199 if (x == Mono_Posix_SysconfName__SC_INT_MAX)
5200 #ifdef _SC_INT_MAX
5201 {*r = _SC_INT_MAX; return 0;}
5202 #else /* def _SC_INT_MAX */
5203 {errno = EINVAL; return -1;}
5204 #endif /* ndef _SC_INT_MAX */
5205 if (x == Mono_Posix_SysconfName__SC_INT_MIN)
5206 #ifdef _SC_INT_MIN
5207 {*r = _SC_INT_MIN; return 0;}
5208 #else /* def _SC_INT_MIN */
5209 {errno = EINVAL; return -1;}
5210 #endif /* ndef _SC_INT_MIN */
5211 if (x == Mono_Posix_SysconfName__SC_IOV_MAX)
5212 #ifdef _SC_IOV_MAX
5213 {*r = _SC_IOV_MAX; return 0;}
5214 #else /* def _SC_IOV_MAX */
5215 {errno = EINVAL; return -1;}
5216 #endif /* ndef _SC_IOV_MAX */
5217 if (x == Mono_Posix_SysconfName__SC_JOB_CONTROL)
5218 #ifdef _SC_JOB_CONTROL
5219 {*r = _SC_JOB_CONTROL; return 0;}
5220 #else /* def _SC_JOB_CONTROL */
5221 {errno = EINVAL; return -1;}
5222 #endif /* ndef _SC_JOB_CONTROL */
5223 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC)
5224 #ifdef _SC_LEVEL1_DCACHE_ASSOC
5225 {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;}
5226 #else /* def _SC_LEVEL1_DCACHE_ASSOC */
5227 {errno = EINVAL; return -1;}
5228 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
5229 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE)
5230 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
5231 {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;}
5232 #else /* def _SC_LEVEL1_DCACHE_LINESIZE */
5233 {errno = EINVAL; return -1;}
5234 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
5235 if (x == Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE)
5236 #ifdef _SC_LEVEL1_DCACHE_SIZE
5237 {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;}
5238 #else /* def _SC_LEVEL1_DCACHE_SIZE */
5239 {errno = EINVAL; return -1;}
5240 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
5241 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC)
5242 #ifdef _SC_LEVEL1_ICACHE_ASSOC
5243 {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;}
5244 #else /* def _SC_LEVEL1_ICACHE_ASSOC */
5245 {errno = EINVAL; return -1;}
5246 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
5247 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE)
5248 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
5249 {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;}
5250 #else /* def _SC_LEVEL1_ICACHE_LINESIZE */
5251 {errno = EINVAL; return -1;}
5252 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
5253 if (x == Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE)
5254 #ifdef _SC_LEVEL1_ICACHE_SIZE
5255 {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;}
5256 #else /* def _SC_LEVEL1_ICACHE_SIZE */
5257 {errno = EINVAL; return -1;}
5258 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
5259 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC)
5260 #ifdef _SC_LEVEL2_CACHE_ASSOC
5261 {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;}
5262 #else /* def _SC_LEVEL2_CACHE_ASSOC */
5263 {errno = EINVAL; return -1;}
5264 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
5265 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE)
5266 #ifdef _SC_LEVEL2_CACHE_LINESIZE
5267 {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;}
5268 #else /* def _SC_LEVEL2_CACHE_LINESIZE */
5269 {errno = EINVAL; return -1;}
5270 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
5271 if (x == Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE)
5272 #ifdef _SC_LEVEL2_CACHE_SIZE
5273 {*r = _SC_LEVEL2_CACHE_SIZE; return 0;}
5274 #else /* def _SC_LEVEL2_CACHE_SIZE */
5275 {errno = EINVAL; return -1;}
5276 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
5277 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC)
5278 #ifdef _SC_LEVEL3_CACHE_ASSOC
5279 {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;}
5280 #else /* def _SC_LEVEL3_CACHE_ASSOC */
5281 {errno = EINVAL; return -1;}
5282 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
5283 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE)
5284 #ifdef _SC_LEVEL3_CACHE_LINESIZE
5285 {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;}
5286 #else /* def _SC_LEVEL3_CACHE_LINESIZE */
5287 {errno = EINVAL; return -1;}
5288 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
5289 if (x == Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE)
5290 #ifdef _SC_LEVEL3_CACHE_SIZE
5291 {*r = _SC_LEVEL3_CACHE_SIZE; return 0;}
5292 #else /* def _SC_LEVEL3_CACHE_SIZE */
5293 {errno = EINVAL; return -1;}
5294 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
5295 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC)
5296 #ifdef _SC_LEVEL4_CACHE_ASSOC
5297 {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;}
5298 #else /* def _SC_LEVEL4_CACHE_ASSOC */
5299 {errno = EINVAL; return -1;}
5300 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
5301 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE)
5302 #ifdef _SC_LEVEL4_CACHE_LINESIZE
5303 {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;}
5304 #else /* def _SC_LEVEL4_CACHE_LINESIZE */
5305 {errno = EINVAL; return -1;}
5306 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
5307 if (x == Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE)
5308 #ifdef _SC_LEVEL4_CACHE_SIZE
5309 {*r = _SC_LEVEL4_CACHE_SIZE; return 0;}
5310 #else /* def _SC_LEVEL4_CACHE_SIZE */
5311 {errno = EINVAL; return -1;}
5312 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
5313 if (x == Mono_Posix_SysconfName__SC_LINE_MAX)
5314 #ifdef _SC_LINE_MAX
5315 {*r = _SC_LINE_MAX; return 0;}
5316 #else /* def _SC_LINE_MAX */
5317 {errno = EINVAL; return -1;}
5318 #endif /* ndef _SC_LINE_MAX */
5319 if (x == Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX)
5320 #ifdef _SC_LOGIN_NAME_MAX
5321 {*r = _SC_LOGIN_NAME_MAX; return 0;}
5322 #else /* def _SC_LOGIN_NAME_MAX */
5323 {errno = EINVAL; return -1;}
5324 #endif /* ndef _SC_LOGIN_NAME_MAX */
5325 if (x == Mono_Posix_SysconfName__SC_LONG_BIT)
5326 #ifdef _SC_LONG_BIT
5327 {*r = _SC_LONG_BIT; return 0;}
5328 #else /* def _SC_LONG_BIT */
5329 {errno = EINVAL; return -1;}
5330 #endif /* ndef _SC_LONG_BIT */
5331 if (x == Mono_Posix_SysconfName__SC_MAPPED_FILES)
5332 #ifdef _SC_MAPPED_FILES
5333 {*r = _SC_MAPPED_FILES; return 0;}
5334 #else /* def _SC_MAPPED_FILES */
5335 {errno = EINVAL; return -1;}
5336 #endif /* ndef _SC_MAPPED_FILES */
5337 if (x == Mono_Posix_SysconfName__SC_MB_LEN_MAX)
5338 #ifdef _SC_MB_LEN_MAX
5339 {*r = _SC_MB_LEN_MAX; return 0;}
5340 #else /* def _SC_MB_LEN_MAX */
5341 {errno = EINVAL; return -1;}
5342 #endif /* ndef _SC_MB_LEN_MAX */
5343 if (x == Mono_Posix_SysconfName__SC_MEMLOCK)
5344 #ifdef _SC_MEMLOCK
5345 {*r = _SC_MEMLOCK; return 0;}
5346 #else /* def _SC_MEMLOCK */
5347 {errno = EINVAL; return -1;}
5348 #endif /* ndef _SC_MEMLOCK */
5349 if (x == Mono_Posix_SysconfName__SC_MEMLOCK_RANGE)
5350 #ifdef _SC_MEMLOCK_RANGE
5351 {*r = _SC_MEMLOCK_RANGE; return 0;}
5352 #else /* def _SC_MEMLOCK_RANGE */
5353 {errno = EINVAL; return -1;}
5354 #endif /* ndef _SC_MEMLOCK_RANGE */
5355 if (x == Mono_Posix_SysconfName__SC_MEMORY_PROTECTION)
5356 #ifdef _SC_MEMORY_PROTECTION
5357 {*r = _SC_MEMORY_PROTECTION; return 0;}
5358 #else /* def _SC_MEMORY_PROTECTION */
5359 {errno = EINVAL; return -1;}
5360 #endif /* ndef _SC_MEMORY_PROTECTION */
5361 if (x == Mono_Posix_SysconfName__SC_MESSAGE_PASSING)
5362 #ifdef _SC_MESSAGE_PASSING
5363 {*r = _SC_MESSAGE_PASSING; return 0;}
5364 #else /* def _SC_MESSAGE_PASSING */
5365 {errno = EINVAL; return -1;}
5366 #endif /* ndef _SC_MESSAGE_PASSING */
5367 if (x == Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK)
5368 #ifdef _SC_MONOTONIC_CLOCK
5369 {*r = _SC_MONOTONIC_CLOCK; return 0;}
5370 #else /* def _SC_MONOTONIC_CLOCK */
5371 {errno = EINVAL; return -1;}
5372 #endif /* ndef _SC_MONOTONIC_CLOCK */
5373 if (x == Mono_Posix_SysconfName__SC_MQ_OPEN_MAX)
5374 #ifdef _SC_MQ_OPEN_MAX
5375 {*r = _SC_MQ_OPEN_MAX; return 0;}
5376 #else /* def _SC_MQ_OPEN_MAX */
5377 {errno = EINVAL; return -1;}
5378 #endif /* ndef _SC_MQ_OPEN_MAX */
5379 if (x == Mono_Posix_SysconfName__SC_MQ_PRIO_MAX)
5380 #ifdef _SC_MQ_PRIO_MAX
5381 {*r = _SC_MQ_PRIO_MAX; return 0;}
5382 #else /* def _SC_MQ_PRIO_MAX */
5383 {errno = EINVAL; return -1;}
5384 #endif /* ndef _SC_MQ_PRIO_MAX */
5385 if (x == Mono_Posix_SysconfName__SC_MULTI_PROCESS)
5386 #ifdef _SC_MULTI_PROCESS
5387 {*r = _SC_MULTI_PROCESS; return 0;}
5388 #else /* def _SC_MULTI_PROCESS */
5389 {errno = EINVAL; return -1;}
5390 #endif /* ndef _SC_MULTI_PROCESS */
5391 if (x == Mono_Posix_SysconfName__SC_NETWORKING)
5392 #ifdef _SC_NETWORKING
5393 {*r = _SC_NETWORKING; return 0;}
5394 #else /* def _SC_NETWORKING */
5395 {errno = EINVAL; return -1;}
5396 #endif /* ndef _SC_NETWORKING */
5397 if (x == Mono_Posix_SysconfName__SC_NGROUPS_MAX)
5398 #ifdef _SC_NGROUPS_MAX
5399 {*r = _SC_NGROUPS_MAX; return 0;}
5400 #else /* def _SC_NGROUPS_MAX */
5401 {errno = EINVAL; return -1;}
5402 #endif /* ndef _SC_NGROUPS_MAX */
5403 if (x == Mono_Posix_SysconfName__SC_NL_ARGMAX)
5404 #ifdef _SC_NL_ARGMAX
5405 {*r = _SC_NL_ARGMAX; return 0;}
5406 #else /* def _SC_NL_ARGMAX */
5407 {errno = EINVAL; return -1;}
5408 #endif /* ndef _SC_NL_ARGMAX */
5409 if (x == Mono_Posix_SysconfName__SC_NL_LANGMAX)
5410 #ifdef _SC_NL_LANGMAX
5411 {*r = _SC_NL_LANGMAX; return 0;}
5412 #else /* def _SC_NL_LANGMAX */
5413 {errno = EINVAL; return -1;}
5414 #endif /* ndef _SC_NL_LANGMAX */
5415 if (x == Mono_Posix_SysconfName__SC_NL_MSGMAX)
5416 #ifdef _SC_NL_MSGMAX
5417 {*r = _SC_NL_MSGMAX; return 0;}
5418 #else /* def _SC_NL_MSGMAX */
5419 {errno = EINVAL; return -1;}
5420 #endif /* ndef _SC_NL_MSGMAX */
5421 if (x == Mono_Posix_SysconfName__SC_NL_NMAX)
5422 #ifdef _SC_NL_NMAX
5423 {*r = _SC_NL_NMAX; return 0;}
5424 #else /* def _SC_NL_NMAX */
5425 {errno = EINVAL; return -1;}
5426 #endif /* ndef _SC_NL_NMAX */
5427 if (x == Mono_Posix_SysconfName__SC_NL_SETMAX)
5428 #ifdef _SC_NL_SETMAX
5429 {*r = _SC_NL_SETMAX; return 0;}
5430 #else /* def _SC_NL_SETMAX */
5431 {errno = EINVAL; return -1;}
5432 #endif /* ndef _SC_NL_SETMAX */
5433 if (x == Mono_Posix_SysconfName__SC_NL_TEXTMAX)
5434 #ifdef _SC_NL_TEXTMAX
5435 {*r = _SC_NL_TEXTMAX; return 0;}
5436 #else /* def _SC_NL_TEXTMAX */
5437 {errno = EINVAL; return -1;}
5438 #endif /* ndef _SC_NL_TEXTMAX */
5439 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_CONF)
5440 #ifdef _SC_NPROCESSORS_CONF
5441 {*r = _SC_NPROCESSORS_CONF; return 0;}
5442 #else /* def _SC_NPROCESSORS_CONF */
5443 {errno = EINVAL; return -1;}
5444 #endif /* ndef _SC_NPROCESSORS_CONF */
5445 if (x == Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN)
5446 #ifdef _SC_NPROCESSORS_ONLN
5447 {*r = _SC_NPROCESSORS_ONLN; return 0;}
5448 #else /* def _SC_NPROCESSORS_ONLN */
5449 {errno = EINVAL; return -1;}
5450 #endif /* ndef _SC_NPROCESSORS_ONLN */
5451 if (x == Mono_Posix_SysconfName__SC_NZERO)
5452 #ifdef _SC_NZERO
5453 {*r = _SC_NZERO; return 0;}
5454 #else /* def _SC_NZERO */
5455 {errno = EINVAL; return -1;}
5456 #endif /* ndef _SC_NZERO */
5457 if (x == Mono_Posix_SysconfName__SC_OPEN_MAX)
5458 #ifdef _SC_OPEN_MAX
5459 {*r = _SC_OPEN_MAX; return 0;}
5460 #else /* def _SC_OPEN_MAX */
5461 {errno = EINVAL; return -1;}
5462 #endif /* ndef _SC_OPEN_MAX */
5463 if (x == Mono_Posix_SysconfName__SC_PAGESIZE)
5464 #ifdef _SC_PAGESIZE
5465 {*r = _SC_PAGESIZE; return 0;}
5466 #else /* def _SC_PAGESIZE */
5467 {errno = EINVAL; return -1;}
5468 #endif /* ndef _SC_PAGESIZE */
5469 if (x == Mono_Posix_SysconfName__SC_PASS_MAX)
5470 #ifdef _SC_PASS_MAX
5471 {*r = _SC_PASS_MAX; return 0;}
5472 #else /* def _SC_PASS_MAX */
5473 {errno = EINVAL; return -1;}
5474 #endif /* ndef _SC_PASS_MAX */
5475 if (x == Mono_Posix_SysconfName__SC_PHYS_PAGES)
5476 #ifdef _SC_PHYS_PAGES
5477 {*r = _SC_PHYS_PAGES; return 0;}
5478 #else /* def _SC_PHYS_PAGES */
5479 {errno = EINVAL; return -1;}
5480 #endif /* ndef _SC_PHYS_PAGES */
5481 if (x == Mono_Posix_SysconfName__SC_PII)
5482 #ifdef _SC_PII
5483 {*r = _SC_PII; return 0;}
5484 #else /* def _SC_PII */
5485 {errno = EINVAL; return -1;}
5486 #endif /* ndef _SC_PII */
5487 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET)
5488 #ifdef _SC_PII_INTERNET
5489 {*r = _SC_PII_INTERNET; return 0;}
5490 #else /* def _SC_PII_INTERNET */
5491 {errno = EINVAL; return -1;}
5492 #endif /* ndef _SC_PII_INTERNET */
5493 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM)
5494 #ifdef _SC_PII_INTERNET_DGRAM
5495 {*r = _SC_PII_INTERNET_DGRAM; return 0;}
5496 #else /* def _SC_PII_INTERNET_DGRAM */
5497 {errno = EINVAL; return -1;}
5498 #endif /* ndef _SC_PII_INTERNET_DGRAM */
5499 if (x == Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM)
5500 #ifdef _SC_PII_INTERNET_STREAM
5501 {*r = _SC_PII_INTERNET_STREAM; return 0;}
5502 #else /* def _SC_PII_INTERNET_STREAM */
5503 {errno = EINVAL; return -1;}
5504 #endif /* ndef _SC_PII_INTERNET_STREAM */
5505 if (x == Mono_Posix_SysconfName__SC_PII_OSI)
5506 #ifdef _SC_PII_OSI
5507 {*r = _SC_PII_OSI; return 0;}
5508 #else /* def _SC_PII_OSI */
5509 {errno = EINVAL; return -1;}
5510 #endif /* ndef _SC_PII_OSI */
5511 if (x == Mono_Posix_SysconfName__SC_PII_OSI_CLTS)
5512 #ifdef _SC_PII_OSI_CLTS
5513 {*r = _SC_PII_OSI_CLTS; return 0;}
5514 #else /* def _SC_PII_OSI_CLTS */
5515 {errno = EINVAL; return -1;}
5516 #endif /* ndef _SC_PII_OSI_CLTS */
5517 if (x == Mono_Posix_SysconfName__SC_PII_OSI_COTS)
5518 #ifdef _SC_PII_OSI_COTS
5519 {*r = _SC_PII_OSI_COTS; return 0;}
5520 #else /* def _SC_PII_OSI_COTS */
5521 {errno = EINVAL; return -1;}
5522 #endif /* ndef _SC_PII_OSI_COTS */
5523 if (x == Mono_Posix_SysconfName__SC_PII_OSI_M)
5524 #ifdef _SC_PII_OSI_M
5525 {*r = _SC_PII_OSI_M; return 0;}
5526 #else /* def _SC_PII_OSI_M */
5527 {errno = EINVAL; return -1;}
5528 #endif /* ndef _SC_PII_OSI_M */
5529 if (x == Mono_Posix_SysconfName__SC_PII_SOCKET)
5530 #ifdef _SC_PII_SOCKET
5531 {*r = _SC_PII_SOCKET; return 0;}
5532 #else /* def _SC_PII_SOCKET */
5533 {errno = EINVAL; return -1;}
5534 #endif /* ndef _SC_PII_SOCKET */
5535 if (x == Mono_Posix_SysconfName__SC_PII_XTI)
5536 #ifdef _SC_PII_XTI
5537 {*r = _SC_PII_XTI; return 0;}
5538 #else /* def _SC_PII_XTI */
5539 {errno = EINVAL; return -1;}
5540 #endif /* ndef _SC_PII_XTI */
5541 if (x == Mono_Posix_SysconfName__SC_PIPE)
5542 #ifdef _SC_PIPE
5543 {*r = _SC_PIPE; return 0;}
5544 #else /* def _SC_PIPE */
5545 {errno = EINVAL; return -1;}
5546 #endif /* ndef _SC_PIPE */
5547 if (x == Mono_Posix_SysconfName__SC_POLL)
5548 #ifdef _SC_POLL
5549 {*r = _SC_POLL; return 0;}
5550 #else /* def _SC_POLL */
5551 {errno = EINVAL; return -1;}
5552 #endif /* ndef _SC_POLL */
5553 if (x == Mono_Posix_SysconfName__SC_PRIORITIZED_IO)
5554 #ifdef _SC_PRIORITIZED_IO
5555 {*r = _SC_PRIORITIZED_IO; return 0;}
5556 #else /* def _SC_PRIORITIZED_IO */
5557 {errno = EINVAL; return -1;}
5558 #endif /* ndef _SC_PRIORITIZED_IO */
5559 if (x == Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING)
5560 #ifdef _SC_PRIORITY_SCHEDULING
5561 {*r = _SC_PRIORITY_SCHEDULING; return 0;}
5562 #else /* def _SC_PRIORITY_SCHEDULING */
5563 {errno = EINVAL; return -1;}
5564 #endif /* ndef _SC_PRIORITY_SCHEDULING */
5565 if (x == Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS)
5566 #ifdef _SC_READER_WRITER_LOCKS
5567 {*r = _SC_READER_WRITER_LOCKS; return 0;}
5568 #else /* def _SC_READER_WRITER_LOCKS */
5569 {errno = EINVAL; return -1;}
5570 #endif /* ndef _SC_READER_WRITER_LOCKS */
5571 if (x == Mono_Posix_SysconfName__SC_REALTIME_SIGNALS)
5572 #ifdef _SC_REALTIME_SIGNALS
5573 {*r = _SC_REALTIME_SIGNALS; return 0;}
5574 #else /* def _SC_REALTIME_SIGNALS */
5575 {errno = EINVAL; return -1;}
5576 #endif /* ndef _SC_REALTIME_SIGNALS */
5577 if (x == Mono_Posix_SysconfName__SC_REGEXP)
5578 #ifdef _SC_REGEXP
5579 {*r = _SC_REGEXP; return 0;}
5580 #else /* def _SC_REGEXP */
5581 {errno = EINVAL; return -1;}
5582 #endif /* ndef _SC_REGEXP */
5583 if (x == Mono_Posix_SysconfName__SC_REGEX_VERSION)
5584 #ifdef _SC_REGEX_VERSION
5585 {*r = _SC_REGEX_VERSION; return 0;}
5586 #else /* def _SC_REGEX_VERSION */
5587 {errno = EINVAL; return -1;}
5588 #endif /* ndef _SC_REGEX_VERSION */
5589 if (x == Mono_Posix_SysconfName__SC_RE_DUP_MAX)
5590 #ifdef _SC_RE_DUP_MAX
5591 {*r = _SC_RE_DUP_MAX; return 0;}
5592 #else /* def _SC_RE_DUP_MAX */
5593 {errno = EINVAL; return -1;}
5594 #endif /* ndef _SC_RE_DUP_MAX */
5595 if (x == Mono_Posix_SysconfName__SC_RTSIG_MAX)
5596 #ifdef _SC_RTSIG_MAX
5597 {*r = _SC_RTSIG_MAX; return 0;}
5598 #else /* def _SC_RTSIG_MAX */
5599 {errno = EINVAL; return -1;}
5600 #endif /* ndef _SC_RTSIG_MAX */
5601 if (x == Mono_Posix_SysconfName__SC_SAVED_IDS)
5602 #ifdef _SC_SAVED_IDS
5603 {*r = _SC_SAVED_IDS; return 0;}
5604 #else /* def _SC_SAVED_IDS */
5605 {errno = EINVAL; return -1;}
5606 #endif /* ndef _SC_SAVED_IDS */
5607 if (x == Mono_Posix_SysconfName__SC_SCHAR_MAX)
5608 #ifdef _SC_SCHAR_MAX
5609 {*r = _SC_SCHAR_MAX; return 0;}
5610 #else /* def _SC_SCHAR_MAX */
5611 {errno = EINVAL; return -1;}
5612 #endif /* ndef _SC_SCHAR_MAX */
5613 if (x == Mono_Posix_SysconfName__SC_SCHAR_MIN)
5614 #ifdef _SC_SCHAR_MIN
5615 {*r = _SC_SCHAR_MIN; return 0;}
5616 #else /* def _SC_SCHAR_MIN */
5617 {errno = EINVAL; return -1;}
5618 #endif /* ndef _SC_SCHAR_MIN */
5619 if (x == Mono_Posix_SysconfName__SC_SELECT)
5620 #ifdef _SC_SELECT
5621 {*r = _SC_SELECT; return 0;}
5622 #else /* def _SC_SELECT */
5623 {errno = EINVAL; return -1;}
5624 #endif /* ndef _SC_SELECT */
5625 if (x == Mono_Posix_SysconfName__SC_SEMAPHORES)
5626 #ifdef _SC_SEMAPHORES
5627 {*r = _SC_SEMAPHORES; return 0;}
5628 #else /* def _SC_SEMAPHORES */
5629 {errno = EINVAL; return -1;}
5630 #endif /* ndef _SC_SEMAPHORES */
5631 if (x == Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX)
5632 #ifdef _SC_SEM_NSEMS_MAX
5633 {*r = _SC_SEM_NSEMS_MAX; return 0;}
5634 #else /* def _SC_SEM_NSEMS_MAX */
5635 {errno = EINVAL; return -1;}
5636 #endif /* ndef _SC_SEM_NSEMS_MAX */
5637 if (x == Mono_Posix_SysconfName__SC_SEM_VALUE_MAX)
5638 #ifdef _SC_SEM_VALUE_MAX
5639 {*r = _SC_SEM_VALUE_MAX; return 0;}
5640 #else /* def _SC_SEM_VALUE_MAX */
5641 {errno = EINVAL; return -1;}
5642 #endif /* ndef _SC_SEM_VALUE_MAX */
5643 if (x == Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS)
5644 #ifdef _SC_SHARED_MEMORY_OBJECTS
5645 {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
5646 #else /* def _SC_SHARED_MEMORY_OBJECTS */
5647 {errno = EINVAL; return -1;}
5648 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
5649 if (x == Mono_Posix_SysconfName__SC_SHELL)
5650 #ifdef _SC_SHELL
5651 {*r = _SC_SHELL; return 0;}
5652 #else /* def _SC_SHELL */
5653 {errno = EINVAL; return -1;}
5654 #endif /* ndef _SC_SHELL */
5655 if (x == Mono_Posix_SysconfName__SC_SHRT_MAX)
5656 #ifdef _SC_SHRT_MAX
5657 {*r = _SC_SHRT_MAX; return 0;}
5658 #else /* def _SC_SHRT_MAX */
5659 {errno = EINVAL; return -1;}
5660 #endif /* ndef _SC_SHRT_MAX */
5661 if (x == Mono_Posix_SysconfName__SC_SHRT_MIN)
5662 #ifdef _SC_SHRT_MIN
5663 {*r = _SC_SHRT_MIN; return 0;}
5664 #else /* def _SC_SHRT_MIN */
5665 {errno = EINVAL; return -1;}
5666 #endif /* ndef _SC_SHRT_MIN */
5667 if (x == Mono_Posix_SysconfName__SC_SIGNALS)
5668 #ifdef _SC_SIGNALS
5669 {*r = _SC_SIGNALS; return 0;}
5670 #else /* def _SC_SIGNALS */
5671 {errno = EINVAL; return -1;}
5672 #endif /* ndef _SC_SIGNALS */
5673 if (x == Mono_Posix_SysconfName__SC_SIGQUEUE_MAX)
5674 #ifdef _SC_SIGQUEUE_MAX
5675 {*r = _SC_SIGQUEUE_MAX; return 0;}
5676 #else /* def _SC_SIGQUEUE_MAX */
5677 {errno = EINVAL; return -1;}
5678 #endif /* ndef _SC_SIGQUEUE_MAX */
5679 if (x == Mono_Posix_SysconfName__SC_SINGLE_PROCESS)
5680 #ifdef _SC_SINGLE_PROCESS
5681 {*r = _SC_SINGLE_PROCESS; return 0;}
5682 #else /* def _SC_SINGLE_PROCESS */
5683 {errno = EINVAL; return -1;}
5684 #endif /* ndef _SC_SINGLE_PROCESS */
5685 if (x == Mono_Posix_SysconfName__SC_SPAWN)
5686 #ifdef _SC_SPAWN
5687 {*r = _SC_SPAWN; return 0;}
5688 #else /* def _SC_SPAWN */
5689 {errno = EINVAL; return -1;}
5690 #endif /* ndef _SC_SPAWN */
5691 if (x == Mono_Posix_SysconfName__SC_SPIN_LOCKS)
5692 #ifdef _SC_SPIN_LOCKS
5693 {*r = _SC_SPIN_LOCKS; return 0;}
5694 #else /* def _SC_SPIN_LOCKS */
5695 {errno = EINVAL; return -1;}
5696 #endif /* ndef _SC_SPIN_LOCKS */
5697 if (x == Mono_Posix_SysconfName__SC_SPORADIC_SERVER)
5698 #ifdef _SC_SPORADIC_SERVER
5699 {*r = _SC_SPORADIC_SERVER; return 0;}
5700 #else /* def _SC_SPORADIC_SERVER */
5701 {errno = EINVAL; return -1;}
5702 #endif /* ndef _SC_SPORADIC_SERVER */
5703 if (x == Mono_Posix_SysconfName__SC_SSIZE_MAX)
5704 #ifdef _SC_SSIZE_MAX
5705 {*r = _SC_SSIZE_MAX; return 0;}
5706 #else /* def _SC_SSIZE_MAX */
5707 {errno = EINVAL; return -1;}
5708 #endif /* ndef _SC_SSIZE_MAX */
5709 if (x == Mono_Posix_SysconfName__SC_STREAMS)
5710 #ifdef _SC_STREAMS
5711 {*r = _SC_STREAMS; return 0;}
5712 #else /* def _SC_STREAMS */
5713 {errno = EINVAL; return -1;}
5714 #endif /* ndef _SC_STREAMS */
5715 if (x == Mono_Posix_SysconfName__SC_STREAM_MAX)
5716 #ifdef _SC_STREAM_MAX
5717 {*r = _SC_STREAM_MAX; return 0;}
5718 #else /* def _SC_STREAM_MAX */
5719 {errno = EINVAL; return -1;}
5720 #endif /* ndef _SC_STREAM_MAX */
5721 if (x == Mono_Posix_SysconfName__SC_SYMLOOP_MAX)
5722 #ifdef _SC_SYMLOOP_MAX
5723 {*r = _SC_SYMLOOP_MAX; return 0;}
5724 #else /* def _SC_SYMLOOP_MAX */
5725 {errno = EINVAL; return -1;}
5726 #endif /* ndef _SC_SYMLOOP_MAX */
5727 if (x == Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO)
5728 #ifdef _SC_SYNCHRONIZED_IO
5729 {*r = _SC_SYNCHRONIZED_IO; return 0;}
5730 #else /* def _SC_SYNCHRONIZED_IO */
5731 {errno = EINVAL; return -1;}
5732 #endif /* ndef _SC_SYNCHRONIZED_IO */
5733 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE)
5734 #ifdef _SC_SYSTEM_DATABASE
5735 {*r = _SC_SYSTEM_DATABASE; return 0;}
5736 #else /* def _SC_SYSTEM_DATABASE */
5737 {errno = EINVAL; return -1;}
5738 #endif /* ndef _SC_SYSTEM_DATABASE */
5739 if (x == Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R)
5740 #ifdef _SC_SYSTEM_DATABASE_R
5741 {*r = _SC_SYSTEM_DATABASE_R; return 0;}
5742 #else /* def _SC_SYSTEM_DATABASE_R */
5743 {errno = EINVAL; return -1;}
5744 #endif /* ndef _SC_SYSTEM_DATABASE_R */
5745 if (x == Mono_Posix_SysconfName__SC_THREADS)
5746 #ifdef _SC_THREADS
5747 {*r = _SC_THREADS; return 0;}
5748 #else /* def _SC_THREADS */
5749 {errno = EINVAL; return -1;}
5750 #endif /* ndef _SC_THREADS */
5751 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR)
5752 #ifdef _SC_THREAD_ATTR_STACKADDR
5753 {*r = _SC_THREAD_ATTR_STACKADDR; return 0;}
5754 #else /* def _SC_THREAD_ATTR_STACKADDR */
5755 {errno = EINVAL; return -1;}
5756 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
5757 if (x == Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE)
5758 #ifdef _SC_THREAD_ATTR_STACKSIZE
5759 {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;}
5760 #else /* def _SC_THREAD_ATTR_STACKSIZE */
5761 {errno = EINVAL; return -1;}
5762 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
5763 if (x == Mono_Posix_SysconfName__SC_THREAD_CPUTIME)
5764 #ifdef _SC_THREAD_CPUTIME
5765 {*r = _SC_THREAD_CPUTIME; return 0;}
5766 #else /* def _SC_THREAD_CPUTIME */
5767 {errno = EINVAL; return -1;}
5768 #endif /* ndef _SC_THREAD_CPUTIME */
5769 if (x == Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS)
5770 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
5771 {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
5772 #else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */
5773 {errno = EINVAL; return -1;}
5774 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
5775 if (x == Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX)
5776 #ifdef _SC_THREAD_KEYS_MAX
5777 {*r = _SC_THREAD_KEYS_MAX; return 0;}
5778 #else /* def _SC_THREAD_KEYS_MAX */
5779 {errno = EINVAL; return -1;}
5780 #endif /* ndef _SC_THREAD_KEYS_MAX */
5781 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING)
5782 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
5783 {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;}
5784 #else /* def _SC_THREAD_PRIORITY_SCHEDULING */
5785 {errno = EINVAL; return -1;}
5786 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
5787 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT)
5788 #ifdef _SC_THREAD_PRIO_INHERIT
5789 {*r = _SC_THREAD_PRIO_INHERIT; return 0;}
5790 #else /* def _SC_THREAD_PRIO_INHERIT */
5791 {errno = EINVAL; return -1;}
5792 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
5793 if (x == Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT)
5794 #ifdef _SC_THREAD_PRIO_PROTECT
5795 {*r = _SC_THREAD_PRIO_PROTECT; return 0;}
5796 #else /* def _SC_THREAD_PRIO_PROTECT */
5797 {errno = EINVAL; return -1;}
5798 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
5799 if (x == Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED)
5800 #ifdef _SC_THREAD_PROCESS_SHARED
5801 {*r = _SC_THREAD_PROCESS_SHARED; return 0;}
5802 #else /* def _SC_THREAD_PROCESS_SHARED */
5803 {errno = EINVAL; return -1;}
5804 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
5805 if (x == Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS)
5806 #ifdef _SC_THREAD_SAFE_FUNCTIONS
5807 {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;}
5808 #else /* def _SC_THREAD_SAFE_FUNCTIONS */
5809 {errno = EINVAL; return -1;}
5810 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
5811 if (x == Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER)
5812 #ifdef _SC_THREAD_SPORADIC_SERVER
5813 {*r = _SC_THREAD_SPORADIC_SERVER; return 0;}
5814 #else /* def _SC_THREAD_SPORADIC_SERVER */
5815 {errno = EINVAL; return -1;}
5816 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
5817 if (x == Mono_Posix_SysconfName__SC_THREAD_STACK_MIN)
5818 #ifdef _SC_THREAD_STACK_MIN
5819 {*r = _SC_THREAD_STACK_MIN; return 0;}
5820 #else /* def _SC_THREAD_STACK_MIN */
5821 {errno = EINVAL; return -1;}
5822 #endif /* ndef _SC_THREAD_STACK_MIN */
5823 if (x == Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX)
5824 #ifdef _SC_THREAD_THREADS_MAX
5825 {*r = _SC_THREAD_THREADS_MAX; return 0;}
5826 #else /* def _SC_THREAD_THREADS_MAX */
5827 {errno = EINVAL; return -1;}
5828 #endif /* ndef _SC_THREAD_THREADS_MAX */
5829 if (x == Mono_Posix_SysconfName__SC_TIMEOUTS)
5830 #ifdef _SC_TIMEOUTS
5831 {*r = _SC_TIMEOUTS; return 0;}
5832 #else /* def _SC_TIMEOUTS */
5833 {errno = EINVAL; return -1;}
5834 #endif /* ndef _SC_TIMEOUTS */
5835 if (x == Mono_Posix_SysconfName__SC_TIMERS)
5836 #ifdef _SC_TIMERS
5837 {*r = _SC_TIMERS; return 0;}
5838 #else /* def _SC_TIMERS */
5839 {errno = EINVAL; return -1;}
5840 #endif /* ndef _SC_TIMERS */
5841 if (x == Mono_Posix_SysconfName__SC_TIMER_MAX)
5842 #ifdef _SC_TIMER_MAX
5843 {*r = _SC_TIMER_MAX; return 0;}
5844 #else /* def _SC_TIMER_MAX */
5845 {errno = EINVAL; return -1;}
5846 #endif /* ndef _SC_TIMER_MAX */
5847 if (x == Mono_Posix_SysconfName__SC_TRACE)
5848 #ifdef _SC_TRACE
5849 {*r = _SC_TRACE; return 0;}
5850 #else /* def _SC_TRACE */
5851 {errno = EINVAL; return -1;}
5852 #endif /* ndef _SC_TRACE */
5853 if (x == Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER)
5854 #ifdef _SC_TRACE_EVENT_FILTER
5855 {*r = _SC_TRACE_EVENT_FILTER; return 0;}
5856 #else /* def _SC_TRACE_EVENT_FILTER */
5857 {errno = EINVAL; return -1;}
5858 #endif /* ndef _SC_TRACE_EVENT_FILTER */
5859 if (x == Mono_Posix_SysconfName__SC_TRACE_INHERIT)
5860 #ifdef _SC_TRACE_INHERIT
5861 {*r = _SC_TRACE_INHERIT; return 0;}
5862 #else /* def _SC_TRACE_INHERIT */
5863 {errno = EINVAL; return -1;}
5864 #endif /* ndef _SC_TRACE_INHERIT */
5865 if (x == Mono_Posix_SysconfName__SC_TRACE_LOG)
5866 #ifdef _SC_TRACE_LOG
5867 {*r = _SC_TRACE_LOG; return 0;}
5868 #else /* def _SC_TRACE_LOG */
5869 {errno = EINVAL; return -1;}
5870 #endif /* ndef _SC_TRACE_LOG */
5871 if (x == Mono_Posix_SysconfName__SC_TTY_NAME_MAX)
5872 #ifdef _SC_TTY_NAME_MAX
5873 {*r = _SC_TTY_NAME_MAX; return 0;}
5874 #else /* def _SC_TTY_NAME_MAX */
5875 {errno = EINVAL; return -1;}
5876 #endif /* ndef _SC_TTY_NAME_MAX */
5877 if (x == Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS)
5878 #ifdef _SC_TYPED_MEMORY_OBJECTS
5879 {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;}
5880 #else /* def _SC_TYPED_MEMORY_OBJECTS */
5881 {errno = EINVAL; return -1;}
5882 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
5883 if (x == Mono_Posix_SysconfName__SC_TZNAME_MAX)
5884 #ifdef _SC_TZNAME_MAX
5885 {*r = _SC_TZNAME_MAX; return 0;}
5886 #else /* def _SC_TZNAME_MAX */
5887 {errno = EINVAL; return -1;}
5888 #endif /* ndef _SC_TZNAME_MAX */
5889 if (x == Mono_Posix_SysconfName__SC_T_IOV_MAX)
5890 #ifdef _SC_T_IOV_MAX
5891 {*r = _SC_T_IOV_MAX; return 0;}
5892 #else /* def _SC_T_IOV_MAX */
5893 {errno = EINVAL; return -1;}
5894 #endif /* ndef _SC_T_IOV_MAX */
5895 if (x == Mono_Posix_SysconfName__SC_UCHAR_MAX)
5896 #ifdef _SC_UCHAR_MAX
5897 {*r = _SC_UCHAR_MAX; return 0;}
5898 #else /* def _SC_UCHAR_MAX */
5899 {errno = EINVAL; return -1;}
5900 #endif /* ndef _SC_UCHAR_MAX */
5901 if (x == Mono_Posix_SysconfName__SC_UINT_MAX)
5902 #ifdef _SC_UINT_MAX
5903 {*r = _SC_UINT_MAX; return 0;}
5904 #else /* def _SC_UINT_MAX */
5905 {errno = EINVAL; return -1;}
5906 #endif /* ndef _SC_UINT_MAX */
5907 if (x == Mono_Posix_SysconfName__SC_UIO_MAXIOV)
5908 #ifdef _SC_UIO_MAXIOV
5909 {*r = _SC_UIO_MAXIOV; return 0;}
5910 #else /* def _SC_UIO_MAXIOV */
5911 {errno = EINVAL; return -1;}
5912 #endif /* ndef _SC_UIO_MAXIOV */
5913 if (x == Mono_Posix_SysconfName__SC_ULONG_MAX)
5914 #ifdef _SC_ULONG_MAX
5915 {*r = _SC_ULONG_MAX; return 0;}
5916 #else /* def _SC_ULONG_MAX */
5917 {errno = EINVAL; return -1;}
5918 #endif /* ndef _SC_ULONG_MAX */
5919 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS)
5920 #ifdef _SC_USER_GROUPS
5921 {*r = _SC_USER_GROUPS; return 0;}
5922 #else /* def _SC_USER_GROUPS */
5923 {errno = EINVAL; return -1;}
5924 #endif /* ndef _SC_USER_GROUPS */
5925 if (x == Mono_Posix_SysconfName__SC_USER_GROUPS_R)
5926 #ifdef _SC_USER_GROUPS_R
5927 {*r = _SC_USER_GROUPS_R; return 0;}
5928 #else /* def _SC_USER_GROUPS_R */
5929 {errno = EINVAL; return -1;}
5930 #endif /* ndef _SC_USER_GROUPS_R */
5931 if (x == Mono_Posix_SysconfName__SC_USHRT_MAX)
5932 #ifdef _SC_USHRT_MAX
5933 {*r = _SC_USHRT_MAX; return 0;}
5934 #else /* def _SC_USHRT_MAX */
5935 {errno = EINVAL; return -1;}
5936 #endif /* ndef _SC_USHRT_MAX */
5937 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFF32)
5938 #ifdef _SC_V6_ILP32_OFF32
5939 {*r = _SC_V6_ILP32_OFF32; return 0;}
5940 #else /* def _SC_V6_ILP32_OFF32 */
5941 {errno = EINVAL; return -1;}
5942 #endif /* ndef _SC_V6_ILP32_OFF32 */
5943 if (x == Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG)
5944 #ifdef _SC_V6_ILP32_OFFBIG
5945 {*r = _SC_V6_ILP32_OFFBIG; return 0;}
5946 #else /* def _SC_V6_ILP32_OFFBIG */
5947 {errno = EINVAL; return -1;}
5948 #endif /* ndef _SC_V6_ILP32_OFFBIG */
5949 if (x == Mono_Posix_SysconfName__SC_V6_LP64_OFF64)
5950 #ifdef _SC_V6_LP64_OFF64
5951 {*r = _SC_V6_LP64_OFF64; return 0;}
5952 #else /* def _SC_V6_LP64_OFF64 */
5953 {errno = EINVAL; return -1;}
5954 #endif /* ndef _SC_V6_LP64_OFF64 */
5955 if (x == Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG)
5956 #ifdef _SC_V6_LPBIG_OFFBIG
5957 {*r = _SC_V6_LPBIG_OFFBIG; return 0;}
5958 #else /* def _SC_V6_LPBIG_OFFBIG */
5959 {errno = EINVAL; return -1;}
5960 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
5961 if (x == Mono_Posix_SysconfName__SC_VERSION)
5962 #ifdef _SC_VERSION
5963 {*r = _SC_VERSION; return 0;}
5964 #else /* def _SC_VERSION */
5965 {errno = EINVAL; return -1;}
5966 #endif /* ndef _SC_VERSION */
5967 if (x == Mono_Posix_SysconfName__SC_WORD_BIT)
5968 #ifdef _SC_WORD_BIT
5969 {*r = _SC_WORD_BIT; return 0;}
5970 #else /* def _SC_WORD_BIT */
5971 {errno = EINVAL; return -1;}
5972 #endif /* ndef _SC_WORD_BIT */
5973 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32)
5974 #ifdef _SC_XBS5_ILP32_OFF32
5975 {*r = _SC_XBS5_ILP32_OFF32; return 0;}
5976 #else /* def _SC_XBS5_ILP32_OFF32 */
5977 {errno = EINVAL; return -1;}
5978 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
5979 if (x == Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG)
5980 #ifdef _SC_XBS5_ILP32_OFFBIG
5981 {*r = _SC_XBS5_ILP32_OFFBIG; return 0;}
5982 #else /* def _SC_XBS5_ILP32_OFFBIG */
5983 {errno = EINVAL; return -1;}
5984 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
5985 if (x == Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64)
5986 #ifdef _SC_XBS5_LP64_OFF64
5987 {*r = _SC_XBS5_LP64_OFF64; return 0;}
5988 #else /* def _SC_XBS5_LP64_OFF64 */
5989 {errno = EINVAL; return -1;}
5990 #endif /* ndef _SC_XBS5_LP64_OFF64 */
5991 if (x == Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG)
5992 #ifdef _SC_XBS5_LPBIG_OFFBIG
5993 {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;}
5994 #else /* def _SC_XBS5_LPBIG_OFFBIG */
5995 {errno = EINVAL; return -1;}
5996 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
5997 if (x == Mono_Posix_SysconfName__SC_XOPEN_CRYPT)
5998 #ifdef _SC_XOPEN_CRYPT
5999 {*r = _SC_XOPEN_CRYPT; return 0;}
6000 #else /* def _SC_XOPEN_CRYPT */
6001 {errno = EINVAL; return -1;}
6002 #endif /* ndef _SC_XOPEN_CRYPT */
6003 if (x == Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N)
6004 #ifdef _SC_XOPEN_ENH_I18N
6005 {*r = _SC_XOPEN_ENH_I18N; return 0;}
6006 #else /* def _SC_XOPEN_ENH_I18N */
6007 {errno = EINVAL; return -1;}
6008 #endif /* ndef _SC_XOPEN_ENH_I18N */
6009 if (x == Mono_Posix_SysconfName__SC_XOPEN_LEGACY)
6010 #ifdef _SC_XOPEN_LEGACY
6011 {*r = _SC_XOPEN_LEGACY; return 0;}
6012 #else /* def _SC_XOPEN_LEGACY */
6013 {errno = EINVAL; return -1;}
6014 #endif /* ndef _SC_XOPEN_LEGACY */
6015 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME)
6016 #ifdef _SC_XOPEN_REALTIME
6017 {*r = _SC_XOPEN_REALTIME; return 0;}
6018 #else /* def _SC_XOPEN_REALTIME */
6019 {errno = EINVAL; return -1;}
6020 #endif /* ndef _SC_XOPEN_REALTIME */
6021 if (x == Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS)
6022 #ifdef _SC_XOPEN_REALTIME_THREADS
6023 {*r = _SC_XOPEN_REALTIME_THREADS; return 0;}
6024 #else /* def _SC_XOPEN_REALTIME_THREADS */
6025 {errno = EINVAL; return -1;}
6026 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6027 if (x == Mono_Posix_SysconfName__SC_XOPEN_SHM)
6028 #ifdef _SC_XOPEN_SHM
6029 {*r = _SC_XOPEN_SHM; return 0;}
6030 #else /* def _SC_XOPEN_SHM */
6031 {errno = EINVAL; return -1;}
6032 #endif /* ndef _SC_XOPEN_SHM */
6033 if (x == Mono_Posix_SysconfName__SC_XOPEN_UNIX)
6034 #ifdef _SC_XOPEN_UNIX
6035 {*r = _SC_XOPEN_UNIX; return 0;}
6036 #else /* def _SC_XOPEN_UNIX */
6037 {errno = EINVAL; return -1;}
6038 #endif /* ndef _SC_XOPEN_UNIX */
6039 if (x == Mono_Posix_SysconfName__SC_XOPEN_VERSION)
6040 #ifdef _SC_XOPEN_VERSION
6041 {*r = _SC_XOPEN_VERSION; return 0;}
6042 #else /* def _SC_XOPEN_VERSION */
6043 {errno = EINVAL; return -1;}
6044 #endif /* ndef _SC_XOPEN_VERSION */
6045 if (x == Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION)
6046 #ifdef _SC_XOPEN_XCU_VERSION
6047 {*r = _SC_XOPEN_XCU_VERSION; return 0;}
6048 #else /* def _SC_XOPEN_XCU_VERSION */
6049 {errno = EINVAL; return -1;}
6050 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6051 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG2)
6052 #ifdef _SC_XOPEN_XPG2
6053 {*r = _SC_XOPEN_XPG2; return 0;}
6054 #else /* def _SC_XOPEN_XPG2 */
6055 {errno = EINVAL; return -1;}
6056 #endif /* ndef _SC_XOPEN_XPG2 */
6057 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG3)
6058 #ifdef _SC_XOPEN_XPG3
6059 {*r = _SC_XOPEN_XPG3; return 0;}
6060 #else /* def _SC_XOPEN_XPG3 */
6061 {errno = EINVAL; return -1;}
6062 #endif /* ndef _SC_XOPEN_XPG3 */
6063 if (x == Mono_Posix_SysconfName__SC_XOPEN_XPG4)
6064 #ifdef _SC_XOPEN_XPG4
6065 {*r = _SC_XOPEN_XPG4; return 0;}
6066 #else /* def _SC_XOPEN_XPG4 */
6067 {errno = EINVAL; return -1;}
6068 #endif /* ndef _SC_XOPEN_XPG4 */
6069 if (x == 0)
6070 return 0;
6071 errno = EINVAL; return -1;
6074 int Mono_Posix_ToSysconfName (int x, int *r)
6076 *r = 0;
6077 if (x == 0)
6078 return 0;
6079 #ifdef _SC_2_CHAR_TERM
6080 if (x == _SC_2_CHAR_TERM)
6081 {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
6082 #endif /* ndef _SC_2_CHAR_TERM */
6083 #ifdef _SC_2_C_BIND
6084 if (x == _SC_2_C_BIND)
6085 {*r = Mono_Posix_SysconfName__SC_2_C_BIND; return 0;}
6086 #endif /* ndef _SC_2_C_BIND */
6087 #ifdef _SC_2_C_DEV
6088 if (x == _SC_2_C_DEV)
6089 {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
6090 #endif /* ndef _SC_2_C_DEV */
6091 #ifdef _SC_2_C_VERSION
6092 if (x == _SC_2_C_VERSION)
6093 {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
6094 #endif /* ndef _SC_2_C_VERSION */
6095 #ifdef _SC_2_FORT_DEV
6096 if (x == _SC_2_FORT_DEV)
6097 {*r = Mono_Posix_SysconfName__SC_2_FORT_DEV; return 0;}
6098 #endif /* ndef _SC_2_FORT_DEV */
6099 #ifdef _SC_2_FORT_RUN
6100 if (x == _SC_2_FORT_RUN)
6101 {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
6102 #endif /* ndef _SC_2_FORT_RUN */
6103 #ifdef _SC_2_LOCALEDEF
6104 if (x == _SC_2_LOCALEDEF)
6105 {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
6106 #endif /* ndef _SC_2_LOCALEDEF */
6107 #ifdef _SC_2_PBS
6108 if (x == _SC_2_PBS)
6109 {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
6110 #endif /* ndef _SC_2_PBS */
6111 #ifdef _SC_2_PBS_ACCOUNTING
6112 if (x == _SC_2_PBS_ACCOUNTING)
6113 {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
6114 #endif /* ndef _SC_2_PBS_ACCOUNTING */
6115 #ifdef _SC_2_PBS_CHECKPOINT
6116 if (x == _SC_2_PBS_CHECKPOINT)
6117 {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
6118 #endif /* ndef _SC_2_PBS_CHECKPOINT */
6119 #ifdef _SC_2_PBS_LOCATE
6120 if (x == _SC_2_PBS_LOCATE)
6121 {*r = Mono_Posix_SysconfName__SC_2_PBS_LOCATE; return 0;}
6122 #endif /* ndef _SC_2_PBS_LOCATE */
6123 #ifdef _SC_2_PBS_MESSAGE
6124 if (x == _SC_2_PBS_MESSAGE)
6125 {*r = Mono_Posix_SysconfName__SC_2_PBS_MESSAGE; return 0;}
6126 #endif /* ndef _SC_2_PBS_MESSAGE */
6127 #ifdef _SC_2_PBS_TRACK
6128 if (x == _SC_2_PBS_TRACK)
6129 {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
6130 #endif /* ndef _SC_2_PBS_TRACK */
6131 #ifdef _SC_2_SW_DEV
6132 if (x == _SC_2_SW_DEV)
6133 {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
6134 #endif /* ndef _SC_2_SW_DEV */
6135 #ifdef _SC_2_UPE
6136 if (x == _SC_2_UPE)
6137 {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
6138 #endif /* ndef _SC_2_UPE */
6139 #ifdef _SC_2_VERSION
6140 if (x == _SC_2_VERSION)
6141 {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
6142 #endif /* ndef _SC_2_VERSION */
6143 #ifdef _SC_ADVISORY_INFO
6144 if (x == _SC_ADVISORY_INFO)
6145 {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
6146 #endif /* ndef _SC_ADVISORY_INFO */
6147 #ifdef _SC_AIO_LISTIO_MAX
6148 if (x == _SC_AIO_LISTIO_MAX)
6149 {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
6150 #endif /* ndef _SC_AIO_LISTIO_MAX */
6151 #ifdef _SC_AIO_MAX
6152 if (x == _SC_AIO_MAX)
6153 {*r = Mono_Posix_SysconfName__SC_AIO_MAX; return 0;}
6154 #endif /* ndef _SC_AIO_MAX */
6155 #ifdef _SC_AIO_PRIO_DELTA_MAX
6156 if (x == _SC_AIO_PRIO_DELTA_MAX)
6157 {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
6158 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
6159 #ifdef _SC_ARG_MAX
6160 if (x == _SC_ARG_MAX)
6161 {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
6162 #endif /* ndef _SC_ARG_MAX */
6163 #ifdef _SC_ASYNCHRONOUS_IO
6164 if (x == _SC_ASYNCHRONOUS_IO)
6165 {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
6166 #endif /* ndef _SC_ASYNCHRONOUS_IO */
6167 #ifdef _SC_ATEXIT_MAX
6168 if (x == _SC_ATEXIT_MAX)
6169 {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
6170 #endif /* ndef _SC_ATEXIT_MAX */
6171 #ifdef _SC_AVPHYS_PAGES
6172 if (x == _SC_AVPHYS_PAGES)
6173 {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
6174 #endif /* ndef _SC_AVPHYS_PAGES */
6175 #ifdef _SC_BARRIERS
6176 if (x == _SC_BARRIERS)
6177 {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
6178 #endif /* ndef _SC_BARRIERS */
6179 #ifdef _SC_BASE
6180 if (x == _SC_BASE)
6181 {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
6182 #endif /* ndef _SC_BASE */
6183 #ifdef _SC_BC_BASE_MAX
6184 if (x == _SC_BC_BASE_MAX)
6185 {*r = Mono_Posix_SysconfName__SC_BC_BASE_MAX; return 0;}
6186 #endif /* ndef _SC_BC_BASE_MAX */
6187 #ifdef _SC_BC_DIM_MAX
6188 if (x == _SC_BC_DIM_MAX)
6189 {*r = Mono_Posix_SysconfName__SC_BC_DIM_MAX; return 0;}
6190 #endif /* ndef _SC_BC_DIM_MAX */
6191 #ifdef _SC_BC_SCALE_MAX
6192 if (x == _SC_BC_SCALE_MAX)
6193 {*r = Mono_Posix_SysconfName__SC_BC_SCALE_MAX; return 0;}
6194 #endif /* ndef _SC_BC_SCALE_MAX */
6195 #ifdef _SC_BC_STRING_MAX
6196 if (x == _SC_BC_STRING_MAX)
6197 {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
6198 #endif /* ndef _SC_BC_STRING_MAX */
6199 #ifdef _SC_CHARCLASS_NAME_MAX
6200 if (x == _SC_CHARCLASS_NAME_MAX)
6201 {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
6202 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
6203 #ifdef _SC_CHAR_BIT
6204 if (x == _SC_CHAR_BIT)
6205 {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
6206 #endif /* ndef _SC_CHAR_BIT */
6207 #ifdef _SC_CHAR_MAX
6208 if (x == _SC_CHAR_MAX)
6209 {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
6210 #endif /* ndef _SC_CHAR_MAX */
6211 #ifdef _SC_CHAR_MIN
6212 if (x == _SC_CHAR_MIN)
6213 {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
6214 #endif /* ndef _SC_CHAR_MIN */
6215 #ifdef _SC_CHILD_MAX
6216 if (x == _SC_CHILD_MAX)
6217 {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
6218 #endif /* ndef _SC_CHILD_MAX */
6219 #ifdef _SC_CLK_TCK
6220 if (x == _SC_CLK_TCK)
6221 {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
6222 #endif /* ndef _SC_CLK_TCK */
6223 #ifdef _SC_CLOCK_SELECTION
6224 if (x == _SC_CLOCK_SELECTION)
6225 {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
6226 #endif /* ndef _SC_CLOCK_SELECTION */
6227 #ifdef _SC_COLL_WEIGHTS_MAX
6228 if (x == _SC_COLL_WEIGHTS_MAX)
6229 {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
6230 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
6231 #ifdef _SC_CPUTIME
6232 if (x == _SC_CPUTIME)
6233 {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
6234 #endif /* ndef _SC_CPUTIME */
6235 #ifdef _SC_C_LANG_SUPPORT
6236 if (x == _SC_C_LANG_SUPPORT)
6237 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT; return 0;}
6238 #endif /* ndef _SC_C_LANG_SUPPORT */
6239 #ifdef _SC_C_LANG_SUPPORT_R
6240 if (x == _SC_C_LANG_SUPPORT_R)
6241 {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
6242 #endif /* ndef _SC_C_LANG_SUPPORT_R */
6243 #ifdef _SC_DELAYTIMER_MAX
6244 if (x == _SC_DELAYTIMER_MAX)
6245 {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
6246 #endif /* ndef _SC_DELAYTIMER_MAX */
6247 #ifdef _SC_DEVICE_IO
6248 if (x == _SC_DEVICE_IO)
6249 {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
6250 #endif /* ndef _SC_DEVICE_IO */
6251 #ifdef _SC_DEVICE_SPECIFIC
6252 if (x == _SC_DEVICE_SPECIFIC)
6253 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
6254 #endif /* ndef _SC_DEVICE_SPECIFIC */
6255 #ifdef _SC_DEVICE_SPECIFIC_R
6256 if (x == _SC_DEVICE_SPECIFIC_R)
6257 {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
6258 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
6259 #ifdef _SC_EQUIV_CLASS_MAX
6260 if (x == _SC_EQUIV_CLASS_MAX)
6261 {*r = Mono_Posix_SysconfName__SC_EQUIV_CLASS_MAX; return 0;}
6262 #endif /* ndef _SC_EQUIV_CLASS_MAX */
6263 #ifdef _SC_EXPR_NEST_MAX
6264 if (x == _SC_EXPR_NEST_MAX)
6265 {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
6266 #endif /* ndef _SC_EXPR_NEST_MAX */
6267 #ifdef _SC_FD_MGMT
6268 if (x == _SC_FD_MGMT)
6269 {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
6270 #endif /* ndef _SC_FD_MGMT */
6271 #ifdef _SC_FIFO
6272 if (x == _SC_FIFO)
6273 {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
6274 #endif /* ndef _SC_FIFO */
6275 #ifdef _SC_FILE_ATTRIBUTES
6276 if (x == _SC_FILE_ATTRIBUTES)
6277 {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
6278 #endif /* ndef _SC_FILE_ATTRIBUTES */
6279 #ifdef _SC_FILE_LOCKING
6280 if (x == _SC_FILE_LOCKING)
6281 {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
6282 #endif /* ndef _SC_FILE_LOCKING */
6283 #ifdef _SC_FILE_SYSTEM
6284 if (x == _SC_FILE_SYSTEM)
6285 {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
6286 #endif /* ndef _SC_FILE_SYSTEM */
6287 #ifdef _SC_FSYNC
6288 if (x == _SC_FSYNC)
6289 {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
6290 #endif /* ndef _SC_FSYNC */
6291 #ifdef _SC_GETGR_R_SIZE_MAX
6292 if (x == _SC_GETGR_R_SIZE_MAX)
6293 {*r = Mono_Posix_SysconfName__SC_GETGR_R_SIZE_MAX; return 0;}
6294 #endif /* ndef _SC_GETGR_R_SIZE_MAX */
6295 #ifdef _SC_GETPW_R_SIZE_MAX
6296 if (x == _SC_GETPW_R_SIZE_MAX)
6297 {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
6298 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
6299 #ifdef _SC_HOST_NAME_MAX
6300 if (x == _SC_HOST_NAME_MAX)
6301 {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
6302 #endif /* ndef _SC_HOST_NAME_MAX */
6303 #ifdef _SC_INT_MAX
6304 if (x == _SC_INT_MAX)
6305 {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
6306 #endif /* ndef _SC_INT_MAX */
6307 #ifdef _SC_INT_MIN
6308 if (x == _SC_INT_MIN)
6309 {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
6310 #endif /* ndef _SC_INT_MIN */
6311 #ifdef _SC_IOV_MAX
6312 if (x == _SC_IOV_MAX)
6313 {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
6314 #endif /* ndef _SC_IOV_MAX */
6315 #ifdef _SC_JOB_CONTROL
6316 if (x == _SC_JOB_CONTROL)
6317 {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
6318 #endif /* ndef _SC_JOB_CONTROL */
6319 #ifdef _SC_LEVEL1_DCACHE_ASSOC
6320 if (x == _SC_LEVEL1_DCACHE_ASSOC)
6321 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_ASSOC; return 0;}
6322 #endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */
6323 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
6324 if (x == _SC_LEVEL1_DCACHE_LINESIZE)
6325 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
6326 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
6327 #ifdef _SC_LEVEL1_DCACHE_SIZE
6328 if (x == _SC_LEVEL1_DCACHE_SIZE)
6329 {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
6330 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
6331 #ifdef _SC_LEVEL1_ICACHE_ASSOC
6332 if (x == _SC_LEVEL1_ICACHE_ASSOC)
6333 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_ASSOC; return 0;}
6334 #endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */
6335 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
6336 if (x == _SC_LEVEL1_ICACHE_LINESIZE)
6337 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
6338 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
6339 #ifdef _SC_LEVEL1_ICACHE_SIZE
6340 if (x == _SC_LEVEL1_ICACHE_SIZE)
6341 {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
6342 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
6343 #ifdef _SC_LEVEL2_CACHE_ASSOC
6344 if (x == _SC_LEVEL2_CACHE_ASSOC)
6345 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_ASSOC; return 0;}
6346 #endif /* ndef _SC_LEVEL2_CACHE_ASSOC */
6347 #ifdef _SC_LEVEL2_CACHE_LINESIZE
6348 if (x == _SC_LEVEL2_CACHE_LINESIZE)
6349 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
6350 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
6351 #ifdef _SC_LEVEL2_CACHE_SIZE
6352 if (x == _SC_LEVEL2_CACHE_SIZE)
6353 {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
6354 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
6355 #ifdef _SC_LEVEL3_CACHE_ASSOC
6356 if (x == _SC_LEVEL3_CACHE_ASSOC)
6357 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_ASSOC; return 0;}
6358 #endif /* ndef _SC_LEVEL3_CACHE_ASSOC */
6359 #ifdef _SC_LEVEL3_CACHE_LINESIZE
6360 if (x == _SC_LEVEL3_CACHE_LINESIZE)
6361 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
6362 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
6363 #ifdef _SC_LEVEL3_CACHE_SIZE
6364 if (x == _SC_LEVEL3_CACHE_SIZE)
6365 {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
6366 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
6367 #ifdef _SC_LEVEL4_CACHE_ASSOC
6368 if (x == _SC_LEVEL4_CACHE_ASSOC)
6369 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_ASSOC; return 0;}
6370 #endif /* ndef _SC_LEVEL4_CACHE_ASSOC */
6371 #ifdef _SC_LEVEL4_CACHE_LINESIZE
6372 if (x == _SC_LEVEL4_CACHE_LINESIZE)
6373 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
6374 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
6375 #ifdef _SC_LEVEL4_CACHE_SIZE
6376 if (x == _SC_LEVEL4_CACHE_SIZE)
6377 {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
6378 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
6379 #ifdef _SC_LINE_MAX
6380 if (x == _SC_LINE_MAX)
6381 {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
6382 #endif /* ndef _SC_LINE_MAX */
6383 #ifdef _SC_LOGIN_NAME_MAX
6384 if (x == _SC_LOGIN_NAME_MAX)
6385 {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
6386 #endif /* ndef _SC_LOGIN_NAME_MAX */
6387 #ifdef _SC_LONG_BIT
6388 if (x == _SC_LONG_BIT)
6389 {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
6390 #endif /* ndef _SC_LONG_BIT */
6391 #ifdef _SC_MAPPED_FILES
6392 if (x == _SC_MAPPED_FILES)
6393 {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
6394 #endif /* ndef _SC_MAPPED_FILES */
6395 #ifdef _SC_MB_LEN_MAX
6396 if (x == _SC_MB_LEN_MAX)
6397 {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
6398 #endif /* ndef _SC_MB_LEN_MAX */
6399 #ifdef _SC_MEMLOCK
6400 if (x == _SC_MEMLOCK)
6401 {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
6402 #endif /* ndef _SC_MEMLOCK */
6403 #ifdef _SC_MEMLOCK_RANGE
6404 if (x == _SC_MEMLOCK_RANGE)
6405 {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
6406 #endif /* ndef _SC_MEMLOCK_RANGE */
6407 #ifdef _SC_MEMORY_PROTECTION
6408 if (x == _SC_MEMORY_PROTECTION)
6409 {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
6410 #endif /* ndef _SC_MEMORY_PROTECTION */
6411 #ifdef _SC_MESSAGE_PASSING
6412 if (x == _SC_MESSAGE_PASSING)
6413 {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
6414 #endif /* ndef _SC_MESSAGE_PASSING */
6415 #ifdef _SC_MONOTONIC_CLOCK
6416 if (x == _SC_MONOTONIC_CLOCK)
6417 {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
6418 #endif /* ndef _SC_MONOTONIC_CLOCK */
6419 #ifdef _SC_MQ_OPEN_MAX
6420 if (x == _SC_MQ_OPEN_MAX)
6421 {*r = Mono_Posix_SysconfName__SC_MQ_OPEN_MAX; return 0;}
6422 #endif /* ndef _SC_MQ_OPEN_MAX */
6423 #ifdef _SC_MQ_PRIO_MAX
6424 if (x == _SC_MQ_PRIO_MAX)
6425 {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
6426 #endif /* ndef _SC_MQ_PRIO_MAX */
6427 #ifdef _SC_MULTI_PROCESS
6428 if (x == _SC_MULTI_PROCESS)
6429 {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
6430 #endif /* ndef _SC_MULTI_PROCESS */
6431 #ifdef _SC_NETWORKING
6432 if (x == _SC_NETWORKING)
6433 {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
6434 #endif /* ndef _SC_NETWORKING */
6435 #ifdef _SC_NGROUPS_MAX
6436 if (x == _SC_NGROUPS_MAX)
6437 {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
6438 #endif /* ndef _SC_NGROUPS_MAX */
6439 #ifdef _SC_NL_ARGMAX
6440 if (x == _SC_NL_ARGMAX)
6441 {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
6442 #endif /* ndef _SC_NL_ARGMAX */
6443 #ifdef _SC_NL_LANGMAX
6444 if (x == _SC_NL_LANGMAX)
6445 {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
6446 #endif /* ndef _SC_NL_LANGMAX */
6447 #ifdef _SC_NL_MSGMAX
6448 if (x == _SC_NL_MSGMAX)
6449 {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
6450 #endif /* ndef _SC_NL_MSGMAX */
6451 #ifdef _SC_NL_NMAX
6452 if (x == _SC_NL_NMAX)
6453 {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
6454 #endif /* ndef _SC_NL_NMAX */
6455 #ifdef _SC_NL_SETMAX
6456 if (x == _SC_NL_SETMAX)
6457 {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
6458 #endif /* ndef _SC_NL_SETMAX */
6459 #ifdef _SC_NL_TEXTMAX
6460 if (x == _SC_NL_TEXTMAX)
6461 {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
6462 #endif /* ndef _SC_NL_TEXTMAX */
6463 #ifdef _SC_NPROCESSORS_CONF
6464 if (x == _SC_NPROCESSORS_CONF)
6465 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
6466 #endif /* ndef _SC_NPROCESSORS_CONF */
6467 #ifdef _SC_NPROCESSORS_ONLN
6468 if (x == _SC_NPROCESSORS_ONLN)
6469 {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
6470 #endif /* ndef _SC_NPROCESSORS_ONLN */
6471 #ifdef _SC_NZERO
6472 if (x == _SC_NZERO)
6473 {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
6474 #endif /* ndef _SC_NZERO */
6475 #ifdef _SC_OPEN_MAX
6476 if (x == _SC_OPEN_MAX)
6477 {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
6478 #endif /* ndef _SC_OPEN_MAX */
6479 #ifdef _SC_PAGESIZE
6480 if (x == _SC_PAGESIZE)
6481 {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
6482 #endif /* ndef _SC_PAGESIZE */
6483 #ifdef _SC_PASS_MAX
6484 if (x == _SC_PASS_MAX)
6485 {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
6486 #endif /* ndef _SC_PASS_MAX */
6487 #ifdef _SC_PHYS_PAGES
6488 if (x == _SC_PHYS_PAGES)
6489 {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
6490 #endif /* ndef _SC_PHYS_PAGES */
6491 #ifdef _SC_PII
6492 if (x == _SC_PII)
6493 {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
6494 #endif /* ndef _SC_PII */
6495 #ifdef _SC_PII_INTERNET
6496 if (x == _SC_PII_INTERNET)
6497 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
6498 #endif /* ndef _SC_PII_INTERNET */
6499 #ifdef _SC_PII_INTERNET_DGRAM
6500 if (x == _SC_PII_INTERNET_DGRAM)
6501 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
6502 #endif /* ndef _SC_PII_INTERNET_DGRAM */
6503 #ifdef _SC_PII_INTERNET_STREAM
6504 if (x == _SC_PII_INTERNET_STREAM)
6505 {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
6506 #endif /* ndef _SC_PII_INTERNET_STREAM */
6507 #ifdef _SC_PII_OSI
6508 if (x == _SC_PII_OSI)
6509 {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
6510 #endif /* ndef _SC_PII_OSI */
6511 #ifdef _SC_PII_OSI_CLTS
6512 if (x == _SC_PII_OSI_CLTS)
6513 {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
6514 #endif /* ndef _SC_PII_OSI_CLTS */
6515 #ifdef _SC_PII_OSI_COTS
6516 if (x == _SC_PII_OSI_COTS)
6517 {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
6518 #endif /* ndef _SC_PII_OSI_COTS */
6519 #ifdef _SC_PII_OSI_M
6520 if (x == _SC_PII_OSI_M)
6521 {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
6522 #endif /* ndef _SC_PII_OSI_M */
6523 #ifdef _SC_PII_SOCKET
6524 if (x == _SC_PII_SOCKET)
6525 {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
6526 #endif /* ndef _SC_PII_SOCKET */
6527 #ifdef _SC_PII_XTI
6528 if (x == _SC_PII_XTI)
6529 {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
6530 #endif /* ndef _SC_PII_XTI */
6531 #ifdef _SC_PIPE
6532 if (x == _SC_PIPE)
6533 {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
6534 #endif /* ndef _SC_PIPE */
6535 #ifdef _SC_POLL
6536 if (x == _SC_POLL)
6537 {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
6538 #endif /* ndef _SC_POLL */
6539 #ifdef _SC_PRIORITIZED_IO
6540 if (x == _SC_PRIORITIZED_IO)
6541 {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
6542 #endif /* ndef _SC_PRIORITIZED_IO */
6543 #ifdef _SC_PRIORITY_SCHEDULING
6544 if (x == _SC_PRIORITY_SCHEDULING)
6545 {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
6546 #endif /* ndef _SC_PRIORITY_SCHEDULING */
6547 #ifdef _SC_READER_WRITER_LOCKS
6548 if (x == _SC_READER_WRITER_LOCKS)
6549 {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
6550 #endif /* ndef _SC_READER_WRITER_LOCKS */
6551 #ifdef _SC_REALTIME_SIGNALS
6552 if (x == _SC_REALTIME_SIGNALS)
6553 {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
6554 #endif /* ndef _SC_REALTIME_SIGNALS */
6555 #ifdef _SC_REGEXP
6556 if (x == _SC_REGEXP)
6557 {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
6558 #endif /* ndef _SC_REGEXP */
6559 #ifdef _SC_REGEX_VERSION
6560 if (x == _SC_REGEX_VERSION)
6561 {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
6562 #endif /* ndef _SC_REGEX_VERSION */
6563 #ifdef _SC_RE_DUP_MAX
6564 if (x == _SC_RE_DUP_MAX)
6565 {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
6566 #endif /* ndef _SC_RE_DUP_MAX */
6567 #ifdef _SC_RTSIG_MAX
6568 if (x == _SC_RTSIG_MAX)
6569 {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
6570 #endif /* ndef _SC_RTSIG_MAX */
6571 #ifdef _SC_SAVED_IDS
6572 if (x == _SC_SAVED_IDS)
6573 {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
6574 #endif /* ndef _SC_SAVED_IDS */
6575 #ifdef _SC_SCHAR_MAX
6576 if (x == _SC_SCHAR_MAX)
6577 {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
6578 #endif /* ndef _SC_SCHAR_MAX */
6579 #ifdef _SC_SCHAR_MIN
6580 if (x == _SC_SCHAR_MIN)
6581 {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
6582 #endif /* ndef _SC_SCHAR_MIN */
6583 #ifdef _SC_SELECT
6584 if (x == _SC_SELECT)
6585 {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
6586 #endif /* ndef _SC_SELECT */
6587 #ifdef _SC_SEMAPHORES
6588 if (x == _SC_SEMAPHORES)
6589 {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
6590 #endif /* ndef _SC_SEMAPHORES */
6591 #ifdef _SC_SEM_NSEMS_MAX
6592 if (x == _SC_SEM_NSEMS_MAX)
6593 {*r = Mono_Posix_SysconfName__SC_SEM_NSEMS_MAX; return 0;}
6594 #endif /* ndef _SC_SEM_NSEMS_MAX */
6595 #ifdef _SC_SEM_VALUE_MAX
6596 if (x == _SC_SEM_VALUE_MAX)
6597 {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
6598 #endif /* ndef _SC_SEM_VALUE_MAX */
6599 #ifdef _SC_SHARED_MEMORY_OBJECTS
6600 if (x == _SC_SHARED_MEMORY_OBJECTS)
6601 {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
6602 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
6603 #ifdef _SC_SHELL
6604 if (x == _SC_SHELL)
6605 {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
6606 #endif /* ndef _SC_SHELL */
6607 #ifdef _SC_SHRT_MAX
6608 if (x == _SC_SHRT_MAX)
6609 {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
6610 #endif /* ndef _SC_SHRT_MAX */
6611 #ifdef _SC_SHRT_MIN
6612 if (x == _SC_SHRT_MIN)
6613 {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
6614 #endif /* ndef _SC_SHRT_MIN */
6615 #ifdef _SC_SIGNALS
6616 if (x == _SC_SIGNALS)
6617 {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
6618 #endif /* ndef _SC_SIGNALS */
6619 #ifdef _SC_SIGQUEUE_MAX
6620 if (x == _SC_SIGQUEUE_MAX)
6621 {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
6622 #endif /* ndef _SC_SIGQUEUE_MAX */
6623 #ifdef _SC_SINGLE_PROCESS
6624 if (x == _SC_SINGLE_PROCESS)
6625 {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
6626 #endif /* ndef _SC_SINGLE_PROCESS */
6627 #ifdef _SC_SPAWN
6628 if (x == _SC_SPAWN)
6629 {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
6630 #endif /* ndef _SC_SPAWN */
6631 #ifdef _SC_SPIN_LOCKS
6632 if (x == _SC_SPIN_LOCKS)
6633 {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
6634 #endif /* ndef _SC_SPIN_LOCKS */
6635 #ifdef _SC_SPORADIC_SERVER
6636 if (x == _SC_SPORADIC_SERVER)
6637 {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
6638 #endif /* ndef _SC_SPORADIC_SERVER */
6639 #ifdef _SC_SSIZE_MAX
6640 if (x == _SC_SSIZE_MAX)
6641 {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
6642 #endif /* ndef _SC_SSIZE_MAX */
6643 #ifdef _SC_STREAMS
6644 if (x == _SC_STREAMS)
6645 {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
6646 #endif /* ndef _SC_STREAMS */
6647 #ifdef _SC_STREAM_MAX
6648 if (x == _SC_STREAM_MAX)
6649 {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
6650 #endif /* ndef _SC_STREAM_MAX */
6651 #ifdef _SC_SYMLOOP_MAX
6652 if (x == _SC_SYMLOOP_MAX)
6653 {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
6654 #endif /* ndef _SC_SYMLOOP_MAX */
6655 #ifdef _SC_SYNCHRONIZED_IO
6656 if (x == _SC_SYNCHRONIZED_IO)
6657 {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
6658 #endif /* ndef _SC_SYNCHRONIZED_IO */
6659 #ifdef _SC_SYSTEM_DATABASE
6660 if (x == _SC_SYSTEM_DATABASE)
6661 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
6662 #endif /* ndef _SC_SYSTEM_DATABASE */
6663 #ifdef _SC_SYSTEM_DATABASE_R
6664 if (x == _SC_SYSTEM_DATABASE_R)
6665 {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
6666 #endif /* ndef _SC_SYSTEM_DATABASE_R */
6667 #ifdef _SC_THREADS
6668 if (x == _SC_THREADS)
6669 {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
6670 #endif /* ndef _SC_THREADS */
6671 #ifdef _SC_THREAD_ATTR_STACKADDR
6672 if (x == _SC_THREAD_ATTR_STACKADDR)
6673 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKADDR; return 0;}
6674 #endif /* ndef _SC_THREAD_ATTR_STACKADDR */
6675 #ifdef _SC_THREAD_ATTR_STACKSIZE
6676 if (x == _SC_THREAD_ATTR_STACKSIZE)
6677 {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
6678 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
6679 #ifdef _SC_THREAD_CPUTIME
6680 if (x == _SC_THREAD_CPUTIME)
6681 {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
6682 #endif /* ndef _SC_THREAD_CPUTIME */
6683 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
6684 if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
6685 {*r = Mono_Posix_SysconfName__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
6686 #endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */
6687 #ifdef _SC_THREAD_KEYS_MAX
6688 if (x == _SC_THREAD_KEYS_MAX)
6689 {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
6690 #endif /* ndef _SC_THREAD_KEYS_MAX */
6691 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
6692 if (x == _SC_THREAD_PRIORITY_SCHEDULING)
6693 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
6694 #endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */
6695 #ifdef _SC_THREAD_PRIO_INHERIT
6696 if (x == _SC_THREAD_PRIO_INHERIT)
6697 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_INHERIT; return 0;}
6698 #endif /* ndef _SC_THREAD_PRIO_INHERIT */
6699 #ifdef _SC_THREAD_PRIO_PROTECT
6700 if (x == _SC_THREAD_PRIO_PROTECT)
6701 {*r = Mono_Posix_SysconfName__SC_THREAD_PRIO_PROTECT; return 0;}
6702 #endif /* ndef _SC_THREAD_PRIO_PROTECT */
6703 #ifdef _SC_THREAD_PROCESS_SHARED
6704 if (x == _SC_THREAD_PROCESS_SHARED)
6705 {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
6706 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
6707 #ifdef _SC_THREAD_SAFE_FUNCTIONS
6708 if (x == _SC_THREAD_SAFE_FUNCTIONS)
6709 {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
6710 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
6711 #ifdef _SC_THREAD_SPORADIC_SERVER
6712 if (x == _SC_THREAD_SPORADIC_SERVER)
6713 {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
6714 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
6715 #ifdef _SC_THREAD_STACK_MIN
6716 if (x == _SC_THREAD_STACK_MIN)
6717 {*r = Mono_Posix_SysconfName__SC_THREAD_STACK_MIN; return 0;}
6718 #endif /* ndef _SC_THREAD_STACK_MIN */
6719 #ifdef _SC_THREAD_THREADS_MAX
6720 if (x == _SC_THREAD_THREADS_MAX)
6721 {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
6722 #endif /* ndef _SC_THREAD_THREADS_MAX */
6723 #ifdef _SC_TIMEOUTS
6724 if (x == _SC_TIMEOUTS)
6725 {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
6726 #endif /* ndef _SC_TIMEOUTS */
6727 #ifdef _SC_TIMERS
6728 if (x == _SC_TIMERS)
6729 {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
6730 #endif /* ndef _SC_TIMERS */
6731 #ifdef _SC_TIMER_MAX
6732 if (x == _SC_TIMER_MAX)
6733 {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
6734 #endif /* ndef _SC_TIMER_MAX */
6735 #ifdef _SC_TRACE
6736 if (x == _SC_TRACE)
6737 {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
6738 #endif /* ndef _SC_TRACE */
6739 #ifdef _SC_TRACE_EVENT_FILTER
6740 if (x == _SC_TRACE_EVENT_FILTER)
6741 {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
6742 #endif /* ndef _SC_TRACE_EVENT_FILTER */
6743 #ifdef _SC_TRACE_INHERIT
6744 if (x == _SC_TRACE_INHERIT)
6745 {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
6746 #endif /* ndef _SC_TRACE_INHERIT */
6747 #ifdef _SC_TRACE_LOG
6748 if (x == _SC_TRACE_LOG)
6749 {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
6750 #endif /* ndef _SC_TRACE_LOG */
6751 #ifdef _SC_TTY_NAME_MAX
6752 if (x == _SC_TTY_NAME_MAX)
6753 {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
6754 #endif /* ndef _SC_TTY_NAME_MAX */
6755 #ifdef _SC_TYPED_MEMORY_OBJECTS
6756 if (x == _SC_TYPED_MEMORY_OBJECTS)
6757 {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
6758 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
6759 #ifdef _SC_TZNAME_MAX
6760 if (x == _SC_TZNAME_MAX)
6761 {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
6762 #endif /* ndef _SC_TZNAME_MAX */
6763 #ifdef _SC_T_IOV_MAX
6764 if (x == _SC_T_IOV_MAX)
6765 {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
6766 #endif /* ndef _SC_T_IOV_MAX */
6767 #ifdef _SC_UCHAR_MAX
6768 if (x == _SC_UCHAR_MAX)
6769 {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
6770 #endif /* ndef _SC_UCHAR_MAX */
6771 #ifdef _SC_UINT_MAX
6772 if (x == _SC_UINT_MAX)
6773 {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
6774 #endif /* ndef _SC_UINT_MAX */
6775 #ifdef _SC_UIO_MAXIOV
6776 if (x == _SC_UIO_MAXIOV)
6777 {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
6778 #endif /* ndef _SC_UIO_MAXIOV */
6779 #ifdef _SC_ULONG_MAX
6780 if (x == _SC_ULONG_MAX)
6781 {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
6782 #endif /* ndef _SC_ULONG_MAX */
6783 #ifdef _SC_USER_GROUPS
6784 if (x == _SC_USER_GROUPS)
6785 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
6786 #endif /* ndef _SC_USER_GROUPS */
6787 #ifdef _SC_USER_GROUPS_R
6788 if (x == _SC_USER_GROUPS_R)
6789 {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
6790 #endif /* ndef _SC_USER_GROUPS_R */
6791 #ifdef _SC_USHRT_MAX
6792 if (x == _SC_USHRT_MAX)
6793 {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
6794 #endif /* ndef _SC_USHRT_MAX */
6795 #ifdef _SC_V6_ILP32_OFF32
6796 if (x == _SC_V6_ILP32_OFF32)
6797 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFF32; return 0;}
6798 #endif /* ndef _SC_V6_ILP32_OFF32 */
6799 #ifdef _SC_V6_ILP32_OFFBIG
6800 if (x == _SC_V6_ILP32_OFFBIG)
6801 {*r = Mono_Posix_SysconfName__SC_V6_ILP32_OFFBIG; return 0;}
6802 #endif /* ndef _SC_V6_ILP32_OFFBIG */
6803 #ifdef _SC_V6_LP64_OFF64
6804 if (x == _SC_V6_LP64_OFF64)
6805 {*r = Mono_Posix_SysconfName__SC_V6_LP64_OFF64; return 0;}
6806 #endif /* ndef _SC_V6_LP64_OFF64 */
6807 #ifdef _SC_V6_LPBIG_OFFBIG
6808 if (x == _SC_V6_LPBIG_OFFBIG)
6809 {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
6810 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
6811 #ifdef _SC_VERSION
6812 if (x == _SC_VERSION)
6813 {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
6814 #endif /* ndef _SC_VERSION */
6815 #ifdef _SC_WORD_BIT
6816 if (x == _SC_WORD_BIT)
6817 {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
6818 #endif /* ndef _SC_WORD_BIT */
6819 #ifdef _SC_XBS5_ILP32_OFF32
6820 if (x == _SC_XBS5_ILP32_OFF32)
6821 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFF32; return 0;}
6822 #endif /* ndef _SC_XBS5_ILP32_OFF32 */
6823 #ifdef _SC_XBS5_ILP32_OFFBIG
6824 if (x == _SC_XBS5_ILP32_OFFBIG)
6825 {*r = Mono_Posix_SysconfName__SC_XBS5_ILP32_OFFBIG; return 0;}
6826 #endif /* ndef _SC_XBS5_ILP32_OFFBIG */
6827 #ifdef _SC_XBS5_LP64_OFF64
6828 if (x == _SC_XBS5_LP64_OFF64)
6829 {*r = Mono_Posix_SysconfName__SC_XBS5_LP64_OFF64; return 0;}
6830 #endif /* ndef _SC_XBS5_LP64_OFF64 */
6831 #ifdef _SC_XBS5_LPBIG_OFFBIG
6832 if (x == _SC_XBS5_LPBIG_OFFBIG)
6833 {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
6834 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
6835 #ifdef _SC_XOPEN_CRYPT
6836 if (x == _SC_XOPEN_CRYPT)
6837 {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
6838 #endif /* ndef _SC_XOPEN_CRYPT */
6839 #ifdef _SC_XOPEN_ENH_I18N
6840 if (x == _SC_XOPEN_ENH_I18N)
6841 {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
6842 #endif /* ndef _SC_XOPEN_ENH_I18N */
6843 #ifdef _SC_XOPEN_LEGACY
6844 if (x == _SC_XOPEN_LEGACY)
6845 {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
6846 #endif /* ndef _SC_XOPEN_LEGACY */
6847 #ifdef _SC_XOPEN_REALTIME
6848 if (x == _SC_XOPEN_REALTIME)
6849 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
6850 #endif /* ndef _SC_XOPEN_REALTIME */
6851 #ifdef _SC_XOPEN_REALTIME_THREADS
6852 if (x == _SC_XOPEN_REALTIME_THREADS)
6853 {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
6854 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
6855 #ifdef _SC_XOPEN_SHM
6856 if (x == _SC_XOPEN_SHM)
6857 {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
6858 #endif /* ndef _SC_XOPEN_SHM */
6859 #ifdef _SC_XOPEN_UNIX
6860 if (x == _SC_XOPEN_UNIX)
6861 {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
6862 #endif /* ndef _SC_XOPEN_UNIX */
6863 #ifdef _SC_XOPEN_VERSION
6864 if (x == _SC_XOPEN_VERSION)
6865 {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
6866 #endif /* ndef _SC_XOPEN_VERSION */
6867 #ifdef _SC_XOPEN_XCU_VERSION
6868 if (x == _SC_XOPEN_XCU_VERSION)
6869 {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
6870 #endif /* ndef _SC_XOPEN_XCU_VERSION */
6871 #ifdef _SC_XOPEN_XPG2
6872 if (x == _SC_XOPEN_XPG2)
6873 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
6874 #endif /* ndef _SC_XOPEN_XPG2 */
6875 #ifdef _SC_XOPEN_XPG3
6876 if (x == _SC_XOPEN_XPG3)
6877 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
6878 #endif /* ndef _SC_XOPEN_XPG3 */
6879 #ifdef _SC_XOPEN_XPG4
6880 if (x == _SC_XOPEN_XPG4)
6881 {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
6882 #endif /* ndef _SC_XOPEN_XPG4 */
6883 errno = EINVAL; return -1;
6886 int Mono_Posix_FromSyslogFacility (int x, int *r)
6888 *r = 0;
6889 if (x == Mono_Posix_SyslogFacility_LOG_AUTH)
6890 #ifdef LOG_AUTH
6891 {*r = LOG_AUTH; return 0;}
6892 #else /* def LOG_AUTH */
6893 {errno = EINVAL; return -1;}
6894 #endif /* ndef LOG_AUTH */
6895 if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
6896 #ifdef LOG_AUTHPRIV
6897 {*r = LOG_AUTHPRIV; return 0;}
6898 #else /* def LOG_AUTHPRIV */
6899 {errno = EINVAL; return -1;}
6900 #endif /* ndef LOG_AUTHPRIV */
6901 if (x == Mono_Posix_SyslogFacility_LOG_CRON)
6902 #ifdef LOG_CRON
6903 {*r = LOG_CRON; return 0;}
6904 #else /* def LOG_CRON */
6905 {errno = EINVAL; return -1;}
6906 #endif /* ndef LOG_CRON */
6907 if (x == Mono_Posix_SyslogFacility_LOG_DAEMON)
6908 #ifdef LOG_DAEMON
6909 {*r = LOG_DAEMON; return 0;}
6910 #else /* def LOG_DAEMON */
6911 {errno = EINVAL; return -1;}
6912 #endif /* ndef LOG_DAEMON */
6913 if (x == Mono_Posix_SyslogFacility_LOG_FTP)
6914 #ifdef LOG_FTP
6915 {*r = LOG_FTP; return 0;}
6916 #else /* def LOG_FTP */
6917 {errno = EINVAL; return -1;}
6918 #endif /* ndef LOG_FTP */
6919 if (x == Mono_Posix_SyslogFacility_LOG_KERN)
6920 #ifdef LOG_KERN
6921 {*r = LOG_KERN; return 0;}
6922 #else /* def LOG_KERN */
6923 {errno = EINVAL; return -1;}
6924 #endif /* ndef LOG_KERN */
6925 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0)
6926 #ifdef LOG_LOCAL0
6927 {*r = LOG_LOCAL0; return 0;}
6928 #else /* def LOG_LOCAL0 */
6929 {errno = EINVAL; return -1;}
6930 #endif /* ndef LOG_LOCAL0 */
6931 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1)
6932 #ifdef LOG_LOCAL1
6933 {*r = LOG_LOCAL1; return 0;}
6934 #else /* def LOG_LOCAL1 */
6935 {errno = EINVAL; return -1;}
6936 #endif /* ndef LOG_LOCAL1 */
6937 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2)
6938 #ifdef LOG_LOCAL2
6939 {*r = LOG_LOCAL2; return 0;}
6940 #else /* def LOG_LOCAL2 */
6941 {errno = EINVAL; return -1;}
6942 #endif /* ndef LOG_LOCAL2 */
6943 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3)
6944 #ifdef LOG_LOCAL3
6945 {*r = LOG_LOCAL3; return 0;}
6946 #else /* def LOG_LOCAL3 */
6947 {errno = EINVAL; return -1;}
6948 #endif /* ndef LOG_LOCAL3 */
6949 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4)
6950 #ifdef LOG_LOCAL4
6951 {*r = LOG_LOCAL4; return 0;}
6952 #else /* def LOG_LOCAL4 */
6953 {errno = EINVAL; return -1;}
6954 #endif /* ndef LOG_LOCAL4 */
6955 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5)
6956 #ifdef LOG_LOCAL5
6957 {*r = LOG_LOCAL5; return 0;}
6958 #else /* def LOG_LOCAL5 */
6959 {errno = EINVAL; return -1;}
6960 #endif /* ndef LOG_LOCAL5 */
6961 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6)
6962 #ifdef LOG_LOCAL6
6963 {*r = LOG_LOCAL6; return 0;}
6964 #else /* def LOG_LOCAL6 */
6965 {errno = EINVAL; return -1;}
6966 #endif /* ndef LOG_LOCAL6 */
6967 if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7)
6968 #ifdef LOG_LOCAL7
6969 {*r = LOG_LOCAL7; return 0;}
6970 #else /* def LOG_LOCAL7 */
6971 {errno = EINVAL; return -1;}
6972 #endif /* ndef LOG_LOCAL7 */
6973 if (x == Mono_Posix_SyslogFacility_LOG_LPR)
6974 #ifdef LOG_LPR
6975 {*r = LOG_LPR; return 0;}
6976 #else /* def LOG_LPR */
6977 {errno = EINVAL; return -1;}
6978 #endif /* ndef LOG_LPR */
6979 if (x == Mono_Posix_SyslogFacility_LOG_MAIL)
6980 #ifdef LOG_MAIL
6981 {*r = LOG_MAIL; return 0;}
6982 #else /* def LOG_MAIL */
6983 {errno = EINVAL; return -1;}
6984 #endif /* ndef LOG_MAIL */
6985 if (x == Mono_Posix_SyslogFacility_LOG_NEWS)
6986 #ifdef LOG_NEWS
6987 {*r = LOG_NEWS; return 0;}
6988 #else /* def LOG_NEWS */
6989 {errno = EINVAL; return -1;}
6990 #endif /* ndef LOG_NEWS */
6991 if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG)
6992 #ifdef LOG_SYSLOG
6993 {*r = LOG_SYSLOG; return 0;}
6994 #else /* def LOG_SYSLOG */
6995 {errno = EINVAL; return -1;}
6996 #endif /* ndef LOG_SYSLOG */
6997 if (x == Mono_Posix_SyslogFacility_LOG_USER)
6998 #ifdef LOG_USER
6999 {*r = LOG_USER; return 0;}
7000 #else /* def LOG_USER */
7001 {errno = EINVAL; return -1;}
7002 #endif /* ndef LOG_USER */
7003 if (x == Mono_Posix_SyslogFacility_LOG_UUCP)
7004 #ifdef LOG_UUCP
7005 {*r = LOG_UUCP; return 0;}
7006 #else /* def LOG_UUCP */
7007 {errno = EINVAL; return -1;}
7008 #endif /* ndef LOG_UUCP */
7009 if (x == 0)
7010 return 0;
7011 errno = EINVAL; return -1;
7014 int Mono_Posix_ToSyslogFacility (int x, int *r)
7016 *r = 0;
7017 if (x == 0)
7018 return 0;
7019 #ifdef LOG_AUTH
7020 if (x == LOG_AUTH)
7021 {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
7022 #endif /* ndef LOG_AUTH */
7023 #ifdef LOG_AUTHPRIV
7024 if (x == LOG_AUTHPRIV)
7025 {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
7026 #endif /* ndef LOG_AUTHPRIV */
7027 #ifdef LOG_CRON
7028 if (x == LOG_CRON)
7029 {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
7030 #endif /* ndef LOG_CRON */
7031 #ifdef LOG_DAEMON
7032 if (x == LOG_DAEMON)
7033 {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
7034 #endif /* ndef LOG_DAEMON */
7035 #ifdef LOG_FTP
7036 if (x == LOG_FTP)
7037 {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
7038 #endif /* ndef LOG_FTP */
7039 #ifdef LOG_KERN
7040 if (x == LOG_KERN)
7041 {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
7042 #endif /* ndef LOG_KERN */
7043 #ifdef LOG_LOCAL0
7044 if (x == LOG_LOCAL0)
7045 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;}
7046 #endif /* ndef LOG_LOCAL0 */
7047 #ifdef LOG_LOCAL1
7048 if (x == LOG_LOCAL1)
7049 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;}
7050 #endif /* ndef LOG_LOCAL1 */
7051 #ifdef LOG_LOCAL2
7052 if (x == LOG_LOCAL2)
7053 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;}
7054 #endif /* ndef LOG_LOCAL2 */
7055 #ifdef LOG_LOCAL3
7056 if (x == LOG_LOCAL3)
7057 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;}
7058 #endif /* ndef LOG_LOCAL3 */
7059 #ifdef LOG_LOCAL4
7060 if (x == LOG_LOCAL4)
7061 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;}
7062 #endif /* ndef LOG_LOCAL4 */
7063 #ifdef LOG_LOCAL5
7064 if (x == LOG_LOCAL5)
7065 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;}
7066 #endif /* ndef LOG_LOCAL5 */
7067 #ifdef LOG_LOCAL6
7068 if (x == LOG_LOCAL6)
7069 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;}
7070 #endif /* ndef LOG_LOCAL6 */
7071 #ifdef LOG_LOCAL7
7072 if (x == LOG_LOCAL7)
7073 {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;}
7074 #endif /* ndef LOG_LOCAL7 */
7075 #ifdef LOG_LPR
7076 if (x == LOG_LPR)
7077 {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
7078 #endif /* ndef LOG_LPR */
7079 #ifdef LOG_MAIL
7080 if (x == LOG_MAIL)
7081 {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
7082 #endif /* ndef LOG_MAIL */
7083 #ifdef LOG_NEWS
7084 if (x == LOG_NEWS)
7085 {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
7086 #endif /* ndef LOG_NEWS */
7087 #ifdef LOG_SYSLOG
7088 if (x == LOG_SYSLOG)
7089 {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
7090 #endif /* ndef LOG_SYSLOG */
7091 #ifdef LOG_USER
7092 if (x == LOG_USER)
7093 {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
7094 #endif /* ndef LOG_USER */
7095 #ifdef LOG_UUCP
7096 if (x == LOG_UUCP)
7097 {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
7098 #endif /* ndef LOG_UUCP */
7099 errno = EINVAL; return -1;
7102 int Mono_Posix_FromSyslogLevel (int x, int *r)
7104 *r = 0;
7105 if (x == Mono_Posix_SyslogLevel_LOG_ALERT)
7106 #ifdef LOG_ALERT
7107 {*r = LOG_ALERT; return 0;}
7108 #else /* def LOG_ALERT */
7109 {errno = EINVAL; return -1;}
7110 #endif /* ndef LOG_ALERT */
7111 if (x == Mono_Posix_SyslogLevel_LOG_CRIT)
7112 #ifdef LOG_CRIT
7113 {*r = LOG_CRIT; return 0;}
7114 #else /* def LOG_CRIT */
7115 {errno = EINVAL; return -1;}
7116 #endif /* ndef LOG_CRIT */
7117 if (x == Mono_Posix_SyslogLevel_LOG_DEBUG)
7118 #ifdef LOG_DEBUG
7119 {*r = LOG_DEBUG; return 0;}
7120 #else /* def LOG_DEBUG */
7121 {errno = EINVAL; return -1;}
7122 #endif /* ndef LOG_DEBUG */
7123 if (x == Mono_Posix_SyslogLevel_LOG_EMERG)
7124 #ifdef LOG_EMERG
7125 {*r = LOG_EMERG; return 0;}
7126 #else /* def LOG_EMERG */
7127 {errno = EINVAL; return -1;}
7128 #endif /* ndef LOG_EMERG */
7129 if (x == Mono_Posix_SyslogLevel_LOG_ERR)
7130 #ifdef LOG_ERR
7131 {*r = LOG_ERR; return 0;}
7132 #else /* def LOG_ERR */
7133 {errno = EINVAL; return -1;}
7134 #endif /* ndef LOG_ERR */
7135 if (x == Mono_Posix_SyslogLevel_LOG_INFO)
7136 #ifdef LOG_INFO
7137 {*r = LOG_INFO; return 0;}
7138 #else /* def LOG_INFO */
7139 {errno = EINVAL; return -1;}
7140 #endif /* ndef LOG_INFO */
7141 if (x == Mono_Posix_SyslogLevel_LOG_NOTICE)
7142 #ifdef LOG_NOTICE
7143 {*r = LOG_NOTICE; return 0;}
7144 #else /* def LOG_NOTICE */
7145 {errno = EINVAL; return -1;}
7146 #endif /* ndef LOG_NOTICE */
7147 if (x == Mono_Posix_SyslogLevel_LOG_WARNING)
7148 #ifdef LOG_WARNING
7149 {*r = LOG_WARNING; return 0;}
7150 #else /* def LOG_WARNING */
7151 {errno = EINVAL; return -1;}
7152 #endif /* ndef LOG_WARNING */
7153 if (x == 0)
7154 return 0;
7155 errno = EINVAL; return -1;
7158 int Mono_Posix_ToSyslogLevel (int x, int *r)
7160 *r = 0;
7161 if (x == 0)
7162 return 0;
7163 #ifdef LOG_ALERT
7164 if (x == LOG_ALERT)
7165 {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;}
7166 #endif /* ndef LOG_ALERT */
7167 #ifdef LOG_CRIT
7168 if (x == LOG_CRIT)
7169 {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;}
7170 #endif /* ndef LOG_CRIT */
7171 #ifdef LOG_DEBUG
7172 if (x == LOG_DEBUG)
7173 {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
7174 #endif /* ndef LOG_DEBUG */
7175 #ifdef LOG_EMERG
7176 if (x == LOG_EMERG)
7177 {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
7178 #endif /* ndef LOG_EMERG */
7179 #ifdef LOG_ERR
7180 if (x == LOG_ERR)
7181 {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
7182 #endif /* ndef LOG_ERR */
7183 #ifdef LOG_INFO
7184 if (x == LOG_INFO)
7185 {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
7186 #endif /* ndef LOG_INFO */
7187 #ifdef LOG_NOTICE
7188 if (x == LOG_NOTICE)
7189 {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
7190 #endif /* ndef LOG_NOTICE */
7191 #ifdef LOG_WARNING
7192 if (x == LOG_WARNING)
7193 {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
7194 #endif /* ndef LOG_WARNING */
7195 errno = EINVAL; return -1;
7198 int Mono_Posix_FromSyslogOptions (int x, int *r)
7200 *r = 0;
7201 if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
7202 #ifdef LOG_CONS
7203 *r |= LOG_CONS;
7204 #else /* def LOG_CONS */
7205 {errno = EINVAL; return -1;}
7206 #endif /* ndef LOG_CONS */
7207 if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
7208 #ifdef LOG_NDELAY
7209 *r |= LOG_NDELAY;
7210 #else /* def LOG_NDELAY */
7211 {errno = EINVAL; return -1;}
7212 #endif /* ndef LOG_NDELAY */
7213 if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
7214 #ifdef LOG_NOWAIT
7215 *r |= LOG_NOWAIT;
7216 #else /* def LOG_NOWAIT */
7217 {errno = EINVAL; return -1;}
7218 #endif /* ndef LOG_NOWAIT */
7219 if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
7220 #ifdef LOG_ODELAY
7221 *r |= LOG_ODELAY;
7222 #else /* def LOG_ODELAY */
7223 {errno = EINVAL; return -1;}
7224 #endif /* ndef LOG_ODELAY */
7225 if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
7226 #ifdef LOG_PERROR
7227 *r |= LOG_PERROR;
7228 #else /* def LOG_PERROR */
7229 {errno = EINVAL; return -1;}
7230 #endif /* ndef LOG_PERROR */
7231 if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
7232 #ifdef LOG_PID
7233 *r |= LOG_PID;
7234 #else /* def LOG_PID */
7235 {errno = EINVAL; return -1;}
7236 #endif /* ndef LOG_PID */
7237 if (x == 0)
7238 return 0;
7239 return 0;
7242 int Mono_Posix_ToSyslogOptions (int x, int *r)
7244 *r = 0;
7245 if (x == 0)
7246 return 0;
7247 #ifdef LOG_CONS
7248 if ((x & LOG_CONS) == LOG_CONS)
7249 *r |= Mono_Posix_SyslogOptions_LOG_CONS;
7250 #endif /* ndef LOG_CONS */
7251 #ifdef LOG_NDELAY
7252 if ((x & LOG_NDELAY) == LOG_NDELAY)
7253 *r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
7254 #endif /* ndef LOG_NDELAY */
7255 #ifdef LOG_NOWAIT
7256 if ((x & LOG_NOWAIT) == LOG_NOWAIT)
7257 *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
7258 #endif /* ndef LOG_NOWAIT */
7259 #ifdef LOG_ODELAY
7260 if ((x & LOG_ODELAY) == LOG_ODELAY)
7261 *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
7262 #endif /* ndef LOG_ODELAY */
7263 #ifdef LOG_PERROR
7264 if ((x & LOG_PERROR) == LOG_PERROR)
7265 *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
7266 #endif /* ndef LOG_PERROR */
7267 #ifdef LOG_PID
7268 if ((x & LOG_PID) == LOG_PID)
7269 *r |= Mono_Posix_SyslogOptions_LOG_PID;
7270 #endif /* ndef LOG_PID */
7271 return 0;
7274 #ifdef HAVE_STRUCT_TIMESPEC
7276 Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
7278 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7279 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7281 memset (to, 0, sizeof(*to));
7283 to->tv_sec = from->tv_sec;
7284 to->tv_nsec = from->tv_nsec;
7286 return 0;
7288 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7291 #ifdef HAVE_STRUCT_TIMESPEC
7293 Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
7295 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7296 _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
7298 memset (to, 0, sizeof(*to));
7300 to->tv_sec = from->tv_sec;
7301 to->tv_nsec = from->tv_nsec;
7303 return 0;
7305 #endif /* ndef HAVE_STRUCT_TIMESPEC */
7308 #ifdef HAVE_STRUCT_TIMEVAL
7310 Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
7312 _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
7313 _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
7315 memset (to, 0, sizeof(*to));
7317 to->tv_sec = from->tv_sec;
7318 to->tv_usec = from->tv_usec;
7320 return 0;
7322 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7325 #ifdef HAVE_STRUCT_TIMEVAL
7327 Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
7329 _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
7330 _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
7332 memset (to, 0, sizeof(*to));
7334 to->tv_sec = from->tv_sec;
7335 to->tv_usec = from->tv_usec;
7337 return 0;
7339 #endif /* ndef HAVE_STRUCT_TIMEVAL */
7342 #ifdef HAVE_STRUCT_TIMEZONE
7344 Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
7346 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7347 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7349 memset (to, 0, sizeof(*to));
7351 to->tz_minuteswest = from->tz_minuteswest;
7352 to->tz_dsttime = from->tz_dsttime;
7354 return 0;
7356 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7359 #ifdef HAVE_STRUCT_TIMEZONE
7361 Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
7363 _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
7364 _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
7366 memset (to, 0, sizeof(*to));
7368 to->tz_minuteswest = from->tz_minuteswest;
7369 to->tz_dsttime = from->tz_dsttime;
7371 return 0;
7373 #endif /* ndef HAVE_STRUCT_TIMEZONE */
7376 #ifdef HAVE_STRUCT_UTIMBUF
7378 Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
7380 _cnm_return_val_if_overflow (time_t, from->actime, -1);
7381 _cnm_return_val_if_overflow (time_t, from->modtime, -1);
7383 memset (to, 0, sizeof(*to));
7385 to->actime = from->actime;
7386 to->modtime = from->modtime;
7388 return 0;
7390 #endif /* ndef HAVE_STRUCT_UTIMBUF */
7393 #ifdef HAVE_STRUCT_UTIMBUF
7395 Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
7397 _cnm_return_val_if_overflow (gint64, from->actime, -1);
7398 _cnm_return_val_if_overflow (gint64, from->modtime, -1);
7400 memset (to, 0, sizeof(*to));
7402 to->actime = from->actime;
7403 to->modtime = from->modtime;
7405 return 0;
7407 #endif /* ndef HAVE_STRUCT_UTIMBUF */
7410 int Mono_Posix_FromWaitOptions (int x, int *r)
7412 *r = 0;
7413 if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
7414 #ifdef WNOHANG
7415 *r |= WNOHANG;
7416 #else /* def WNOHANG */
7417 {errno = EINVAL; return -1;}
7418 #endif /* ndef WNOHANG */
7419 if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
7420 #ifdef WUNTRACED
7421 *r |= WUNTRACED;
7422 #else /* def WUNTRACED */
7423 {errno = EINVAL; return -1;}
7424 #endif /* ndef WUNTRACED */
7425 if (x == 0)
7426 return 0;
7427 return 0;
7430 int Mono_Posix_ToWaitOptions (int x, int *r)
7432 *r = 0;
7433 if (x == 0)
7434 return 0;
7435 #ifdef WNOHANG
7436 if ((x & WNOHANG) == WNOHANG)
7437 *r |= Mono_Posix_WaitOptions_WNOHANG;
7438 #endif /* ndef WNOHANG */
7439 #ifdef WUNTRACED
7440 if ((x & WUNTRACED) == WUNTRACED)
7441 *r |= Mono_Posix_WaitOptions_WUNTRACED;
7442 #endif /* ndef WUNTRACED */
7443 return 0;
7446 int Mono_Posix_FromXattrFlags (int x, int *r)
7448 *r = 0;
7449 if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO)
7450 #ifdef XATTR_AUTO
7451 *r |= XATTR_AUTO;
7452 #else /* def XATTR_AUTO */
7453 {errno = EINVAL; return -1;}
7454 #endif /* ndef XATTR_AUTO */
7455 if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE)
7456 #ifdef XATTR_CREATE
7457 *r |= XATTR_CREATE;
7458 #else /* def XATTR_CREATE */
7459 {errno = EINVAL; return -1;}
7460 #endif /* ndef XATTR_CREATE */
7461 if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE)
7462 #ifdef XATTR_REPLACE
7463 *r |= XATTR_REPLACE;
7464 #else /* def XATTR_REPLACE */
7465 {errno = EINVAL; return -1;}
7466 #endif /* ndef XATTR_REPLACE */
7467 if (x == 0)
7468 return 0;
7469 return 0;
7472 int Mono_Posix_ToXattrFlags (int x, int *r)
7474 *r = 0;
7475 if (x == 0)
7476 return 0;
7477 #ifdef XATTR_AUTO
7478 if ((x & XATTR_AUTO) == XATTR_AUTO)
7479 *r |= Mono_Posix_XattrFlags_XATTR_AUTO;
7480 #endif /* ndef XATTR_AUTO */
7481 #ifdef XATTR_CREATE
7482 if ((x & XATTR_CREATE) == XATTR_CREATE)
7483 *r |= Mono_Posix_XattrFlags_XATTR_CREATE;
7484 #endif /* ndef XATTR_CREATE */
7485 #ifdef XATTR_REPLACE
7486 if ((x & XATTR_REPLACE) == XATTR_REPLACE)
7487 *r |= Mono_Posix_XattrFlags_XATTR_REPLACE;
7488 #endif /* ndef XATTR_REPLACE */
7489 return 0;