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