From 93a903adc101fb01b5e014e84153cc86da5178e8 Mon Sep 17 00:00:00 2001 From: Gonzalo Paniagua Javier Date: Tue, 4 Oct 2005 21:46:46 +0000 Subject: [PATCH] svn path=/branches/mono-1-1-9/mono/; revision=51215 --- support/ChangeLog | 433 --- support/Makefile.am | 91 - support/dirent.c | 105 - support/errno.c | 121 - support/fcntl.c | 160 - support/fstab.c | 331 -- support/grp.c | 294 -- support/macros.c | 146 - support/map-icalls.h | 235 -- support/map.c | 6490 ---------------------------------------- support/map.h | 701 ----- support/mph.h | 161 - support/old-map.c | 178 -- support/old-map.h | 71 - support/pwd.c | 250 -- support/serial.c | 249 -- support/signal.c | 42 - support/stdio.c | 214 -- support/stdlib.c | 71 - support/supportw.c | 230 -- support/supportw.h | 12 - support/sys-mman.c | 148 - support/sys-sendfile.c | 43 - support/sys-stat.c | 126 - support/sys-statvfs.c | 187 -- support/sys-time.c | 102 - support/sys-wait.c | 60 - support/sys-xattr.c | 627 ---- support/time.c | 56 - support/unistd.c | 239 -- support/utime.c | 42 - support/x-struct-str.c | 92 - support/zlib_macros.c | 112 - 33 files changed, 12419 deletions(-) delete mode 100644 support/ChangeLog delete mode 100644 support/Makefile.am delete mode 100644 support/dirent.c delete mode 100644 support/errno.c delete mode 100644 support/fcntl.c delete mode 100644 support/fstab.c delete mode 100644 support/grp.c delete mode 100644 support/macros.c delete mode 100644 support/map-icalls.h delete mode 100644 support/map.c delete mode 100644 support/map.h delete mode 100644 support/mph.h delete mode 100644 support/old-map.c delete mode 100644 support/old-map.h delete mode 100644 support/pwd.c delete mode 100644 support/serial.c delete mode 100644 support/signal.c delete mode 100644 support/stdio.c delete mode 100644 support/stdlib.c delete mode 100644 support/supportw.c delete mode 100644 support/supportw.h delete mode 100644 support/sys-mman.c delete mode 100644 support/sys-sendfile.c delete mode 100644 support/sys-stat.c delete mode 100644 support/sys-statvfs.c delete mode 100644 support/sys-time.c delete mode 100644 support/sys-wait.c delete mode 100644 support/sys-xattr.c delete mode 100644 support/time.c delete mode 100644 support/unistd.c delete mode 100644 support/utime.c delete mode 100644 support/x-struct-str.c delete mode 100644 support/zlib_macros.c diff --git a/support/ChangeLog b/support/ChangeLog deleted file mode 100644 index a9087a62a6a..00000000000 --- a/support/ChangeLog +++ /dev/null @@ -1,433 +0,0 @@ -2005-07-12 Daniel Drake - - * sys-xattr.c: Use if does not exist (e.g. for - glibc 2.2) - * Makefile.am: Link to libattr if libc does not provide the xattr - syscalls. - -Thu Jul 7 12:35:20 EDT 2005 Paolo Molaro - - *supportw.c, Makefile.am: remove calls and link to libmono/libwapi. - -2005-07-01 Daniel Drake - - * sys-xattr.c: Support FreeBSD's extattr implementation. Slight API rework - to provide transparency between Linux and FreeBSD EA's. - * map-icalls.h: Update as above - -2005-06-30 Gonzalo Paniagua Javier - - * supportw.c: HeapDestroy. - * Makefile.am: don't build supportw on windows. - -2005-06-29 Ben Maurer - - * Makefile.am: namespace our library. - -2005-06-29 Gonzalo Paniagua Javier - - * supportw.c: - * supportw.h: - * Makefile.am: new library intended to provide often P/Invoked windows - API functions not present in io-layer. - -2005-06-29 Jonathan Pryor - - * map.c: Handle Syslog-related changes (SyslogFacility isn't a - [Flags] enum); make-map.exe changes. - -2005-06-28 Jonathan Pryor - - * map.c, map.h: Handle Syslog-related changes (SyslogLevel isn't a [Flags] - enum; change in order between LOG_USER and LOG_USRE). - -2005-06-27 Jonathan Pryor - - * map.c, map.h: Add corrected spelling of LOG_USER. - -2005-06-13 Miguel de Icaza - - * sys-statvfs.c (copy_statfs): f_flags is the field name on BSD, - not f_flag. - -2005-06-08 Jonathan Pryor - - * Makefile.am: Create an unversioned library. We won't make any gaurantees - about ABI stability until Mono 1.2 (if then). - -2005-06-07 Jonathan Pryor - - * sys-mman.c: Check for presence of mremap and remap_file_pages. - -2005-06-05 Jonathan Pryor - - * map-icalls.h, map.h: Change header comment so it matches what - `make refresh` generates. - * map.c: Add header. - -2005-05-31 Jonathan Pryor - - * sys-mman.c: Add wrappers for mmap, munmap, mprotect, msync, mlock, - munlock, mremap, mincore, remap_file_pages. - * map-icalls.h: Update to latest shared interface. - * map.c, map.h: Add {To,From} pairs for MmapFlags, MmapProt, MsyncFlags, - MlockallFlags, MremapFlags. - * mph.h: Add mph_return_*_if_ssize_t_overflow macros. - -2005-05-31 Jonathan Pryor - - * unistd.c: Oops -- deal with s/LockFlags/LockfCommand/ change. - -2005-05-31 Jonathan Pryor - - * map.h, map.c, map-icalls.h: Rename LockFlags to LockfCommand. - -2005-05-20 Zoltan Varga - - * Makefile.am (MPH_C_SOURCE): Add map-icalls.h. Fixes #75012. - -2005-05-18 Jonathan Pryor - - * map-icalls.h: Added; auto-generated file which contains Mono_Posix_* - declarations for DllImport functions in Mono.Posix.dll. This ensure - consistency between Mono.Posix.dll and MonoPosixHelper.so. - * mph.h: Add include for map-icalls.h, to ensure that all MonoPosixHelper - exports have correct prototypes. - * dirent.c, grp.c, macros.c, pwd.c, signal.c, stdio.c, sys-stat.c, - sys-time.c, utime.c: Correct prototypes to match map-icalls.h. Alas, this - "loses" information -- FILE* becomes void*, etc. -- but no semantics or - ABI should be changed (except for Mono_Posix_Syscall_utime). Some - structure names also changed to match the generated names; since the - structures are private, this shouldn't break anything. - * errno.c: Remove Mono_Posix_Syscall_SetLastError so we don't get a warning - about a missing prototype. This was never in a stable release. - * old-map.c: Include mph.h for prototype checking. - * unistd.c: SeekFlags conversion is now done in managed code so that a short - isn't passed as a parameter; Correct prototypes to match map-icalls.h. - * sys-xattr.c: fix lsetxattr/fsetxattr confusion; Correct prototypes to - match map-icalls.h. - * sys-sendfile.c: Move mph.h include so that HAVE_SYS_SENDFILE_H is used. - * sys-wait.c: Include mph.h so that prototypes are checked. - -2005-05-16 Jonathan Pryor - - * sys-statvfs.c: Include "map.h" for Mono_Posix_ToMountFlags prototype. - * map.c: Include so Mono_Posix_{To,From}MountFlags actually - does something useful. - -2005-05-12 Jonathan Pryor - - * map.c, map.h: Add FromMountFlags, ToMountFlags. (MountFlags is used in - `struct statvfs', which is POSIX). - * sys-statvfs.c: Use ToMountFlags to convert the OS flags value into the - managed equivalent. - -2005-05-03 Geoff Norton - - * sys-xattr.c: Mac OS/X Tiger supports xattr but has a different API for supporting - resource forks. Allow mono to build on Tiger. - -2005-04-30 Jonathan Pryor - - * stdio.c: Add Mono_Posix_Stdlib_DumpFilePosition, which create a hex string - "dump" of a fpos_t. This is used for Mono.Unix.FilePosition.ToString(). - -2005-04-19 Jonathan Pryor - - * map.c, map.h: Added XattrFlags values, functions. - * sys-xattr.c: Added; wrapper functions. Thanks to Daniel - Drake for writing these. - * Makefile.am: Add sys-xattr.c to the build. - -2005-04-07 Jonathan Pryor - - * errno.c: Use the GNU version of strerror_r if _GNU_SOURCE is defined - (otherwise assume existence of XPG variant). This allows proper - compilation under Red Hat 9. - * fstab.c: protect against users calling setfsent(), setfsent(), ... - endfsent(), which would otherwise leak a FILE handle. - -2005-04-05 Zoltan Varga - - * mph.h: Apply patch from the freebsd ports collection. - -2005-02-10 Zoltan Varga - - * zlib_macros.c (create_z_stream): Explicitly check for older versions - of zlib. - -2005-02-08 Zoltan Varga - - * pwd.c (Mono_Posix_Syscall_getpwnam_r): Add another part missing from the last patch. - -2005-02-07 Jonathan Pryor - - * grp.c: Oops. Didn't see other Solaris fix in #72292. - -2005-02-07 Jonathan Pryor - - * grp.c, pwd.c: Clear errno before calling the actual calls, as errno may - have a stale value, leading to spurious errors later. Fixes #72292. - -2005-02-03 Jonathan Pryor - - * Makefile.am (MPH_C_SOURCE): Move errno.c into MPH_C_SOURCE, so it's built - on Windows as well as Unix. - -2005-02-03 Jonathan Pryor - - * errno.c: Mono_Posix_Syscall_SetLastError should be in Stdlib, not Syscall, - since it's part of ANSI C (and errno will be used from StdioFileStream). - Add Mono_Posix_Stdlib_SetLastError. Don't remove the Syscall version, as - we don't want to break Mono 1.1.4/svn users the day after release. :-) - -2005-01-25 Jonathan Pryor - - * macros.c: Use gint64, not long, to match C# declaration. Fixes 71152. - -2005-01-23 Geoff Norton - - * dirent.c: Include to bring off_t in on gcc4.0+OSX - -2005-01-13 Jonathan Pryor - - * map.h: Correct Mono_Posix_OpenFlags values (they should now match - x86 linux); remove unused enumerations (MountFlags, etc.). - -2005-01-13 Jonathan Pryor - - * fstab.c: Fix HPUX support. HPUX includes both and - , so we need to give preference to . - -2005-01-05 Jonathan Pryor - - * fstab.c: Add support for HPUX, which uses . - -2005-01-05 Jonathan Pryor - - * map.c: Continuing my ineptitude... isn't on Win32. - * mph.h: Win32 doesn't define EOVERFLOW, either. Define it. - -2005-01-05 Jonathan Pryor - - * map.c: Include so we can check for PLATFORM_WIN32. - -2005-01-05 Jonathan Pryor - - * map.c: Fix Win32 build break. Win32 doesn't have all the sys/* headers. - -2005-01-05 Jonathan Pryor - - * serial.c: HPUX compiler fix. - * stdlib.c: Add C-defined macro wrappers. - -2005-01-04 Jonathan Pryor - - * stdio.c: Add wrapper for C99's snprintf(3). - -2005-01-04 Jonathan Pryor - - * Makefile.am: Rewrite. Remove configure-generated warnings about - multiple _LIBADD and _SOURCES lines. Add support for Win32. - Win32 support is limited to ANSI C functions. - * stdio.c: Don't compile Unix wrappers on Win32. - -2005-01-04 Raja R Harinath - - * Makefile.am (LIBS): Remove. Was overriding results of configure check. - (libMonoPosixHelper_la_LIBADD): List $(GLIB_LIBS) here. - -2005-01-04 Jonathan Pryor - - * Makefile.am: Add libnsl to LIBS. Hopefully this will let sparc link. - * mph.h: Make MPH_INTERNAL conditional on __GNUC__. - -2005-01-03 Jonathan Pryor - - * signal.c, stdio.c: Remove "function declaration isn't a prototype" warnings. - * unistd.c: Check for presence of gethostname and sethostname. - -2005-01-03 Jonathan Pryor - - * mph.h, x-struct-str.c: Add "const" to parameters to remove - "warning: passing arg [2|4]...discards qualifiers" message. - -2005-01-03 Jonathan Pryor - - * fstab.c: Remove some sparc compiler warnings. - -2005-01-03 Jonathan Pryor - - * fstab.c: Solaris doesn't support getfsent(3), but it provides equivalent - functionality in getvfsent(3C). Implement Solaris support. - -2005-01-02 Jonathan Pryor - - * stdio.c: More wrapper functions. I missed a few macros... This should - complete all macro's defined in for C99. - -2004-12-30 Jonathan Pryor - - * stdio.c: More wrapper functions. This should complete C89's - requirements. - -2004-12-30 Jonathan Pryor - - * sys-statvfs.c: Further proving that changing code without compiling is - dangerous business... Compiler fix for OS X. - -2004-12-30 Jonathan Pryor - - * signal.c: Mac OS X portability fixes -- it doesn't provide sighandler_t! - -2004-12-30 Jonathan Pryor - - * Makefile.am: Add signal.c to the build. - * signal.c: Added. Contains helper functions to wrap signal(2). - -2004-12-30 Jonathan Pryor - - * sys-statvfs.c: Fix Mac OS X build (statfs.f_frsize doesn't exist on OSX; - f_fsid isn't an integral type; fstatfs needs to use fpathconf). - -2004-12-29 Jonathan Pryor - - * unistd.c: Null-terminate the string returned by readlink(2). This works - around a marshaler "issue". - -2004-12-28 Jonathan Pryor - - * Makefile.am: Add GLIB_LIBS to the LIBS line, since we require linking - against glib-2.0 (to use g_assert()). - -2004-12-28 Jonathan Pryor - - * fstab.c: Added; wrap functions: getfsent(3), getfsfile(3), - getfsspec(3). - * map.c: Add new conversion functions for SyslogOptions, SyslogFacility, - SyslogLevel; see syslog(3) for details. - * map.h: Add new conversion functions and values for SyslogOptions, - SyslogFacility, SyslogLevel; see syslog(3) for details. - * Makefile.am (MPH_SOURCE): add fstab.c, sys-statvfs.c, x-struct-str.c. - * mph.h: Document location for Mac OS X man page documentation; add - MPH_INTERNAL macro for intra-library function calls (for functions that - shouldn't be exported from libMonoPosixHelper.so); declare - _mph_copy_structure_strings(). - * pwd.c: Use _mph_copy_structure_strings() to copy strings embedded within - struct passwd. - * sys-statvfs.c: Added; wrap functions statvfs(2), - fstatvfs(2), and (to complicate things) implement (f)statvfs(2) in terms - of (f)statfs(2) on Mac OS X (which lacks the -vfs calls). - * x-struct-str.c: implements _mph_copy_structure_strings(), which is a - generalized interface to copy strings between structures (as is needed in - pwd.c and fstab.c). - -Thu Dec 23 14:58:09 EST 2004 Paolo Molaro - - * serial.c: remove mono calls from here: they break the build - and they don't belong here. - -2004-12-21 Chris Toshok - - * serial.c: initial import of System.IO.Ports pinvoke stuff. - - * Makefile.am (MPH_SOURCE): add serial.c. - -2004-11-30 Jonathan Pryor - - * mph.h: Use , not , as the HP/UX compiler needs - to handle the `inline' keyword. - -2004-11-27 Miguel de Icaza - - * Makefile.am (MPH_SOURCE): Add macros.c for compatibility with - the old API (currently the old API would fail). - -2004-11-25 Raja R Harinath - - * Makefile.am (MPH_SOURCE): Distribute old-map.h and map.h. - -2004-11-18 Jonathan Pryor - - * stdio.c: Add fread(3) and fwrite(3) wrappers. - -2004-11-16 Jonathan Pryor - - * Makefile.am: Remove sys-mount.c from the build. - * sys-mount.c: Delete. We're not exporting mount-related functionality - anymore. It's not remotely portable, and trying to make it portable is a - doomed idea. - * map.c: Remove mount- and umount-related conversion functions. - -2004-11-14 Geoff Norton - - * mph.h: Revernt jonp's removal of MPH_ON_BSD define as sys-mount.c - and unistd.c still check this configuration value. This allows mono - to build on *BSD again. - -2004-11-12 Jonathan Pryor - - * dirent.c: Only access members which exist on the target - platform. - * errno.c: Only export strerror_r if it's available. - * mph.h: Remove MPH_ON_BSD; use the configure checks instead. - * sys-mman.c: Only export posix_madvise if it's available. - * unistd.c: Only export sethostid if it's available. - -2004-11-08 Jonathan Pryor - - * Makefile.am: Add sys-sendfile.c to the build. - * dirent.c, fcntl.c, unistd.c: Remove - compile-time checks for -64 apis (pread64, etc.), as they're - superfluous. GLibc #defines the functions to the appropriate - -64 counterpart when necessary, and Darwin is intrinsically - large-file-aware, so manual checking on my part is redundant and - unnecessary. - * grp.c: Add checks for non-portable functions getgrnam_r, - getgrgid_r. - * pwd.c: Add checks for non-portable functions getpwnam_r, - getpwuid_r. - * map.c: Remove include. Building on Tiger (Mac - OS X 10.4 beta) breaks when both and are - included, so only use . - * mph.h: Clean up macro handling for type overflow checking. - -2004-11-05 Jonathan Pryor - - * .cvsignore: Ignore generated files. - * Makefile.am: Add new INCLUDE directives (for glib - headers), source; bump library version (so we don't clobber - previous versions of libMonoPosixHelper.so). - * dirent.c: New file; wrapper functions; - BSD portability fixes. - * errno.c: New file; wrapper functions - * fcntl.c: New file; wrapper functions; - BSD portability fixes. - * grp.c: New file; wrapper functions; - BSD portability fixes. - * map.c: Updated macro mapping functions (more enums - mapped, more error checking, etc.). - * map.h: Updated macro mapping functions - * old-map.c: Previous map.c implementation, for backward - compatibility Remove spurious warning about redefining - _GNU_SOURCE. - * old-map.h: Previous map.h implementation, for backward - compatibility - * mph.h: New file; Utility types, macros; - BSD portability fixes. - * pwd.c: New file; wrapper functions; - BSD portability fixes. - * stdio.c: New file; wrapper functions - * stdlib.c: New file; wrapper functions - * sys-mman.c: New file; wrapper functions - * sys-mount.c: New file; wrapper functions; - BSD portability fixes. - * sys-sendfile.c: New file; wrapper - functions; BSD portability fixes. - * sys-stat.c: New file; wrapper functions - * sys-wait.c: New file; wrapper functions - * time.c: New file; wrapper functions; - BSD portability fixes. - * unistd.c: New file; wrapper functions; - BSD portability fixes. - diff --git a/support/Makefile.am b/support/Makefile.am deleted file mode 100644 index e798ad7da2d..00000000000 --- a/support/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -if PLATFORM_WIN32 -SUPPORT= -else -SUPPORT=libMonoSupportW.la -endif -lib_LTLIBRARIES = \ - libMonoPosixHelper.la \ - $(SUPPORT) - -INCLUDES = \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir) - -# Source code which helps implement the ANSI C standards, and thus *should* be -# portable to any platform having a C compiler. -MPH_C_SOURCE = \ - errno.c \ - map.c \ - map.h \ - mph.h \ - signal.c \ - stdio.c \ - stdlib.c \ - map-icalls.h - -# Source code which helps implement POSIX and other related Unix standards, -# and *may* be portable between Unix platforms. -MPH_UNIX_SOURCE = \ - dirent.c \ - fcntl.c \ - fstab.c \ - grp.c \ - macros.c \ - old-map.c \ - old-map.h \ - pwd.c \ - serial.c \ - sys-mman.c \ - sys-sendfile.c \ - sys-stat.c \ - sys-statvfs.c \ - sys-time.c \ - sys-wait.c \ - sys-xattr.c \ - time.c \ - unistd.c \ - utime.c \ - x-struct-str.c - -if PLATFORM_WIN32 -MPH_SOURCE = $(MPH_C_SOURCE) -MPH_LIBS = -else -MPH_SOURCE = $(MPH_C_SOURCE) $(MPH_UNIX_SOURCE) -MPH_LIBS = $(GLIB_LIBS) -endif - -if HAVE_ZLIB -Z_SOURCE = zlib_macros.c -Z_LIBS = -lz -else -Z_SOURCE = -Z_LIBS = -endif - -libMonoPosixHelper_la_SOURCES = \ - $(MPH_SOURCE) \ - $(Z_SOURCE) - -libMonoPosixHelper_la_LIBADD = \ - $(MPH_LIBS) \ - $(Z_LIBS) \ - $(XATTR_LIB) - -# libMonoPosixHelper_la_LDFLAGS = -no-undefined -version-info 1:0:1 -libMonoPosixHelper_la_LDFLAGS = -no-undefined -avoid-version -libMonoSupportW_la_LDFLAGS = -no-undefined -avoid-version - -libMonoSupportW_la_SOURCES = \ - supportw.c \ - supportw.h - -libMonoSupportW_la_LIBADD = \ - $(GLIB_LIBS) - -# -# Use this target to refresh the values in map.[ch] -# -refresh: - $(top_builddir)/runtime/mono-wrapper $(mcs_topdir)/class/Mono.Posix/Mono.Unix/make-map.exe $(mcs_topdir)/class/lib/default/Mono.Posix.dll map - diff --git a/support/dirent.c b/support/dirent.c deleted file mode 100644 index 11138f53c68..00000000000 --- a/support/dirent.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include -#include -#include -#include - -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Syscall__Dirent { - /* ino_t */ mph_ino_t d_ino; - /* off_t */ mph_off_t d_off; - /* ushort */ unsigned short d_reclen; - /* byte */ unsigned char d_type; - /* string */ char *d_name; -}; - -gint32 -Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset) -{ - mph_return_if_off_t_overflow (offset); - - errno = 0; - - seekdir ((DIR*) dir, (off_t) offset); - - return errno != 0; -} - -mph_off_t -Mono_Posix_Syscall_telldir (void *dir) -{ - return telldir ((DIR*) dir); -} - -static void -copy_dirent (struct Mono_Posix_Syscall__Dirent *to, struct dirent *from) -{ - memset (to, 0, sizeof(*to)); - - to->d_ino = from->d_ino; - to->d_name = strdup (from->d_name); - -#ifdef HAVE_STRUCT_DIRENT_D_OFF - to->d_off = from->d_off; -#endif -#ifdef HAVE_STRUCT_DIRENT_D_RECLEN - to->d_reclen = from->d_reclen; -#endif -#ifdef HAVE_STRUCT_DIRENT_D_TYPE - to->d_type = from->d_type; -#endif -} - -gint32 -Mono_Posix_Syscall_readdir (void *dirp, struct Mono_Posix_Syscall__Dirent *entry) -{ - struct dirent *d; - - if (entry == NULL) { - errno = EFAULT; - return -1; - } - - d = readdir (dirp); - - if (d == NULL) { - return -1; - } - - copy_dirent (entry, d); - - return 0; -} - -gint32 -Mono_Posix_Syscall_readdir_r (void *dirp, struct Mono_Posix_Syscall__Dirent *entry, void **result) -{ - struct dirent _entry; - int r; - - r = readdir_r (dirp, &_entry, (struct dirent**) result); - - if (r == 0 && result != NULL) { - copy_dirent (entry, &_entry); - } - - return r; -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/errno.c b/support/errno.c deleted file mode 100644 index 878e9560eb6..00000000000 --- a/support/errno.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * wrapper functions. - */ - -#include -#include -#include "mph.h" -#include - -G_BEGIN_DECLS - -void -Mono_Posix_Stdlib_SetLastError (int error_number) -{ - errno = error_number; -} - -#ifdef HAVE_STRERROR_R - -/* - * There are two versions of strerror_r: - * - the GNU version: char *strerror_r (int errnum, char *buf, size_t n); - * - the XPG version: int strerror_r (int errnum, char *buf, size_t n); - * - * Ideally I could stick with the XPG version, but we need to support - * Red Hat 9, which only supports the GNU version. - * - * Furthermore, I do NOT want to export the GNU version in Mono.Posix.dll, - * as that's supposed to contain *standard* function definitions (give or - * take a few GNU extensions). Portability trumps all. - * - * Consequently, we export the functionality of the XPG version. - * Internally, we se the GNU version if _GNU_SOURCE is defined, otherwise - * we assume that the XPG version is present. - */ - -#ifdef _GNU_SOURCE -#define mph_min(x,y) ((x) <= (y) ? (x) : (y)) - -/* If you pass an invalid errno value to glibc 2.3.2's strerror_r, you get - * back the string "Unknown error" with the error value appended. */ -static const char mph_unknown[] = "Unknown error "; - -/* - * Translate the GNU semantics to the XPG semantics. - * - * From reading the (RH9-using) GLibc 2.3.2 sysdeps/generic/_strerror.c, - * we can say the following: - * - If errnum is a valid error number, a pointer to a constant string is - * returned. Thus, the prototype *lies* (it's not really a char*). - * `buf' is unchanged (WTF?). - * - If errnum is an *invalid* error number, an error message is copied - * into `buf' and `buf' is returned. The error message returned is - * "Unknown error %i", where %i is the input errnum. - * - * Meanwhile, XPG always modifies `buf' if there's enough space, and either - * returns 0 (success) or -1 (error) with errno = EINVAL (bad errnum) or - * ERANGE (`buf' isn't big enough). Also, GLibc 2.3.3 (which has the XPG - * version) first checks the validity of errnum first, then does the copy. - * - * Assuming that the GNU implementation doesn't change much (ha!), we can - * check for EINVAL by comparing the strerror_r return to `buf', OR by - * comparing the return value to "Uknown error". (This assumes that - * strerror_r will always only return the input buffer for errors.) - * - * Check for ERANGE by comparing the string length returned by strerror_r to - * `n'. - * - * Then pray that this actually works... - */ -gint32 -Mono_Posix_Syscall_strerror_r (int errnum, char *buf, mph_size_t n) -{ - char *r; - char ebuf [sizeof(mph_unknown)]; - size_t len; - size_t blen; - - mph_return_if_size_t_overflow (n); - - /* first, check for valid errnum */ - r = strerror_r (errnum, ebuf, sizeof(ebuf)); - len = strlen (r); - - if (r == ebuf || - strncmp (r, mph_unknown, mph_min (len, sizeof(mph_unknown))) == 0) { - errno = EINVAL; - return -1; - } - - /* valid errnum (we hope); is buffer big enough? */ - blen = (size_t) n; - if ((len+1) > blen) { - errno = ERANGE; - return -1; - } - - strncpy (buf, r, len); - buf[len] = '\0'; - - return 0; -} - -#else /* !def _GNU_SOURCE */ - -gint32 -Mono_Posix_Syscall_strerror_r (int errnum, char *buf, mph_size_t n) -{ - mph_return_if_size_t_overflow (n); - return strerror_r (errnum, buf, (size_t) n); -} - -#endif /* def _GNU_SOURCE */ - -#endif /* def HAVE_STRERROR_R */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/fcntl.c b/support/fcntl.c deleted file mode 100644 index 3e0424cb901..00000000000 --- a/support/fcntl.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include - -#include "map.h" -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Flock { - gint16 l_type; - gint16 l_whence; - mph_off_t l_start; - mph_off_t l_len; - mph_pid_t l_pid; -}; - -gint32 -Mono_Posix_Syscall_fcntl (gint32 fd, gint32 cmd) -{ - if (Mono_Posix_FromFcntlCommand (cmd, &cmd) == -1) - return -1; - return fcntl (fd, cmd); -} - -gint32 -Mono_Posix_Syscall_fcntl_arg (gint32 fd, gint32 cmd, gint64 arg) -{ - long _arg; - gint32 _cmd; - - mph_return_if_long_overflow (arg); - -#ifdef F_NOTIFY - if (cmd == F_NOTIFY) { - int _argi; - if (Mono_Posix_FromDirectoryNotifyFlags (arg, &_argi) == -1) { - return -1; - } - _arg = _argi; - } - else -#endif - _arg = (long) arg; - - if (Mono_Posix_FromFcntlCommand (cmd, &_cmd) == -1) - return -1; - return fcntl (fd, cmd, _arg); -} - -gint32 -Mono_Posix_Syscall_fcntl_lock (gint32 fd, gint32 cmd, struct Mono_Posix_Flock *lock) -{ - struct flock _lock; - int r; - - if (lock == NULL) { - errno = EFAULT; - return -1; - } - - mph_return_if_off_t_overflow (lock->l_start); - mph_return_if_off_t_overflow (lock->l_len); - - if (Mono_Posix_FromLockType (lock->l_type, &lock->l_type) == -1) - return -1; - _lock.l_type = lock->l_type; - _lock.l_whence = lock->l_whence; - _lock.l_start = lock->l_start; - _lock.l_len = lock->l_len; - _lock.l_pid = lock->l_pid; - - r = fcntl (fd, cmd, &_lock); - - if (Mono_Posix_ToLockType (_lock.l_type, &_lock.l_type) == -1) - r = -1; - lock->l_type = _lock.l_type; - lock->l_whence = _lock.l_whence; - lock->l_start = _lock.l_start; - lock->l_len = _lock.l_len; - lock->l_pid = _lock.l_pid; - - return r; -} - -gint32 -Mono_Posix_Syscall_open (const char *pathname, gint32 flags) -{ - if (Mono_Posix_FromOpenFlags (flags, &flags) == -1) - return -1; - - return open (pathname, flags); -} - -gint32 -Mono_Posix_Syscall_open_mode (const char *pathname, gint32 flags, guint32 mode) -{ - if (Mono_Posix_FromOpenFlags (flags, &flags) == -1) - return -1; - if (Mono_Posix_FromFilePermissions (mode, &mode) == -1) - return -1; - - return open (pathname, flags, mode); -} - -gint32 -Mono_Posix_Syscall_creat (const char *pathname, guint32 mode) -{ - if (Mono_Posix_FromFilePermissions (mode, &mode) == -1) - return -1; - - return creat (pathname, mode); -} - -#ifdef HAVE_POSIX_FADVISE -gint32 -Mono_Posix_Syscall_posix_fadvise (gint32 fd, mph_off_t offset, mph_off_t len, - gint32 advice) -{ - mph_return_if_off_t_overflow (offset); - mph_return_if_off_t_overflow (len); - - if (Mono_Posix_FromPosixFadviseAdvice (advice, &advice) == -1) - return -1; - - return posix_fadvise (fd, (off_t) offset, (off_t) len, advice); -} -#endif /* ndef HAVE_POSIX_FADVISE */ - -#ifdef HAVE_POSIX_FALLOCATE -gint32 -Mono_Posix_Syscall_posix_fallocate (gint32 fd, mph_off_t offset, mph_size_t len) -{ - mph_return_if_off_t_overflow (offset); - mph_return_if_size_t_overflow (len); - - return posix_fallocate (fd, (off_t) offset, (size_t) len); -} -#endif /* ndef HAVE_POSIX_FALLOCATE */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/fstab.c b/support/fstab.c deleted file mode 100644 index 2fb79be2671..00000000000 --- a/support/fstab.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004-2005 Jonathan Pryor - */ - -#include -#include -#include -#include -#include - -#include "mph.h" - -#if defined (HAVE_CHECKLIST_H) -#include -#elif defined (HAVE_FSTAB_H) -#include -#endif /* def HAVE_FSTAB_H */ - -#ifdef HAVE_SYS_VFSTAB_H -#include -#endif /* def HAVE_SYS_VFSTAB_H */ - -G_BEGIN_DECLS - -struct Mono_Posix_Syscall__Fstab { - char *fs_spec; /* block device name */ - char *fs_file; /* mount point */ - char *fs_vfstype; /* filesystem type */ - char *fs_mntops; /* mount options */ - char *fs_type; /* rw/rq/ro/sw/xx option */ - int fs_freq; /* dump frequency, in days */ - int fs_passno; /* pass number on parallel dump */ - - char *_fs_buf_; -}; - -#ifdef HAVE_CHECKLIST_H - -typedef struct checklist mph_fstab; - -static const size_t -fstab_offsets[] = { - offsetof (struct checklist, fs_spec), - offsetof (struct checklist, fs_dir), - offsetof (struct checklist, fs_type) -}; - -static const size_t -mph_fstab_offsets[] = { - offsetof (struct Mono_Posix_Syscall__Fstab, fs_spec), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_file), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_type) -}; - -#elif defined (HAVE_FSTAB_H) - -typedef struct fstab mph_fstab; - -static const size_t -fstab_offsets[] = { - offsetof (struct fstab, fs_spec), - offsetof (struct fstab, fs_file), - offsetof (struct fstab, fs_vfstype), - offsetof (struct fstab, fs_mntops), - offsetof (struct fstab, fs_type) -}; - -static const size_t -mph_fstab_offsets[] = { - offsetof (struct Mono_Posix_Syscall__Fstab, fs_spec), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_file), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_vfstype), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_mntops), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_type) -}; - -#endif /* def HAVE_FSTAB_H */ - -#if defined (HAVE_CHECKLIST_H) || defined (HAVE_FSTAB_H) - -/* - * Copy the native `fstab' structure to it's managed representation. - * - * To minimize separate mallocs, all the strings are allocated within the same - * memory block (stored in _fs_buf_). - */ -static int -copy_fstab (struct Mono_Posix_Syscall__Fstab *to, mph_fstab *from) -{ - char *buf; - - memset (to, 0, sizeof(*to)); - - buf = _mph_copy_structure_strings (to, mph_fstab_offsets, - from, fstab_offsets, sizeof(fstab_offsets)/sizeof(fstab_offsets[0])); - - to->fs_freq = from->fs_freq; - to->fs_passno = from->fs_passno; - - to->_fs_buf_ = buf; - if (buf == NULL) { - return -1; - } - - return 0; -} - -#endif /* def HAVE_CHECKLIST_H || def HAVE_FSTAB_H */ - -#ifdef HAVE_SYS_VFSTAB_H - -/* - * Solaris doesn't provide but has equivalent functionality in - * via getvfsent(3C) and company. - */ - -typedef struct vfstab mph_fstab; - -static const size_t -vfstab_offsets[] = { - offsetof (struct vfstab, vfs_special), - offsetof (struct vfstab, vfs_mountp), - offsetof (struct vfstab, vfs_fstype), - offsetof (struct vfstab, vfs_mntopts) -}; - -static const size_t -mph_fstab_offsets[] = { - offsetof (struct Mono_Posix_Syscall__Fstab, fs_spec), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_file), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_vfstype), - offsetof (struct Mono_Posix_Syscall__Fstab, fs_mntops) -}; - -/* - * Copy the native `vfstab' structure to it's managed representation. - * - * To minimize separate mallocs, all the strings are allocated within the same - * memory block (stored in _fs_buf_). - */ -static int -copy_fstab (struct Mono_Posix_Syscall__Fstab *to, struct vfstab *from) -{ - char *buf; - - memset (to, 0, sizeof(*to)); - - buf = _mph_copy_structure_strings (to, mph_fstab_offsets, - from, vfstab_offsets, sizeof(vfstab_offsets)/sizeof(vfstab_offsets[0])); - - to->fs_type = NULL; - to->fs_freq = -1; - to->fs_passno = -1; - - to->_fs_buf_ = buf; - if (buf == NULL) { - return -1; - } - - return 0; -} - -/* - * Implement Linux/BSD getfsent(3) in terms of Solaris getvfsent(3C)... - */ -static FILE* -etc_fstab; - -static int -setfsent (void) -{ - /* protect from bad users calling setfsent(), setfsent(), ... endfsent() */ - if (etc_fstab != NULL) - fclose (etc_fstab); - etc_fstab = fopen ("/etc/vfstab", "r"); - if (etc_fstab != NULL) - return 1; - return 0; -} - -static void -endfsent (void) -{ - fclose (etc_fstab); - etc_fstab = NULL; -} - -static struct vfstab -cur_vfstab_entry; - -static struct vfstab* -getfsent (void) -{ - int r; - r = getvfsent (etc_fstab, &cur_vfstab_entry); - if (r == 0) - return &cur_vfstab_entry; - return NULL; -} - -static struct vfstab* -getfsfile (const char *mount_point) -{ - int r; - int close = 0; - if (etc_fstab == 0) { - close = 1; - if (setfsent () != 1) - return NULL; - } - rewind (etc_fstab); - r = getvfsfile (etc_fstab, &cur_vfstab_entry, (char*) mount_point); - if (close) - endfsent (); - if (r == 0) - return &cur_vfstab_entry; - return NULL; -} - -static struct vfstab* -getfsspec (const char *special_file) -{ - int r; - int close = 0; - if (etc_fstab == 0) { - close = 1; - if (setfsent () != 1) - return NULL; - } - rewind (etc_fstab); - r = getvfsspec (etc_fstab, &cur_vfstab_entry, (char*) special_file); - if (close) - endfsent (); - if (r == 0) - return &cur_vfstab_entry; - return NULL; -} - -#endif /* def HAVE_SYS_VFSTAB_H */ - -#if defined (HAVE_FSTAB_H) || defined (HAVE_CHECKPOINT_H) || defined (HAVE_SYS_VFSTAB_H) - -void -Mono_Posix_Syscall_endfsent (void) -{ - endfsent (); -} - -gint32 -Mono_Posix_Syscall_getfsent (struct Mono_Posix_Syscall__Fstab *fsbuf) -{ - mph_fstab *fs; - - if (fsbuf == NULL) { - errno = EFAULT; - return -1; - } - - fs = getfsent (); - if (fs == NULL) - return -1; - - if (copy_fstab (fsbuf, fs) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -gint32 -Mono_Posix_Syscall_getfsfile (const char *mount_point, - struct Mono_Posix_Syscall__Fstab *fsbuf) -{ - mph_fstab *fs; - - if (fsbuf == NULL) { - errno = EFAULT; - return -1; - } - - fs = getfsfile (mount_point); - if (fs == NULL) - return -1; - - if (copy_fstab (fsbuf, fs) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -gint32 -Mono_Posix_Syscall_getfsspec (const char *special_file, - struct Mono_Posix_Syscall__Fstab *fsbuf) -{ - mph_fstab *fs; - - if (fsbuf == NULL) { - errno = EFAULT; - return -1; - } - - fs = getfsspec (special_file); - if (fs == NULL) - return -1; - - if (copy_fstab (fsbuf, fs) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -gint32 -Mono_Posix_Syscall_setfsent (void) -{ - return setfsent (); -} - -#endif /* def HAVE_FSTAB_H || def HAVE_CHECKPOINT_H || def HAVE_SYS_VFSTAB_H */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/grp.c b/support/grp.c deleted file mode 100644 index 9fa70b93c92..00000000000 --- a/support/grp.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include -#include -#include -#include -#include -#include -#include /* for setgroups on Mac OS X */ - -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Syscall__Group { - /* string */ char *gr_name; - /* string */ char *gr_passwd; - /* gid_t */ mph_gid_t gr_gid; - /* int */ int _gr_nmem_; - /* string */ char **gr_mem; - /* string */ char *_gr_buf_; /* holds all but gr_mem */ -}; - -static void -count_members (char **gr_mem, int *count, size_t *mem) -{ - char *cur; - *count = 0; - - // ensure that later (*mem)+1 doesn't result in integer overflow - if (*mem > INT_MAX - 1) - return; - - for (cur = *gr_mem; cur != NULL; cur = *++gr_mem) { - size_t len; - len = strlen (cur); - - if (!(len < INT_MAX - ((*mem) + 1))) - break; - - ++(*count); - *mem += (len + 1); - } -} - -static int -copy_group (struct Mono_Posix_Syscall__Group *to, struct group *from) -{ - size_t nlen, plen, buflen; - int i, count; - char *cur; - - to->gr_gid = from->gr_gid; - - to->gr_name = NULL; - to->gr_passwd = NULL; - to->gr_mem = NULL; - to->_gr_buf_ = NULL; - - nlen = strlen (from->gr_name); - plen = strlen (from->gr_passwd); - - buflen = 2; - - if (!(nlen < INT_MAX - buflen)) - return -1; - buflen += nlen; - - if (!(plen < INT_MAX - buflen)) - return -1; - buflen += plen; - - count = 0; - count_members (from->gr_mem, &count, &buflen); - - to->_gr_nmem_ = count; - cur = to->_gr_buf_ = (char*) malloc (buflen); - to->gr_mem = (char **) malloc (sizeof(char*)*(count+1)); - if (to->_gr_buf_ == NULL || to->gr_mem == NULL) { - free (to->_gr_buf_); - free (to->gr_mem); - return -1; - } - - to->gr_name = strcpy (cur, from->gr_name); - cur += (nlen + 1); - to->gr_passwd = strcpy (cur, from->gr_passwd); - cur += (plen + 1); - - for (i = 0; i != count; ++i) { - to->gr_mem[i] = strcpy (cur, from->gr_mem[i]); - cur += (strlen (from->gr_mem[i])+1); - } - to->gr_mem[i] = NULL; - - return 0; -} - -gint32 -Mono_Posix_Syscall_getgrnam (const char *name, struct Mono_Posix_Syscall__Group *gbuf) -{ - struct group *_gbuf; - - if (gbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - _gbuf = getgrnam (name); - if (_gbuf == NULL) - return -1; - - if (copy_group (gbuf, _gbuf) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -gint32 -Mono_Posix_Syscall_getgrgid (mph_gid_t gid, struct Mono_Posix_Syscall__Group *gbuf) -{ - struct group *_gbuf; - - if (gbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - _gbuf = getgrgid (gid); - if (_gbuf == NULL) - return -1; - - if (copy_group (gbuf, _gbuf) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -#ifdef HAVE_GETGRNAM_R -gint32 -Mono_Posix_Syscall_getgrnam_r (const char *name, - struct Mono_Posix_Syscall__Group *gbuf, - void **gbufp) -{ - char *buf, *buf2; - size_t buflen; - int r; - struct group _grbuf; - - if (gbuf == NULL) { - errno = EFAULT; - return -1; - } - - buf = buf2 = NULL; - buflen = 2; - - do { - buf2 = realloc (buf, buflen *= 2); - if (buf2 == NULL) { - free (buf); - errno = ENOMEM; - return -1; - } - buf = buf2; - errno = 0; - } while ((r = getgrnam_r (name, &_grbuf, buf, buflen, (struct group**) gbufp)) && - recheck_range (r)); - - /* On Solaris, this function returns 0 even if the entry was not found */ - if (r == 0 && !(*gbufp)) - r = errno = ENOENT; - - if (r == 0 && copy_group (gbuf, &_grbuf) == -1) - r = errno = ENOMEM; - free (buf); - - return r; -} -#endif /* ndef HAVE_GETGRNAM_R */ - -#ifdef HAVE_GETGRGID_R -gint32 -Mono_Posix_Syscall_getgrgid_r (mph_gid_t gid, - struct Mono_Posix_Syscall__Group *gbuf, - void **gbufp) -{ - char *buf, *buf2; - size_t buflen; - int r; - struct group _grbuf; - - if (gbuf == NULL) { - errno = EFAULT; - return -1; - } - - buf = buf2 = NULL; - buflen = 2; - - do { - buf2 = realloc (buf, buflen *= 2); - if (buf2 == NULL) { - free (buf); - errno = ENOMEM; - return -1; - } - buf = buf2; - errno = 0; - } while ((r = getgrgid_r (gid, &_grbuf, buf, buflen, (struct group**) gbufp)) && - recheck_range (r)); - - /* On Solaris, this function returns 0 even if the entry was not found */ - if (r == 0 && !(*gbufp)) - r = errno = ENOENT; - - if (r == 0 && copy_group (gbuf, &_grbuf) == -1) - r = errno = ENOMEM; - free (buf); - - return r; -} -#endif /* ndef HAVE_GETGRGID_R */ - -gint32 -Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf) -{ - struct group *gr; - - if (grbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - gr = getgrent (); - if (gr == NULL) - return -1; - - if (copy_group (grbuf, gr) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -#ifdef HAVE_FGETGRENT -gint32 -Mono_Posix_Syscall_fgetgrent (void *stream, struct Mono_Posix_Syscall__Group *grbuf) -{ - struct group *gr; - - if (grbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - gr = fgetgrent ((FILE*) stream); - if (gr == NULL) - return -1; - - if (copy_group (grbuf, gr) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} -#endif /* ndef HAVE_FGETGRENT */ - -gint32 -Mono_Posix_Syscall_setgroups (mph_size_t size, mph_gid_t *list) -{ - mph_return_if_size_t_overflow (size); - return setgroups ((size_t) size, list); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/macros.c b/support/macros.c deleted file mode 100644 index 802f0631942..00000000000 --- a/support/macros.c +++ /dev/null @@ -1,146 +0,0 @@ -#include "mph.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int wifexited (int status) -{ - return WIFEXITED (status); -} - -int wexitstatus (int status) -{ - return WEXITSTATUS (status); -} - -int wifsignaled (int status) -{ - return WIFSIGNALED (status); -} - -int wtermsig (int status) -{ - return WTERMSIG (status); -} - -int wifstopped (int status) -{ - return WIFSTOPPED (status); -} - -int wstopsig (int status) -{ - return WSTOPSIG (status); -} - -int helper_Mono_Posix_Stat(const char *filename, int dereference, - int *device, - int *inode, - int *mode, - int *nlinks, - int *uid, - int *gid, - int *rdev, - gint64 *size, - gint64 *blksize, - gint64 *blocks, - gint64 *atime, - gint64 *mtime, - gint64 *ctime - ) { - int ret; - struct stat buf; - - if (!dereference) - ret = stat(filename, &buf); - else - ret = lstat(filename, &buf); - - if (ret) return ret; - - *device = buf.st_dev; - *inode = buf.st_ino; - *mode = buf.st_mode; - *nlinks = buf.st_nlink; - *uid = buf.st_uid; - *gid = buf.st_gid; - *rdev = buf.st_rdev; - *size = buf.st_size; - *blksize = buf.st_blksize; - *blocks = buf.st_blocks; - *atime = buf.st_atime; - *mtime = buf.st_mtime; - *ctime = buf.st_ctime; - return 0; -} - -const char *helper_Mono_Posix_GetUserName(int uid) { - struct passwd *p = getpwuid(uid); - if (p == NULL) return NULL; - return strdup (p->pw_name); -} -const char *helper_Mono_Posix_GetGroupName(int gid) { - struct group *p = getgrgid(gid); - if (p == NULL) return NULL; - return strdup (p->gr_name); -} - -const char *helper_Mono_Posix_readdir(void *dir) { - struct dirent* e = readdir((DIR*) dir); - if (e == NULL) return NULL; - return strdup (e->d_name); -} - -int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid, - char **account, - char **password, - int *uid, - int *gid, - char **name, - char **home, - char **shell - ) { - - struct passwd pw, *pwp; - char buf[4096]; - int ret; - - if (mode == 0) - ret = getpwnam_r (in_name, &pw, buf, 4096, &pwp); - else - ret = getpwuid_r (in_uid, &pw, buf, 4096, &pwp); - - if (ret == 0 && pwp == NULL) { - // Don't know why this happens, but it does. - // ret == 0, errno == 0, but no record was found. - ret = ENOENT; - } - - if (ret) { - *account = NULL; // prevent marshalling unset pointers - *password = NULL; - *uid = 0; - *gid = 0; - *name = NULL; - *home = NULL; - *shell = NULL; - return ret; - } - - *account = pwp->pw_name; - *password = pwp->pw_passwd; - *uid = pwp->pw_uid; - *gid = pwp->pw_gid; - *name = pwp->pw_gecos; - *home = pwp->pw_dir; - *shell = pwp->pw_shell; - - return 0; -} diff --git a/support/map-icalls.h b/support/map-icalls.h deleted file mode 100644 index d7d45b198e7..00000000000 --- a/support/map-icalls.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * This file was automatically generated by make-map from ../../mcs/class/lib/default/Mono.Posix.dll. - * - * DO NOT MODIFY. - */ -#include - -#ifndef INC_Mono_Posix_map_ICALLS_H -#define INC_Mono_Posix_map_ICALLS_H - -#include - -G_BEGIN_DECLS - -/* - * Structure Declarations - */ -struct Mono_Posix_Flock; -struct Mono_Posix_Stat; -struct Mono_Posix_Statvfs; -struct Mono_Posix_Syscall__Dirent; -struct Mono_Posix_Syscall__Fstab; -struct Mono_Posix_Syscall__Group; -struct Mono_Posix_Syscall__Passwd; -struct Mono_Posix_Timeval; -struct Mono_Posix_Timezone; -struct Mono_Posix_Utimbuf; - -/* - * Function Declarations - */ -int Mono_Posix_FromAccessMode (int value, int* rval); -int Mono_Posix_FromConfStr (int value, int* rval); -int Mono_Posix_FromDirectoryNotifyFlags (int value, int* rval); -int Mono_Posix_FromError (int value, int* rval); -int Mono_Posix_FromFcntlCommand (int value, int* rval); -int Mono_Posix_FromFilePermissions (unsigned int value, unsigned int* rval); -int Mono_Posix_FromLockType (short value, short* rval); -int Mono_Posix_FromLockfCommand (int value, int* rval); -int Mono_Posix_FromMlockallFlags (int value, int* rval); -int Mono_Posix_FromMmapFlags (int value, int* rval); -int Mono_Posix_FromMmapProt (int value, int* rval); -int Mono_Posix_FromMountFlags (guint64 value, guint64* rval); -int Mono_Posix_FromMremapFlags (guint64 value, guint64* rval); -int Mono_Posix_FromMsyncFlags (int value, int* rval); -int Mono_Posix_FromOpenFlags (int value, int* rval); -int Mono_Posix_FromPathConf (int value, int* rval); -int Mono_Posix_FromPollEvents (short value, short* rval); -int Mono_Posix_FromPosixFadviseAdvice (int value, int* rval); -int Mono_Posix_FromPosixMadviseAdvice (int value, int* rval); -int Mono_Posix_FromSeekFlags (short value, short* rval); -int Mono_Posix_FromSignum (int value, int* rval); -int Mono_Posix_FromSysConf (int value, int* rval); -int Mono_Posix_FromSyslogFacility (int value, int* rval); -int Mono_Posix_FromSyslogLevel (int value, int* rval); -int Mono_Posix_FromSyslogOptions (int value, int* rval); -int Mono_Posix_FromWaitOptions (int value, int* rval); -int Mono_Posix_FromXattrFlags (int value, int* rval); -int Mono_Posix_Stdlib_BUFSIZ (void); -void* Mono_Posix_Stdlib_CreateFilePosition (void); -int Mono_Posix_Stdlib_DumpFilePosition (char* buf, void* handle, int len); -int Mono_Posix_Stdlib_EOF (void); -int Mono_Posix_Stdlib_EXIT_FAILURE (void); -int Mono_Posix_Stdlib_EXIT_SUCCESS (void); -int Mono_Posix_Stdlib_FILENAME_MAX (void); -int Mono_Posix_Stdlib_FOPEN_MAX (void); -void Mono_Posix_Stdlib_InvokeSignalHandler (int signum, void* handler); -int Mono_Posix_Stdlib_L_tmpnam (void); -int Mono_Posix_Stdlib_MB_CUR_MAX (void); -int Mono_Posix_Stdlib_RAND_MAX (void); -void* Mono_Posix_Stdlib_SIG_DFL (void); -void* Mono_Posix_Stdlib_SIG_ERR (void); -void* Mono_Posix_Stdlib_SIG_IGN (void); -void Mono_Posix_Stdlib_SetLastError (int error); -int Mono_Posix_Stdlib_TMP_MAX (void); -int Mono_Posix_Stdlib__IOFBF (void); -int Mono_Posix_Stdlib__IOLBF (void); -int Mono_Posix_Stdlib__IONBF (void); -void* Mono_Posix_Stdlib_calloc (guint64 nmemb, guint64 size); -int Mono_Posix_Stdlib_fgetpos (void* stream, void* pos); -guint64 Mono_Posix_Stdlib_fread (void* ptr, guint64 size, guint64 nmemb, void* stream); -int Mono_Posix_Stdlib_fseek (void* stream, gint64 offset, int origin); -int Mono_Posix_Stdlib_fsetpos (void* stream, void* pos); -gint64 Mono_Posix_Stdlib_ftell (void* stream); -guint64 Mono_Posix_Stdlib_fwrite (void* ptr, guint64 size, guint64 nmemb, void* stream); -void* Mono_Posix_Stdlib_malloc (guint64 size); -void* Mono_Posix_Stdlib_realloc (void* ptr, guint64 size); -int Mono_Posix_Stdlib_setvbuf (void* stream, void* buf, int mode, guint64 size); -void* Mono_Posix_Stdlib_stderr (void); -void* Mono_Posix_Stdlib_stdin (void); -void* Mono_Posix_Stdlib_stdout (void); -int Mono_Posix_Syscall_L_ctermid (void); -int Mono_Posix_Syscall_L_cuserid (void); -int Mono_Posix_Syscall_WEXITSTATUS (int status); -int Mono_Posix_Syscall_WIFEXITED (int status); -int Mono_Posix_Syscall_WIFSIGNALED (int status); -int Mono_Posix_Syscall_WIFSTOPPED (int status); -int Mono_Posix_Syscall_WSTOPSIG (int status); -int Mono_Posix_Syscall_WTERMSIG (int status); -guint64 Mono_Posix_Syscall_confstr (int name, char* buf, guint64 len); -int Mono_Posix_Syscall_creat (const char* pathname, unsigned int mode); -void Mono_Posix_Syscall_endfsent (void); -int Mono_Posix_Syscall_fcntl (int fd, int cmd); -int Mono_Posix_Syscall_fcntl_arg (int fd, int cmd, gint64 arg); -int Mono_Posix_Syscall_fcntl_lock (int fd, int cmd, struct Mono_Posix_Flock* lock); -int Mono_Posix_Syscall_fgetgrent (void* stream, struct Mono_Posix_Syscall__Group* grbuf); -int Mono_Posix_Syscall_fgetpwent (void* stream, struct Mono_Posix_Syscall__Passwd* pwbuf); -gint64 Mono_Posix_Syscall_fgetxattr (int fd, const char* name, void* value, guint64 size); -gint64 Mono_Posix_Syscall_flistxattr (int fd, void* list, guint64 size); -gint64 Mono_Posix_Syscall_fpathconf (int filedes, int name); -int Mono_Posix_Syscall_fremovexattr (int fd, const char* name); -int Mono_Posix_Syscall_fsetxattr (int fd, const char* name, void* value, guint64 size, int flags); -int Mono_Posix_Syscall_fstat (int filedes, struct Mono_Posix_Stat* buf); -int Mono_Posix_Syscall_fstatvfs (int fd, struct Mono_Posix_Statvfs* buf); -int Mono_Posix_Syscall_ftruncate (int fd, gint64 length); -void* Mono_Posix_Syscall_getcwd (char* buf, guint64 size); -int Mono_Posix_Syscall_getdomainname (char* name, guint64 len); -int Mono_Posix_Syscall_getfsent (struct Mono_Posix_Syscall__Fstab* fs); -int Mono_Posix_Syscall_getfsfile (const char* mount_point, struct Mono_Posix_Syscall__Fstab* fs); -int Mono_Posix_Syscall_getfsspec (const char* special_file, struct Mono_Posix_Syscall__Fstab* fs); -int Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group* grbuf); -int Mono_Posix_Syscall_getgrgid (unsigned int uid, struct Mono_Posix_Syscall__Group* group); -int Mono_Posix_Syscall_getgrgid_r (unsigned int uid, struct Mono_Posix_Syscall__Group* grbuf, void** grbufp); -int Mono_Posix_Syscall_getgrnam (const char* name, struct Mono_Posix_Syscall__Group* group); -int Mono_Posix_Syscall_getgrnam_r (const char* name, struct Mono_Posix_Syscall__Group* grbuf, void** grbufp); -gint64 Mono_Posix_Syscall_gethostid (void); -int Mono_Posix_Syscall_gethostname (char* name, guint64 len); -int Mono_Posix_Syscall_getlogin_r (char* name, guint64 bufsize); -int Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd* pwbuf); -int Mono_Posix_Syscall_getpwnam (const char* name, struct Mono_Posix_Syscall__Passwd* passwd); -int Mono_Posix_Syscall_getpwnam_r (const char* name, struct Mono_Posix_Syscall__Passwd* pwbuf, void** pwbufp); -int Mono_Posix_Syscall_getpwuid (unsigned int uid, struct Mono_Posix_Syscall__Passwd* passwd); -int Mono_Posix_Syscall_getpwuid_r (unsigned int uid, struct Mono_Posix_Syscall__Passwd* pwbuf, void** pwbufp); -int Mono_Posix_Syscall_gettimeofday (struct Mono_Posix_Timeval* tv, void* ignore); -gint64 Mono_Posix_Syscall_getxattr (const char* path, const char* name, void* value, guint64 size); -gint64 Mono_Posix_Syscall_lgetxattr (const char* path, const char* name, void* value, guint64 size); -gint64 Mono_Posix_Syscall_listxattr (const char* path, void* list, guint64 size); -gint64 Mono_Posix_Syscall_llistxattr (const char* path, void* list, guint64 size); -int Mono_Posix_Syscall_lockf (int fd, int cmd, gint64 len); -int Mono_Posix_Syscall_lremovexattr (const char* path, const char* name); -gint64 Mono_Posix_Syscall_lseek (int fd, gint64 offset, int whence); -int Mono_Posix_Syscall_lsetxattr (const char* path, const char* name, void* value, guint64 size, int flags); -int Mono_Posix_Syscall_lstat (const char* file_name, struct Mono_Posix_Stat* buf); -int Mono_Posix_Syscall_mincore (void* start, guint64 length, void* vec); -int Mono_Posix_Syscall_mknod (const char* pathname, unsigned int mode, guint64 dev); -int Mono_Posix_Syscall_mlock (void* start, guint64 len); -void* Mono_Posix_Syscall_mmap (void* start, guint64 length, int prot, int flags, int fd, gint64 offset); -int Mono_Posix_Syscall_mprotect (void* start, guint64 len, int prot); -void* Mono_Posix_Syscall_mremap (void* old_address, guint64 old_size, guint64 new_size, guint64 flags); -int Mono_Posix_Syscall_msync (void* start, guint64 len, int flags); -int Mono_Posix_Syscall_munlock (void* start, guint64 len); -int Mono_Posix_Syscall_munmap (void* start, guint64 length); -int Mono_Posix_Syscall_open (const char* pathname, int flags); -int Mono_Posix_Syscall_open_mode (const char* pathname, int flags, unsigned int mode); -gint64 Mono_Posix_Syscall_pathconf (const char* path, int name); -int Mono_Posix_Syscall_pipe (int* reading, int* writing); -int Mono_Posix_Syscall_posix_fadvise (int fd, gint64 offset, gint64 len, int advice); -int Mono_Posix_Syscall_posix_fallocate (int fd, gint64 offset, guint64 len); -int Mono_Posix_Syscall_posix_madvise (void* addr, guint64 len, int advice); -gint64 Mono_Posix_Syscall_pread (int fd, void* buf, guint64 count, gint64 offset); -gint64 Mono_Posix_Syscall_pwrite (int fd, void* buf, guint64 count, gint64 offset); -gint64 Mono_Posix_Syscall_read (int fd, void* buf, guint64 count); -int Mono_Posix_Syscall_readdir (void* dir, struct Mono_Posix_Syscall__Dirent* dentry); -int Mono_Posix_Syscall_readdir_r (void* dirp, struct Mono_Posix_Syscall__Dirent* entry, void** result); -int Mono_Posix_Syscall_readlink (const char* path, char* buf, guint64 bufsiz); -int Mono_Posix_Syscall_remap_file_pages (void* start, guint64 size, int prot, gint64 pgoff, int flags); -int Mono_Posix_Syscall_removexattr (const char* path, const char* name); -int Mono_Posix_Syscall_seekdir (void* dir, gint64 offset); -gint64 Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, gint64* offset, guint64 count); -int Mono_Posix_Syscall_setdomainname (const char* name, guint64 len); -int Mono_Posix_Syscall_setfsent (void); -int Mono_Posix_Syscall_setgroups (guint64 size, unsigned int* list); -int Mono_Posix_Syscall_sethostid (gint64 hostid); -int Mono_Posix_Syscall_sethostname (const char* name, guint64 len); -int Mono_Posix_Syscall_settimeofday (struct Mono_Posix_Timeval* tv, struct Mono_Posix_Timezone* tz); -int Mono_Posix_Syscall_setxattr (const char* path, const char* name, void* value, guint64 size, int flags); -int Mono_Posix_Syscall_stat (const char* file_name, struct Mono_Posix_Stat* buf); -int Mono_Posix_Syscall_statvfs (const char* path, struct Mono_Posix_Statvfs* buf); -int Mono_Posix_Syscall_stime (gint64* t); -int Mono_Posix_Syscall_strerror_r (int errnum, char* buf, guint64 n); -void Mono_Posix_Syscall_swab (void* from, void* to, gint64 n); -gint64 Mono_Posix_Syscall_sysconf (int name); -gint64 Mono_Posix_Syscall_telldir (void* dir); -gint64 Mono_Posix_Syscall_time (gint64* t); -int Mono_Posix_Syscall_truncate (const char* path, gint64 length); -int Mono_Posix_Syscall_ttyname_r (int fd, char* buf, guint64 buflen); -int Mono_Posix_Syscall_utime (const char* filename, struct Mono_Posix_Utimbuf* buf, int use_buf); -int Mono_Posix_Syscall_utimes (const char* filename, struct Mono_Posix_Timeval* tvp); -gint64 Mono_Posix_Syscall_write (int fd, void* buf, guint64 count); -int Mono_Posix_ToAccessMode (int value, int* rval); -int Mono_Posix_ToConfStr (int value, int* rval); -int Mono_Posix_ToDirectoryNotifyFlags (int value, int* rval); -int Mono_Posix_ToError (int value, int* rval); -int Mono_Posix_ToFcntlCommand (int value, int* rval); -int Mono_Posix_ToFilePermissions (unsigned int value, unsigned int* rval); -int Mono_Posix_ToLockType (short value, short* rval); -int Mono_Posix_ToLockfCommand (int value, int* rval); -int Mono_Posix_ToMlockallFlags (int value, int* rval); -int Mono_Posix_ToMmapFlags (int value, int* rval); -int Mono_Posix_ToMmapProt (int value, int* rval); -int Mono_Posix_ToMountFlags (guint64 value, guint64* rval); -int Mono_Posix_ToMremapFlags (guint64 value, guint64* rval); -int Mono_Posix_ToMsyncFlags (int value, int* rval); -int Mono_Posix_ToOpenFlags (int value, int* rval); -int Mono_Posix_ToPathConf (int value, int* rval); -int Mono_Posix_ToPollEvents (short value, short* rval); -int Mono_Posix_ToPosixFadviseAdvice (int value, int* rval); -int Mono_Posix_ToPosixMadviseAdvice (int value, int* rval); -int Mono_Posix_ToSeekFlags (short value, short* rval); -int Mono_Posix_ToSignum (int value, int* rval); -int Mono_Posix_ToSysConf (int value, int* rval); -int Mono_Posix_ToSyslogFacility (int value, int* rval); -int Mono_Posix_ToSyslogLevel (int value, int* rval); -int Mono_Posix_ToSyslogOptions (int value, int* rval); -int Mono_Posix_ToWaitOptions (int value, int* rval); -int Mono_Posix_ToXattrFlags (int value, int* rval); -const char* helper_Mono_Posix_GetGroupName (int gid); -const char* helper_Mono_Posix_GetUserName (int uid); -int helper_Mono_Posix_Stat (const char* filename, int dereference, int* device, int* inode, int* mode, int* nlinks, int* uid, int* gid, int* rdev, gint64* size, gint64* blksize, gint64* blocks, gint64* atime, gint64* mtime, gint64* ctime); -const char* helper_Mono_Posix_readdir (void* dir); -int map_Mono_Posix_AccessMode (int mode); -int map_Mono_Posix_FileMode (int mode); -int map_Mono_Posix_OpenFlags (int flags); -int map_Mono_Posix_WaitOptions (int wait_options); -int wexitstatus (int status); -int wifexited (int status); -int wifsignaled (int status); -int wifstopped (int status); -int wstopsig (int status); -int wtermsig (int status); - -G_END_DECLS - -#endif /* ndef INC_Mono_Posix_map_ICALLS_H */ - diff --git a/support/map.c b/support/map.c deleted file mode 100644 index 4b91eecdbe0..00000000000 --- a/support/map.c +++ /dev/null @@ -1,6490 +0,0 @@ -/* - * This file was automatically generated by make-map from ../../mcs/class/lib/default/Mono.Posix.dll. - * - * DO NOT MODIFY. - */ -#include - -#include "map.h" - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif /* ndef _GNU_SOURCE */ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE -#endif /* ndef _XOPEN_SOURCE */ -#include -#include -#ifdef HAVE_SYS_POLL_H -#include -#endif -#ifdef HAVE_SYS_WAIT_H -#include -#endif -#ifdef HAVE_SYS_STATVFS_H -#include -#endif -#ifdef HAVE_SYS_XATTR_H -#include -#endif -#include -#include -#include -#ifdef HAVE_POLL_H -#include -#endif -#ifdef HAVE_GRP_H -#include -#endif -#include -#ifdef HAVE_SYSLOG_H -#include -#endif - -int Mono_Posix_FromError (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_Error_EPERM) -#ifdef EPERM - {*r = EPERM; return 0;} -#else /* def EPERM */ - {errno = EINVAL; return -1;} -#endif /* ndef EPERM */ - if (x == Mono_Posix_Error_ENOENT) -#ifdef ENOENT - {*r = ENOENT; return 0;} -#else /* def ENOENT */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOENT */ - if (x == Mono_Posix_Error_ESRCH) -#ifdef ESRCH - {*r = ESRCH; return 0;} -#else /* def ESRCH */ - {errno = EINVAL; return -1;} -#endif /* ndef ESRCH */ - if (x == Mono_Posix_Error_EINTR) -#ifdef EINTR - {*r = EINTR; return 0;} -#else /* def EINTR */ - {errno = EINVAL; return -1;} -#endif /* ndef EINTR */ - if (x == Mono_Posix_Error_EIO) -#ifdef EIO - {*r = EIO; return 0;} -#else /* def EIO */ - {errno = EINVAL; return -1;} -#endif /* ndef EIO */ - if (x == Mono_Posix_Error_ENXIO) -#ifdef ENXIO - {*r = ENXIO; return 0;} -#else /* def ENXIO */ - {errno = EINVAL; return -1;} -#endif /* ndef ENXIO */ - if (x == Mono_Posix_Error_E2BIG) -#ifdef E2BIG - {*r = E2BIG; return 0;} -#else /* def E2BIG */ - {errno = EINVAL; return -1;} -#endif /* ndef E2BIG */ - if (x == Mono_Posix_Error_ENOEXEC) -#ifdef ENOEXEC - {*r = ENOEXEC; return 0;} -#else /* def ENOEXEC */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOEXEC */ - if (x == Mono_Posix_Error_EBADF) -#ifdef EBADF - {*r = EBADF; return 0;} -#else /* def EBADF */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADF */ - if (x == Mono_Posix_Error_ECHILD) -#ifdef ECHILD - {*r = ECHILD; return 0;} -#else /* def ECHILD */ - {errno = EINVAL; return -1;} -#endif /* ndef ECHILD */ - if (x == Mono_Posix_Error_EAGAIN) -#ifdef EAGAIN - {*r = EAGAIN; return 0;} -#else /* def EAGAIN */ - {errno = EINVAL; return -1;} -#endif /* ndef EAGAIN */ - if (x == Mono_Posix_Error_ENOMEM) -#ifdef ENOMEM - {*r = ENOMEM; return 0;} -#else /* def ENOMEM */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOMEM */ - if (x == Mono_Posix_Error_EACCES) -#ifdef EACCES - {*r = EACCES; return 0;} -#else /* def EACCES */ - {errno = EINVAL; return -1;} -#endif /* ndef EACCES */ - if (x == Mono_Posix_Error_EFAULT) -#ifdef EFAULT - {*r = EFAULT; return 0;} -#else /* def EFAULT */ - {errno = EINVAL; return -1;} -#endif /* ndef EFAULT */ - if (x == Mono_Posix_Error_ENOTBLK) -#ifdef ENOTBLK - {*r = ENOTBLK; return 0;} -#else /* def ENOTBLK */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTBLK */ - if (x == Mono_Posix_Error_EBUSY) -#ifdef EBUSY - {*r = EBUSY; return 0;} -#else /* def EBUSY */ - {errno = EINVAL; return -1;} -#endif /* ndef EBUSY */ - if (x == Mono_Posix_Error_EEXIST) -#ifdef EEXIST - {*r = EEXIST; return 0;} -#else /* def EEXIST */ - {errno = EINVAL; return -1;} -#endif /* ndef EEXIST */ - if (x == Mono_Posix_Error_EXDEV) -#ifdef EXDEV - {*r = EXDEV; return 0;} -#else /* def EXDEV */ - {errno = EINVAL; return -1;} -#endif /* ndef EXDEV */ - if (x == Mono_Posix_Error_ENODEV) -#ifdef ENODEV - {*r = ENODEV; return 0;} -#else /* def ENODEV */ - {errno = EINVAL; return -1;} -#endif /* ndef ENODEV */ - if (x == Mono_Posix_Error_ENOTDIR) -#ifdef ENOTDIR - {*r = ENOTDIR; return 0;} -#else /* def ENOTDIR */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTDIR */ - if (x == Mono_Posix_Error_EISDIR) -#ifdef EISDIR - {*r = EISDIR; return 0;} -#else /* def EISDIR */ - {errno = EINVAL; return -1;} -#endif /* ndef EISDIR */ - if (x == Mono_Posix_Error_EINVAL) -#ifdef EINVAL - {*r = EINVAL; return 0;} -#else /* def EINVAL */ - {errno = EINVAL; return -1;} -#endif /* ndef EINVAL */ - if (x == Mono_Posix_Error_ENFILE) -#ifdef ENFILE - {*r = ENFILE; return 0;} -#else /* def ENFILE */ - {errno = EINVAL; return -1;} -#endif /* ndef ENFILE */ - if (x == Mono_Posix_Error_EMFILE) -#ifdef EMFILE - {*r = EMFILE; return 0;} -#else /* def EMFILE */ - {errno = EINVAL; return -1;} -#endif /* ndef EMFILE */ - if (x == Mono_Posix_Error_ENOTTY) -#ifdef ENOTTY - {*r = ENOTTY; return 0;} -#else /* def ENOTTY */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTTY */ - if (x == Mono_Posix_Error_ETXTBSY) -#ifdef ETXTBSY - {*r = ETXTBSY; return 0;} -#else /* def ETXTBSY */ - {errno = EINVAL; return -1;} -#endif /* ndef ETXTBSY */ - if (x == Mono_Posix_Error_EFBIG) -#ifdef EFBIG - {*r = EFBIG; return 0;} -#else /* def EFBIG */ - {errno = EINVAL; return -1;} -#endif /* ndef EFBIG */ - if (x == Mono_Posix_Error_ENOSPC) -#ifdef ENOSPC - {*r = ENOSPC; return 0;} -#else /* def ENOSPC */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOSPC */ - if (x == Mono_Posix_Error_ESPIPE) -#ifdef ESPIPE - {*r = ESPIPE; return 0;} -#else /* def ESPIPE */ - {errno = EINVAL; return -1;} -#endif /* ndef ESPIPE */ - if (x == Mono_Posix_Error_EROFS) -#ifdef EROFS - {*r = EROFS; return 0;} -#else /* def EROFS */ - {errno = EINVAL; return -1;} -#endif /* ndef EROFS */ - if (x == Mono_Posix_Error_EMLINK) -#ifdef EMLINK - {*r = EMLINK; return 0;} -#else /* def EMLINK */ - {errno = EINVAL; return -1;} -#endif /* ndef EMLINK */ - if (x == Mono_Posix_Error_EPIPE) -#ifdef EPIPE - {*r = EPIPE; return 0;} -#else /* def EPIPE */ - {errno = EINVAL; return -1;} -#endif /* ndef EPIPE */ - if (x == Mono_Posix_Error_EDOM) -#ifdef EDOM - {*r = EDOM; return 0;} -#else /* def EDOM */ - {errno = EINVAL; return -1;} -#endif /* ndef EDOM */ - if (x == Mono_Posix_Error_ERANGE) -#ifdef ERANGE - {*r = ERANGE; return 0;} -#else /* def ERANGE */ - {errno = EINVAL; return -1;} -#endif /* ndef ERANGE */ - if (x == Mono_Posix_Error_EDEADLK) -#ifdef EDEADLK - {*r = EDEADLK; return 0;} -#else /* def EDEADLK */ - {errno = EINVAL; return -1;} -#endif /* ndef EDEADLK */ - if (x == Mono_Posix_Error_ENAMETOOLONG) -#ifdef ENAMETOOLONG - {*r = ENAMETOOLONG; return 0;} -#else /* def ENAMETOOLONG */ - {errno = EINVAL; return -1;} -#endif /* ndef ENAMETOOLONG */ - if (x == Mono_Posix_Error_ENOLCK) -#ifdef ENOLCK - {*r = ENOLCK; return 0;} -#else /* def ENOLCK */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOLCK */ - if (x == Mono_Posix_Error_ENOSYS) -#ifdef ENOSYS - {*r = ENOSYS; return 0;} -#else /* def ENOSYS */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOSYS */ - if (x == Mono_Posix_Error_ENOTEMPTY) -#ifdef ENOTEMPTY - {*r = ENOTEMPTY; return 0;} -#else /* def ENOTEMPTY */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTEMPTY */ - if (x == Mono_Posix_Error_ELOOP) -#ifdef ELOOP - {*r = ELOOP; return 0;} -#else /* def ELOOP */ - {errno = EINVAL; return -1;} -#endif /* ndef ELOOP */ - if (x == Mono_Posix_Error_EWOULDBLOCK) -#ifdef EWOULDBLOCK - {*r = EWOULDBLOCK; return 0;} -#else /* def EWOULDBLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef EWOULDBLOCK */ - if (x == Mono_Posix_Error_ENOMSG) -#ifdef ENOMSG - {*r = ENOMSG; return 0;} -#else /* def ENOMSG */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOMSG */ - if (x == Mono_Posix_Error_EIDRM) -#ifdef EIDRM - {*r = EIDRM; return 0;} -#else /* def EIDRM */ - {errno = EINVAL; return -1;} -#endif /* ndef EIDRM */ - if (x == Mono_Posix_Error_ECHRNG) -#ifdef ECHRNG - {*r = ECHRNG; return 0;} -#else /* def ECHRNG */ - {errno = EINVAL; return -1;} -#endif /* ndef ECHRNG */ - if (x == Mono_Posix_Error_EL2NSYNC) -#ifdef EL2NSYNC - {*r = EL2NSYNC; return 0;} -#else /* def EL2NSYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef EL2NSYNC */ - if (x == Mono_Posix_Error_EL3HLT) -#ifdef EL3HLT - {*r = EL3HLT; return 0;} -#else /* def EL3HLT */ - {errno = EINVAL; return -1;} -#endif /* ndef EL3HLT */ - if (x == Mono_Posix_Error_EL3RST) -#ifdef EL3RST - {*r = EL3RST; return 0;} -#else /* def EL3RST */ - {errno = EINVAL; return -1;} -#endif /* ndef EL3RST */ - if (x == Mono_Posix_Error_ELNRNG) -#ifdef ELNRNG - {*r = ELNRNG; return 0;} -#else /* def ELNRNG */ - {errno = EINVAL; return -1;} -#endif /* ndef ELNRNG */ - if (x == Mono_Posix_Error_EUNATCH) -#ifdef EUNATCH - {*r = EUNATCH; return 0;} -#else /* def EUNATCH */ - {errno = EINVAL; return -1;} -#endif /* ndef EUNATCH */ - if (x == Mono_Posix_Error_ENOCSI) -#ifdef ENOCSI - {*r = ENOCSI; return 0;} -#else /* def ENOCSI */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOCSI */ - if (x == Mono_Posix_Error_EL2HLT) -#ifdef EL2HLT - {*r = EL2HLT; return 0;} -#else /* def EL2HLT */ - {errno = EINVAL; return -1;} -#endif /* ndef EL2HLT */ - if (x == Mono_Posix_Error_EBADE) -#ifdef EBADE - {*r = EBADE; return 0;} -#else /* def EBADE */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADE */ - if (x == Mono_Posix_Error_EBADR) -#ifdef EBADR - {*r = EBADR; return 0;} -#else /* def EBADR */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADR */ - if (x == Mono_Posix_Error_EXFULL) -#ifdef EXFULL - {*r = EXFULL; return 0;} -#else /* def EXFULL */ - {errno = EINVAL; return -1;} -#endif /* ndef EXFULL */ - if (x == Mono_Posix_Error_ENOANO) -#ifdef ENOANO - {*r = ENOANO; return 0;} -#else /* def ENOANO */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOANO */ - if (x == Mono_Posix_Error_EBADRQC) -#ifdef EBADRQC - {*r = EBADRQC; return 0;} -#else /* def EBADRQC */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADRQC */ - if (x == Mono_Posix_Error_EBADSLT) -#ifdef EBADSLT - {*r = EBADSLT; return 0;} -#else /* def EBADSLT */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADSLT */ - if (x == Mono_Posix_Error_EDEADLOCK) -#ifdef EDEADLOCK - {*r = EDEADLOCK; return 0;} -#else /* def EDEADLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef EDEADLOCK */ - if (x == Mono_Posix_Error_EBFONT) -#ifdef EBFONT - {*r = EBFONT; return 0;} -#else /* def EBFONT */ - {errno = EINVAL; return -1;} -#endif /* ndef EBFONT */ - if (x == Mono_Posix_Error_ENOSTR) -#ifdef ENOSTR - {*r = ENOSTR; return 0;} -#else /* def ENOSTR */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOSTR */ - if (x == Mono_Posix_Error_ENODATA) -#ifdef ENODATA - {*r = ENODATA; return 0;} -#else /* def ENODATA */ - {errno = EINVAL; return -1;} -#endif /* ndef ENODATA */ - if (x == Mono_Posix_Error_ETIME) -#ifdef ETIME - {*r = ETIME; return 0;} -#else /* def ETIME */ - {errno = EINVAL; return -1;} -#endif /* ndef ETIME */ - if (x == Mono_Posix_Error_ENOSR) -#ifdef ENOSR - {*r = ENOSR; return 0;} -#else /* def ENOSR */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOSR */ - if (x == Mono_Posix_Error_ENONET) -#ifdef ENONET - {*r = ENONET; return 0;} -#else /* def ENONET */ - {errno = EINVAL; return -1;} -#endif /* ndef ENONET */ - if (x == Mono_Posix_Error_ENOPKG) -#ifdef ENOPKG - {*r = ENOPKG; return 0;} -#else /* def ENOPKG */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOPKG */ - if (x == Mono_Posix_Error_EREMOTE) -#ifdef EREMOTE - {*r = EREMOTE; return 0;} -#else /* def EREMOTE */ - {errno = EINVAL; return -1;} -#endif /* ndef EREMOTE */ - if (x == Mono_Posix_Error_ENOLINK) -#ifdef ENOLINK - {*r = ENOLINK; return 0;} -#else /* def ENOLINK */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOLINK */ - if (x == Mono_Posix_Error_EADV) -#ifdef EADV - {*r = EADV; return 0;} -#else /* def EADV */ - {errno = EINVAL; return -1;} -#endif /* ndef EADV */ - if (x == Mono_Posix_Error_ESRMNT) -#ifdef ESRMNT - {*r = ESRMNT; return 0;} -#else /* def ESRMNT */ - {errno = EINVAL; return -1;} -#endif /* ndef ESRMNT */ - if (x == Mono_Posix_Error_ECOMM) -#ifdef ECOMM - {*r = ECOMM; return 0;} -#else /* def ECOMM */ - {errno = EINVAL; return -1;} -#endif /* ndef ECOMM */ - if (x == Mono_Posix_Error_EPROTO) -#ifdef EPROTO - {*r = EPROTO; return 0;} -#else /* def EPROTO */ - {errno = EINVAL; return -1;} -#endif /* ndef EPROTO */ - if (x == Mono_Posix_Error_EMULTIHOP) -#ifdef EMULTIHOP - {*r = EMULTIHOP; return 0;} -#else /* def EMULTIHOP */ - {errno = EINVAL; return -1;} -#endif /* ndef EMULTIHOP */ - if (x == Mono_Posix_Error_EDOTDOT) -#ifdef EDOTDOT - {*r = EDOTDOT; return 0;} -#else /* def EDOTDOT */ - {errno = EINVAL; return -1;} -#endif /* ndef EDOTDOT */ - if (x == Mono_Posix_Error_EBADMSG) -#ifdef EBADMSG - {*r = EBADMSG; return 0;} -#else /* def EBADMSG */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADMSG */ - if (x == Mono_Posix_Error_EOVERFLOW) -#ifdef EOVERFLOW - {*r = EOVERFLOW; return 0;} -#else /* def EOVERFLOW */ - {errno = EINVAL; return -1;} -#endif /* ndef EOVERFLOW */ - if (x == Mono_Posix_Error_ENOTUNIQ) -#ifdef ENOTUNIQ - {*r = ENOTUNIQ; return 0;} -#else /* def ENOTUNIQ */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTUNIQ */ - if (x == Mono_Posix_Error_EBADFD) -#ifdef EBADFD - {*r = EBADFD; return 0;} -#else /* def EBADFD */ - {errno = EINVAL; return -1;} -#endif /* ndef EBADFD */ - if (x == Mono_Posix_Error_EREMCHG) -#ifdef EREMCHG - {*r = EREMCHG; return 0;} -#else /* def EREMCHG */ - {errno = EINVAL; return -1;} -#endif /* ndef EREMCHG */ - if (x == Mono_Posix_Error_ELIBACC) -#ifdef ELIBACC - {*r = ELIBACC; return 0;} -#else /* def ELIBACC */ - {errno = EINVAL; return -1;} -#endif /* ndef ELIBACC */ - if (x == Mono_Posix_Error_ELIBBAD) -#ifdef ELIBBAD - {*r = ELIBBAD; return 0;} -#else /* def ELIBBAD */ - {errno = EINVAL; return -1;} -#endif /* ndef ELIBBAD */ - if (x == Mono_Posix_Error_ELIBSCN) -#ifdef ELIBSCN - {*r = ELIBSCN; return 0;} -#else /* def ELIBSCN */ - {errno = EINVAL; return -1;} -#endif /* ndef ELIBSCN */ - if (x == Mono_Posix_Error_ELIBMAX) -#ifdef ELIBMAX - {*r = ELIBMAX; return 0;} -#else /* def ELIBMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef ELIBMAX */ - if (x == Mono_Posix_Error_ELIBEXEC) -#ifdef ELIBEXEC - {*r = ELIBEXEC; return 0;} -#else /* def ELIBEXEC */ - {errno = EINVAL; return -1;} -#endif /* ndef ELIBEXEC */ - if (x == Mono_Posix_Error_EILSEQ) -#ifdef EILSEQ - {*r = EILSEQ; return 0;} -#else /* def EILSEQ */ - {errno = EINVAL; return -1;} -#endif /* ndef EILSEQ */ - if (x == Mono_Posix_Error_ERESTART) -#ifdef ERESTART - {*r = ERESTART; return 0;} -#else /* def ERESTART */ - {errno = EINVAL; return -1;} -#endif /* ndef ERESTART */ - if (x == Mono_Posix_Error_ESTRPIPE) -#ifdef ESTRPIPE - {*r = ESTRPIPE; return 0;} -#else /* def ESTRPIPE */ - {errno = EINVAL; return -1;} -#endif /* ndef ESTRPIPE */ - if (x == Mono_Posix_Error_EUSERS) -#ifdef EUSERS - {*r = EUSERS; return 0;} -#else /* def EUSERS */ - {errno = EINVAL; return -1;} -#endif /* ndef EUSERS */ - if (x == Mono_Posix_Error_ENOTSOCK) -#ifdef ENOTSOCK - {*r = ENOTSOCK; return 0;} -#else /* def ENOTSOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTSOCK */ - if (x == Mono_Posix_Error_EDESTADDRREQ) -#ifdef EDESTADDRREQ - {*r = EDESTADDRREQ; return 0;} -#else /* def EDESTADDRREQ */ - {errno = EINVAL; return -1;} -#endif /* ndef EDESTADDRREQ */ - if (x == Mono_Posix_Error_EMSGSIZE) -#ifdef EMSGSIZE - {*r = EMSGSIZE; return 0;} -#else /* def EMSGSIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef EMSGSIZE */ - if (x == Mono_Posix_Error_EPROTOTYPE) -#ifdef EPROTOTYPE - {*r = EPROTOTYPE; return 0;} -#else /* def EPROTOTYPE */ - {errno = EINVAL; return -1;} -#endif /* ndef EPROTOTYPE */ - if (x == Mono_Posix_Error_ENOPROTOOPT) -#ifdef ENOPROTOOPT - {*r = ENOPROTOOPT; return 0;} -#else /* def ENOPROTOOPT */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOPROTOOPT */ - if (x == Mono_Posix_Error_EPROTONOSUPPORT) -#ifdef EPROTONOSUPPORT - {*r = EPROTONOSUPPORT; return 0;} -#else /* def EPROTONOSUPPORT */ - {errno = EINVAL; return -1;} -#endif /* ndef EPROTONOSUPPORT */ - if (x == Mono_Posix_Error_ESOCKTNOSUPPORT) -#ifdef ESOCKTNOSUPPORT - {*r = ESOCKTNOSUPPORT; return 0;} -#else /* def ESOCKTNOSUPPORT */ - {errno = EINVAL; return -1;} -#endif /* ndef ESOCKTNOSUPPORT */ - if (x == Mono_Posix_Error_EOPNOTSUPP) -#ifdef EOPNOTSUPP - {*r = EOPNOTSUPP; return 0;} -#else /* def EOPNOTSUPP */ - {errno = EINVAL; return -1;} -#endif /* ndef EOPNOTSUPP */ - if (x == Mono_Posix_Error_EPFNOSUPPORT) -#ifdef EPFNOSUPPORT - {*r = EPFNOSUPPORT; return 0;} -#else /* def EPFNOSUPPORT */ - {errno = EINVAL; return -1;} -#endif /* ndef EPFNOSUPPORT */ - if (x == Mono_Posix_Error_EAFNOSUPPORT) -#ifdef EAFNOSUPPORT - {*r = EAFNOSUPPORT; return 0;} -#else /* def EAFNOSUPPORT */ - {errno = EINVAL; return -1;} -#endif /* ndef EAFNOSUPPORT */ - if (x == Mono_Posix_Error_EADDRINUSE) -#ifdef EADDRINUSE - {*r = EADDRINUSE; return 0;} -#else /* def EADDRINUSE */ - {errno = EINVAL; return -1;} -#endif /* ndef EADDRINUSE */ - if (x == Mono_Posix_Error_EADDRNOTAVAIL) -#ifdef EADDRNOTAVAIL - {*r = EADDRNOTAVAIL; return 0;} -#else /* def EADDRNOTAVAIL */ - {errno = EINVAL; return -1;} -#endif /* ndef EADDRNOTAVAIL */ - if (x == Mono_Posix_Error_ENETDOWN) -#ifdef ENETDOWN - {*r = ENETDOWN; return 0;} -#else /* def ENETDOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef ENETDOWN */ - if (x == Mono_Posix_Error_ENETUNREACH) -#ifdef ENETUNREACH - {*r = ENETUNREACH; return 0;} -#else /* def ENETUNREACH */ - {errno = EINVAL; return -1;} -#endif /* ndef ENETUNREACH */ - if (x == Mono_Posix_Error_ENETRESET) -#ifdef ENETRESET - {*r = ENETRESET; return 0;} -#else /* def ENETRESET */ - {errno = EINVAL; return -1;} -#endif /* ndef ENETRESET */ - if (x == Mono_Posix_Error_ECONNABORTED) -#ifdef ECONNABORTED - {*r = ECONNABORTED; return 0;} -#else /* def ECONNABORTED */ - {errno = EINVAL; return -1;} -#endif /* ndef ECONNABORTED */ - if (x == Mono_Posix_Error_ECONNRESET) -#ifdef ECONNRESET - {*r = ECONNRESET; return 0;} -#else /* def ECONNRESET */ - {errno = EINVAL; return -1;} -#endif /* ndef ECONNRESET */ - if (x == Mono_Posix_Error_ENOBUFS) -#ifdef ENOBUFS - {*r = ENOBUFS; return 0;} -#else /* def ENOBUFS */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOBUFS */ - if (x == Mono_Posix_Error_EISCONN) -#ifdef EISCONN - {*r = EISCONN; return 0;} -#else /* def EISCONN */ - {errno = EINVAL; return -1;} -#endif /* ndef EISCONN */ - if (x == Mono_Posix_Error_ENOTCONN) -#ifdef ENOTCONN - {*r = ENOTCONN; return 0;} -#else /* def ENOTCONN */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTCONN */ - if (x == Mono_Posix_Error_ESHUTDOWN) -#ifdef ESHUTDOWN - {*r = ESHUTDOWN; return 0;} -#else /* def ESHUTDOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef ESHUTDOWN */ - if (x == Mono_Posix_Error_ETOOMANYREFS) -#ifdef ETOOMANYREFS - {*r = ETOOMANYREFS; return 0;} -#else /* def ETOOMANYREFS */ - {errno = EINVAL; return -1;} -#endif /* ndef ETOOMANYREFS */ - if (x == Mono_Posix_Error_ETIMEDOUT) -#ifdef ETIMEDOUT - {*r = ETIMEDOUT; return 0;} -#else /* def ETIMEDOUT */ - {errno = EINVAL; return -1;} -#endif /* ndef ETIMEDOUT */ - if (x == Mono_Posix_Error_ECONNREFUSED) -#ifdef ECONNREFUSED - {*r = ECONNREFUSED; return 0;} -#else /* def ECONNREFUSED */ - {errno = EINVAL; return -1;} -#endif /* ndef ECONNREFUSED */ - if (x == Mono_Posix_Error_EHOSTDOWN) -#ifdef EHOSTDOWN - {*r = EHOSTDOWN; return 0;} -#else /* def EHOSTDOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef EHOSTDOWN */ - if (x == Mono_Posix_Error_EHOSTUNREACH) -#ifdef EHOSTUNREACH - {*r = EHOSTUNREACH; return 0;} -#else /* def EHOSTUNREACH */ - {errno = EINVAL; return -1;} -#endif /* ndef EHOSTUNREACH */ - if (x == Mono_Posix_Error_EALREADY) -#ifdef EALREADY - {*r = EALREADY; return 0;} -#else /* def EALREADY */ - {errno = EINVAL; return -1;} -#endif /* ndef EALREADY */ - if (x == Mono_Posix_Error_EINPROGRESS) -#ifdef EINPROGRESS - {*r = EINPROGRESS; return 0;} -#else /* def EINPROGRESS */ - {errno = EINVAL; return -1;} -#endif /* ndef EINPROGRESS */ - if (x == Mono_Posix_Error_ESTALE) -#ifdef ESTALE - {*r = ESTALE; return 0;} -#else /* def ESTALE */ - {errno = EINVAL; return -1;} -#endif /* ndef ESTALE */ - if (x == Mono_Posix_Error_EUCLEAN) -#ifdef EUCLEAN - {*r = EUCLEAN; return 0;} -#else /* def EUCLEAN */ - {errno = EINVAL; return -1;} -#endif /* ndef EUCLEAN */ - if (x == Mono_Posix_Error_ENOTNAM) -#ifdef ENOTNAM - {*r = ENOTNAM; return 0;} -#else /* def ENOTNAM */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOTNAM */ - if (x == Mono_Posix_Error_ENAVAIL) -#ifdef ENAVAIL - {*r = ENAVAIL; return 0;} -#else /* def ENAVAIL */ - {errno = EINVAL; return -1;} -#endif /* ndef ENAVAIL */ - if (x == Mono_Posix_Error_EISNAM) -#ifdef EISNAM - {*r = EISNAM; return 0;} -#else /* def EISNAM */ - {errno = EINVAL; return -1;} -#endif /* ndef EISNAM */ - if (x == Mono_Posix_Error_EREMOTEIO) -#ifdef EREMOTEIO - {*r = EREMOTEIO; return 0;} -#else /* def EREMOTEIO */ - {errno = EINVAL; return -1;} -#endif /* ndef EREMOTEIO */ - if (x == Mono_Posix_Error_EDQUOT) -#ifdef EDQUOT - {*r = EDQUOT; return 0;} -#else /* def EDQUOT */ - {errno = EINVAL; return -1;} -#endif /* ndef EDQUOT */ - if (x == Mono_Posix_Error_ENOMEDIUM) -#ifdef ENOMEDIUM - {*r = ENOMEDIUM; return 0;} -#else /* def ENOMEDIUM */ - {errno = EINVAL; return -1;} -#endif /* ndef ENOMEDIUM */ - if (x == Mono_Posix_Error_EMEDIUMTYPE) -#ifdef EMEDIUMTYPE - {*r = EMEDIUMTYPE; return 0;} -#else /* def EMEDIUMTYPE */ - {errno = EINVAL; return -1;} -#endif /* ndef EMEDIUMTYPE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToError (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef EPERM - if (x == EPERM) - {*r = Mono_Posix_Error_EPERM; return 0;} -#endif /* ndef EPERM */ -#ifdef ENOENT - if (x == ENOENT) - {*r = Mono_Posix_Error_ENOENT; return 0;} -#endif /* ndef ENOENT */ -#ifdef ESRCH - if (x == ESRCH) - {*r = Mono_Posix_Error_ESRCH; return 0;} -#endif /* ndef ESRCH */ -#ifdef EINTR - if (x == EINTR) - {*r = Mono_Posix_Error_EINTR; return 0;} -#endif /* ndef EINTR */ -#ifdef EIO - if (x == EIO) - {*r = Mono_Posix_Error_EIO; return 0;} -#endif /* ndef EIO */ -#ifdef ENXIO - if (x == ENXIO) - {*r = Mono_Posix_Error_ENXIO; return 0;} -#endif /* ndef ENXIO */ -#ifdef E2BIG - if (x == E2BIG) - {*r = Mono_Posix_Error_E2BIG; return 0;} -#endif /* ndef E2BIG */ -#ifdef ENOEXEC - if (x == ENOEXEC) - {*r = Mono_Posix_Error_ENOEXEC; return 0;} -#endif /* ndef ENOEXEC */ -#ifdef EBADF - if (x == EBADF) - {*r = Mono_Posix_Error_EBADF; return 0;} -#endif /* ndef EBADF */ -#ifdef ECHILD - if (x == ECHILD) - {*r = Mono_Posix_Error_ECHILD; return 0;} -#endif /* ndef ECHILD */ -#ifdef EAGAIN - if (x == EAGAIN) - {*r = Mono_Posix_Error_EAGAIN; return 0;} -#endif /* ndef EAGAIN */ -#ifdef ENOMEM - if (x == ENOMEM) - {*r = Mono_Posix_Error_ENOMEM; return 0;} -#endif /* ndef ENOMEM */ -#ifdef EACCES - if (x == EACCES) - {*r = Mono_Posix_Error_EACCES; return 0;} -#endif /* ndef EACCES */ -#ifdef EFAULT - if (x == EFAULT) - {*r = Mono_Posix_Error_EFAULT; return 0;} -#endif /* ndef EFAULT */ -#ifdef ENOTBLK - if (x == ENOTBLK) - {*r = Mono_Posix_Error_ENOTBLK; return 0;} -#endif /* ndef ENOTBLK */ -#ifdef EBUSY - if (x == EBUSY) - {*r = Mono_Posix_Error_EBUSY; return 0;} -#endif /* ndef EBUSY */ -#ifdef EEXIST - if (x == EEXIST) - {*r = Mono_Posix_Error_EEXIST; return 0;} -#endif /* ndef EEXIST */ -#ifdef EXDEV - if (x == EXDEV) - {*r = Mono_Posix_Error_EXDEV; return 0;} -#endif /* ndef EXDEV */ -#ifdef ENODEV - if (x == ENODEV) - {*r = Mono_Posix_Error_ENODEV; return 0;} -#endif /* ndef ENODEV */ -#ifdef ENOTDIR - if (x == ENOTDIR) - {*r = Mono_Posix_Error_ENOTDIR; return 0;} -#endif /* ndef ENOTDIR */ -#ifdef EISDIR - if (x == EISDIR) - {*r = Mono_Posix_Error_EISDIR; return 0;} -#endif /* ndef EISDIR */ -#ifdef EINVAL - if (x == EINVAL) - {*r = Mono_Posix_Error_EINVAL; return 0;} -#endif /* ndef EINVAL */ -#ifdef ENFILE - if (x == ENFILE) - {*r = Mono_Posix_Error_ENFILE; return 0;} -#endif /* ndef ENFILE */ -#ifdef EMFILE - if (x == EMFILE) - {*r = Mono_Posix_Error_EMFILE; return 0;} -#endif /* ndef EMFILE */ -#ifdef ENOTTY - if (x == ENOTTY) - {*r = Mono_Posix_Error_ENOTTY; return 0;} -#endif /* ndef ENOTTY */ -#ifdef ETXTBSY - if (x == ETXTBSY) - {*r = Mono_Posix_Error_ETXTBSY; return 0;} -#endif /* ndef ETXTBSY */ -#ifdef EFBIG - if (x == EFBIG) - {*r = Mono_Posix_Error_EFBIG; return 0;} -#endif /* ndef EFBIG */ -#ifdef ENOSPC - if (x == ENOSPC) - {*r = Mono_Posix_Error_ENOSPC; return 0;} -#endif /* ndef ENOSPC */ -#ifdef ESPIPE - if (x == ESPIPE) - {*r = Mono_Posix_Error_ESPIPE; return 0;} -#endif /* ndef ESPIPE */ -#ifdef EROFS - if (x == EROFS) - {*r = Mono_Posix_Error_EROFS; return 0;} -#endif /* ndef EROFS */ -#ifdef EMLINK - if (x == EMLINK) - {*r = Mono_Posix_Error_EMLINK; return 0;} -#endif /* ndef EMLINK */ -#ifdef EPIPE - if (x == EPIPE) - {*r = Mono_Posix_Error_EPIPE; return 0;} -#endif /* ndef EPIPE */ -#ifdef EDOM - if (x == EDOM) - {*r = Mono_Posix_Error_EDOM; return 0;} -#endif /* ndef EDOM */ -#ifdef ERANGE - if (x == ERANGE) - {*r = Mono_Posix_Error_ERANGE; return 0;} -#endif /* ndef ERANGE */ -#ifdef EDEADLK - if (x == EDEADLK) - {*r = Mono_Posix_Error_EDEADLK; return 0;} -#endif /* ndef EDEADLK */ -#ifdef ENAMETOOLONG - if (x == ENAMETOOLONG) - {*r = Mono_Posix_Error_ENAMETOOLONG; return 0;} -#endif /* ndef ENAMETOOLONG */ -#ifdef ENOLCK - if (x == ENOLCK) - {*r = Mono_Posix_Error_ENOLCK; return 0;} -#endif /* ndef ENOLCK */ -#ifdef ENOSYS - if (x == ENOSYS) - {*r = Mono_Posix_Error_ENOSYS; return 0;} -#endif /* ndef ENOSYS */ -#ifdef ENOTEMPTY - if (x == ENOTEMPTY) - {*r = Mono_Posix_Error_ENOTEMPTY; return 0;} -#endif /* ndef ENOTEMPTY */ -#ifdef ELOOP - if (x == ELOOP) - {*r = Mono_Posix_Error_ELOOP; return 0;} -#endif /* ndef ELOOP */ -#ifdef EWOULDBLOCK - if (x == EWOULDBLOCK) - {*r = Mono_Posix_Error_EWOULDBLOCK; return 0;} -#endif /* ndef EWOULDBLOCK */ -#ifdef ENOMSG - if (x == ENOMSG) - {*r = Mono_Posix_Error_ENOMSG; return 0;} -#endif /* ndef ENOMSG */ -#ifdef EIDRM - if (x == EIDRM) - {*r = Mono_Posix_Error_EIDRM; return 0;} -#endif /* ndef EIDRM */ -#ifdef ECHRNG - if (x == ECHRNG) - {*r = Mono_Posix_Error_ECHRNG; return 0;} -#endif /* ndef ECHRNG */ -#ifdef EL2NSYNC - if (x == EL2NSYNC) - {*r = Mono_Posix_Error_EL2NSYNC; return 0;} -#endif /* ndef EL2NSYNC */ -#ifdef EL3HLT - if (x == EL3HLT) - {*r = Mono_Posix_Error_EL3HLT; return 0;} -#endif /* ndef EL3HLT */ -#ifdef EL3RST - if (x == EL3RST) - {*r = Mono_Posix_Error_EL3RST; return 0;} -#endif /* ndef EL3RST */ -#ifdef ELNRNG - if (x == ELNRNG) - {*r = Mono_Posix_Error_ELNRNG; return 0;} -#endif /* ndef ELNRNG */ -#ifdef EUNATCH - if (x == EUNATCH) - {*r = Mono_Posix_Error_EUNATCH; return 0;} -#endif /* ndef EUNATCH */ -#ifdef ENOCSI - if (x == ENOCSI) - {*r = Mono_Posix_Error_ENOCSI; return 0;} -#endif /* ndef ENOCSI */ -#ifdef EL2HLT - if (x == EL2HLT) - {*r = Mono_Posix_Error_EL2HLT; return 0;} -#endif /* ndef EL2HLT */ -#ifdef EBADE - if (x == EBADE) - {*r = Mono_Posix_Error_EBADE; return 0;} -#endif /* ndef EBADE */ -#ifdef EBADR - if (x == EBADR) - {*r = Mono_Posix_Error_EBADR; return 0;} -#endif /* ndef EBADR */ -#ifdef EXFULL - if (x == EXFULL) - {*r = Mono_Posix_Error_EXFULL; return 0;} -#endif /* ndef EXFULL */ -#ifdef ENOANO - if (x == ENOANO) - {*r = Mono_Posix_Error_ENOANO; return 0;} -#endif /* ndef ENOANO */ -#ifdef EBADRQC - if (x == EBADRQC) - {*r = Mono_Posix_Error_EBADRQC; return 0;} -#endif /* ndef EBADRQC */ -#ifdef EBADSLT - if (x == EBADSLT) - {*r = Mono_Posix_Error_EBADSLT; return 0;} -#endif /* ndef EBADSLT */ -#ifdef EDEADLOCK - if (x == EDEADLOCK) - {*r = Mono_Posix_Error_EDEADLOCK; return 0;} -#endif /* ndef EDEADLOCK */ -#ifdef EBFONT - if (x == EBFONT) - {*r = Mono_Posix_Error_EBFONT; return 0;} -#endif /* ndef EBFONT */ -#ifdef ENOSTR - if (x == ENOSTR) - {*r = Mono_Posix_Error_ENOSTR; return 0;} -#endif /* ndef ENOSTR */ -#ifdef ENODATA - if (x == ENODATA) - {*r = Mono_Posix_Error_ENODATA; return 0;} -#endif /* ndef ENODATA */ -#ifdef ETIME - if (x == ETIME) - {*r = Mono_Posix_Error_ETIME; return 0;} -#endif /* ndef ETIME */ -#ifdef ENOSR - if (x == ENOSR) - {*r = Mono_Posix_Error_ENOSR; return 0;} -#endif /* ndef ENOSR */ -#ifdef ENONET - if (x == ENONET) - {*r = Mono_Posix_Error_ENONET; return 0;} -#endif /* ndef ENONET */ -#ifdef ENOPKG - if (x == ENOPKG) - {*r = Mono_Posix_Error_ENOPKG; return 0;} -#endif /* ndef ENOPKG */ -#ifdef EREMOTE - if (x == EREMOTE) - {*r = Mono_Posix_Error_EREMOTE; return 0;} -#endif /* ndef EREMOTE */ -#ifdef ENOLINK - if (x == ENOLINK) - {*r = Mono_Posix_Error_ENOLINK; return 0;} -#endif /* ndef ENOLINK */ -#ifdef EADV - if (x == EADV) - {*r = Mono_Posix_Error_EADV; return 0;} -#endif /* ndef EADV */ -#ifdef ESRMNT - if (x == ESRMNT) - {*r = Mono_Posix_Error_ESRMNT; return 0;} -#endif /* ndef ESRMNT */ -#ifdef ECOMM - if (x == ECOMM) - {*r = Mono_Posix_Error_ECOMM; return 0;} -#endif /* ndef ECOMM */ -#ifdef EPROTO - if (x == EPROTO) - {*r = Mono_Posix_Error_EPROTO; return 0;} -#endif /* ndef EPROTO */ -#ifdef EMULTIHOP - if (x == EMULTIHOP) - {*r = Mono_Posix_Error_EMULTIHOP; return 0;} -#endif /* ndef EMULTIHOP */ -#ifdef EDOTDOT - if (x == EDOTDOT) - {*r = Mono_Posix_Error_EDOTDOT; return 0;} -#endif /* ndef EDOTDOT */ -#ifdef EBADMSG - if (x == EBADMSG) - {*r = Mono_Posix_Error_EBADMSG; return 0;} -#endif /* ndef EBADMSG */ -#ifdef EOVERFLOW - if (x == EOVERFLOW) - {*r = Mono_Posix_Error_EOVERFLOW; return 0;} -#endif /* ndef EOVERFLOW */ -#ifdef ENOTUNIQ - if (x == ENOTUNIQ) - {*r = Mono_Posix_Error_ENOTUNIQ; return 0;} -#endif /* ndef ENOTUNIQ */ -#ifdef EBADFD - if (x == EBADFD) - {*r = Mono_Posix_Error_EBADFD; return 0;} -#endif /* ndef EBADFD */ -#ifdef EREMCHG - if (x == EREMCHG) - {*r = Mono_Posix_Error_EREMCHG; return 0;} -#endif /* ndef EREMCHG */ -#ifdef ELIBACC - if (x == ELIBACC) - {*r = Mono_Posix_Error_ELIBACC; return 0;} -#endif /* ndef ELIBACC */ -#ifdef ELIBBAD - if (x == ELIBBAD) - {*r = Mono_Posix_Error_ELIBBAD; return 0;} -#endif /* ndef ELIBBAD */ -#ifdef ELIBSCN - if (x == ELIBSCN) - {*r = Mono_Posix_Error_ELIBSCN; return 0;} -#endif /* ndef ELIBSCN */ -#ifdef ELIBMAX - if (x == ELIBMAX) - {*r = Mono_Posix_Error_ELIBMAX; return 0;} -#endif /* ndef ELIBMAX */ -#ifdef ELIBEXEC - if (x == ELIBEXEC) - {*r = Mono_Posix_Error_ELIBEXEC; return 0;} -#endif /* ndef ELIBEXEC */ -#ifdef EILSEQ - if (x == EILSEQ) - {*r = Mono_Posix_Error_EILSEQ; return 0;} -#endif /* ndef EILSEQ */ -#ifdef ERESTART - if (x == ERESTART) - {*r = Mono_Posix_Error_ERESTART; return 0;} -#endif /* ndef ERESTART */ -#ifdef ESTRPIPE - if (x == ESTRPIPE) - {*r = Mono_Posix_Error_ESTRPIPE; return 0;} -#endif /* ndef ESTRPIPE */ -#ifdef EUSERS - if (x == EUSERS) - {*r = Mono_Posix_Error_EUSERS; return 0;} -#endif /* ndef EUSERS */ -#ifdef ENOTSOCK - if (x == ENOTSOCK) - {*r = Mono_Posix_Error_ENOTSOCK; return 0;} -#endif /* ndef ENOTSOCK */ -#ifdef EDESTADDRREQ - if (x == EDESTADDRREQ) - {*r = Mono_Posix_Error_EDESTADDRREQ; return 0;} -#endif /* ndef EDESTADDRREQ */ -#ifdef EMSGSIZE - if (x == EMSGSIZE) - {*r = Mono_Posix_Error_EMSGSIZE; return 0;} -#endif /* ndef EMSGSIZE */ -#ifdef EPROTOTYPE - if (x == EPROTOTYPE) - {*r = Mono_Posix_Error_EPROTOTYPE; return 0;} -#endif /* ndef EPROTOTYPE */ -#ifdef ENOPROTOOPT - if (x == ENOPROTOOPT) - {*r = Mono_Posix_Error_ENOPROTOOPT; return 0;} -#endif /* ndef ENOPROTOOPT */ -#ifdef EPROTONOSUPPORT - if (x == EPROTONOSUPPORT) - {*r = Mono_Posix_Error_EPROTONOSUPPORT; return 0;} -#endif /* ndef EPROTONOSUPPORT */ -#ifdef ESOCKTNOSUPPORT - if (x == ESOCKTNOSUPPORT) - {*r = Mono_Posix_Error_ESOCKTNOSUPPORT; return 0;} -#endif /* ndef ESOCKTNOSUPPORT */ -#ifdef EOPNOTSUPP - if (x == EOPNOTSUPP) - {*r = Mono_Posix_Error_EOPNOTSUPP; return 0;} -#endif /* ndef EOPNOTSUPP */ -#ifdef EPFNOSUPPORT - if (x == EPFNOSUPPORT) - {*r = Mono_Posix_Error_EPFNOSUPPORT; return 0;} -#endif /* ndef EPFNOSUPPORT */ -#ifdef EAFNOSUPPORT - if (x == EAFNOSUPPORT) - {*r = Mono_Posix_Error_EAFNOSUPPORT; return 0;} -#endif /* ndef EAFNOSUPPORT */ -#ifdef EADDRINUSE - if (x == EADDRINUSE) - {*r = Mono_Posix_Error_EADDRINUSE; return 0;} -#endif /* ndef EADDRINUSE */ -#ifdef EADDRNOTAVAIL - if (x == EADDRNOTAVAIL) - {*r = Mono_Posix_Error_EADDRNOTAVAIL; return 0;} -#endif /* ndef EADDRNOTAVAIL */ -#ifdef ENETDOWN - if (x == ENETDOWN) - {*r = Mono_Posix_Error_ENETDOWN; return 0;} -#endif /* ndef ENETDOWN */ -#ifdef ENETUNREACH - if (x == ENETUNREACH) - {*r = Mono_Posix_Error_ENETUNREACH; return 0;} -#endif /* ndef ENETUNREACH */ -#ifdef ENETRESET - if (x == ENETRESET) - {*r = Mono_Posix_Error_ENETRESET; return 0;} -#endif /* ndef ENETRESET */ -#ifdef ECONNABORTED - if (x == ECONNABORTED) - {*r = Mono_Posix_Error_ECONNABORTED; return 0;} -#endif /* ndef ECONNABORTED */ -#ifdef ECONNRESET - if (x == ECONNRESET) - {*r = Mono_Posix_Error_ECONNRESET; return 0;} -#endif /* ndef ECONNRESET */ -#ifdef ENOBUFS - if (x == ENOBUFS) - {*r = Mono_Posix_Error_ENOBUFS; return 0;} -#endif /* ndef ENOBUFS */ -#ifdef EISCONN - if (x == EISCONN) - {*r = Mono_Posix_Error_EISCONN; return 0;} -#endif /* ndef EISCONN */ -#ifdef ENOTCONN - if (x == ENOTCONN) - {*r = Mono_Posix_Error_ENOTCONN; return 0;} -#endif /* ndef ENOTCONN */ -#ifdef ESHUTDOWN - if (x == ESHUTDOWN) - {*r = Mono_Posix_Error_ESHUTDOWN; return 0;} -#endif /* ndef ESHUTDOWN */ -#ifdef ETOOMANYREFS - if (x == ETOOMANYREFS) - {*r = Mono_Posix_Error_ETOOMANYREFS; return 0;} -#endif /* ndef ETOOMANYREFS */ -#ifdef ETIMEDOUT - if (x == ETIMEDOUT) - {*r = Mono_Posix_Error_ETIMEDOUT; return 0;} -#endif /* ndef ETIMEDOUT */ -#ifdef ECONNREFUSED - if (x == ECONNREFUSED) - {*r = Mono_Posix_Error_ECONNREFUSED; return 0;} -#endif /* ndef ECONNREFUSED */ -#ifdef EHOSTDOWN - if (x == EHOSTDOWN) - {*r = Mono_Posix_Error_EHOSTDOWN; return 0;} -#endif /* ndef EHOSTDOWN */ -#ifdef EHOSTUNREACH - if (x == EHOSTUNREACH) - {*r = Mono_Posix_Error_EHOSTUNREACH; return 0;} -#endif /* ndef EHOSTUNREACH */ -#ifdef EALREADY - if (x == EALREADY) - {*r = Mono_Posix_Error_EALREADY; return 0;} -#endif /* ndef EALREADY */ -#ifdef EINPROGRESS - if (x == EINPROGRESS) - {*r = Mono_Posix_Error_EINPROGRESS; return 0;} -#endif /* ndef EINPROGRESS */ -#ifdef ESTALE - if (x == ESTALE) - {*r = Mono_Posix_Error_ESTALE; return 0;} -#endif /* ndef ESTALE */ -#ifdef EUCLEAN - if (x == EUCLEAN) - {*r = Mono_Posix_Error_EUCLEAN; return 0;} -#endif /* ndef EUCLEAN */ -#ifdef ENOTNAM - if (x == ENOTNAM) - {*r = Mono_Posix_Error_ENOTNAM; return 0;} -#endif /* ndef ENOTNAM */ -#ifdef ENAVAIL - if (x == ENAVAIL) - {*r = Mono_Posix_Error_ENAVAIL; return 0;} -#endif /* ndef ENAVAIL */ -#ifdef EISNAM - if (x == EISNAM) - {*r = Mono_Posix_Error_EISNAM; return 0;} -#endif /* ndef EISNAM */ -#ifdef EREMOTEIO - if (x == EREMOTEIO) - {*r = Mono_Posix_Error_EREMOTEIO; return 0;} -#endif /* ndef EREMOTEIO */ -#ifdef EDQUOT - if (x == EDQUOT) - {*r = Mono_Posix_Error_EDQUOT; return 0;} -#endif /* ndef EDQUOT */ -#ifdef ENOMEDIUM - if (x == ENOMEDIUM) - {*r = Mono_Posix_Error_ENOMEDIUM; return 0;} -#endif /* ndef ENOMEDIUM */ -#ifdef EMEDIUMTYPE - if (x == EMEDIUMTYPE) - {*r = Mono_Posix_Error_EMEDIUMTYPE; return 0;} -#endif /* ndef EMEDIUMTYPE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromSyslogOptions (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID) -#ifdef LOG_PID - *r |= LOG_PID; -#else /* def LOG_PID */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_PID */ - if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS) -#ifdef LOG_CONS - *r |= LOG_CONS; -#else /* def LOG_CONS */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_CONS */ - if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY) -#ifdef LOG_ODELAY - *r |= LOG_ODELAY; -#else /* def LOG_ODELAY */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_ODELAY */ - if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY) -#ifdef LOG_NDELAY - *r |= LOG_NDELAY; -#else /* def LOG_NDELAY */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_NDELAY */ - if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT) -#ifdef LOG_NOWAIT - *r |= LOG_NOWAIT; -#else /* def LOG_NOWAIT */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_NOWAIT */ - if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR) -#ifdef LOG_PERROR - *r |= LOG_PERROR; -#else /* def LOG_PERROR */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_PERROR */ - return 0; -} - -int Mono_Posix_ToSyslogOptions (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef LOG_PID - if ((x & LOG_PID) == LOG_PID) - *r |= Mono_Posix_SyslogOptions_LOG_PID; -#endif /* ndef LOG_PID */ -#ifdef LOG_CONS - if ((x & LOG_CONS) == LOG_CONS) - *r |= Mono_Posix_SyslogOptions_LOG_CONS; -#endif /* ndef LOG_CONS */ -#ifdef LOG_ODELAY - if ((x & LOG_ODELAY) == LOG_ODELAY) - *r |= Mono_Posix_SyslogOptions_LOG_ODELAY; -#endif /* ndef LOG_ODELAY */ -#ifdef LOG_NDELAY - if ((x & LOG_NDELAY) == LOG_NDELAY) - *r |= Mono_Posix_SyslogOptions_LOG_NDELAY; -#endif /* ndef LOG_NDELAY */ -#ifdef LOG_NOWAIT - if ((x & LOG_NOWAIT) == LOG_NOWAIT) - *r |= Mono_Posix_SyslogOptions_LOG_NOWAIT; -#endif /* ndef LOG_NOWAIT */ -#ifdef LOG_PERROR - if ((x & LOG_PERROR) == LOG_PERROR) - *r |= Mono_Posix_SyslogOptions_LOG_PERROR; -#endif /* ndef LOG_PERROR */ - return 0; -} - -int Mono_Posix_FromSyslogFacility (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_SyslogFacility_LOG_KERN) -#ifdef LOG_KERN - {*r = LOG_KERN; return 0;} -#else /* def LOG_KERN */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_KERN */ - if (x == Mono_Posix_SyslogFacility_LOG_USER) -#ifdef LOG_USER - {*r = LOG_USER; return 0;} -#else /* def LOG_USER */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_USER */ - /* Mono_Posix_SyslogFacility_LOG_USRE is obsolete; ignoring */ - if (x == Mono_Posix_SyslogFacility_LOG_MAIL) -#ifdef LOG_MAIL - {*r = LOG_MAIL; return 0;} -#else /* def LOG_MAIL */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_MAIL */ - if (x == Mono_Posix_SyslogFacility_LOG_DAEMON) -#ifdef LOG_DAEMON - {*r = LOG_DAEMON; return 0;} -#else /* def LOG_DAEMON */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_DAEMON */ - if (x == Mono_Posix_SyslogFacility_LOG_AUTH) -#ifdef LOG_AUTH - {*r = LOG_AUTH; return 0;} -#else /* def LOG_AUTH */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_AUTH */ - if (x == Mono_Posix_SyslogFacility_LOG_SYSLOG) -#ifdef LOG_SYSLOG - {*r = LOG_SYSLOG; return 0;} -#else /* def LOG_SYSLOG */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_SYSLOG */ - if (x == Mono_Posix_SyslogFacility_LOG_LPR) -#ifdef LOG_LPR - {*r = LOG_LPR; return 0;} -#else /* def LOG_LPR */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LPR */ - if (x == Mono_Posix_SyslogFacility_LOG_NEWS) -#ifdef LOG_NEWS - {*r = LOG_NEWS; return 0;} -#else /* def LOG_NEWS */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_NEWS */ - if (x == Mono_Posix_SyslogFacility_LOG_UUCP) -#ifdef LOG_UUCP - {*r = LOG_UUCP; return 0;} -#else /* def LOG_UUCP */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_UUCP */ - if (x == Mono_Posix_SyslogFacility_LOG_CRON) -#ifdef LOG_CRON - {*r = LOG_CRON; return 0;} -#else /* def LOG_CRON */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_CRON */ - if (x == Mono_Posix_SyslogFacility_LOG_AUTHPRIV) -#ifdef LOG_AUTHPRIV - {*r = LOG_AUTHPRIV; return 0;} -#else /* def LOG_AUTHPRIV */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_AUTHPRIV */ - if (x == Mono_Posix_SyslogFacility_LOG_FTP) -#ifdef LOG_FTP - {*r = LOG_FTP; return 0;} -#else /* def LOG_FTP */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_FTP */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL0) -#ifdef LOG_LOCAL0 - {*r = LOG_LOCAL0; return 0;} -#else /* def LOG_LOCAL0 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL0 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL1) -#ifdef LOG_LOCAL1 - {*r = LOG_LOCAL1; return 0;} -#else /* def LOG_LOCAL1 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL1 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL2) -#ifdef LOG_LOCAL2 - {*r = LOG_LOCAL2; return 0;} -#else /* def LOG_LOCAL2 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL2 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL3) -#ifdef LOG_LOCAL3 - {*r = LOG_LOCAL3; return 0;} -#else /* def LOG_LOCAL3 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL3 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL4) -#ifdef LOG_LOCAL4 - {*r = LOG_LOCAL4; return 0;} -#else /* def LOG_LOCAL4 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL4 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL5) -#ifdef LOG_LOCAL5 - {*r = LOG_LOCAL5; return 0;} -#else /* def LOG_LOCAL5 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL5 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL6) -#ifdef LOG_LOCAL6 - {*r = LOG_LOCAL6; return 0;} -#else /* def LOG_LOCAL6 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL6 */ - if (x == Mono_Posix_SyslogFacility_LOG_LOCAL7) -#ifdef LOG_LOCAL7 - {*r = LOG_LOCAL7; return 0;} -#else /* def LOG_LOCAL7 */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_LOCAL7 */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToSyslogFacility (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef LOG_KERN - if (x == LOG_KERN) - {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;} -#endif /* ndef LOG_KERN */ -#ifdef LOG_USER - if (x == LOG_USER) - {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;} -#endif /* ndef LOG_USER */ -#ifdef LOG_USRE - if (x == LOG_USRE) - {*r = Mono_Posix_SyslogFacility_LOG_USRE; return 0;} -#endif /* ndef LOG_USRE */ -#ifdef LOG_MAIL - if (x == LOG_MAIL) - {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;} -#endif /* ndef LOG_MAIL */ -#ifdef LOG_DAEMON - if (x == LOG_DAEMON) - {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;} -#endif /* ndef LOG_DAEMON */ -#ifdef LOG_AUTH - if (x == LOG_AUTH) - {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;} -#endif /* ndef LOG_AUTH */ -#ifdef LOG_SYSLOG - if (x == LOG_SYSLOG) - {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;} -#endif /* ndef LOG_SYSLOG */ -#ifdef LOG_LPR - if (x == LOG_LPR) - {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;} -#endif /* ndef LOG_LPR */ -#ifdef LOG_NEWS - if (x == LOG_NEWS) - {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;} -#endif /* ndef LOG_NEWS */ -#ifdef LOG_UUCP - if (x == LOG_UUCP) - {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;} -#endif /* ndef LOG_UUCP */ -#ifdef LOG_CRON - if (x == LOG_CRON) - {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;} -#endif /* ndef LOG_CRON */ -#ifdef LOG_AUTHPRIV - if (x == LOG_AUTHPRIV) - {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;} -#endif /* ndef LOG_AUTHPRIV */ -#ifdef LOG_FTP - if (x == LOG_FTP) - {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;} -#endif /* ndef LOG_FTP */ -#ifdef LOG_LOCAL0 - if (x == LOG_LOCAL0) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL0; return 0;} -#endif /* ndef LOG_LOCAL0 */ -#ifdef LOG_LOCAL1 - if (x == LOG_LOCAL1) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL1; return 0;} -#endif /* ndef LOG_LOCAL1 */ -#ifdef LOG_LOCAL2 - if (x == LOG_LOCAL2) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL2; return 0;} -#endif /* ndef LOG_LOCAL2 */ -#ifdef LOG_LOCAL3 - if (x == LOG_LOCAL3) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL3; return 0;} -#endif /* ndef LOG_LOCAL3 */ -#ifdef LOG_LOCAL4 - if (x == LOG_LOCAL4) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL4; return 0;} -#endif /* ndef LOG_LOCAL4 */ -#ifdef LOG_LOCAL5 - if (x == LOG_LOCAL5) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL5; return 0;} -#endif /* ndef LOG_LOCAL5 */ -#ifdef LOG_LOCAL6 - if (x == LOG_LOCAL6) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL6; return 0;} -#endif /* ndef LOG_LOCAL6 */ -#ifdef LOG_LOCAL7 - if (x == LOG_LOCAL7) - {*r = Mono_Posix_SyslogFacility_LOG_LOCAL7; return 0;} -#endif /* ndef LOG_LOCAL7 */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromSyslogLevel (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_SyslogLevel_LOG_EMERG) -#ifdef LOG_EMERG - {*r = LOG_EMERG; return 0;} -#else /* def LOG_EMERG */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_EMERG */ - if (x == Mono_Posix_SyslogLevel_LOG_ALERT) -#ifdef LOG_ALERT - {*r = LOG_ALERT; return 0;} -#else /* def LOG_ALERT */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_ALERT */ - if (x == Mono_Posix_SyslogLevel_LOG_CRIT) -#ifdef LOG_CRIT - {*r = LOG_CRIT; return 0;} -#else /* def LOG_CRIT */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_CRIT */ - if (x == Mono_Posix_SyslogLevel_LOG_ERR) -#ifdef LOG_ERR - {*r = LOG_ERR; return 0;} -#else /* def LOG_ERR */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_ERR */ - if (x == Mono_Posix_SyslogLevel_LOG_WARNING) -#ifdef LOG_WARNING - {*r = LOG_WARNING; return 0;} -#else /* def LOG_WARNING */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_WARNING */ - if (x == Mono_Posix_SyslogLevel_LOG_NOTICE) -#ifdef LOG_NOTICE - {*r = LOG_NOTICE; return 0;} -#else /* def LOG_NOTICE */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_NOTICE */ - if (x == Mono_Posix_SyslogLevel_LOG_INFO) -#ifdef LOG_INFO - {*r = LOG_INFO; return 0;} -#else /* def LOG_INFO */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_INFO */ - if (x == Mono_Posix_SyslogLevel_LOG_DEBUG) -#ifdef LOG_DEBUG - {*r = LOG_DEBUG; return 0;} -#else /* def LOG_DEBUG */ - {errno = EINVAL; return -1;} -#endif /* ndef LOG_DEBUG */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToSyslogLevel (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef LOG_EMERG - if (x == LOG_EMERG) - {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;} -#endif /* ndef LOG_EMERG */ -#ifdef LOG_ALERT - if (x == LOG_ALERT) - {*r = Mono_Posix_SyslogLevel_LOG_ALERT; return 0;} -#endif /* ndef LOG_ALERT */ -#ifdef LOG_CRIT - if (x == LOG_CRIT) - {*r = Mono_Posix_SyslogLevel_LOG_CRIT; return 0;} -#endif /* ndef LOG_CRIT */ -#ifdef LOG_ERR - if (x == LOG_ERR) - {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;} -#endif /* ndef LOG_ERR */ -#ifdef LOG_WARNING - if (x == LOG_WARNING) - {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;} -#endif /* ndef LOG_WARNING */ -#ifdef LOG_NOTICE - if (x == LOG_NOTICE) - {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;} -#endif /* ndef LOG_NOTICE */ -#ifdef LOG_INFO - if (x == LOG_INFO) - {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;} -#endif /* ndef LOG_INFO */ -#ifdef LOG_DEBUG - if (x == LOG_DEBUG) - {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;} -#endif /* ndef LOG_DEBUG */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromOpenFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY) -#ifdef O_RDONLY - *r |= O_RDONLY; -#else /* def O_RDONLY */ - {errno = EINVAL; return -1;} -#endif /* ndef O_RDONLY */ - if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY) -#ifdef O_WRONLY - *r |= O_WRONLY; -#else /* def O_WRONLY */ - {errno = EINVAL; return -1;} -#endif /* ndef O_WRONLY */ - if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR) -#ifdef O_RDWR - *r |= O_RDWR; -#else /* def O_RDWR */ - {errno = EINVAL; return -1;} -#endif /* ndef O_RDWR */ - if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT) -#ifdef O_CREAT - *r |= O_CREAT; -#else /* def O_CREAT */ - {errno = EINVAL; return -1;} -#endif /* ndef O_CREAT */ - if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL) -#ifdef O_EXCL - *r |= O_EXCL; -#else /* def O_EXCL */ - {errno = EINVAL; return -1;} -#endif /* ndef O_EXCL */ - if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY) -#ifdef O_NOCTTY - *r |= O_NOCTTY; -#else /* def O_NOCTTY */ - {errno = EINVAL; return -1;} -#endif /* ndef O_NOCTTY */ - if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC) -#ifdef O_TRUNC - *r |= O_TRUNC; -#else /* def O_TRUNC */ - {errno = EINVAL; return -1;} -#endif /* ndef O_TRUNC */ - if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND) -#ifdef O_APPEND - *r |= O_APPEND; -#else /* def O_APPEND */ - {errno = EINVAL; return -1;} -#endif /* ndef O_APPEND */ - if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK) -#ifdef O_NONBLOCK - *r |= O_NONBLOCK; -#else /* def O_NONBLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef O_NONBLOCK */ - if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC) -#ifdef O_SYNC - *r |= O_SYNC; -#else /* def O_SYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef O_SYNC */ - if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW) -#ifdef O_NOFOLLOW - *r |= O_NOFOLLOW; -#else /* def O_NOFOLLOW */ - {errno = EINVAL; return -1;} -#endif /* ndef O_NOFOLLOW */ - if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY) -#ifdef O_DIRECTORY - *r |= O_DIRECTORY; -#else /* def O_DIRECTORY */ - {errno = EINVAL; return -1;} -#endif /* ndef O_DIRECTORY */ - if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT) -#ifdef O_DIRECT - *r |= O_DIRECT; -#else /* def O_DIRECT */ - {errno = EINVAL; return -1;} -#endif /* ndef O_DIRECT */ - if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC) -#ifdef O_ASYNC - *r |= O_ASYNC; -#else /* def O_ASYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef O_ASYNC */ - if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE) -#ifdef O_LARGEFILE - *r |= O_LARGEFILE; -#else /* def O_LARGEFILE */ - {errno = EINVAL; return -1;} -#endif /* ndef O_LARGEFILE */ - return 0; -} - -int Mono_Posix_ToOpenFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef O_RDONLY - if ((x & O_RDONLY) == O_RDONLY) - *r |= Mono_Posix_OpenFlags_O_RDONLY; -#endif /* ndef O_RDONLY */ -#ifdef O_WRONLY - if ((x & O_WRONLY) == O_WRONLY) - *r |= Mono_Posix_OpenFlags_O_WRONLY; -#endif /* ndef O_WRONLY */ -#ifdef O_RDWR - if ((x & O_RDWR) == O_RDWR) - *r |= Mono_Posix_OpenFlags_O_RDWR; -#endif /* ndef O_RDWR */ -#ifdef O_CREAT - if ((x & O_CREAT) == O_CREAT) - *r |= Mono_Posix_OpenFlags_O_CREAT; -#endif /* ndef O_CREAT */ -#ifdef O_EXCL - if ((x & O_EXCL) == O_EXCL) - *r |= Mono_Posix_OpenFlags_O_EXCL; -#endif /* ndef O_EXCL */ -#ifdef O_NOCTTY - if ((x & O_NOCTTY) == O_NOCTTY) - *r |= Mono_Posix_OpenFlags_O_NOCTTY; -#endif /* ndef O_NOCTTY */ -#ifdef O_TRUNC - if ((x & O_TRUNC) == O_TRUNC) - *r |= Mono_Posix_OpenFlags_O_TRUNC; -#endif /* ndef O_TRUNC */ -#ifdef O_APPEND - if ((x & O_APPEND) == O_APPEND) - *r |= Mono_Posix_OpenFlags_O_APPEND; -#endif /* ndef O_APPEND */ -#ifdef O_NONBLOCK - if ((x & O_NONBLOCK) == O_NONBLOCK) - *r |= Mono_Posix_OpenFlags_O_NONBLOCK; -#endif /* ndef O_NONBLOCK */ -#ifdef O_SYNC - if ((x & O_SYNC) == O_SYNC) - *r |= Mono_Posix_OpenFlags_O_SYNC; -#endif /* ndef O_SYNC */ -#ifdef O_NOFOLLOW - if ((x & O_NOFOLLOW) == O_NOFOLLOW) - *r |= Mono_Posix_OpenFlags_O_NOFOLLOW; -#endif /* ndef O_NOFOLLOW */ -#ifdef O_DIRECTORY - if ((x & O_DIRECTORY) == O_DIRECTORY) - *r |= Mono_Posix_OpenFlags_O_DIRECTORY; -#endif /* ndef O_DIRECTORY */ -#ifdef O_DIRECT - if ((x & O_DIRECT) == O_DIRECT) - *r |= Mono_Posix_OpenFlags_O_DIRECT; -#endif /* ndef O_DIRECT */ -#ifdef O_ASYNC - if ((x & O_ASYNC) == O_ASYNC) - *r |= Mono_Posix_OpenFlags_O_ASYNC; -#endif /* ndef O_ASYNC */ -#ifdef O_LARGEFILE - if ((x & O_LARGEFILE) == O_LARGEFILE) - *r |= Mono_Posix_OpenFlags_O_LARGEFILE; -#endif /* ndef O_LARGEFILE */ - return 0; -} - -int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID) -#ifdef S_ISUID - *r |= S_ISUID; -#else /* def S_ISUID */ - {errno = EINVAL; return -1;} -#endif /* ndef S_ISUID */ - if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID) -#ifdef S_ISGID - *r |= S_ISGID; -#else /* def S_ISGID */ - {errno = EINVAL; return -1;} -#endif /* ndef S_ISGID */ - if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX) -#ifdef S_ISVTX - *r |= S_ISVTX; -#else /* def S_ISVTX */ - {errno = EINVAL; return -1;} -#endif /* ndef S_ISVTX */ - if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR) -#ifdef S_IRUSR - *r |= S_IRUSR; -#else /* def S_IRUSR */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IRUSR */ - if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR) -#ifdef S_IWUSR - *r |= S_IWUSR; -#else /* def S_IWUSR */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IWUSR */ - if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR) -#ifdef S_IXUSR - *r |= S_IXUSR; -#else /* def S_IXUSR */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IXUSR */ - if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP) -#ifdef S_IRGRP - *r |= S_IRGRP; -#else /* def S_IRGRP */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IRGRP */ - if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP) -#ifdef S_IWGRP - *r |= S_IWGRP; -#else /* def S_IWGRP */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IWGRP */ - if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP) -#ifdef S_IXGRP - *r |= S_IXGRP; -#else /* def S_IXGRP */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IXGRP */ - if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH) -#ifdef S_IROTH - *r |= S_IROTH; -#else /* def S_IROTH */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IROTH */ - if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH) -#ifdef S_IWOTH - *r |= S_IWOTH; -#else /* def S_IWOTH */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IWOTH */ - if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH) -#ifdef S_IXOTH - *r |= S_IXOTH; -#else /* def S_IXOTH */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IXOTH */ - if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG) -#ifdef S_IRWXG - *r |= S_IRWXG; -#else /* def S_IRWXG */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IRWXG */ - if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU) -#ifdef S_IRWXU - *r |= S_IRWXU; -#else /* def S_IRWXU */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IRWXU */ - if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO) -#ifdef S_IRWXO - *r |= S_IRWXO; -#else /* def S_IRWXO */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IRWXO */ - if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS) -#ifdef ACCESSPERMS - *r |= ACCESSPERMS; -#else /* def ACCESSPERMS */ - {errno = EINVAL; return -1;} -#endif /* ndef ACCESSPERMS */ - if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS) -#ifdef ALLPERMS - *r |= ALLPERMS; -#else /* def ALLPERMS */ - {errno = EINVAL; return -1;} -#endif /* ndef ALLPERMS */ - if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE) -#ifdef DEFFILEMODE - *r |= DEFFILEMODE; -#else /* def DEFFILEMODE */ - {errno = EINVAL; return -1;} -#endif /* ndef DEFFILEMODE */ - if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT) -#ifdef S_IFMT - *r |= S_IFMT; -#else /* def S_IFMT */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFMT */ - if ((x & Mono_Posix_FilePermissions_S_IFDIR) == Mono_Posix_FilePermissions_S_IFDIR) -#ifdef S_IFDIR - *r |= S_IFDIR; -#else /* def S_IFDIR */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFDIR */ - if ((x & Mono_Posix_FilePermissions_S_IFCHR) == Mono_Posix_FilePermissions_S_IFCHR) -#ifdef S_IFCHR - *r |= S_IFCHR; -#else /* def S_IFCHR */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFCHR */ - if ((x & Mono_Posix_FilePermissions_S_IFBLK) == Mono_Posix_FilePermissions_S_IFBLK) -#ifdef S_IFBLK - *r |= S_IFBLK; -#else /* def S_IFBLK */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFBLK */ - if ((x & Mono_Posix_FilePermissions_S_IFREG) == Mono_Posix_FilePermissions_S_IFREG) -#ifdef S_IFREG - *r |= S_IFREG; -#else /* def S_IFREG */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFREG */ - if ((x & Mono_Posix_FilePermissions_S_IFIFO) == Mono_Posix_FilePermissions_S_IFIFO) -#ifdef S_IFIFO - *r |= S_IFIFO; -#else /* def S_IFIFO */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFIFO */ - if ((x & Mono_Posix_FilePermissions_S_IFLNK) == Mono_Posix_FilePermissions_S_IFLNK) -#ifdef S_IFLNK - *r |= S_IFLNK; -#else /* def S_IFLNK */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFLNK */ - if ((x & Mono_Posix_FilePermissions_S_IFSOCK) == Mono_Posix_FilePermissions_S_IFSOCK) -#ifdef S_IFSOCK - *r |= S_IFSOCK; -#else /* def S_IFSOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef S_IFSOCK */ - return 0; -} - -int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef S_ISUID - if ((x & S_ISUID) == S_ISUID) - *r |= Mono_Posix_FilePermissions_S_ISUID; -#endif /* ndef S_ISUID */ -#ifdef S_ISGID - if ((x & S_ISGID) == S_ISGID) - *r |= Mono_Posix_FilePermissions_S_ISGID; -#endif /* ndef S_ISGID */ -#ifdef S_ISVTX - if ((x & S_ISVTX) == S_ISVTX) - *r |= Mono_Posix_FilePermissions_S_ISVTX; -#endif /* ndef S_ISVTX */ -#ifdef S_IRUSR - if ((x & S_IRUSR) == S_IRUSR) - *r |= Mono_Posix_FilePermissions_S_IRUSR; -#endif /* ndef S_IRUSR */ -#ifdef S_IWUSR - if ((x & S_IWUSR) == S_IWUSR) - *r |= Mono_Posix_FilePermissions_S_IWUSR; -#endif /* ndef S_IWUSR */ -#ifdef S_IXUSR - if ((x & S_IXUSR) == S_IXUSR) - *r |= Mono_Posix_FilePermissions_S_IXUSR; -#endif /* ndef S_IXUSR */ -#ifdef S_IRGRP - if ((x & S_IRGRP) == S_IRGRP) - *r |= Mono_Posix_FilePermissions_S_IRGRP; -#endif /* ndef S_IRGRP */ -#ifdef S_IWGRP - if ((x & S_IWGRP) == S_IWGRP) - *r |= Mono_Posix_FilePermissions_S_IWGRP; -#endif /* ndef S_IWGRP */ -#ifdef S_IXGRP - if ((x & S_IXGRP) == S_IXGRP) - *r |= Mono_Posix_FilePermissions_S_IXGRP; -#endif /* ndef S_IXGRP */ -#ifdef S_IROTH - if ((x & S_IROTH) == S_IROTH) - *r |= Mono_Posix_FilePermissions_S_IROTH; -#endif /* ndef S_IROTH */ -#ifdef S_IWOTH - if ((x & S_IWOTH) == S_IWOTH) - *r |= Mono_Posix_FilePermissions_S_IWOTH; -#endif /* ndef S_IWOTH */ -#ifdef S_IXOTH - if ((x & S_IXOTH) == S_IXOTH) - *r |= Mono_Posix_FilePermissions_S_IXOTH; -#endif /* ndef S_IXOTH */ -#ifdef S_IRWXG - if ((x & S_IRWXG) == S_IRWXG) - *r |= Mono_Posix_FilePermissions_S_IRWXG; -#endif /* ndef S_IRWXG */ -#ifdef S_IRWXU - if ((x & S_IRWXU) == S_IRWXU) - *r |= Mono_Posix_FilePermissions_S_IRWXU; -#endif /* ndef S_IRWXU */ -#ifdef S_IRWXO - if ((x & S_IRWXO) == S_IRWXO) - *r |= Mono_Posix_FilePermissions_S_IRWXO; -#endif /* ndef S_IRWXO */ -#ifdef ACCESSPERMS - if ((x & ACCESSPERMS) == ACCESSPERMS) - *r |= Mono_Posix_FilePermissions_ACCESSPERMS; -#endif /* ndef ACCESSPERMS */ -#ifdef ALLPERMS - if ((x & ALLPERMS) == ALLPERMS) - *r |= Mono_Posix_FilePermissions_ALLPERMS; -#endif /* ndef ALLPERMS */ -#ifdef DEFFILEMODE - if ((x & DEFFILEMODE) == DEFFILEMODE) - *r |= Mono_Posix_FilePermissions_DEFFILEMODE; -#endif /* ndef DEFFILEMODE */ -#ifdef S_IFMT - if ((x & S_IFMT) == S_IFMT) - *r |= Mono_Posix_FilePermissions_S_IFMT; -#endif /* ndef S_IFMT */ -#ifdef S_IFDIR - if ((x & S_IFDIR) == S_IFDIR) - *r |= Mono_Posix_FilePermissions_S_IFDIR; -#endif /* ndef S_IFDIR */ -#ifdef S_IFCHR - if ((x & S_IFCHR) == S_IFCHR) - *r |= Mono_Posix_FilePermissions_S_IFCHR; -#endif /* ndef S_IFCHR */ -#ifdef S_IFBLK - if ((x & S_IFBLK) == S_IFBLK) - *r |= Mono_Posix_FilePermissions_S_IFBLK; -#endif /* ndef S_IFBLK */ -#ifdef S_IFREG - if ((x & S_IFREG) == S_IFREG) - *r |= Mono_Posix_FilePermissions_S_IFREG; -#endif /* ndef S_IFREG */ -#ifdef S_IFIFO - if ((x & S_IFIFO) == S_IFIFO) - *r |= Mono_Posix_FilePermissions_S_IFIFO; -#endif /* ndef S_IFIFO */ -#ifdef S_IFLNK - if ((x & S_IFLNK) == S_IFLNK) - *r |= Mono_Posix_FilePermissions_S_IFLNK; -#endif /* ndef S_IFLNK */ -#ifdef S_IFSOCK - if ((x & S_IFSOCK) == S_IFSOCK) - *r |= Mono_Posix_FilePermissions_S_IFSOCK; -#endif /* ndef S_IFSOCK */ - return 0; -} - -int Mono_Posix_FromFcntlCommand (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_FcntlCommand_F_DUPFD) -#ifdef F_DUPFD - {*r = F_DUPFD; return 0;} -#else /* def F_DUPFD */ - {errno = EINVAL; return -1;} -#endif /* ndef F_DUPFD */ - if (x == Mono_Posix_FcntlCommand_F_GETFD) -#ifdef F_GETFD - {*r = F_GETFD; return 0;} -#else /* def F_GETFD */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETFD */ - if (x == Mono_Posix_FcntlCommand_F_SETFD) -#ifdef F_SETFD - {*r = F_SETFD; return 0;} -#else /* def F_SETFD */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETFD */ - if (x == Mono_Posix_FcntlCommand_F_GETFL) -#ifdef F_GETFL - {*r = F_GETFL; return 0;} -#else /* def F_GETFL */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETFL */ - if (x == Mono_Posix_FcntlCommand_F_SETFL) -#ifdef F_SETFL - {*r = F_SETFL; return 0;} -#else /* def F_SETFL */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETFL */ - if (x == Mono_Posix_FcntlCommand_F_GETLK) -#ifdef F_GETLK - {*r = F_GETLK; return 0;} -#else /* def F_GETLK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETLK */ - if (x == Mono_Posix_FcntlCommand_F_SETLK) -#ifdef F_SETLK - {*r = F_SETLK; return 0;} -#else /* def F_SETLK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETLK */ - if (x == Mono_Posix_FcntlCommand_F_SETLKW) -#ifdef F_SETLKW - {*r = F_SETLKW; return 0;} -#else /* def F_SETLKW */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETLKW */ - if (x == Mono_Posix_FcntlCommand_F_SETOWN) -#ifdef F_SETOWN - {*r = F_SETOWN; return 0;} -#else /* def F_SETOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETOWN */ - if (x == Mono_Posix_FcntlCommand_F_GETOWN) -#ifdef F_GETOWN - {*r = F_GETOWN; return 0;} -#else /* def F_GETOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETOWN */ - if (x == Mono_Posix_FcntlCommand_F_SETSIG) -#ifdef F_SETSIG - {*r = F_SETSIG; return 0;} -#else /* def F_SETSIG */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETSIG */ - if (x == Mono_Posix_FcntlCommand_F_GETSIG) -#ifdef F_GETSIG - {*r = F_GETSIG; return 0;} -#else /* def F_GETSIG */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETSIG */ - if (x == Mono_Posix_FcntlCommand_F_SETLEASE) -#ifdef F_SETLEASE - {*r = F_SETLEASE; return 0;} -#else /* def F_SETLEASE */ - {errno = EINVAL; return -1;} -#endif /* ndef F_SETLEASE */ - if (x == Mono_Posix_FcntlCommand_F_GETLEASE) -#ifdef F_GETLEASE - {*r = F_GETLEASE; return 0;} -#else /* def F_GETLEASE */ - {errno = EINVAL; return -1;} -#endif /* ndef F_GETLEASE */ - if (x == Mono_Posix_FcntlCommand_F_NOTIFY) -#ifdef F_NOTIFY - {*r = F_NOTIFY; return 0;} -#else /* def F_NOTIFY */ - {errno = EINVAL; return -1;} -#endif /* ndef F_NOTIFY */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToFcntlCommand (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef F_DUPFD - if (x == F_DUPFD) - {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;} -#endif /* ndef F_DUPFD */ -#ifdef F_GETFD - if (x == F_GETFD) - {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;} -#endif /* ndef F_GETFD */ -#ifdef F_SETFD - if (x == F_SETFD) - {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;} -#endif /* ndef F_SETFD */ -#ifdef F_GETFL - if (x == F_GETFL) - {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;} -#endif /* ndef F_GETFL */ -#ifdef F_SETFL - if (x == F_SETFL) - {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;} -#endif /* ndef F_SETFL */ -#ifdef F_GETLK - if (x == F_GETLK) - {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;} -#endif /* ndef F_GETLK */ -#ifdef F_SETLK - if (x == F_SETLK) - {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;} -#endif /* ndef F_SETLK */ -#ifdef F_SETLKW - if (x == F_SETLKW) - {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;} -#endif /* ndef F_SETLKW */ -#ifdef F_SETOWN - if (x == F_SETOWN) - {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;} -#endif /* ndef F_SETOWN */ -#ifdef F_GETOWN - if (x == F_GETOWN) - {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;} -#endif /* ndef F_GETOWN */ -#ifdef F_SETSIG - if (x == F_SETSIG) - {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;} -#endif /* ndef F_SETSIG */ -#ifdef F_GETSIG - if (x == F_GETSIG) - {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;} -#endif /* ndef F_GETSIG */ -#ifdef F_SETLEASE - if (x == F_SETLEASE) - {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;} -#endif /* ndef F_SETLEASE */ -#ifdef F_GETLEASE - if (x == F_GETLEASE) - {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;} -#endif /* ndef F_GETLEASE */ -#ifdef F_NOTIFY - if (x == F_NOTIFY) - {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;} -#endif /* ndef F_NOTIFY */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromLockType (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_LockType_F_RDLCK) -#ifdef F_RDLCK - {*r = F_RDLCK; return 0;} -#else /* def F_RDLCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_RDLCK */ - if (x == Mono_Posix_LockType_F_WRLCK) -#ifdef F_WRLCK - {*r = F_WRLCK; return 0;} -#else /* def F_WRLCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_WRLCK */ - if (x == Mono_Posix_LockType_F_UNLCK) -#ifdef F_UNLCK - {*r = F_UNLCK; return 0;} -#else /* def F_UNLCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_UNLCK */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToLockType (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef F_RDLCK - if (x == F_RDLCK) - {*r = Mono_Posix_LockType_F_RDLCK; return 0;} -#endif /* ndef F_RDLCK */ -#ifdef F_WRLCK - if (x == F_WRLCK) - {*r = Mono_Posix_LockType_F_WRLCK; return 0;} -#endif /* ndef F_WRLCK */ -#ifdef F_UNLCK - if (x == F_UNLCK) - {*r = Mono_Posix_LockType_F_UNLCK; return 0;} -#endif /* ndef F_UNLCK */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromSeekFlags (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_SeekFlags_SEEK_SET) -#ifdef SEEK_SET - {*r = SEEK_SET; return 0;} -#else /* def SEEK_SET */ - {errno = EINVAL; return -1;} -#endif /* ndef SEEK_SET */ - if (x == Mono_Posix_SeekFlags_SEEK_CUR) -#ifdef SEEK_CUR - {*r = SEEK_CUR; return 0;} -#else /* def SEEK_CUR */ - {errno = EINVAL; return -1;} -#endif /* ndef SEEK_CUR */ - if (x == Mono_Posix_SeekFlags_SEEK_END) -#ifdef SEEK_END - {*r = SEEK_END; return 0;} -#else /* def SEEK_END */ - {errno = EINVAL; return -1;} -#endif /* ndef SEEK_END */ - if (x == Mono_Posix_SeekFlags_L_SET) -#ifdef L_SET - {*r = L_SET; return 0;} -#else /* def L_SET */ - {errno = EINVAL; return -1;} -#endif /* ndef L_SET */ - if (x == Mono_Posix_SeekFlags_L_INCR) -#ifdef L_INCR - {*r = L_INCR; return 0;} -#else /* def L_INCR */ - {errno = EINVAL; return -1;} -#endif /* ndef L_INCR */ - if (x == Mono_Posix_SeekFlags_L_XTND) -#ifdef L_XTND - {*r = L_XTND; return 0;} -#else /* def L_XTND */ - {errno = EINVAL; return -1;} -#endif /* ndef L_XTND */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToSeekFlags (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef SEEK_SET - if (x == SEEK_SET) - {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;} -#endif /* ndef SEEK_SET */ -#ifdef SEEK_CUR - if (x == SEEK_CUR) - {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;} -#endif /* ndef SEEK_CUR */ -#ifdef SEEK_END - if (x == SEEK_END) - {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;} -#endif /* ndef SEEK_END */ -#ifdef L_SET - if (x == L_SET) - {*r = Mono_Posix_SeekFlags_L_SET; return 0;} -#endif /* ndef L_SET */ -#ifdef L_INCR - if (x == L_INCR) - {*r = Mono_Posix_SeekFlags_L_INCR; return 0;} -#endif /* ndef L_INCR */ -#ifdef L_XTND - if (x == L_XTND) - {*r = Mono_Posix_SeekFlags_L_XTND; return 0;} -#endif /* ndef L_XTND */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) == Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) -#ifdef DN_ACCESS - *r |= DN_ACCESS; -#else /* def DN_ACCESS */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_ACCESS */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) -#ifdef DN_MODIFY - *r |= DN_MODIFY; -#else /* def DN_MODIFY */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_MODIFY */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_CREATE) == Mono_Posix_DirectoryNotifyFlags_DN_CREATE) -#ifdef DN_CREATE - *r |= DN_CREATE; -#else /* def DN_CREATE */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_CREATE */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_DELETE) == Mono_Posix_DirectoryNotifyFlags_DN_DELETE) -#ifdef DN_DELETE - *r |= DN_DELETE; -#else /* def DN_DELETE */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_DELETE */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME) -#ifdef DN_RENAME - *r |= DN_RENAME; -#else /* def DN_RENAME */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_RENAME */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) == Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) -#ifdef DN_ATTRIB - *r |= DN_ATTRIB; -#else /* def DN_ATTRIB */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_ATTRIB */ - if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) -#ifdef DN_MULTISHOT - *r |= DN_MULTISHOT; -#else /* def DN_MULTISHOT */ - {errno = EINVAL; return -1;} -#endif /* ndef DN_MULTISHOT */ - return 0; -} - -int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef DN_ACCESS - if ((x & DN_ACCESS) == DN_ACCESS) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_ACCESS; -#endif /* ndef DN_ACCESS */ -#ifdef DN_MODIFY - if ((x & DN_MODIFY) == DN_MODIFY) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY; -#endif /* ndef DN_MODIFY */ -#ifdef DN_CREATE - if ((x & DN_CREATE) == DN_CREATE) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_CREATE; -#endif /* ndef DN_CREATE */ -#ifdef DN_DELETE - if ((x & DN_DELETE) == DN_DELETE) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_DELETE; -#endif /* ndef DN_DELETE */ -#ifdef DN_RENAME - if ((x & DN_RENAME) == DN_RENAME) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME; -#endif /* ndef DN_RENAME */ -#ifdef DN_ATTRIB - if ((x & DN_ATTRIB) == DN_ATTRIB) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB; -#endif /* ndef DN_ATTRIB */ -#ifdef DN_MULTISHOT - if ((x & DN_MULTISHOT) == DN_MULTISHOT) - *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT; -#endif /* ndef DN_MULTISHOT */ - return 0; -} - -int Mono_Posix_FromPosixFadviseAdvice (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL) -#ifdef POSIX_FADV_NORMAL - {*r = POSIX_FADV_NORMAL; return 0;} -#else /* def POSIX_FADV_NORMAL */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_NORMAL */ - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM) -#ifdef POSIX_FADV_RANDOM - {*r = POSIX_FADV_RANDOM; return 0;} -#else /* def POSIX_FADV_RANDOM */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_RANDOM */ - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL) -#ifdef POSIX_FADV_SEQUENTIAL - {*r = POSIX_FADV_SEQUENTIAL; return 0;} -#else /* def POSIX_FADV_SEQUENTIAL */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_SEQUENTIAL */ - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED) -#ifdef POSIX_FADV_WILLNEED - {*r = POSIX_FADV_WILLNEED; return 0;} -#else /* def POSIX_FADV_WILLNEED */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_WILLNEED */ - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED) -#ifdef POSIX_FADV_DONTNEED - {*r = POSIX_FADV_DONTNEED; return 0;} -#else /* def POSIX_FADV_DONTNEED */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_DONTNEED */ - if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE) -#ifdef POSIX_FADV_NOREUSE - {*r = POSIX_FADV_NOREUSE; return 0;} -#else /* def POSIX_FADV_NOREUSE */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_FADV_NOREUSE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToPosixFadviseAdvice (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef POSIX_FADV_NORMAL - if (x == POSIX_FADV_NORMAL) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;} -#endif /* ndef POSIX_FADV_NORMAL */ -#ifdef POSIX_FADV_RANDOM - if (x == POSIX_FADV_RANDOM) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;} -#endif /* ndef POSIX_FADV_RANDOM */ -#ifdef POSIX_FADV_SEQUENTIAL - if (x == POSIX_FADV_SEQUENTIAL) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;} -#endif /* ndef POSIX_FADV_SEQUENTIAL */ -#ifdef POSIX_FADV_WILLNEED - if (x == POSIX_FADV_WILLNEED) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;} -#endif /* ndef POSIX_FADV_WILLNEED */ -#ifdef POSIX_FADV_DONTNEED - if (x == POSIX_FADV_DONTNEED) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;} -#endif /* ndef POSIX_FADV_DONTNEED */ -#ifdef POSIX_FADV_NOREUSE - if (x == POSIX_FADV_NOREUSE) - {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;} -#endif /* ndef POSIX_FADV_NOREUSE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromPosixMadviseAdvice (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL) -#ifdef POSIX_MADV_NORMAL - {*r = POSIX_MADV_NORMAL; return 0;} -#else /* def POSIX_MADV_NORMAL */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_MADV_NORMAL */ - if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM) -#ifdef POSIX_MADV_RANDOM - {*r = POSIX_MADV_RANDOM; return 0;} -#else /* def POSIX_MADV_RANDOM */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_MADV_RANDOM */ - if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL) -#ifdef POSIX_MADV_SEQUENTIAL - {*r = POSIX_MADV_SEQUENTIAL; return 0;} -#else /* def POSIX_MADV_SEQUENTIAL */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_MADV_SEQUENTIAL */ - if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED) -#ifdef POSIX_MADV_WILLNEED - {*r = POSIX_MADV_WILLNEED; return 0;} -#else /* def POSIX_MADV_WILLNEED */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_MADV_WILLNEED */ - if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED) -#ifdef POSIX_MADV_DONTNEED - {*r = POSIX_MADV_DONTNEED; return 0;} -#else /* def POSIX_MADV_DONTNEED */ - {errno = EINVAL; return -1;} -#endif /* ndef POSIX_MADV_DONTNEED */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToPosixMadviseAdvice (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef POSIX_MADV_NORMAL - if (x == POSIX_MADV_NORMAL) - {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;} -#endif /* ndef POSIX_MADV_NORMAL */ -#ifdef POSIX_MADV_RANDOM - if (x == POSIX_MADV_RANDOM) - {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;} -#endif /* ndef POSIX_MADV_RANDOM */ -#ifdef POSIX_MADV_SEQUENTIAL - if (x == POSIX_MADV_SEQUENTIAL) - {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;} -#endif /* ndef POSIX_MADV_SEQUENTIAL */ -#ifdef POSIX_MADV_WILLNEED - if (x == POSIX_MADV_WILLNEED) - {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;} -#endif /* ndef POSIX_MADV_WILLNEED */ -#ifdef POSIX_MADV_DONTNEED - if (x == POSIX_MADV_DONTNEED) - {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;} -#endif /* ndef POSIX_MADV_DONTNEED */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromSignum (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_Signum_SIGHUP) -#ifdef SIGHUP - {*r = SIGHUP; return 0;} -#else /* def SIGHUP */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGHUP */ - if (x == Mono_Posix_Signum_SIGINT) -#ifdef SIGINT - {*r = SIGINT; return 0;} -#else /* def SIGINT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGINT */ - if (x == Mono_Posix_Signum_SIGQUIT) -#ifdef SIGQUIT - {*r = SIGQUIT; return 0;} -#else /* def SIGQUIT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGQUIT */ - if (x == Mono_Posix_Signum_SIGILL) -#ifdef SIGILL - {*r = SIGILL; return 0;} -#else /* def SIGILL */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGILL */ - if (x == Mono_Posix_Signum_SIGTRAP) -#ifdef SIGTRAP - {*r = SIGTRAP; return 0;} -#else /* def SIGTRAP */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGTRAP */ - if (x == Mono_Posix_Signum_SIGABRT) -#ifdef SIGABRT - {*r = SIGABRT; return 0;} -#else /* def SIGABRT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGABRT */ - if (x == Mono_Posix_Signum_SIGIOT) -#ifdef SIGIOT - {*r = SIGIOT; return 0;} -#else /* def SIGIOT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGIOT */ - if (x == Mono_Posix_Signum_SIGBUS) -#ifdef SIGBUS - {*r = SIGBUS; return 0;} -#else /* def SIGBUS */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGBUS */ - if (x == Mono_Posix_Signum_SIGFPE) -#ifdef SIGFPE - {*r = SIGFPE; return 0;} -#else /* def SIGFPE */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGFPE */ - if (x == Mono_Posix_Signum_SIGKILL) -#ifdef SIGKILL - {*r = SIGKILL; return 0;} -#else /* def SIGKILL */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGKILL */ - if (x == Mono_Posix_Signum_SIGUSR1) -#ifdef SIGUSR1 - {*r = SIGUSR1; return 0;} -#else /* def SIGUSR1 */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGUSR1 */ - if (x == Mono_Posix_Signum_SIGSEGV) -#ifdef SIGSEGV - {*r = SIGSEGV; return 0;} -#else /* def SIGSEGV */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGSEGV */ - if (x == Mono_Posix_Signum_SIGUSR2) -#ifdef SIGUSR2 - {*r = SIGUSR2; return 0;} -#else /* def SIGUSR2 */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGUSR2 */ - if (x == Mono_Posix_Signum_SIGPIPE) -#ifdef SIGPIPE - {*r = SIGPIPE; return 0;} -#else /* def SIGPIPE */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGPIPE */ - if (x == Mono_Posix_Signum_SIGALRM) -#ifdef SIGALRM - {*r = SIGALRM; return 0;} -#else /* def SIGALRM */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGALRM */ - if (x == Mono_Posix_Signum_SIGTERM) -#ifdef SIGTERM - {*r = SIGTERM; return 0;} -#else /* def SIGTERM */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGTERM */ - if (x == Mono_Posix_Signum_SIGSTKFLT) -#ifdef SIGSTKFLT - {*r = SIGSTKFLT; return 0;} -#else /* def SIGSTKFLT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGSTKFLT */ - if (x == Mono_Posix_Signum_SIGCHLD) -#ifdef SIGCHLD - {*r = SIGCHLD; return 0;} -#else /* def SIGCHLD */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGCHLD */ - if (x == Mono_Posix_Signum_SIGCLD) -#ifdef SIGCLD - {*r = SIGCLD; return 0;} -#else /* def SIGCLD */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGCLD */ - if (x == Mono_Posix_Signum_SIGCONT) -#ifdef SIGCONT - {*r = SIGCONT; return 0;} -#else /* def SIGCONT */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGCONT */ - if (x == Mono_Posix_Signum_SIGSTOP) -#ifdef SIGSTOP - {*r = SIGSTOP; return 0;} -#else /* def SIGSTOP */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGSTOP */ - if (x == Mono_Posix_Signum_SIGTSTP) -#ifdef SIGTSTP - {*r = SIGTSTP; return 0;} -#else /* def SIGTSTP */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGTSTP */ - if (x == Mono_Posix_Signum_SIGTTIN) -#ifdef SIGTTIN - {*r = SIGTTIN; return 0;} -#else /* def SIGTTIN */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGTTIN */ - if (x == Mono_Posix_Signum_SIGTTOU) -#ifdef SIGTTOU - {*r = SIGTTOU; return 0;} -#else /* def SIGTTOU */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGTTOU */ - if (x == Mono_Posix_Signum_SIGURG) -#ifdef SIGURG - {*r = SIGURG; return 0;} -#else /* def SIGURG */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGURG */ - if (x == Mono_Posix_Signum_SIGXCPU) -#ifdef SIGXCPU - {*r = SIGXCPU; return 0;} -#else /* def SIGXCPU */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGXCPU */ - if (x == Mono_Posix_Signum_SIGXFSZ) -#ifdef SIGXFSZ - {*r = SIGXFSZ; return 0;} -#else /* def SIGXFSZ */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGXFSZ */ - if (x == Mono_Posix_Signum_SIGVTALRM) -#ifdef SIGVTALRM - {*r = SIGVTALRM; return 0;} -#else /* def SIGVTALRM */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGVTALRM */ - if (x == Mono_Posix_Signum_SIGPROF) -#ifdef SIGPROF - {*r = SIGPROF; return 0;} -#else /* def SIGPROF */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGPROF */ - if (x == Mono_Posix_Signum_SIGWINCH) -#ifdef SIGWINCH - {*r = SIGWINCH; return 0;} -#else /* def SIGWINCH */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGWINCH */ - if (x == Mono_Posix_Signum_SIGIO) -#ifdef SIGIO - {*r = SIGIO; return 0;} -#else /* def SIGIO */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGIO */ - if (x == Mono_Posix_Signum_SIGPOLL) -#ifdef SIGPOLL - {*r = SIGPOLL; return 0;} -#else /* def SIGPOLL */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGPOLL */ - if (x == Mono_Posix_Signum_SIGPWR) -#ifdef SIGPWR - {*r = SIGPWR; return 0;} -#else /* def SIGPWR */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGPWR */ - if (x == Mono_Posix_Signum_SIGSYS) -#ifdef SIGSYS - {*r = SIGSYS; return 0;} -#else /* def SIGSYS */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGSYS */ - if (x == Mono_Posix_Signum_SIGUNUSED) -#ifdef SIGUNUSED - {*r = SIGUNUSED; return 0;} -#else /* def SIGUNUSED */ - {errno = EINVAL; return -1;} -#endif /* ndef SIGUNUSED */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToSignum (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef SIGHUP - if (x == SIGHUP) - {*r = Mono_Posix_Signum_SIGHUP; return 0;} -#endif /* ndef SIGHUP */ -#ifdef SIGINT - if (x == SIGINT) - {*r = Mono_Posix_Signum_SIGINT; return 0;} -#endif /* ndef SIGINT */ -#ifdef SIGQUIT - if (x == SIGQUIT) - {*r = Mono_Posix_Signum_SIGQUIT; return 0;} -#endif /* ndef SIGQUIT */ -#ifdef SIGILL - if (x == SIGILL) - {*r = Mono_Posix_Signum_SIGILL; return 0;} -#endif /* ndef SIGILL */ -#ifdef SIGTRAP - if (x == SIGTRAP) - {*r = Mono_Posix_Signum_SIGTRAP; return 0;} -#endif /* ndef SIGTRAP */ -#ifdef SIGABRT - if (x == SIGABRT) - {*r = Mono_Posix_Signum_SIGABRT; return 0;} -#endif /* ndef SIGABRT */ -#ifdef SIGIOT - if (x == SIGIOT) - {*r = Mono_Posix_Signum_SIGIOT; return 0;} -#endif /* ndef SIGIOT */ -#ifdef SIGBUS - if (x == SIGBUS) - {*r = Mono_Posix_Signum_SIGBUS; return 0;} -#endif /* ndef SIGBUS */ -#ifdef SIGFPE - if (x == SIGFPE) - {*r = Mono_Posix_Signum_SIGFPE; return 0;} -#endif /* ndef SIGFPE */ -#ifdef SIGKILL - if (x == SIGKILL) - {*r = Mono_Posix_Signum_SIGKILL; return 0;} -#endif /* ndef SIGKILL */ -#ifdef SIGUSR1 - if (x == SIGUSR1) - {*r = Mono_Posix_Signum_SIGUSR1; return 0;} -#endif /* ndef SIGUSR1 */ -#ifdef SIGSEGV - if (x == SIGSEGV) - {*r = Mono_Posix_Signum_SIGSEGV; return 0;} -#endif /* ndef SIGSEGV */ -#ifdef SIGUSR2 - if (x == SIGUSR2) - {*r = Mono_Posix_Signum_SIGUSR2; return 0;} -#endif /* ndef SIGUSR2 */ -#ifdef SIGPIPE - if (x == SIGPIPE) - {*r = Mono_Posix_Signum_SIGPIPE; return 0;} -#endif /* ndef SIGPIPE */ -#ifdef SIGALRM - if (x == SIGALRM) - {*r = Mono_Posix_Signum_SIGALRM; return 0;} -#endif /* ndef SIGALRM */ -#ifdef SIGTERM - if (x == SIGTERM) - {*r = Mono_Posix_Signum_SIGTERM; return 0;} -#endif /* ndef SIGTERM */ -#ifdef SIGSTKFLT - if (x == SIGSTKFLT) - {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;} -#endif /* ndef SIGSTKFLT */ -#ifdef SIGCHLD - if (x == SIGCHLD) - {*r = Mono_Posix_Signum_SIGCHLD; return 0;} -#endif /* ndef SIGCHLD */ -#ifdef SIGCLD - if (x == SIGCLD) - {*r = Mono_Posix_Signum_SIGCLD; return 0;} -#endif /* ndef SIGCLD */ -#ifdef SIGCONT - if (x == SIGCONT) - {*r = Mono_Posix_Signum_SIGCONT; return 0;} -#endif /* ndef SIGCONT */ -#ifdef SIGSTOP - if (x == SIGSTOP) - {*r = Mono_Posix_Signum_SIGSTOP; return 0;} -#endif /* ndef SIGSTOP */ -#ifdef SIGTSTP - if (x == SIGTSTP) - {*r = Mono_Posix_Signum_SIGTSTP; return 0;} -#endif /* ndef SIGTSTP */ -#ifdef SIGTTIN - if (x == SIGTTIN) - {*r = Mono_Posix_Signum_SIGTTIN; return 0;} -#endif /* ndef SIGTTIN */ -#ifdef SIGTTOU - if (x == SIGTTOU) - {*r = Mono_Posix_Signum_SIGTTOU; return 0;} -#endif /* ndef SIGTTOU */ -#ifdef SIGURG - if (x == SIGURG) - {*r = Mono_Posix_Signum_SIGURG; return 0;} -#endif /* ndef SIGURG */ -#ifdef SIGXCPU - if (x == SIGXCPU) - {*r = Mono_Posix_Signum_SIGXCPU; return 0;} -#endif /* ndef SIGXCPU */ -#ifdef SIGXFSZ - if (x == SIGXFSZ) - {*r = Mono_Posix_Signum_SIGXFSZ; return 0;} -#endif /* ndef SIGXFSZ */ -#ifdef SIGVTALRM - if (x == SIGVTALRM) - {*r = Mono_Posix_Signum_SIGVTALRM; return 0;} -#endif /* ndef SIGVTALRM */ -#ifdef SIGPROF - if (x == SIGPROF) - {*r = Mono_Posix_Signum_SIGPROF; return 0;} -#endif /* ndef SIGPROF */ -#ifdef SIGWINCH - if (x == SIGWINCH) - {*r = Mono_Posix_Signum_SIGWINCH; return 0;} -#endif /* ndef SIGWINCH */ -#ifdef SIGIO - if (x == SIGIO) - {*r = Mono_Posix_Signum_SIGIO; return 0;} -#endif /* ndef SIGIO */ -#ifdef SIGPOLL - if (x == SIGPOLL) - {*r = Mono_Posix_Signum_SIGPOLL; return 0;} -#endif /* ndef SIGPOLL */ -#ifdef SIGPWR - if (x == SIGPWR) - {*r = Mono_Posix_Signum_SIGPWR; return 0;} -#endif /* ndef SIGPWR */ -#ifdef SIGSYS - if (x == SIGSYS) - {*r = Mono_Posix_Signum_SIGSYS; return 0;} -#endif /* ndef SIGSYS */ -#ifdef SIGUNUSED - if (x == SIGUNUSED) - {*r = Mono_Posix_Signum_SIGUNUSED; return 0;} -#endif /* ndef SIGUNUSED */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromWaitOptions (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG) -#ifdef WNOHANG - *r |= WNOHANG; -#else /* def WNOHANG */ - {errno = EINVAL; return -1;} -#endif /* ndef WNOHANG */ - if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED) -#ifdef WUNTRACED - *r |= WUNTRACED; -#else /* def WUNTRACED */ - {errno = EINVAL; return -1;} -#endif /* ndef WUNTRACED */ - return 0; -} - -int Mono_Posix_ToWaitOptions (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef WNOHANG - if ((x & WNOHANG) == WNOHANG) - *r |= Mono_Posix_WaitOptions_WNOHANG; -#endif /* ndef WNOHANG */ -#ifdef WUNTRACED - if ((x & WUNTRACED) == WUNTRACED) - *r |= Mono_Posix_WaitOptions_WUNTRACED; -#endif /* ndef WUNTRACED */ - return 0; -} - -int Mono_Posix_FromAccessMode (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_AccessMode_R_OK) == Mono_Posix_AccessMode_R_OK) -#ifdef R_OK - *r |= R_OK; -#else /* def R_OK */ - {errno = EINVAL; return -1;} -#endif /* ndef R_OK */ - if ((x & Mono_Posix_AccessMode_W_OK) == Mono_Posix_AccessMode_W_OK) -#ifdef W_OK - *r |= W_OK; -#else /* def W_OK */ - {errno = EINVAL; return -1;} -#endif /* ndef W_OK */ - if ((x & Mono_Posix_AccessMode_X_OK) == Mono_Posix_AccessMode_X_OK) -#ifdef X_OK - *r |= X_OK; -#else /* def X_OK */ - {errno = EINVAL; return -1;} -#endif /* ndef X_OK */ - if ((x & Mono_Posix_AccessMode_F_OK) == Mono_Posix_AccessMode_F_OK) -#ifdef F_OK - *r |= F_OK; -#else /* def F_OK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_OK */ - return 0; -} - -int Mono_Posix_ToAccessMode (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef R_OK - if ((x & R_OK) == R_OK) - *r |= Mono_Posix_AccessMode_R_OK; -#endif /* ndef R_OK */ -#ifdef W_OK - if ((x & W_OK) == W_OK) - *r |= Mono_Posix_AccessMode_W_OK; -#endif /* ndef W_OK */ -#ifdef X_OK - if ((x & X_OK) == X_OK) - *r |= Mono_Posix_AccessMode_X_OK; -#endif /* ndef X_OK */ -#ifdef F_OK - if ((x & F_OK) == F_OK) - *r |= Mono_Posix_AccessMode_F_OK; -#endif /* ndef F_OK */ - return 0; -} - -int Mono_Posix_FromPathConf (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_PathConf__PC_LINK_MAX) -#ifdef _PC_LINK_MAX - {*r = _PC_LINK_MAX; return 0;} -#else /* def _PC_LINK_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_LINK_MAX */ - if (x == Mono_Posix_PathConf__PC_MAX_CANON) -#ifdef _PC_MAX_CANON - {*r = _PC_MAX_CANON; return 0;} -#else /* def _PC_MAX_CANON */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_MAX_CANON */ - if (x == Mono_Posix_PathConf__PC_MAX_INPUT) -#ifdef _PC_MAX_INPUT - {*r = _PC_MAX_INPUT; return 0;} -#else /* def _PC_MAX_INPUT */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_MAX_INPUT */ - if (x == Mono_Posix_PathConf__PC_NAME_MAX) -#ifdef _PC_NAME_MAX - {*r = _PC_NAME_MAX; return 0;} -#else /* def _PC_NAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_NAME_MAX */ - if (x == Mono_Posix_PathConf__PC_PATH_MAX) -#ifdef _PC_PATH_MAX - {*r = _PC_PATH_MAX; return 0;} -#else /* def _PC_PATH_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_PATH_MAX */ - if (x == Mono_Posix_PathConf__PC_PIPE_BUF) -#ifdef _PC_PIPE_BUF - {*r = _PC_PIPE_BUF; return 0;} -#else /* def _PC_PIPE_BUF */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_PIPE_BUF */ - if (x == Mono_Posix_PathConf__PC_CHOWN_RESTRICTED) -#ifdef _PC_CHOWN_RESTRICTED - {*r = _PC_CHOWN_RESTRICTED; return 0;} -#else /* def _PC_CHOWN_RESTRICTED */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_CHOWN_RESTRICTED */ - if (x == Mono_Posix_PathConf__PC_NO_TRUNC) -#ifdef _PC_NO_TRUNC - {*r = _PC_NO_TRUNC; return 0;} -#else /* def _PC_NO_TRUNC */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_NO_TRUNC */ - if (x == Mono_Posix_PathConf__PC_VDISABLE) -#ifdef _PC_VDISABLE - {*r = _PC_VDISABLE; return 0;} -#else /* def _PC_VDISABLE */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_VDISABLE */ - if (x == Mono_Posix_PathConf__PC_SYNC_IO) -#ifdef _PC_SYNC_IO - {*r = _PC_SYNC_IO; return 0;} -#else /* def _PC_SYNC_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_SYNC_IO */ - if (x == Mono_Posix_PathConf__PC_ASYNC_IO) -#ifdef _PC_ASYNC_IO - {*r = _PC_ASYNC_IO; return 0;} -#else /* def _PC_ASYNC_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_ASYNC_IO */ - if (x == Mono_Posix_PathConf__PC_PRIO_IO) -#ifdef _PC_PRIO_IO - {*r = _PC_PRIO_IO; return 0;} -#else /* def _PC_PRIO_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_PRIO_IO */ - if (x == Mono_Posix_PathConf__PC_SOCK_MAXBUF) -#ifdef _PC_SOCK_MAXBUF - {*r = _PC_SOCK_MAXBUF; return 0;} -#else /* def _PC_SOCK_MAXBUF */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_SOCK_MAXBUF */ - if (x == Mono_Posix_PathConf__PC_FILESIZEBITS) -#ifdef _PC_FILESIZEBITS - {*r = _PC_FILESIZEBITS; return 0;} -#else /* def _PC_FILESIZEBITS */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_FILESIZEBITS */ - if (x == Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE) -#ifdef _PC_REC_INCR_XFER_SIZE - {*r = _PC_REC_INCR_XFER_SIZE; return 0;} -#else /* def _PC_REC_INCR_XFER_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_REC_INCR_XFER_SIZE */ - if (x == Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE) -#ifdef _PC_REC_MAX_XFER_SIZE - {*r = _PC_REC_MAX_XFER_SIZE; return 0;} -#else /* def _PC_REC_MAX_XFER_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_REC_MAX_XFER_SIZE */ - if (x == Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE) -#ifdef _PC_REC_MIN_XFER_SIZE - {*r = _PC_REC_MIN_XFER_SIZE; return 0;} -#else /* def _PC_REC_MIN_XFER_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_REC_MIN_XFER_SIZE */ - if (x == Mono_Posix_PathConf__PC_REC_XFER_ALIGN) -#ifdef _PC_REC_XFER_ALIGN - {*r = _PC_REC_XFER_ALIGN; return 0;} -#else /* def _PC_REC_XFER_ALIGN */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_REC_XFER_ALIGN */ - if (x == Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN) -#ifdef _PC_ALLOC_SIZE_MIN - {*r = _PC_ALLOC_SIZE_MIN; return 0;} -#else /* def _PC_ALLOC_SIZE_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_ALLOC_SIZE_MIN */ - if (x == Mono_Posix_PathConf__PC_SYMLINK_MAX) -#ifdef _PC_SYMLINK_MAX - {*r = _PC_SYMLINK_MAX; return 0;} -#else /* def _PC_SYMLINK_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_SYMLINK_MAX */ - if (x == Mono_Posix_PathConf__PC_2_SYMLINKS) -#ifdef _PC_2_SYMLINKS - {*r = _PC_2_SYMLINKS; return 0;} -#else /* def _PC_2_SYMLINKS */ - {errno = EINVAL; return -1;} -#endif /* ndef _PC_2_SYMLINKS */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToPathConf (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef _PC_LINK_MAX - if (x == _PC_LINK_MAX) - {*r = Mono_Posix_PathConf__PC_LINK_MAX; return 0;} -#endif /* ndef _PC_LINK_MAX */ -#ifdef _PC_MAX_CANON - if (x == _PC_MAX_CANON) - {*r = Mono_Posix_PathConf__PC_MAX_CANON; return 0;} -#endif /* ndef _PC_MAX_CANON */ -#ifdef _PC_MAX_INPUT - if (x == _PC_MAX_INPUT) - {*r = Mono_Posix_PathConf__PC_MAX_INPUT; return 0;} -#endif /* ndef _PC_MAX_INPUT */ -#ifdef _PC_NAME_MAX - if (x == _PC_NAME_MAX) - {*r = Mono_Posix_PathConf__PC_NAME_MAX; return 0;} -#endif /* ndef _PC_NAME_MAX */ -#ifdef _PC_PATH_MAX - if (x == _PC_PATH_MAX) - {*r = Mono_Posix_PathConf__PC_PATH_MAX; return 0;} -#endif /* ndef _PC_PATH_MAX */ -#ifdef _PC_PIPE_BUF - if (x == _PC_PIPE_BUF) - {*r = Mono_Posix_PathConf__PC_PIPE_BUF; return 0;} -#endif /* ndef _PC_PIPE_BUF */ -#ifdef _PC_CHOWN_RESTRICTED - if (x == _PC_CHOWN_RESTRICTED) - {*r = Mono_Posix_PathConf__PC_CHOWN_RESTRICTED; return 0;} -#endif /* ndef _PC_CHOWN_RESTRICTED */ -#ifdef _PC_NO_TRUNC - if (x == _PC_NO_TRUNC) - {*r = Mono_Posix_PathConf__PC_NO_TRUNC; return 0;} -#endif /* ndef _PC_NO_TRUNC */ -#ifdef _PC_VDISABLE - if (x == _PC_VDISABLE) - {*r = Mono_Posix_PathConf__PC_VDISABLE; return 0;} -#endif /* ndef _PC_VDISABLE */ -#ifdef _PC_SYNC_IO - if (x == _PC_SYNC_IO) - {*r = Mono_Posix_PathConf__PC_SYNC_IO; return 0;} -#endif /* ndef _PC_SYNC_IO */ -#ifdef _PC_ASYNC_IO - if (x == _PC_ASYNC_IO) - {*r = Mono_Posix_PathConf__PC_ASYNC_IO; return 0;} -#endif /* ndef _PC_ASYNC_IO */ -#ifdef _PC_PRIO_IO - if (x == _PC_PRIO_IO) - {*r = Mono_Posix_PathConf__PC_PRIO_IO; return 0;} -#endif /* ndef _PC_PRIO_IO */ -#ifdef _PC_SOCK_MAXBUF - if (x == _PC_SOCK_MAXBUF) - {*r = Mono_Posix_PathConf__PC_SOCK_MAXBUF; return 0;} -#endif /* ndef _PC_SOCK_MAXBUF */ -#ifdef _PC_FILESIZEBITS - if (x == _PC_FILESIZEBITS) - {*r = Mono_Posix_PathConf__PC_FILESIZEBITS; return 0;} -#endif /* ndef _PC_FILESIZEBITS */ -#ifdef _PC_REC_INCR_XFER_SIZE - if (x == _PC_REC_INCR_XFER_SIZE) - {*r = Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE; return 0;} -#endif /* ndef _PC_REC_INCR_XFER_SIZE */ -#ifdef _PC_REC_MAX_XFER_SIZE - if (x == _PC_REC_MAX_XFER_SIZE) - {*r = Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE; return 0;} -#endif /* ndef _PC_REC_MAX_XFER_SIZE */ -#ifdef _PC_REC_MIN_XFER_SIZE - if (x == _PC_REC_MIN_XFER_SIZE) - {*r = Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE; return 0;} -#endif /* ndef _PC_REC_MIN_XFER_SIZE */ -#ifdef _PC_REC_XFER_ALIGN - if (x == _PC_REC_XFER_ALIGN) - {*r = Mono_Posix_PathConf__PC_REC_XFER_ALIGN; return 0;} -#endif /* ndef _PC_REC_XFER_ALIGN */ -#ifdef _PC_ALLOC_SIZE_MIN - if (x == _PC_ALLOC_SIZE_MIN) - {*r = Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN; return 0;} -#endif /* ndef _PC_ALLOC_SIZE_MIN */ -#ifdef _PC_SYMLINK_MAX - if (x == _PC_SYMLINK_MAX) - {*r = Mono_Posix_PathConf__PC_SYMLINK_MAX; return 0;} -#endif /* ndef _PC_SYMLINK_MAX */ -#ifdef _PC_2_SYMLINKS - if (x == _PC_2_SYMLINKS) - {*r = Mono_Posix_PathConf__PC_2_SYMLINKS; return 0;} -#endif /* ndef _PC_2_SYMLINKS */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromSysConf (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_SysConf__SC_ARG_MAX) -#ifdef _SC_ARG_MAX - {*r = _SC_ARG_MAX; return 0;} -#else /* def _SC_ARG_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_ARG_MAX */ - if (x == Mono_Posix_SysConf__SC_CHILD_MAX) -#ifdef _SC_CHILD_MAX - {*r = _SC_CHILD_MAX; return 0;} -#else /* def _SC_CHILD_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CHILD_MAX */ - if (x == Mono_Posix_SysConf__SC_CLK_TCK) -#ifdef _SC_CLK_TCK - {*r = _SC_CLK_TCK; return 0;} -#else /* def _SC_CLK_TCK */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CLK_TCK */ - if (x == Mono_Posix_SysConf__SC_NGROUPS_MAX) -#ifdef _SC_NGROUPS_MAX - {*r = _SC_NGROUPS_MAX; return 0;} -#else /* def _SC_NGROUPS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NGROUPS_MAX */ - if (x == Mono_Posix_SysConf__SC_OPEN_MAX) -#ifdef _SC_OPEN_MAX - {*r = _SC_OPEN_MAX; return 0;} -#else /* def _SC_OPEN_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_OPEN_MAX */ - if (x == Mono_Posix_SysConf__SC_STREAM_MAX) -#ifdef _SC_STREAM_MAX - {*r = _SC_STREAM_MAX; return 0;} -#else /* def _SC_STREAM_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_STREAM_MAX */ - if (x == Mono_Posix_SysConf__SC_TZNAME_MAX) -#ifdef _SC_TZNAME_MAX - {*r = _SC_TZNAME_MAX; return 0;} -#else /* def _SC_TZNAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TZNAME_MAX */ - if (x == Mono_Posix_SysConf__SC_JOB_CONTROL) -#ifdef _SC_JOB_CONTROL - {*r = _SC_JOB_CONTROL; return 0;} -#else /* def _SC_JOB_CONTROL */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_JOB_CONTROL */ - if (x == Mono_Posix_SysConf__SC_SAVED_IDS) -#ifdef _SC_SAVED_IDS - {*r = _SC_SAVED_IDS; return 0;} -#else /* def _SC_SAVED_IDS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SAVED_IDS */ - if (x == Mono_Posix_SysConf__SC_REALTIME_SIGNALS) -#ifdef _SC_REALTIME_SIGNALS - {*r = _SC_REALTIME_SIGNALS; return 0;} -#else /* def _SC_REALTIME_SIGNALS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_REALTIME_SIGNALS */ - if (x == Mono_Posix_SysConf__SC_PRIORITY_SCHEDULING) -#ifdef _SC_PRIORITY_SCHEDULING - {*r = _SC_PRIORITY_SCHEDULING; return 0;} -#else /* def _SC_PRIORITY_SCHEDULING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PRIORITY_SCHEDULING */ - if (x == Mono_Posix_SysConf__SC_TIMERS) -#ifdef _SC_TIMERS - {*r = _SC_TIMERS; return 0;} -#else /* def _SC_TIMERS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TIMERS */ - if (x == Mono_Posix_SysConf__SC_ASYNCHRONOUS_IO) -#ifdef _SC_ASYNCHRONOUS_IO - {*r = _SC_ASYNCHRONOUS_IO; return 0;} -#else /* def _SC_ASYNCHRONOUS_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_ASYNCHRONOUS_IO */ - if (x == Mono_Posix_SysConf__SC_PRIORITIZED_IO) -#ifdef _SC_PRIORITIZED_IO - {*r = _SC_PRIORITIZED_IO; return 0;} -#else /* def _SC_PRIORITIZED_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PRIORITIZED_IO */ - if (x == Mono_Posix_SysConf__SC_SYNCHRONIZED_IO) -#ifdef _SC_SYNCHRONIZED_IO - {*r = _SC_SYNCHRONIZED_IO; return 0;} -#else /* def _SC_SYNCHRONIZED_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SYNCHRONIZED_IO */ - if (x == Mono_Posix_SysConf__SC_FSYNC) -#ifdef _SC_FSYNC - {*r = _SC_FSYNC; return 0;} -#else /* def _SC_FSYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FSYNC */ - if (x == Mono_Posix_SysConf__SC_MAPPED_FILES) -#ifdef _SC_MAPPED_FILES - {*r = _SC_MAPPED_FILES; return 0;} -#else /* def _SC_MAPPED_FILES */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MAPPED_FILES */ - if (x == Mono_Posix_SysConf__SC_MEMLOCK) -#ifdef _SC_MEMLOCK - {*r = _SC_MEMLOCK; return 0;} -#else /* def _SC_MEMLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MEMLOCK */ - if (x == Mono_Posix_SysConf__SC_MEMLOCK_RANGE) -#ifdef _SC_MEMLOCK_RANGE - {*r = _SC_MEMLOCK_RANGE; return 0;} -#else /* def _SC_MEMLOCK_RANGE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MEMLOCK_RANGE */ - if (x == Mono_Posix_SysConf__SC_MEMORY_PROTECTION) -#ifdef _SC_MEMORY_PROTECTION - {*r = _SC_MEMORY_PROTECTION; return 0;} -#else /* def _SC_MEMORY_PROTECTION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MEMORY_PROTECTION */ - if (x == Mono_Posix_SysConf__SC_MESSAGE_PASSING) -#ifdef _SC_MESSAGE_PASSING - {*r = _SC_MESSAGE_PASSING; return 0;} -#else /* def _SC_MESSAGE_PASSING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MESSAGE_PASSING */ - if (x == Mono_Posix_SysConf__SC_SEMAPHORES) -#ifdef _SC_SEMAPHORES - {*r = _SC_SEMAPHORES; return 0;} -#else /* def _SC_SEMAPHORES */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SEMAPHORES */ - if (x == Mono_Posix_SysConf__SC_SHARED_MEMORY_OBJECTS) -#ifdef _SC_SHARED_MEMORY_OBJECTS - {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;} -#else /* def _SC_SHARED_MEMORY_OBJECTS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SHARED_MEMORY_OBJECTS */ - if (x == Mono_Posix_SysConf__SC_AIO_LISTIO_MAX) -#ifdef _SC_AIO_LISTIO_MAX - {*r = _SC_AIO_LISTIO_MAX; return 0;} -#else /* def _SC_AIO_LISTIO_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_AIO_LISTIO_MAX */ - if (x == Mono_Posix_SysConf__SC_AIO_MAX) -#ifdef _SC_AIO_MAX - {*r = _SC_AIO_MAX; return 0;} -#else /* def _SC_AIO_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_AIO_MAX */ - if (x == Mono_Posix_SysConf__SC_AIO_PRIO_DELTA_MAX) -#ifdef _SC_AIO_PRIO_DELTA_MAX - {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;} -#else /* def _SC_AIO_PRIO_DELTA_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_AIO_PRIO_DELTA_MAX */ - if (x == Mono_Posix_SysConf__SC_DELAYTIMER_MAX) -#ifdef _SC_DELAYTIMER_MAX - {*r = _SC_DELAYTIMER_MAX; return 0;} -#else /* def _SC_DELAYTIMER_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_DELAYTIMER_MAX */ - if (x == Mono_Posix_SysConf__SC_MQ_OPEN_MAX) -#ifdef _SC_MQ_OPEN_MAX - {*r = _SC_MQ_OPEN_MAX; return 0;} -#else /* def _SC_MQ_OPEN_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MQ_OPEN_MAX */ - if (x == Mono_Posix_SysConf__SC_MQ_PRIO_MAX) -#ifdef _SC_MQ_PRIO_MAX - {*r = _SC_MQ_PRIO_MAX; return 0;} -#else /* def _SC_MQ_PRIO_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MQ_PRIO_MAX */ - if (x == Mono_Posix_SysConf__SC_VERSION) -#ifdef _SC_VERSION - {*r = _SC_VERSION; return 0;} -#else /* def _SC_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_VERSION */ - if (x == Mono_Posix_SysConf__SC_PAGESIZE) -#ifdef _SC_PAGESIZE - {*r = _SC_PAGESIZE; return 0;} -#else /* def _SC_PAGESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PAGESIZE */ - if (x == Mono_Posix_SysConf__SC_RTSIG_MAX) -#ifdef _SC_RTSIG_MAX - {*r = _SC_RTSIG_MAX; return 0;} -#else /* def _SC_RTSIG_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_RTSIG_MAX */ - if (x == Mono_Posix_SysConf__SC_SEM_NSEMS_MAX) -#ifdef _SC_SEM_NSEMS_MAX - {*r = _SC_SEM_NSEMS_MAX; return 0;} -#else /* def _SC_SEM_NSEMS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SEM_NSEMS_MAX */ - if (x == Mono_Posix_SysConf__SC_SEM_VALUE_MAX) -#ifdef _SC_SEM_VALUE_MAX - {*r = _SC_SEM_VALUE_MAX; return 0;} -#else /* def _SC_SEM_VALUE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SEM_VALUE_MAX */ - if (x == Mono_Posix_SysConf__SC_SIGQUEUE_MAX) -#ifdef _SC_SIGQUEUE_MAX - {*r = _SC_SIGQUEUE_MAX; return 0;} -#else /* def _SC_SIGQUEUE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SIGQUEUE_MAX */ - if (x == Mono_Posix_SysConf__SC_TIMER_MAX) -#ifdef _SC_TIMER_MAX - {*r = _SC_TIMER_MAX; return 0;} -#else /* def _SC_TIMER_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TIMER_MAX */ - if (x == Mono_Posix_SysConf__SC_BC_BASE_MAX) -#ifdef _SC_BC_BASE_MAX - {*r = _SC_BC_BASE_MAX; return 0;} -#else /* def _SC_BC_BASE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BC_BASE_MAX */ - if (x == Mono_Posix_SysConf__SC_BC_DIM_MAX) -#ifdef _SC_BC_DIM_MAX - {*r = _SC_BC_DIM_MAX; return 0;} -#else /* def _SC_BC_DIM_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BC_DIM_MAX */ - if (x == Mono_Posix_SysConf__SC_BC_SCALE_MAX) -#ifdef _SC_BC_SCALE_MAX - {*r = _SC_BC_SCALE_MAX; return 0;} -#else /* def _SC_BC_SCALE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BC_SCALE_MAX */ - if (x == Mono_Posix_SysConf__SC_BC_STRING_MAX) -#ifdef _SC_BC_STRING_MAX - {*r = _SC_BC_STRING_MAX; return 0;} -#else /* def _SC_BC_STRING_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BC_STRING_MAX */ - if (x == Mono_Posix_SysConf__SC_COLL_WEIGHTS_MAX) -#ifdef _SC_COLL_WEIGHTS_MAX - {*r = _SC_COLL_WEIGHTS_MAX; return 0;} -#else /* def _SC_COLL_WEIGHTS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_COLL_WEIGHTS_MAX */ - if (x == Mono_Posix_SysConf__SC_EQUIV_CLASS_MAX) -#ifdef _SC_EQUIV_CLASS_MAX - {*r = _SC_EQUIV_CLASS_MAX; return 0;} -#else /* def _SC_EQUIV_CLASS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_EQUIV_CLASS_MAX */ - if (x == Mono_Posix_SysConf__SC_EXPR_NEST_MAX) -#ifdef _SC_EXPR_NEST_MAX - {*r = _SC_EXPR_NEST_MAX; return 0;} -#else /* def _SC_EXPR_NEST_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_EXPR_NEST_MAX */ - if (x == Mono_Posix_SysConf__SC_LINE_MAX) -#ifdef _SC_LINE_MAX - {*r = _SC_LINE_MAX; return 0;} -#else /* def _SC_LINE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LINE_MAX */ - if (x == Mono_Posix_SysConf__SC_RE_DUP_MAX) -#ifdef _SC_RE_DUP_MAX - {*r = _SC_RE_DUP_MAX; return 0;} -#else /* def _SC_RE_DUP_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_RE_DUP_MAX */ - if (x == Mono_Posix_SysConf__SC_CHARCLASS_NAME_MAX) -#ifdef _SC_CHARCLASS_NAME_MAX - {*r = _SC_CHARCLASS_NAME_MAX; return 0;} -#else /* def _SC_CHARCLASS_NAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CHARCLASS_NAME_MAX */ - if (x == Mono_Posix_SysConf__SC_2_VERSION) -#ifdef _SC_2_VERSION - {*r = _SC_2_VERSION; return 0;} -#else /* def _SC_2_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_VERSION */ - if (x == Mono_Posix_SysConf__SC_2_C_BIND) -#ifdef _SC_2_C_BIND - {*r = _SC_2_C_BIND; return 0;} -#else /* def _SC_2_C_BIND */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_C_BIND */ - if (x == Mono_Posix_SysConf__SC_2_C_DEV) -#ifdef _SC_2_C_DEV - {*r = _SC_2_C_DEV; return 0;} -#else /* def _SC_2_C_DEV */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_C_DEV */ - if (x == Mono_Posix_SysConf__SC_2_FORT_DEV) -#ifdef _SC_2_FORT_DEV - {*r = _SC_2_FORT_DEV; return 0;} -#else /* def _SC_2_FORT_DEV */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_FORT_DEV */ - if (x == Mono_Posix_SysConf__SC_2_FORT_RUN) -#ifdef _SC_2_FORT_RUN - {*r = _SC_2_FORT_RUN; return 0;} -#else /* def _SC_2_FORT_RUN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_FORT_RUN */ - if (x == Mono_Posix_SysConf__SC_2_SW_DEV) -#ifdef _SC_2_SW_DEV - {*r = _SC_2_SW_DEV; return 0;} -#else /* def _SC_2_SW_DEV */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_SW_DEV */ - if (x == Mono_Posix_SysConf__SC_2_LOCALEDEF) -#ifdef _SC_2_LOCALEDEF - {*r = _SC_2_LOCALEDEF; return 0;} -#else /* def _SC_2_LOCALEDEF */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_LOCALEDEF */ - if (x == Mono_Posix_SysConf__SC_PII) -#ifdef _SC_PII - {*r = _SC_PII; return 0;} -#else /* def _SC_PII */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII */ - if (x == Mono_Posix_SysConf__SC_PII_XTI) -#ifdef _SC_PII_XTI - {*r = _SC_PII_XTI; return 0;} -#else /* def _SC_PII_XTI */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_XTI */ - if (x == Mono_Posix_SysConf__SC_PII_SOCKET) -#ifdef _SC_PII_SOCKET - {*r = _SC_PII_SOCKET; return 0;} -#else /* def _SC_PII_SOCKET */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_SOCKET */ - if (x == Mono_Posix_SysConf__SC_PII_INTERNET) -#ifdef _SC_PII_INTERNET - {*r = _SC_PII_INTERNET; return 0;} -#else /* def _SC_PII_INTERNET */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_INTERNET */ - if (x == Mono_Posix_SysConf__SC_PII_OSI) -#ifdef _SC_PII_OSI - {*r = _SC_PII_OSI; return 0;} -#else /* def _SC_PII_OSI */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_OSI */ - if (x == Mono_Posix_SysConf__SC_POLL) -#ifdef _SC_POLL - {*r = _SC_POLL; return 0;} -#else /* def _SC_POLL */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_POLL */ - if (x == Mono_Posix_SysConf__SC_SELECT) -#ifdef _SC_SELECT - {*r = _SC_SELECT; return 0;} -#else /* def _SC_SELECT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SELECT */ - if (x == Mono_Posix_SysConf__SC_UIO_MAXIOV) -#ifdef _SC_UIO_MAXIOV - {*r = _SC_UIO_MAXIOV; return 0;} -#else /* def _SC_UIO_MAXIOV */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_UIO_MAXIOV */ - if (x == Mono_Posix_SysConf__SC_IOV_MAX) -#ifdef _SC_IOV_MAX - {*r = _SC_IOV_MAX; return 0;} -#else /* def _SC_IOV_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_IOV_MAX */ - if (x == Mono_Posix_SysConf__SC_PII_INTERNET_STREAM) -#ifdef _SC_PII_INTERNET_STREAM - {*r = _SC_PII_INTERNET_STREAM; return 0;} -#else /* def _SC_PII_INTERNET_STREAM */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_INTERNET_STREAM */ - if (x == Mono_Posix_SysConf__SC_PII_INTERNET_DGRAM) -#ifdef _SC_PII_INTERNET_DGRAM - {*r = _SC_PII_INTERNET_DGRAM; return 0;} -#else /* def _SC_PII_INTERNET_DGRAM */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_INTERNET_DGRAM */ - if (x == Mono_Posix_SysConf__SC_PII_OSI_COTS) -#ifdef _SC_PII_OSI_COTS - {*r = _SC_PII_OSI_COTS; return 0;} -#else /* def _SC_PII_OSI_COTS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_OSI_COTS */ - if (x == Mono_Posix_SysConf__SC_PII_OSI_CLTS) -#ifdef _SC_PII_OSI_CLTS - {*r = _SC_PII_OSI_CLTS; return 0;} -#else /* def _SC_PII_OSI_CLTS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_OSI_CLTS */ - if (x == Mono_Posix_SysConf__SC_PII_OSI_M) -#ifdef _SC_PII_OSI_M - {*r = _SC_PII_OSI_M; return 0;} -#else /* def _SC_PII_OSI_M */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PII_OSI_M */ - if (x == Mono_Posix_SysConf__SC_T_IOV_MAX) -#ifdef _SC_T_IOV_MAX - {*r = _SC_T_IOV_MAX; return 0;} -#else /* def _SC_T_IOV_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_T_IOV_MAX */ - if (x == Mono_Posix_SysConf__SC_THREADS) -#ifdef _SC_THREADS - {*r = _SC_THREADS; return 0;} -#else /* def _SC_THREADS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREADS */ - if (x == Mono_Posix_SysConf__SC_THREAD_SAFE_FUNCTIONS) -#ifdef _SC_THREAD_SAFE_FUNCTIONS - {*r = _SC_THREAD_SAFE_FUNCTIONS; return 0;} -#else /* def _SC_THREAD_SAFE_FUNCTIONS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */ - if (x == Mono_Posix_SysConf__SC_GETGR_R_SIZE_MAX) -#ifdef _SC_GETGR_R_SIZE_MAX - {*r = _SC_GETGR_R_SIZE_MAX; return 0;} -#else /* def _SC_GETGR_R_SIZE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_GETGR_R_SIZE_MAX */ - if (x == Mono_Posix_SysConf__SC_GETPW_R_SIZE_MAX) -#ifdef _SC_GETPW_R_SIZE_MAX - {*r = _SC_GETPW_R_SIZE_MAX; return 0;} -#else /* def _SC_GETPW_R_SIZE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_GETPW_R_SIZE_MAX */ - if (x == Mono_Posix_SysConf__SC_LOGIN_NAME_MAX) -#ifdef _SC_LOGIN_NAME_MAX - {*r = _SC_LOGIN_NAME_MAX; return 0;} -#else /* def _SC_LOGIN_NAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LOGIN_NAME_MAX */ - if (x == Mono_Posix_SysConf__SC_TTY_NAME_MAX) -#ifdef _SC_TTY_NAME_MAX - {*r = _SC_TTY_NAME_MAX; return 0;} -#else /* def _SC_TTY_NAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TTY_NAME_MAX */ - if (x == Mono_Posix_SysConf__SC_THREAD_DESTRUCTOR_ITERATIONS) -#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS - {*r = _SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;} -#else /* def _SC_THREAD_DESTRUCTOR_ITERATIONS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */ - if (x == Mono_Posix_SysConf__SC_THREAD_KEYS_MAX) -#ifdef _SC_THREAD_KEYS_MAX - {*r = _SC_THREAD_KEYS_MAX; return 0;} -#else /* def _SC_THREAD_KEYS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_KEYS_MAX */ - if (x == Mono_Posix_SysConf__SC_THREAD_STACK_MIN) -#ifdef _SC_THREAD_STACK_MIN - {*r = _SC_THREAD_STACK_MIN; return 0;} -#else /* def _SC_THREAD_STACK_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_STACK_MIN */ - if (x == Mono_Posix_SysConf__SC_THREAD_THREADS_MAX) -#ifdef _SC_THREAD_THREADS_MAX - {*r = _SC_THREAD_THREADS_MAX; return 0;} -#else /* def _SC_THREAD_THREADS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_THREADS_MAX */ - if (x == Mono_Posix_SysConf__SC_THREAD_ATTR_STACKADDR) -#ifdef _SC_THREAD_ATTR_STACKADDR - {*r = _SC_THREAD_ATTR_STACKADDR; return 0;} -#else /* def _SC_THREAD_ATTR_STACKADDR */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_ATTR_STACKADDR */ - if (x == Mono_Posix_SysConf__SC_THREAD_ATTR_STACKSIZE) -#ifdef _SC_THREAD_ATTR_STACKSIZE - {*r = _SC_THREAD_ATTR_STACKSIZE; return 0;} -#else /* def _SC_THREAD_ATTR_STACKSIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_ATTR_STACKSIZE */ - if (x == Mono_Posix_SysConf__SC_THREAD_PRIORITY_SCHEDULING) -#ifdef _SC_THREAD_PRIORITY_SCHEDULING - {*r = _SC_THREAD_PRIORITY_SCHEDULING; return 0;} -#else /* def _SC_THREAD_PRIORITY_SCHEDULING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */ - if (x == Mono_Posix_SysConf__SC_THREAD_PRIO_INHERIT) -#ifdef _SC_THREAD_PRIO_INHERIT - {*r = _SC_THREAD_PRIO_INHERIT; return 0;} -#else /* def _SC_THREAD_PRIO_INHERIT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_PRIO_INHERIT */ - if (x == Mono_Posix_SysConf__SC_THREAD_PRIO_PROTECT) -#ifdef _SC_THREAD_PRIO_PROTECT - {*r = _SC_THREAD_PRIO_PROTECT; return 0;} -#else /* def _SC_THREAD_PRIO_PROTECT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_PRIO_PROTECT */ - if (x == Mono_Posix_SysConf__SC_THREAD_PROCESS_SHARED) -#ifdef _SC_THREAD_PROCESS_SHARED - {*r = _SC_THREAD_PROCESS_SHARED; return 0;} -#else /* def _SC_THREAD_PROCESS_SHARED */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_PROCESS_SHARED */ - if (x == Mono_Posix_SysConf__SC_NPROCESSORS_CONF) -#ifdef _SC_NPROCESSORS_CONF - {*r = _SC_NPROCESSORS_CONF; return 0;} -#else /* def _SC_NPROCESSORS_CONF */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NPROCESSORS_CONF */ - if (x == Mono_Posix_SysConf__SC_NPROCESSORS_ONLN) -#ifdef _SC_NPROCESSORS_ONLN - {*r = _SC_NPROCESSORS_ONLN; return 0;} -#else /* def _SC_NPROCESSORS_ONLN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NPROCESSORS_ONLN */ - if (x == Mono_Posix_SysConf__SC_PHYS_PAGES) -#ifdef _SC_PHYS_PAGES - {*r = _SC_PHYS_PAGES; return 0;} -#else /* def _SC_PHYS_PAGES */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PHYS_PAGES */ - if (x == Mono_Posix_SysConf__SC_AVPHYS_PAGES) -#ifdef _SC_AVPHYS_PAGES - {*r = _SC_AVPHYS_PAGES; return 0;} -#else /* def _SC_AVPHYS_PAGES */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_AVPHYS_PAGES */ - if (x == Mono_Posix_SysConf__SC_ATEXIT_MAX) -#ifdef _SC_ATEXIT_MAX - {*r = _SC_ATEXIT_MAX; return 0;} -#else /* def _SC_ATEXIT_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_ATEXIT_MAX */ - if (x == Mono_Posix_SysConf__SC_PASS_MAX) -#ifdef _SC_PASS_MAX - {*r = _SC_PASS_MAX; return 0;} -#else /* def _SC_PASS_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PASS_MAX */ - if (x == Mono_Posix_SysConf__SC_XOPEN_VERSION) -#ifdef _SC_XOPEN_VERSION - {*r = _SC_XOPEN_VERSION; return 0;} -#else /* def _SC_XOPEN_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_VERSION */ - if (x == Mono_Posix_SysConf__SC_XOPEN_XCU_VERSION) -#ifdef _SC_XOPEN_XCU_VERSION - {*r = _SC_XOPEN_XCU_VERSION; return 0;} -#else /* def _SC_XOPEN_XCU_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_XCU_VERSION */ - if (x == Mono_Posix_SysConf__SC_XOPEN_UNIX) -#ifdef _SC_XOPEN_UNIX - {*r = _SC_XOPEN_UNIX; return 0;} -#else /* def _SC_XOPEN_UNIX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_UNIX */ - if (x == Mono_Posix_SysConf__SC_XOPEN_CRYPT) -#ifdef _SC_XOPEN_CRYPT - {*r = _SC_XOPEN_CRYPT; return 0;} -#else /* def _SC_XOPEN_CRYPT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_CRYPT */ - if (x == Mono_Posix_SysConf__SC_XOPEN_ENH_I18N) -#ifdef _SC_XOPEN_ENH_I18N - {*r = _SC_XOPEN_ENH_I18N; return 0;} -#else /* def _SC_XOPEN_ENH_I18N */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_ENH_I18N */ - if (x == Mono_Posix_SysConf__SC_XOPEN_SHM) -#ifdef _SC_XOPEN_SHM - {*r = _SC_XOPEN_SHM; return 0;} -#else /* def _SC_XOPEN_SHM */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_SHM */ - if (x == Mono_Posix_SysConf__SC_2_CHAR_TERM) -#ifdef _SC_2_CHAR_TERM - {*r = _SC_2_CHAR_TERM; return 0;} -#else /* def _SC_2_CHAR_TERM */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_CHAR_TERM */ - if (x == Mono_Posix_SysConf__SC_2_C_VERSION) -#ifdef _SC_2_C_VERSION - {*r = _SC_2_C_VERSION; return 0;} -#else /* def _SC_2_C_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_C_VERSION */ - if (x == Mono_Posix_SysConf__SC_2_UPE) -#ifdef _SC_2_UPE - {*r = _SC_2_UPE; return 0;} -#else /* def _SC_2_UPE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_UPE */ - if (x == Mono_Posix_SysConf__SC_XOPEN_XPG2) -#ifdef _SC_XOPEN_XPG2 - {*r = _SC_XOPEN_XPG2; return 0;} -#else /* def _SC_XOPEN_XPG2 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_XPG2 */ - if (x == Mono_Posix_SysConf__SC_XOPEN_XPG3) -#ifdef _SC_XOPEN_XPG3 - {*r = _SC_XOPEN_XPG3; return 0;} -#else /* def _SC_XOPEN_XPG3 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_XPG3 */ - if (x == Mono_Posix_SysConf__SC_XOPEN_XPG4) -#ifdef _SC_XOPEN_XPG4 - {*r = _SC_XOPEN_XPG4; return 0;} -#else /* def _SC_XOPEN_XPG4 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_XPG4 */ - if (x == Mono_Posix_SysConf__SC_CHAR_BIT) -#ifdef _SC_CHAR_BIT - {*r = _SC_CHAR_BIT; return 0;} -#else /* def _SC_CHAR_BIT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CHAR_BIT */ - if (x == Mono_Posix_SysConf__SC_CHAR_MAX) -#ifdef _SC_CHAR_MAX - {*r = _SC_CHAR_MAX; return 0;} -#else /* def _SC_CHAR_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CHAR_MAX */ - if (x == Mono_Posix_SysConf__SC_CHAR_MIN) -#ifdef _SC_CHAR_MIN - {*r = _SC_CHAR_MIN; return 0;} -#else /* def _SC_CHAR_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CHAR_MIN */ - if (x == Mono_Posix_SysConf__SC_INT_MAX) -#ifdef _SC_INT_MAX - {*r = _SC_INT_MAX; return 0;} -#else /* def _SC_INT_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_INT_MAX */ - if (x == Mono_Posix_SysConf__SC_INT_MIN) -#ifdef _SC_INT_MIN - {*r = _SC_INT_MIN; return 0;} -#else /* def _SC_INT_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_INT_MIN */ - if (x == Mono_Posix_SysConf__SC_LONG_BIT) -#ifdef _SC_LONG_BIT - {*r = _SC_LONG_BIT; return 0;} -#else /* def _SC_LONG_BIT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LONG_BIT */ - if (x == Mono_Posix_SysConf__SC_WORD_BIT) -#ifdef _SC_WORD_BIT - {*r = _SC_WORD_BIT; return 0;} -#else /* def _SC_WORD_BIT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_WORD_BIT */ - if (x == Mono_Posix_SysConf__SC_MB_LEN_MAX) -#ifdef _SC_MB_LEN_MAX - {*r = _SC_MB_LEN_MAX; return 0;} -#else /* def _SC_MB_LEN_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MB_LEN_MAX */ - if (x == Mono_Posix_SysConf__SC_NZERO) -#ifdef _SC_NZERO - {*r = _SC_NZERO; return 0;} -#else /* def _SC_NZERO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NZERO */ - if (x == Mono_Posix_SysConf__SC_SSIZE_MAX) -#ifdef _SC_SSIZE_MAX - {*r = _SC_SSIZE_MAX; return 0;} -#else /* def _SC_SSIZE_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SSIZE_MAX */ - if (x == Mono_Posix_SysConf__SC_SCHAR_MAX) -#ifdef _SC_SCHAR_MAX - {*r = _SC_SCHAR_MAX; return 0;} -#else /* def _SC_SCHAR_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SCHAR_MAX */ - if (x == Mono_Posix_SysConf__SC_SCHAR_MIN) -#ifdef _SC_SCHAR_MIN - {*r = _SC_SCHAR_MIN; return 0;} -#else /* def _SC_SCHAR_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SCHAR_MIN */ - if (x == Mono_Posix_SysConf__SC_SHRT_MAX) -#ifdef _SC_SHRT_MAX - {*r = _SC_SHRT_MAX; return 0;} -#else /* def _SC_SHRT_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SHRT_MAX */ - if (x == Mono_Posix_SysConf__SC_SHRT_MIN) -#ifdef _SC_SHRT_MIN - {*r = _SC_SHRT_MIN; return 0;} -#else /* def _SC_SHRT_MIN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SHRT_MIN */ - if (x == Mono_Posix_SysConf__SC_UCHAR_MAX) -#ifdef _SC_UCHAR_MAX - {*r = _SC_UCHAR_MAX; return 0;} -#else /* def _SC_UCHAR_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_UCHAR_MAX */ - if (x == Mono_Posix_SysConf__SC_UINT_MAX) -#ifdef _SC_UINT_MAX - {*r = _SC_UINT_MAX; return 0;} -#else /* def _SC_UINT_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_UINT_MAX */ - if (x == Mono_Posix_SysConf__SC_ULONG_MAX) -#ifdef _SC_ULONG_MAX - {*r = _SC_ULONG_MAX; return 0;} -#else /* def _SC_ULONG_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_ULONG_MAX */ - if (x == Mono_Posix_SysConf__SC_USHRT_MAX) -#ifdef _SC_USHRT_MAX - {*r = _SC_USHRT_MAX; return 0;} -#else /* def _SC_USHRT_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_USHRT_MAX */ - if (x == Mono_Posix_SysConf__SC_NL_ARGMAX) -#ifdef _SC_NL_ARGMAX - {*r = _SC_NL_ARGMAX; return 0;} -#else /* def _SC_NL_ARGMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_ARGMAX */ - if (x == Mono_Posix_SysConf__SC_NL_LANGMAX) -#ifdef _SC_NL_LANGMAX - {*r = _SC_NL_LANGMAX; return 0;} -#else /* def _SC_NL_LANGMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_LANGMAX */ - if (x == Mono_Posix_SysConf__SC_NL_MSGMAX) -#ifdef _SC_NL_MSGMAX - {*r = _SC_NL_MSGMAX; return 0;} -#else /* def _SC_NL_MSGMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_MSGMAX */ - if (x == Mono_Posix_SysConf__SC_NL_NMAX) -#ifdef _SC_NL_NMAX - {*r = _SC_NL_NMAX; return 0;} -#else /* def _SC_NL_NMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_NMAX */ - if (x == Mono_Posix_SysConf__SC_NL_SETMAX) -#ifdef _SC_NL_SETMAX - {*r = _SC_NL_SETMAX; return 0;} -#else /* def _SC_NL_SETMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_SETMAX */ - if (x == Mono_Posix_SysConf__SC_NL_TEXTMAX) -#ifdef _SC_NL_TEXTMAX - {*r = _SC_NL_TEXTMAX; return 0;} -#else /* def _SC_NL_TEXTMAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NL_TEXTMAX */ - if (x == Mono_Posix_SysConf__SC_XBS5_ILP32_OFF32) -#ifdef _SC_XBS5_ILP32_OFF32 - {*r = _SC_XBS5_ILP32_OFF32; return 0;} -#else /* def _SC_XBS5_ILP32_OFF32 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XBS5_ILP32_OFF32 */ - if (x == Mono_Posix_SysConf__SC_XBS5_ILP32_OFFBIG) -#ifdef _SC_XBS5_ILP32_OFFBIG - {*r = _SC_XBS5_ILP32_OFFBIG; return 0;} -#else /* def _SC_XBS5_ILP32_OFFBIG */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XBS5_ILP32_OFFBIG */ - if (x == Mono_Posix_SysConf__SC_XBS5_LP64_OFF64) -#ifdef _SC_XBS5_LP64_OFF64 - {*r = _SC_XBS5_LP64_OFF64; return 0;} -#else /* def _SC_XBS5_LP64_OFF64 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XBS5_LP64_OFF64 */ - if (x == Mono_Posix_SysConf__SC_XBS5_LPBIG_OFFBIG) -#ifdef _SC_XBS5_LPBIG_OFFBIG - {*r = _SC_XBS5_LPBIG_OFFBIG; return 0;} -#else /* def _SC_XBS5_LPBIG_OFFBIG */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XBS5_LPBIG_OFFBIG */ - if (x == Mono_Posix_SysConf__SC_XOPEN_LEGACY) -#ifdef _SC_XOPEN_LEGACY - {*r = _SC_XOPEN_LEGACY; return 0;} -#else /* def _SC_XOPEN_LEGACY */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_LEGACY */ - if (x == Mono_Posix_SysConf__SC_XOPEN_REALTIME) -#ifdef _SC_XOPEN_REALTIME - {*r = _SC_XOPEN_REALTIME; return 0;} -#else /* def _SC_XOPEN_REALTIME */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_REALTIME */ - if (x == Mono_Posix_SysConf__SC_XOPEN_REALTIME_THREADS) -#ifdef _SC_XOPEN_REALTIME_THREADS - {*r = _SC_XOPEN_REALTIME_THREADS; return 0;} -#else /* def _SC_XOPEN_REALTIME_THREADS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_XOPEN_REALTIME_THREADS */ - if (x == Mono_Posix_SysConf__SC_ADVISORY_INFO) -#ifdef _SC_ADVISORY_INFO - {*r = _SC_ADVISORY_INFO; return 0;} -#else /* def _SC_ADVISORY_INFO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_ADVISORY_INFO */ - if (x == Mono_Posix_SysConf__SC_BARRIERS) -#ifdef _SC_BARRIERS - {*r = _SC_BARRIERS; return 0;} -#else /* def _SC_BARRIERS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BARRIERS */ - if (x == Mono_Posix_SysConf__SC_BASE) -#ifdef _SC_BASE - {*r = _SC_BASE; return 0;} -#else /* def _SC_BASE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_BASE */ - if (x == Mono_Posix_SysConf__SC_C_LANG_SUPPORT) -#ifdef _SC_C_LANG_SUPPORT - {*r = _SC_C_LANG_SUPPORT; return 0;} -#else /* def _SC_C_LANG_SUPPORT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_C_LANG_SUPPORT */ - if (x == Mono_Posix_SysConf__SC_C_LANG_SUPPORT_R) -#ifdef _SC_C_LANG_SUPPORT_R - {*r = _SC_C_LANG_SUPPORT_R; return 0;} -#else /* def _SC_C_LANG_SUPPORT_R */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_C_LANG_SUPPORT_R */ - if (x == Mono_Posix_SysConf__SC_CLOCK_SELECTION) -#ifdef _SC_CLOCK_SELECTION - {*r = _SC_CLOCK_SELECTION; return 0;} -#else /* def _SC_CLOCK_SELECTION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CLOCK_SELECTION */ - if (x == Mono_Posix_SysConf__SC_CPUTIME) -#ifdef _SC_CPUTIME - {*r = _SC_CPUTIME; return 0;} -#else /* def _SC_CPUTIME */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_CPUTIME */ - if (x == Mono_Posix_SysConf__SC_THREAD_CPUTIME) -#ifdef _SC_THREAD_CPUTIME - {*r = _SC_THREAD_CPUTIME; return 0;} -#else /* def _SC_THREAD_CPUTIME */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_CPUTIME */ - if (x == Mono_Posix_SysConf__SC_DEVICE_IO) -#ifdef _SC_DEVICE_IO - {*r = _SC_DEVICE_IO; return 0;} -#else /* def _SC_DEVICE_IO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_DEVICE_IO */ - if (x == Mono_Posix_SysConf__SC_DEVICE_SPECIFIC) -#ifdef _SC_DEVICE_SPECIFIC - {*r = _SC_DEVICE_SPECIFIC; return 0;} -#else /* def _SC_DEVICE_SPECIFIC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_DEVICE_SPECIFIC */ - if (x == Mono_Posix_SysConf__SC_DEVICE_SPECIFIC_R) -#ifdef _SC_DEVICE_SPECIFIC_R - {*r = _SC_DEVICE_SPECIFIC_R; return 0;} -#else /* def _SC_DEVICE_SPECIFIC_R */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_DEVICE_SPECIFIC_R */ - if (x == Mono_Posix_SysConf__SC_FD_MGMT) -#ifdef _SC_FD_MGMT - {*r = _SC_FD_MGMT; return 0;} -#else /* def _SC_FD_MGMT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FD_MGMT */ - if (x == Mono_Posix_SysConf__SC_FIFO) -#ifdef _SC_FIFO - {*r = _SC_FIFO; return 0;} -#else /* def _SC_FIFO */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FIFO */ - if (x == Mono_Posix_SysConf__SC_PIPE) -#ifdef _SC_PIPE - {*r = _SC_PIPE; return 0;} -#else /* def _SC_PIPE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_PIPE */ - if (x == Mono_Posix_SysConf__SC_FILE_ATTRIBUTES) -#ifdef _SC_FILE_ATTRIBUTES - {*r = _SC_FILE_ATTRIBUTES; return 0;} -#else /* def _SC_FILE_ATTRIBUTES */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FILE_ATTRIBUTES */ - if (x == Mono_Posix_SysConf__SC_FILE_LOCKING) -#ifdef _SC_FILE_LOCKING - {*r = _SC_FILE_LOCKING; return 0;} -#else /* def _SC_FILE_LOCKING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FILE_LOCKING */ - if (x == Mono_Posix_SysConf__SC_FILE_SYSTEM) -#ifdef _SC_FILE_SYSTEM - {*r = _SC_FILE_SYSTEM; return 0;} -#else /* def _SC_FILE_SYSTEM */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_FILE_SYSTEM */ - if (x == Mono_Posix_SysConf__SC_MONOTONIC_CLOCK) -#ifdef _SC_MONOTONIC_CLOCK - {*r = _SC_MONOTONIC_CLOCK; return 0;} -#else /* def _SC_MONOTONIC_CLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MONOTONIC_CLOCK */ - if (x == Mono_Posix_SysConf__SC_MULTI_PROCESS) -#ifdef _SC_MULTI_PROCESS - {*r = _SC_MULTI_PROCESS; return 0;} -#else /* def _SC_MULTI_PROCESS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_MULTI_PROCESS */ - if (x == Mono_Posix_SysConf__SC_SINGLE_PROCESS) -#ifdef _SC_SINGLE_PROCESS - {*r = _SC_SINGLE_PROCESS; return 0;} -#else /* def _SC_SINGLE_PROCESS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SINGLE_PROCESS */ - if (x == Mono_Posix_SysConf__SC_NETWORKING) -#ifdef _SC_NETWORKING - {*r = _SC_NETWORKING; return 0;} -#else /* def _SC_NETWORKING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_NETWORKING */ - if (x == Mono_Posix_SysConf__SC_READER_WRITER_LOCKS) -#ifdef _SC_READER_WRITER_LOCKS - {*r = _SC_READER_WRITER_LOCKS; return 0;} -#else /* def _SC_READER_WRITER_LOCKS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_READER_WRITER_LOCKS */ - if (x == Mono_Posix_SysConf__SC_SPIN_LOCKS) -#ifdef _SC_SPIN_LOCKS - {*r = _SC_SPIN_LOCKS; return 0;} -#else /* def _SC_SPIN_LOCKS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SPIN_LOCKS */ - if (x == Mono_Posix_SysConf__SC_REGEXP) -#ifdef _SC_REGEXP - {*r = _SC_REGEXP; return 0;} -#else /* def _SC_REGEXP */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_REGEXP */ - if (x == Mono_Posix_SysConf__SC_REGEX_VERSION) -#ifdef _SC_REGEX_VERSION - {*r = _SC_REGEX_VERSION; return 0;} -#else /* def _SC_REGEX_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_REGEX_VERSION */ - if (x == Mono_Posix_SysConf__SC_SHELL) -#ifdef _SC_SHELL - {*r = _SC_SHELL; return 0;} -#else /* def _SC_SHELL */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SHELL */ - if (x == Mono_Posix_SysConf__SC_SIGNALS) -#ifdef _SC_SIGNALS - {*r = _SC_SIGNALS; return 0;} -#else /* def _SC_SIGNALS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SIGNALS */ - if (x == Mono_Posix_SysConf__SC_SPAWN) -#ifdef _SC_SPAWN - {*r = _SC_SPAWN; return 0;} -#else /* def _SC_SPAWN */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SPAWN */ - if (x == Mono_Posix_SysConf__SC_SPORADIC_SERVER) -#ifdef _SC_SPORADIC_SERVER - {*r = _SC_SPORADIC_SERVER; return 0;} -#else /* def _SC_SPORADIC_SERVER */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SPORADIC_SERVER */ - if (x == Mono_Posix_SysConf__SC_THREAD_SPORADIC_SERVER) -#ifdef _SC_THREAD_SPORADIC_SERVER - {*r = _SC_THREAD_SPORADIC_SERVER; return 0;} -#else /* def _SC_THREAD_SPORADIC_SERVER */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_THREAD_SPORADIC_SERVER */ - if (x == Mono_Posix_SysConf__SC_SYSTEM_DATABASE) -#ifdef _SC_SYSTEM_DATABASE - {*r = _SC_SYSTEM_DATABASE; return 0;} -#else /* def _SC_SYSTEM_DATABASE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SYSTEM_DATABASE */ - if (x == Mono_Posix_SysConf__SC_SYSTEM_DATABASE_R) -#ifdef _SC_SYSTEM_DATABASE_R - {*r = _SC_SYSTEM_DATABASE_R; return 0;} -#else /* def _SC_SYSTEM_DATABASE_R */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SYSTEM_DATABASE_R */ - if (x == Mono_Posix_SysConf__SC_TIMEOUTS) -#ifdef _SC_TIMEOUTS - {*r = _SC_TIMEOUTS; return 0;} -#else /* def _SC_TIMEOUTS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TIMEOUTS */ - if (x == Mono_Posix_SysConf__SC_TYPED_MEMORY_OBJECTS) -#ifdef _SC_TYPED_MEMORY_OBJECTS - {*r = _SC_TYPED_MEMORY_OBJECTS; return 0;} -#else /* def _SC_TYPED_MEMORY_OBJECTS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TYPED_MEMORY_OBJECTS */ - if (x == Mono_Posix_SysConf__SC_USER_GROUPS) -#ifdef _SC_USER_GROUPS - {*r = _SC_USER_GROUPS; return 0;} -#else /* def _SC_USER_GROUPS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_USER_GROUPS */ - if (x == Mono_Posix_SysConf__SC_USER_GROUPS_R) -#ifdef _SC_USER_GROUPS_R - {*r = _SC_USER_GROUPS_R; return 0;} -#else /* def _SC_USER_GROUPS_R */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_USER_GROUPS_R */ - if (x == Mono_Posix_SysConf__SC_2_PBS) -#ifdef _SC_2_PBS - {*r = _SC_2_PBS; return 0;} -#else /* def _SC_2_PBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS */ - if (x == Mono_Posix_SysConf__SC_2_PBS_ACCOUNTING) -#ifdef _SC_2_PBS_ACCOUNTING - {*r = _SC_2_PBS_ACCOUNTING; return 0;} -#else /* def _SC_2_PBS_ACCOUNTING */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS_ACCOUNTING */ - if (x == Mono_Posix_SysConf__SC_2_PBS_LOCATE) -#ifdef _SC_2_PBS_LOCATE - {*r = _SC_2_PBS_LOCATE; return 0;} -#else /* def _SC_2_PBS_LOCATE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS_LOCATE */ - if (x == Mono_Posix_SysConf__SC_2_PBS_MESSAGE) -#ifdef _SC_2_PBS_MESSAGE - {*r = _SC_2_PBS_MESSAGE; return 0;} -#else /* def _SC_2_PBS_MESSAGE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS_MESSAGE */ - if (x == Mono_Posix_SysConf__SC_2_PBS_TRACK) -#ifdef _SC_2_PBS_TRACK - {*r = _SC_2_PBS_TRACK; return 0;} -#else /* def _SC_2_PBS_TRACK */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS_TRACK */ - if (x == Mono_Posix_SysConf__SC_SYMLOOP_MAX) -#ifdef _SC_SYMLOOP_MAX - {*r = _SC_SYMLOOP_MAX; return 0;} -#else /* def _SC_SYMLOOP_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_SYMLOOP_MAX */ - if (x == Mono_Posix_SysConf__SC_STREAMS) -#ifdef _SC_STREAMS - {*r = _SC_STREAMS; return 0;} -#else /* def _SC_STREAMS */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_STREAMS */ - if (x == Mono_Posix_SysConf__SC_2_PBS_CHECKPOINT) -#ifdef _SC_2_PBS_CHECKPOINT - {*r = _SC_2_PBS_CHECKPOINT; return 0;} -#else /* def _SC_2_PBS_CHECKPOINT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_2_PBS_CHECKPOINT */ - if (x == Mono_Posix_SysConf__SC_V6_ILP32_OFF32) -#ifdef _SC_V6_ILP32_OFF32 - {*r = _SC_V6_ILP32_OFF32; return 0;} -#else /* def _SC_V6_ILP32_OFF32 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_V6_ILP32_OFF32 */ - if (x == Mono_Posix_SysConf__SC_V6_ILP32_OFFBIG) -#ifdef _SC_V6_ILP32_OFFBIG - {*r = _SC_V6_ILP32_OFFBIG; return 0;} -#else /* def _SC_V6_ILP32_OFFBIG */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_V6_ILP32_OFFBIG */ - if (x == Mono_Posix_SysConf__SC_V6_LP64_OFF64) -#ifdef _SC_V6_LP64_OFF64 - {*r = _SC_V6_LP64_OFF64; return 0;} -#else /* def _SC_V6_LP64_OFF64 */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_V6_LP64_OFF64 */ - if (x == Mono_Posix_SysConf__SC_V6_LPBIG_OFFBIG) -#ifdef _SC_V6_LPBIG_OFFBIG - {*r = _SC_V6_LPBIG_OFFBIG; return 0;} -#else /* def _SC_V6_LPBIG_OFFBIG */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_V6_LPBIG_OFFBIG */ - if (x == Mono_Posix_SysConf__SC_HOST_NAME_MAX) -#ifdef _SC_HOST_NAME_MAX - {*r = _SC_HOST_NAME_MAX; return 0;} -#else /* def _SC_HOST_NAME_MAX */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_HOST_NAME_MAX */ - if (x == Mono_Posix_SysConf__SC_TRACE) -#ifdef _SC_TRACE - {*r = _SC_TRACE; return 0;} -#else /* def _SC_TRACE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TRACE */ - if (x == Mono_Posix_SysConf__SC_TRACE_EVENT_FILTER) -#ifdef _SC_TRACE_EVENT_FILTER - {*r = _SC_TRACE_EVENT_FILTER; return 0;} -#else /* def _SC_TRACE_EVENT_FILTER */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TRACE_EVENT_FILTER */ - if (x == Mono_Posix_SysConf__SC_TRACE_INHERIT) -#ifdef _SC_TRACE_INHERIT - {*r = _SC_TRACE_INHERIT; return 0;} -#else /* def _SC_TRACE_INHERIT */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TRACE_INHERIT */ - if (x == Mono_Posix_SysConf__SC_TRACE_LOG) -#ifdef _SC_TRACE_LOG - {*r = _SC_TRACE_LOG; return 0;} -#else /* def _SC_TRACE_LOG */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_TRACE_LOG */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_ICACHE_SIZE) -#ifdef _SC_LEVEL1_ICACHE_SIZE - {*r = _SC_LEVEL1_ICACHE_SIZE; return 0;} -#else /* def _SC_LEVEL1_ICACHE_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_ICACHE_SIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_ICACHE_ASSOC) -#ifdef _SC_LEVEL1_ICACHE_ASSOC - {*r = _SC_LEVEL1_ICACHE_ASSOC; return 0;} -#else /* def _SC_LEVEL1_ICACHE_ASSOC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_ICACHE_LINESIZE) -#ifdef _SC_LEVEL1_ICACHE_LINESIZE - {*r = _SC_LEVEL1_ICACHE_LINESIZE; return 0;} -#else /* def _SC_LEVEL1_ICACHE_LINESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_DCACHE_SIZE) -#ifdef _SC_LEVEL1_DCACHE_SIZE - {*r = _SC_LEVEL1_DCACHE_SIZE; return 0;} -#else /* def _SC_LEVEL1_DCACHE_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_DCACHE_SIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_DCACHE_ASSOC) -#ifdef _SC_LEVEL1_DCACHE_ASSOC - {*r = _SC_LEVEL1_DCACHE_ASSOC; return 0;} -#else /* def _SC_LEVEL1_DCACHE_ASSOC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */ - if (x == Mono_Posix_SysConf__SC_LEVEL1_DCACHE_LINESIZE) -#ifdef _SC_LEVEL1_DCACHE_LINESIZE - {*r = _SC_LEVEL1_DCACHE_LINESIZE; return 0;} -#else /* def _SC_LEVEL1_DCACHE_LINESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL2_CACHE_SIZE) -#ifdef _SC_LEVEL2_CACHE_SIZE - {*r = _SC_LEVEL2_CACHE_SIZE; return 0;} -#else /* def _SC_LEVEL2_CACHE_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL2_CACHE_SIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL2_CACHE_ASSOC) -#ifdef _SC_LEVEL2_CACHE_ASSOC - {*r = _SC_LEVEL2_CACHE_ASSOC; return 0;} -#else /* def _SC_LEVEL2_CACHE_ASSOC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL2_CACHE_ASSOC */ - if (x == Mono_Posix_SysConf__SC_LEVEL2_CACHE_LINESIZE) -#ifdef _SC_LEVEL2_CACHE_LINESIZE - {*r = _SC_LEVEL2_CACHE_LINESIZE; return 0;} -#else /* def _SC_LEVEL2_CACHE_LINESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL3_CACHE_SIZE) -#ifdef _SC_LEVEL3_CACHE_SIZE - {*r = _SC_LEVEL3_CACHE_SIZE; return 0;} -#else /* def _SC_LEVEL3_CACHE_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL3_CACHE_SIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL3_CACHE_ASSOC) -#ifdef _SC_LEVEL3_CACHE_ASSOC - {*r = _SC_LEVEL3_CACHE_ASSOC; return 0;} -#else /* def _SC_LEVEL3_CACHE_ASSOC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL3_CACHE_ASSOC */ - if (x == Mono_Posix_SysConf__SC_LEVEL3_CACHE_LINESIZE) -#ifdef _SC_LEVEL3_CACHE_LINESIZE - {*r = _SC_LEVEL3_CACHE_LINESIZE; return 0;} -#else /* def _SC_LEVEL3_CACHE_LINESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL4_CACHE_SIZE) -#ifdef _SC_LEVEL4_CACHE_SIZE - {*r = _SC_LEVEL4_CACHE_SIZE; return 0;} -#else /* def _SC_LEVEL4_CACHE_SIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL4_CACHE_SIZE */ - if (x == Mono_Posix_SysConf__SC_LEVEL4_CACHE_ASSOC) -#ifdef _SC_LEVEL4_CACHE_ASSOC - {*r = _SC_LEVEL4_CACHE_ASSOC; return 0;} -#else /* def _SC_LEVEL4_CACHE_ASSOC */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL4_CACHE_ASSOC */ - if (x == Mono_Posix_SysConf__SC_LEVEL4_CACHE_LINESIZE) -#ifdef _SC_LEVEL4_CACHE_LINESIZE - {*r = _SC_LEVEL4_CACHE_LINESIZE; return 0;} -#else /* def _SC_LEVEL4_CACHE_LINESIZE */ - {errno = EINVAL; return -1;} -#endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToSysConf (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef _SC_ARG_MAX - if (x == _SC_ARG_MAX) - {*r = Mono_Posix_SysConf__SC_ARG_MAX; return 0;} -#endif /* ndef _SC_ARG_MAX */ -#ifdef _SC_CHILD_MAX - if (x == _SC_CHILD_MAX) - {*r = Mono_Posix_SysConf__SC_CHILD_MAX; return 0;} -#endif /* ndef _SC_CHILD_MAX */ -#ifdef _SC_CLK_TCK - if (x == _SC_CLK_TCK) - {*r = Mono_Posix_SysConf__SC_CLK_TCK; return 0;} -#endif /* ndef _SC_CLK_TCK */ -#ifdef _SC_NGROUPS_MAX - if (x == _SC_NGROUPS_MAX) - {*r = Mono_Posix_SysConf__SC_NGROUPS_MAX; return 0;} -#endif /* ndef _SC_NGROUPS_MAX */ -#ifdef _SC_OPEN_MAX - if (x == _SC_OPEN_MAX) - {*r = Mono_Posix_SysConf__SC_OPEN_MAX; return 0;} -#endif /* ndef _SC_OPEN_MAX */ -#ifdef _SC_STREAM_MAX - if (x == _SC_STREAM_MAX) - {*r = Mono_Posix_SysConf__SC_STREAM_MAX; return 0;} -#endif /* ndef _SC_STREAM_MAX */ -#ifdef _SC_TZNAME_MAX - if (x == _SC_TZNAME_MAX) - {*r = Mono_Posix_SysConf__SC_TZNAME_MAX; return 0;} -#endif /* ndef _SC_TZNAME_MAX */ -#ifdef _SC_JOB_CONTROL - if (x == _SC_JOB_CONTROL) - {*r = Mono_Posix_SysConf__SC_JOB_CONTROL; return 0;} -#endif /* ndef _SC_JOB_CONTROL */ -#ifdef _SC_SAVED_IDS - if (x == _SC_SAVED_IDS) - {*r = Mono_Posix_SysConf__SC_SAVED_IDS; return 0;} -#endif /* ndef _SC_SAVED_IDS */ -#ifdef _SC_REALTIME_SIGNALS - if (x == _SC_REALTIME_SIGNALS) - {*r = Mono_Posix_SysConf__SC_REALTIME_SIGNALS; return 0;} -#endif /* ndef _SC_REALTIME_SIGNALS */ -#ifdef _SC_PRIORITY_SCHEDULING - if (x == _SC_PRIORITY_SCHEDULING) - {*r = Mono_Posix_SysConf__SC_PRIORITY_SCHEDULING; return 0;} -#endif /* ndef _SC_PRIORITY_SCHEDULING */ -#ifdef _SC_TIMERS - if (x == _SC_TIMERS) - {*r = Mono_Posix_SysConf__SC_TIMERS; return 0;} -#endif /* ndef _SC_TIMERS */ -#ifdef _SC_ASYNCHRONOUS_IO - if (x == _SC_ASYNCHRONOUS_IO) - {*r = Mono_Posix_SysConf__SC_ASYNCHRONOUS_IO; return 0;} -#endif /* ndef _SC_ASYNCHRONOUS_IO */ -#ifdef _SC_PRIORITIZED_IO - if (x == _SC_PRIORITIZED_IO) - {*r = Mono_Posix_SysConf__SC_PRIORITIZED_IO; return 0;} -#endif /* ndef _SC_PRIORITIZED_IO */ -#ifdef _SC_SYNCHRONIZED_IO - if (x == _SC_SYNCHRONIZED_IO) - {*r = Mono_Posix_SysConf__SC_SYNCHRONIZED_IO; return 0;} -#endif /* ndef _SC_SYNCHRONIZED_IO */ -#ifdef _SC_FSYNC - if (x == _SC_FSYNC) - {*r = Mono_Posix_SysConf__SC_FSYNC; return 0;} -#endif /* ndef _SC_FSYNC */ -#ifdef _SC_MAPPED_FILES - if (x == _SC_MAPPED_FILES) - {*r = Mono_Posix_SysConf__SC_MAPPED_FILES; return 0;} -#endif /* ndef _SC_MAPPED_FILES */ -#ifdef _SC_MEMLOCK - if (x == _SC_MEMLOCK) - {*r = Mono_Posix_SysConf__SC_MEMLOCK; return 0;} -#endif /* ndef _SC_MEMLOCK */ -#ifdef _SC_MEMLOCK_RANGE - if (x == _SC_MEMLOCK_RANGE) - {*r = Mono_Posix_SysConf__SC_MEMLOCK_RANGE; return 0;} -#endif /* ndef _SC_MEMLOCK_RANGE */ -#ifdef _SC_MEMORY_PROTECTION - if (x == _SC_MEMORY_PROTECTION) - {*r = Mono_Posix_SysConf__SC_MEMORY_PROTECTION; return 0;} -#endif /* ndef _SC_MEMORY_PROTECTION */ -#ifdef _SC_MESSAGE_PASSING - if (x == _SC_MESSAGE_PASSING) - {*r = Mono_Posix_SysConf__SC_MESSAGE_PASSING; return 0;} -#endif /* ndef _SC_MESSAGE_PASSING */ -#ifdef _SC_SEMAPHORES - if (x == _SC_SEMAPHORES) - {*r = Mono_Posix_SysConf__SC_SEMAPHORES; return 0;} -#endif /* ndef _SC_SEMAPHORES */ -#ifdef _SC_SHARED_MEMORY_OBJECTS - if (x == _SC_SHARED_MEMORY_OBJECTS) - {*r = Mono_Posix_SysConf__SC_SHARED_MEMORY_OBJECTS; return 0;} -#endif /* ndef _SC_SHARED_MEMORY_OBJECTS */ -#ifdef _SC_AIO_LISTIO_MAX - if (x == _SC_AIO_LISTIO_MAX) - {*r = Mono_Posix_SysConf__SC_AIO_LISTIO_MAX; return 0;} -#endif /* ndef _SC_AIO_LISTIO_MAX */ -#ifdef _SC_AIO_MAX - if (x == _SC_AIO_MAX) - {*r = Mono_Posix_SysConf__SC_AIO_MAX; return 0;} -#endif /* ndef _SC_AIO_MAX */ -#ifdef _SC_AIO_PRIO_DELTA_MAX - if (x == _SC_AIO_PRIO_DELTA_MAX) - {*r = Mono_Posix_SysConf__SC_AIO_PRIO_DELTA_MAX; return 0;} -#endif /* ndef _SC_AIO_PRIO_DELTA_MAX */ -#ifdef _SC_DELAYTIMER_MAX - if (x == _SC_DELAYTIMER_MAX) - {*r = Mono_Posix_SysConf__SC_DELAYTIMER_MAX; return 0;} -#endif /* ndef _SC_DELAYTIMER_MAX */ -#ifdef _SC_MQ_OPEN_MAX - if (x == _SC_MQ_OPEN_MAX) - {*r = Mono_Posix_SysConf__SC_MQ_OPEN_MAX; return 0;} -#endif /* ndef _SC_MQ_OPEN_MAX */ -#ifdef _SC_MQ_PRIO_MAX - if (x == _SC_MQ_PRIO_MAX) - {*r = Mono_Posix_SysConf__SC_MQ_PRIO_MAX; return 0;} -#endif /* ndef _SC_MQ_PRIO_MAX */ -#ifdef _SC_VERSION - if (x == _SC_VERSION) - {*r = Mono_Posix_SysConf__SC_VERSION; return 0;} -#endif /* ndef _SC_VERSION */ -#ifdef _SC_PAGESIZE - if (x == _SC_PAGESIZE) - {*r = Mono_Posix_SysConf__SC_PAGESIZE; return 0;} -#endif /* ndef _SC_PAGESIZE */ -#ifdef _SC_RTSIG_MAX - if (x == _SC_RTSIG_MAX) - {*r = Mono_Posix_SysConf__SC_RTSIG_MAX; return 0;} -#endif /* ndef _SC_RTSIG_MAX */ -#ifdef _SC_SEM_NSEMS_MAX - if (x == _SC_SEM_NSEMS_MAX) - {*r = Mono_Posix_SysConf__SC_SEM_NSEMS_MAX; return 0;} -#endif /* ndef _SC_SEM_NSEMS_MAX */ -#ifdef _SC_SEM_VALUE_MAX - if (x == _SC_SEM_VALUE_MAX) - {*r = Mono_Posix_SysConf__SC_SEM_VALUE_MAX; return 0;} -#endif /* ndef _SC_SEM_VALUE_MAX */ -#ifdef _SC_SIGQUEUE_MAX - if (x == _SC_SIGQUEUE_MAX) - {*r = Mono_Posix_SysConf__SC_SIGQUEUE_MAX; return 0;} -#endif /* ndef _SC_SIGQUEUE_MAX */ -#ifdef _SC_TIMER_MAX - if (x == _SC_TIMER_MAX) - {*r = Mono_Posix_SysConf__SC_TIMER_MAX; return 0;} -#endif /* ndef _SC_TIMER_MAX */ -#ifdef _SC_BC_BASE_MAX - if (x == _SC_BC_BASE_MAX) - {*r = Mono_Posix_SysConf__SC_BC_BASE_MAX; return 0;} -#endif /* ndef _SC_BC_BASE_MAX */ -#ifdef _SC_BC_DIM_MAX - if (x == _SC_BC_DIM_MAX) - {*r = Mono_Posix_SysConf__SC_BC_DIM_MAX; return 0;} -#endif /* ndef _SC_BC_DIM_MAX */ -#ifdef _SC_BC_SCALE_MAX - if (x == _SC_BC_SCALE_MAX) - {*r = Mono_Posix_SysConf__SC_BC_SCALE_MAX; return 0;} -#endif /* ndef _SC_BC_SCALE_MAX */ -#ifdef _SC_BC_STRING_MAX - if (x == _SC_BC_STRING_MAX) - {*r = Mono_Posix_SysConf__SC_BC_STRING_MAX; return 0;} -#endif /* ndef _SC_BC_STRING_MAX */ -#ifdef _SC_COLL_WEIGHTS_MAX - if (x == _SC_COLL_WEIGHTS_MAX) - {*r = Mono_Posix_SysConf__SC_COLL_WEIGHTS_MAX; return 0;} -#endif /* ndef _SC_COLL_WEIGHTS_MAX */ -#ifdef _SC_EQUIV_CLASS_MAX - if (x == _SC_EQUIV_CLASS_MAX) - {*r = Mono_Posix_SysConf__SC_EQUIV_CLASS_MAX; return 0;} -#endif /* ndef _SC_EQUIV_CLASS_MAX */ -#ifdef _SC_EXPR_NEST_MAX - if (x == _SC_EXPR_NEST_MAX) - {*r = Mono_Posix_SysConf__SC_EXPR_NEST_MAX; return 0;} -#endif /* ndef _SC_EXPR_NEST_MAX */ -#ifdef _SC_LINE_MAX - if (x == _SC_LINE_MAX) - {*r = Mono_Posix_SysConf__SC_LINE_MAX; return 0;} -#endif /* ndef _SC_LINE_MAX */ -#ifdef _SC_RE_DUP_MAX - if (x == _SC_RE_DUP_MAX) - {*r = Mono_Posix_SysConf__SC_RE_DUP_MAX; return 0;} -#endif /* ndef _SC_RE_DUP_MAX */ -#ifdef _SC_CHARCLASS_NAME_MAX - if (x == _SC_CHARCLASS_NAME_MAX) - {*r = Mono_Posix_SysConf__SC_CHARCLASS_NAME_MAX; return 0;} -#endif /* ndef _SC_CHARCLASS_NAME_MAX */ -#ifdef _SC_2_VERSION - if (x == _SC_2_VERSION) - {*r = Mono_Posix_SysConf__SC_2_VERSION; return 0;} -#endif /* ndef _SC_2_VERSION */ -#ifdef _SC_2_C_BIND - if (x == _SC_2_C_BIND) - {*r = Mono_Posix_SysConf__SC_2_C_BIND; return 0;} -#endif /* ndef _SC_2_C_BIND */ -#ifdef _SC_2_C_DEV - if (x == _SC_2_C_DEV) - {*r = Mono_Posix_SysConf__SC_2_C_DEV; return 0;} -#endif /* ndef _SC_2_C_DEV */ -#ifdef _SC_2_FORT_DEV - if (x == _SC_2_FORT_DEV) - {*r = Mono_Posix_SysConf__SC_2_FORT_DEV; return 0;} -#endif /* ndef _SC_2_FORT_DEV */ -#ifdef _SC_2_FORT_RUN - if (x == _SC_2_FORT_RUN) - {*r = Mono_Posix_SysConf__SC_2_FORT_RUN; return 0;} -#endif /* ndef _SC_2_FORT_RUN */ -#ifdef _SC_2_SW_DEV - if (x == _SC_2_SW_DEV) - {*r = Mono_Posix_SysConf__SC_2_SW_DEV; return 0;} -#endif /* ndef _SC_2_SW_DEV */ -#ifdef _SC_2_LOCALEDEF - if (x == _SC_2_LOCALEDEF) - {*r = Mono_Posix_SysConf__SC_2_LOCALEDEF; return 0;} -#endif /* ndef _SC_2_LOCALEDEF */ -#ifdef _SC_PII - if (x == _SC_PII) - {*r = Mono_Posix_SysConf__SC_PII; return 0;} -#endif /* ndef _SC_PII */ -#ifdef _SC_PII_XTI - if (x == _SC_PII_XTI) - {*r = Mono_Posix_SysConf__SC_PII_XTI; return 0;} -#endif /* ndef _SC_PII_XTI */ -#ifdef _SC_PII_SOCKET - if (x == _SC_PII_SOCKET) - {*r = Mono_Posix_SysConf__SC_PII_SOCKET; return 0;} -#endif /* ndef _SC_PII_SOCKET */ -#ifdef _SC_PII_INTERNET - if (x == _SC_PII_INTERNET) - {*r = Mono_Posix_SysConf__SC_PII_INTERNET; return 0;} -#endif /* ndef _SC_PII_INTERNET */ -#ifdef _SC_PII_OSI - if (x == _SC_PII_OSI) - {*r = Mono_Posix_SysConf__SC_PII_OSI; return 0;} -#endif /* ndef _SC_PII_OSI */ -#ifdef _SC_POLL - if (x == _SC_POLL) - {*r = Mono_Posix_SysConf__SC_POLL; return 0;} -#endif /* ndef _SC_POLL */ -#ifdef _SC_SELECT - if (x == _SC_SELECT) - {*r = Mono_Posix_SysConf__SC_SELECT; return 0;} -#endif /* ndef _SC_SELECT */ -#ifdef _SC_UIO_MAXIOV - if (x == _SC_UIO_MAXIOV) - {*r = Mono_Posix_SysConf__SC_UIO_MAXIOV; return 0;} -#endif /* ndef _SC_UIO_MAXIOV */ -#ifdef _SC_IOV_MAX - if (x == _SC_IOV_MAX) - {*r = Mono_Posix_SysConf__SC_IOV_MAX; return 0;} -#endif /* ndef _SC_IOV_MAX */ -#ifdef _SC_PII_INTERNET_STREAM - if (x == _SC_PII_INTERNET_STREAM) - {*r = Mono_Posix_SysConf__SC_PII_INTERNET_STREAM; return 0;} -#endif /* ndef _SC_PII_INTERNET_STREAM */ -#ifdef _SC_PII_INTERNET_DGRAM - if (x == _SC_PII_INTERNET_DGRAM) - {*r = Mono_Posix_SysConf__SC_PII_INTERNET_DGRAM; return 0;} -#endif /* ndef _SC_PII_INTERNET_DGRAM */ -#ifdef _SC_PII_OSI_COTS - if (x == _SC_PII_OSI_COTS) - {*r = Mono_Posix_SysConf__SC_PII_OSI_COTS; return 0;} -#endif /* ndef _SC_PII_OSI_COTS */ -#ifdef _SC_PII_OSI_CLTS - if (x == _SC_PII_OSI_CLTS) - {*r = Mono_Posix_SysConf__SC_PII_OSI_CLTS; return 0;} -#endif /* ndef _SC_PII_OSI_CLTS */ -#ifdef _SC_PII_OSI_M - if (x == _SC_PII_OSI_M) - {*r = Mono_Posix_SysConf__SC_PII_OSI_M; return 0;} -#endif /* ndef _SC_PII_OSI_M */ -#ifdef _SC_T_IOV_MAX - if (x == _SC_T_IOV_MAX) - {*r = Mono_Posix_SysConf__SC_T_IOV_MAX; return 0;} -#endif /* ndef _SC_T_IOV_MAX */ -#ifdef _SC_THREADS - if (x == _SC_THREADS) - {*r = Mono_Posix_SysConf__SC_THREADS; return 0;} -#endif /* ndef _SC_THREADS */ -#ifdef _SC_THREAD_SAFE_FUNCTIONS - if (x == _SC_THREAD_SAFE_FUNCTIONS) - {*r = Mono_Posix_SysConf__SC_THREAD_SAFE_FUNCTIONS; return 0;} -#endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */ -#ifdef _SC_GETGR_R_SIZE_MAX - if (x == _SC_GETGR_R_SIZE_MAX) - {*r = Mono_Posix_SysConf__SC_GETGR_R_SIZE_MAX; return 0;} -#endif /* ndef _SC_GETGR_R_SIZE_MAX */ -#ifdef _SC_GETPW_R_SIZE_MAX - if (x == _SC_GETPW_R_SIZE_MAX) - {*r = Mono_Posix_SysConf__SC_GETPW_R_SIZE_MAX; return 0;} -#endif /* ndef _SC_GETPW_R_SIZE_MAX */ -#ifdef _SC_LOGIN_NAME_MAX - if (x == _SC_LOGIN_NAME_MAX) - {*r = Mono_Posix_SysConf__SC_LOGIN_NAME_MAX; return 0;} -#endif /* ndef _SC_LOGIN_NAME_MAX */ -#ifdef _SC_TTY_NAME_MAX - if (x == _SC_TTY_NAME_MAX) - {*r = Mono_Posix_SysConf__SC_TTY_NAME_MAX; return 0;} -#endif /* ndef _SC_TTY_NAME_MAX */ -#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS - if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS) - {*r = Mono_Posix_SysConf__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;} -#endif /* ndef _SC_THREAD_DESTRUCTOR_ITERATIONS */ -#ifdef _SC_THREAD_KEYS_MAX - if (x == _SC_THREAD_KEYS_MAX) - {*r = Mono_Posix_SysConf__SC_THREAD_KEYS_MAX; return 0;} -#endif /* ndef _SC_THREAD_KEYS_MAX */ -#ifdef _SC_THREAD_STACK_MIN - if (x == _SC_THREAD_STACK_MIN) - {*r = Mono_Posix_SysConf__SC_THREAD_STACK_MIN; return 0;} -#endif /* ndef _SC_THREAD_STACK_MIN */ -#ifdef _SC_THREAD_THREADS_MAX - if (x == _SC_THREAD_THREADS_MAX) - {*r = Mono_Posix_SysConf__SC_THREAD_THREADS_MAX; return 0;} -#endif /* ndef _SC_THREAD_THREADS_MAX */ -#ifdef _SC_THREAD_ATTR_STACKADDR - if (x == _SC_THREAD_ATTR_STACKADDR) - {*r = Mono_Posix_SysConf__SC_THREAD_ATTR_STACKADDR; return 0;} -#endif /* ndef _SC_THREAD_ATTR_STACKADDR */ -#ifdef _SC_THREAD_ATTR_STACKSIZE - if (x == _SC_THREAD_ATTR_STACKSIZE) - {*r = Mono_Posix_SysConf__SC_THREAD_ATTR_STACKSIZE; return 0;} -#endif /* ndef _SC_THREAD_ATTR_STACKSIZE */ -#ifdef _SC_THREAD_PRIORITY_SCHEDULING - if (x == _SC_THREAD_PRIORITY_SCHEDULING) - {*r = Mono_Posix_SysConf__SC_THREAD_PRIORITY_SCHEDULING; return 0;} -#endif /* ndef _SC_THREAD_PRIORITY_SCHEDULING */ -#ifdef _SC_THREAD_PRIO_INHERIT - if (x == _SC_THREAD_PRIO_INHERIT) - {*r = Mono_Posix_SysConf__SC_THREAD_PRIO_INHERIT; return 0;} -#endif /* ndef _SC_THREAD_PRIO_INHERIT */ -#ifdef _SC_THREAD_PRIO_PROTECT - if (x == _SC_THREAD_PRIO_PROTECT) - {*r = Mono_Posix_SysConf__SC_THREAD_PRIO_PROTECT; return 0;} -#endif /* ndef _SC_THREAD_PRIO_PROTECT */ -#ifdef _SC_THREAD_PROCESS_SHARED - if (x == _SC_THREAD_PROCESS_SHARED) - {*r = Mono_Posix_SysConf__SC_THREAD_PROCESS_SHARED; return 0;} -#endif /* ndef _SC_THREAD_PROCESS_SHARED */ -#ifdef _SC_NPROCESSORS_CONF - if (x == _SC_NPROCESSORS_CONF) - {*r = Mono_Posix_SysConf__SC_NPROCESSORS_CONF; return 0;} -#endif /* ndef _SC_NPROCESSORS_CONF */ -#ifdef _SC_NPROCESSORS_ONLN - if (x == _SC_NPROCESSORS_ONLN) - {*r = Mono_Posix_SysConf__SC_NPROCESSORS_ONLN; return 0;} -#endif /* ndef _SC_NPROCESSORS_ONLN */ -#ifdef _SC_PHYS_PAGES - if (x == _SC_PHYS_PAGES) - {*r = Mono_Posix_SysConf__SC_PHYS_PAGES; return 0;} -#endif /* ndef _SC_PHYS_PAGES */ -#ifdef _SC_AVPHYS_PAGES - if (x == _SC_AVPHYS_PAGES) - {*r = Mono_Posix_SysConf__SC_AVPHYS_PAGES; return 0;} -#endif /* ndef _SC_AVPHYS_PAGES */ -#ifdef _SC_ATEXIT_MAX - if (x == _SC_ATEXIT_MAX) - {*r = Mono_Posix_SysConf__SC_ATEXIT_MAX; return 0;} -#endif /* ndef _SC_ATEXIT_MAX */ -#ifdef _SC_PASS_MAX - if (x == _SC_PASS_MAX) - {*r = Mono_Posix_SysConf__SC_PASS_MAX; return 0;} -#endif /* ndef _SC_PASS_MAX */ -#ifdef _SC_XOPEN_VERSION - if (x == _SC_XOPEN_VERSION) - {*r = Mono_Posix_SysConf__SC_XOPEN_VERSION; return 0;} -#endif /* ndef _SC_XOPEN_VERSION */ -#ifdef _SC_XOPEN_XCU_VERSION - if (x == _SC_XOPEN_XCU_VERSION) - {*r = Mono_Posix_SysConf__SC_XOPEN_XCU_VERSION; return 0;} -#endif /* ndef _SC_XOPEN_XCU_VERSION */ -#ifdef _SC_XOPEN_UNIX - if (x == _SC_XOPEN_UNIX) - {*r = Mono_Posix_SysConf__SC_XOPEN_UNIX; return 0;} -#endif /* ndef _SC_XOPEN_UNIX */ -#ifdef _SC_XOPEN_CRYPT - if (x == _SC_XOPEN_CRYPT) - {*r = Mono_Posix_SysConf__SC_XOPEN_CRYPT; return 0;} -#endif /* ndef _SC_XOPEN_CRYPT */ -#ifdef _SC_XOPEN_ENH_I18N - if (x == _SC_XOPEN_ENH_I18N) - {*r = Mono_Posix_SysConf__SC_XOPEN_ENH_I18N; return 0;} -#endif /* ndef _SC_XOPEN_ENH_I18N */ -#ifdef _SC_XOPEN_SHM - if (x == _SC_XOPEN_SHM) - {*r = Mono_Posix_SysConf__SC_XOPEN_SHM; return 0;} -#endif /* ndef _SC_XOPEN_SHM */ -#ifdef _SC_2_CHAR_TERM - if (x == _SC_2_CHAR_TERM) - {*r = Mono_Posix_SysConf__SC_2_CHAR_TERM; return 0;} -#endif /* ndef _SC_2_CHAR_TERM */ -#ifdef _SC_2_C_VERSION - if (x == _SC_2_C_VERSION) - {*r = Mono_Posix_SysConf__SC_2_C_VERSION; return 0;} -#endif /* ndef _SC_2_C_VERSION */ -#ifdef _SC_2_UPE - if (x == _SC_2_UPE) - {*r = Mono_Posix_SysConf__SC_2_UPE; return 0;} -#endif /* ndef _SC_2_UPE */ -#ifdef _SC_XOPEN_XPG2 - if (x == _SC_XOPEN_XPG2) - {*r = Mono_Posix_SysConf__SC_XOPEN_XPG2; return 0;} -#endif /* ndef _SC_XOPEN_XPG2 */ -#ifdef _SC_XOPEN_XPG3 - if (x == _SC_XOPEN_XPG3) - {*r = Mono_Posix_SysConf__SC_XOPEN_XPG3; return 0;} -#endif /* ndef _SC_XOPEN_XPG3 */ -#ifdef _SC_XOPEN_XPG4 - if (x == _SC_XOPEN_XPG4) - {*r = Mono_Posix_SysConf__SC_XOPEN_XPG4; return 0;} -#endif /* ndef _SC_XOPEN_XPG4 */ -#ifdef _SC_CHAR_BIT - if (x == _SC_CHAR_BIT) - {*r = Mono_Posix_SysConf__SC_CHAR_BIT; return 0;} -#endif /* ndef _SC_CHAR_BIT */ -#ifdef _SC_CHAR_MAX - if (x == _SC_CHAR_MAX) - {*r = Mono_Posix_SysConf__SC_CHAR_MAX; return 0;} -#endif /* ndef _SC_CHAR_MAX */ -#ifdef _SC_CHAR_MIN - if (x == _SC_CHAR_MIN) - {*r = Mono_Posix_SysConf__SC_CHAR_MIN; return 0;} -#endif /* ndef _SC_CHAR_MIN */ -#ifdef _SC_INT_MAX - if (x == _SC_INT_MAX) - {*r = Mono_Posix_SysConf__SC_INT_MAX; return 0;} -#endif /* ndef _SC_INT_MAX */ -#ifdef _SC_INT_MIN - if (x == _SC_INT_MIN) - {*r = Mono_Posix_SysConf__SC_INT_MIN; return 0;} -#endif /* ndef _SC_INT_MIN */ -#ifdef _SC_LONG_BIT - if (x == _SC_LONG_BIT) - {*r = Mono_Posix_SysConf__SC_LONG_BIT; return 0;} -#endif /* ndef _SC_LONG_BIT */ -#ifdef _SC_WORD_BIT - if (x == _SC_WORD_BIT) - {*r = Mono_Posix_SysConf__SC_WORD_BIT; return 0;} -#endif /* ndef _SC_WORD_BIT */ -#ifdef _SC_MB_LEN_MAX - if (x == _SC_MB_LEN_MAX) - {*r = Mono_Posix_SysConf__SC_MB_LEN_MAX; return 0;} -#endif /* ndef _SC_MB_LEN_MAX */ -#ifdef _SC_NZERO - if (x == _SC_NZERO) - {*r = Mono_Posix_SysConf__SC_NZERO; return 0;} -#endif /* ndef _SC_NZERO */ -#ifdef _SC_SSIZE_MAX - if (x == _SC_SSIZE_MAX) - {*r = Mono_Posix_SysConf__SC_SSIZE_MAX; return 0;} -#endif /* ndef _SC_SSIZE_MAX */ -#ifdef _SC_SCHAR_MAX - if (x == _SC_SCHAR_MAX) - {*r = Mono_Posix_SysConf__SC_SCHAR_MAX; return 0;} -#endif /* ndef _SC_SCHAR_MAX */ -#ifdef _SC_SCHAR_MIN - if (x == _SC_SCHAR_MIN) - {*r = Mono_Posix_SysConf__SC_SCHAR_MIN; return 0;} -#endif /* ndef _SC_SCHAR_MIN */ -#ifdef _SC_SHRT_MAX - if (x == _SC_SHRT_MAX) - {*r = Mono_Posix_SysConf__SC_SHRT_MAX; return 0;} -#endif /* ndef _SC_SHRT_MAX */ -#ifdef _SC_SHRT_MIN - if (x == _SC_SHRT_MIN) - {*r = Mono_Posix_SysConf__SC_SHRT_MIN; return 0;} -#endif /* ndef _SC_SHRT_MIN */ -#ifdef _SC_UCHAR_MAX - if (x == _SC_UCHAR_MAX) - {*r = Mono_Posix_SysConf__SC_UCHAR_MAX; return 0;} -#endif /* ndef _SC_UCHAR_MAX */ -#ifdef _SC_UINT_MAX - if (x == _SC_UINT_MAX) - {*r = Mono_Posix_SysConf__SC_UINT_MAX; return 0;} -#endif /* ndef _SC_UINT_MAX */ -#ifdef _SC_ULONG_MAX - if (x == _SC_ULONG_MAX) - {*r = Mono_Posix_SysConf__SC_ULONG_MAX; return 0;} -#endif /* ndef _SC_ULONG_MAX */ -#ifdef _SC_USHRT_MAX - if (x == _SC_USHRT_MAX) - {*r = Mono_Posix_SysConf__SC_USHRT_MAX; return 0;} -#endif /* ndef _SC_USHRT_MAX */ -#ifdef _SC_NL_ARGMAX - if (x == _SC_NL_ARGMAX) - {*r = Mono_Posix_SysConf__SC_NL_ARGMAX; return 0;} -#endif /* ndef _SC_NL_ARGMAX */ -#ifdef _SC_NL_LANGMAX - if (x == _SC_NL_LANGMAX) - {*r = Mono_Posix_SysConf__SC_NL_LANGMAX; return 0;} -#endif /* ndef _SC_NL_LANGMAX */ -#ifdef _SC_NL_MSGMAX - if (x == _SC_NL_MSGMAX) - {*r = Mono_Posix_SysConf__SC_NL_MSGMAX; return 0;} -#endif /* ndef _SC_NL_MSGMAX */ -#ifdef _SC_NL_NMAX - if (x == _SC_NL_NMAX) - {*r = Mono_Posix_SysConf__SC_NL_NMAX; return 0;} -#endif /* ndef _SC_NL_NMAX */ -#ifdef _SC_NL_SETMAX - if (x == _SC_NL_SETMAX) - {*r = Mono_Posix_SysConf__SC_NL_SETMAX; return 0;} -#endif /* ndef _SC_NL_SETMAX */ -#ifdef _SC_NL_TEXTMAX - if (x == _SC_NL_TEXTMAX) - {*r = Mono_Posix_SysConf__SC_NL_TEXTMAX; return 0;} -#endif /* ndef _SC_NL_TEXTMAX */ -#ifdef _SC_XBS5_ILP32_OFF32 - if (x == _SC_XBS5_ILP32_OFF32) - {*r = Mono_Posix_SysConf__SC_XBS5_ILP32_OFF32; return 0;} -#endif /* ndef _SC_XBS5_ILP32_OFF32 */ -#ifdef _SC_XBS5_ILP32_OFFBIG - if (x == _SC_XBS5_ILP32_OFFBIG) - {*r = Mono_Posix_SysConf__SC_XBS5_ILP32_OFFBIG; return 0;} -#endif /* ndef _SC_XBS5_ILP32_OFFBIG */ -#ifdef _SC_XBS5_LP64_OFF64 - if (x == _SC_XBS5_LP64_OFF64) - {*r = Mono_Posix_SysConf__SC_XBS5_LP64_OFF64; return 0;} -#endif /* ndef _SC_XBS5_LP64_OFF64 */ -#ifdef _SC_XBS5_LPBIG_OFFBIG - if (x == _SC_XBS5_LPBIG_OFFBIG) - {*r = Mono_Posix_SysConf__SC_XBS5_LPBIG_OFFBIG; return 0;} -#endif /* ndef _SC_XBS5_LPBIG_OFFBIG */ -#ifdef _SC_XOPEN_LEGACY - if (x == _SC_XOPEN_LEGACY) - {*r = Mono_Posix_SysConf__SC_XOPEN_LEGACY; return 0;} -#endif /* ndef _SC_XOPEN_LEGACY */ -#ifdef _SC_XOPEN_REALTIME - if (x == _SC_XOPEN_REALTIME) - {*r = Mono_Posix_SysConf__SC_XOPEN_REALTIME; return 0;} -#endif /* ndef _SC_XOPEN_REALTIME */ -#ifdef _SC_XOPEN_REALTIME_THREADS - if (x == _SC_XOPEN_REALTIME_THREADS) - {*r = Mono_Posix_SysConf__SC_XOPEN_REALTIME_THREADS; return 0;} -#endif /* ndef _SC_XOPEN_REALTIME_THREADS */ -#ifdef _SC_ADVISORY_INFO - if (x == _SC_ADVISORY_INFO) - {*r = Mono_Posix_SysConf__SC_ADVISORY_INFO; return 0;} -#endif /* ndef _SC_ADVISORY_INFO */ -#ifdef _SC_BARRIERS - if (x == _SC_BARRIERS) - {*r = Mono_Posix_SysConf__SC_BARRIERS; return 0;} -#endif /* ndef _SC_BARRIERS */ -#ifdef _SC_BASE - if (x == _SC_BASE) - {*r = Mono_Posix_SysConf__SC_BASE; return 0;} -#endif /* ndef _SC_BASE */ -#ifdef _SC_C_LANG_SUPPORT - if (x == _SC_C_LANG_SUPPORT) - {*r = Mono_Posix_SysConf__SC_C_LANG_SUPPORT; return 0;} -#endif /* ndef _SC_C_LANG_SUPPORT */ -#ifdef _SC_C_LANG_SUPPORT_R - if (x == _SC_C_LANG_SUPPORT_R) - {*r = Mono_Posix_SysConf__SC_C_LANG_SUPPORT_R; return 0;} -#endif /* ndef _SC_C_LANG_SUPPORT_R */ -#ifdef _SC_CLOCK_SELECTION - if (x == _SC_CLOCK_SELECTION) - {*r = Mono_Posix_SysConf__SC_CLOCK_SELECTION; return 0;} -#endif /* ndef _SC_CLOCK_SELECTION */ -#ifdef _SC_CPUTIME - if (x == _SC_CPUTIME) - {*r = Mono_Posix_SysConf__SC_CPUTIME; return 0;} -#endif /* ndef _SC_CPUTIME */ -#ifdef _SC_THREAD_CPUTIME - if (x == _SC_THREAD_CPUTIME) - {*r = Mono_Posix_SysConf__SC_THREAD_CPUTIME; return 0;} -#endif /* ndef _SC_THREAD_CPUTIME */ -#ifdef _SC_DEVICE_IO - if (x == _SC_DEVICE_IO) - {*r = Mono_Posix_SysConf__SC_DEVICE_IO; return 0;} -#endif /* ndef _SC_DEVICE_IO */ -#ifdef _SC_DEVICE_SPECIFIC - if (x == _SC_DEVICE_SPECIFIC) - {*r = Mono_Posix_SysConf__SC_DEVICE_SPECIFIC; return 0;} -#endif /* ndef _SC_DEVICE_SPECIFIC */ -#ifdef _SC_DEVICE_SPECIFIC_R - if (x == _SC_DEVICE_SPECIFIC_R) - {*r = Mono_Posix_SysConf__SC_DEVICE_SPECIFIC_R; return 0;} -#endif /* ndef _SC_DEVICE_SPECIFIC_R */ -#ifdef _SC_FD_MGMT - if (x == _SC_FD_MGMT) - {*r = Mono_Posix_SysConf__SC_FD_MGMT; return 0;} -#endif /* ndef _SC_FD_MGMT */ -#ifdef _SC_FIFO - if (x == _SC_FIFO) - {*r = Mono_Posix_SysConf__SC_FIFO; return 0;} -#endif /* ndef _SC_FIFO */ -#ifdef _SC_PIPE - if (x == _SC_PIPE) - {*r = Mono_Posix_SysConf__SC_PIPE; return 0;} -#endif /* ndef _SC_PIPE */ -#ifdef _SC_FILE_ATTRIBUTES - if (x == _SC_FILE_ATTRIBUTES) - {*r = Mono_Posix_SysConf__SC_FILE_ATTRIBUTES; return 0;} -#endif /* ndef _SC_FILE_ATTRIBUTES */ -#ifdef _SC_FILE_LOCKING - if (x == _SC_FILE_LOCKING) - {*r = Mono_Posix_SysConf__SC_FILE_LOCKING; return 0;} -#endif /* ndef _SC_FILE_LOCKING */ -#ifdef _SC_FILE_SYSTEM - if (x == _SC_FILE_SYSTEM) - {*r = Mono_Posix_SysConf__SC_FILE_SYSTEM; return 0;} -#endif /* ndef _SC_FILE_SYSTEM */ -#ifdef _SC_MONOTONIC_CLOCK - if (x == _SC_MONOTONIC_CLOCK) - {*r = Mono_Posix_SysConf__SC_MONOTONIC_CLOCK; return 0;} -#endif /* ndef _SC_MONOTONIC_CLOCK */ -#ifdef _SC_MULTI_PROCESS - if (x == _SC_MULTI_PROCESS) - {*r = Mono_Posix_SysConf__SC_MULTI_PROCESS; return 0;} -#endif /* ndef _SC_MULTI_PROCESS */ -#ifdef _SC_SINGLE_PROCESS - if (x == _SC_SINGLE_PROCESS) - {*r = Mono_Posix_SysConf__SC_SINGLE_PROCESS; return 0;} -#endif /* ndef _SC_SINGLE_PROCESS */ -#ifdef _SC_NETWORKING - if (x == _SC_NETWORKING) - {*r = Mono_Posix_SysConf__SC_NETWORKING; return 0;} -#endif /* ndef _SC_NETWORKING */ -#ifdef _SC_READER_WRITER_LOCKS - if (x == _SC_READER_WRITER_LOCKS) - {*r = Mono_Posix_SysConf__SC_READER_WRITER_LOCKS; return 0;} -#endif /* ndef _SC_READER_WRITER_LOCKS */ -#ifdef _SC_SPIN_LOCKS - if (x == _SC_SPIN_LOCKS) - {*r = Mono_Posix_SysConf__SC_SPIN_LOCKS; return 0;} -#endif /* ndef _SC_SPIN_LOCKS */ -#ifdef _SC_REGEXP - if (x == _SC_REGEXP) - {*r = Mono_Posix_SysConf__SC_REGEXP; return 0;} -#endif /* ndef _SC_REGEXP */ -#ifdef _SC_REGEX_VERSION - if (x == _SC_REGEX_VERSION) - {*r = Mono_Posix_SysConf__SC_REGEX_VERSION; return 0;} -#endif /* ndef _SC_REGEX_VERSION */ -#ifdef _SC_SHELL - if (x == _SC_SHELL) - {*r = Mono_Posix_SysConf__SC_SHELL; return 0;} -#endif /* ndef _SC_SHELL */ -#ifdef _SC_SIGNALS - if (x == _SC_SIGNALS) - {*r = Mono_Posix_SysConf__SC_SIGNALS; return 0;} -#endif /* ndef _SC_SIGNALS */ -#ifdef _SC_SPAWN - if (x == _SC_SPAWN) - {*r = Mono_Posix_SysConf__SC_SPAWN; return 0;} -#endif /* ndef _SC_SPAWN */ -#ifdef _SC_SPORADIC_SERVER - if (x == _SC_SPORADIC_SERVER) - {*r = Mono_Posix_SysConf__SC_SPORADIC_SERVER; return 0;} -#endif /* ndef _SC_SPORADIC_SERVER */ -#ifdef _SC_THREAD_SPORADIC_SERVER - if (x == _SC_THREAD_SPORADIC_SERVER) - {*r = Mono_Posix_SysConf__SC_THREAD_SPORADIC_SERVER; return 0;} -#endif /* ndef _SC_THREAD_SPORADIC_SERVER */ -#ifdef _SC_SYSTEM_DATABASE - if (x == _SC_SYSTEM_DATABASE) - {*r = Mono_Posix_SysConf__SC_SYSTEM_DATABASE; return 0;} -#endif /* ndef _SC_SYSTEM_DATABASE */ -#ifdef _SC_SYSTEM_DATABASE_R - if (x == _SC_SYSTEM_DATABASE_R) - {*r = Mono_Posix_SysConf__SC_SYSTEM_DATABASE_R; return 0;} -#endif /* ndef _SC_SYSTEM_DATABASE_R */ -#ifdef _SC_TIMEOUTS - if (x == _SC_TIMEOUTS) - {*r = Mono_Posix_SysConf__SC_TIMEOUTS; return 0;} -#endif /* ndef _SC_TIMEOUTS */ -#ifdef _SC_TYPED_MEMORY_OBJECTS - if (x == _SC_TYPED_MEMORY_OBJECTS) - {*r = Mono_Posix_SysConf__SC_TYPED_MEMORY_OBJECTS; return 0;} -#endif /* ndef _SC_TYPED_MEMORY_OBJECTS */ -#ifdef _SC_USER_GROUPS - if (x == _SC_USER_GROUPS) - {*r = Mono_Posix_SysConf__SC_USER_GROUPS; return 0;} -#endif /* ndef _SC_USER_GROUPS */ -#ifdef _SC_USER_GROUPS_R - if (x == _SC_USER_GROUPS_R) - {*r = Mono_Posix_SysConf__SC_USER_GROUPS_R; return 0;} -#endif /* ndef _SC_USER_GROUPS_R */ -#ifdef _SC_2_PBS - if (x == _SC_2_PBS) - {*r = Mono_Posix_SysConf__SC_2_PBS; return 0;} -#endif /* ndef _SC_2_PBS */ -#ifdef _SC_2_PBS_ACCOUNTING - if (x == _SC_2_PBS_ACCOUNTING) - {*r = Mono_Posix_SysConf__SC_2_PBS_ACCOUNTING; return 0;} -#endif /* ndef _SC_2_PBS_ACCOUNTING */ -#ifdef _SC_2_PBS_LOCATE - if (x == _SC_2_PBS_LOCATE) - {*r = Mono_Posix_SysConf__SC_2_PBS_LOCATE; return 0;} -#endif /* ndef _SC_2_PBS_LOCATE */ -#ifdef _SC_2_PBS_MESSAGE - if (x == _SC_2_PBS_MESSAGE) - {*r = Mono_Posix_SysConf__SC_2_PBS_MESSAGE; return 0;} -#endif /* ndef _SC_2_PBS_MESSAGE */ -#ifdef _SC_2_PBS_TRACK - if (x == _SC_2_PBS_TRACK) - {*r = Mono_Posix_SysConf__SC_2_PBS_TRACK; return 0;} -#endif /* ndef _SC_2_PBS_TRACK */ -#ifdef _SC_SYMLOOP_MAX - if (x == _SC_SYMLOOP_MAX) - {*r = Mono_Posix_SysConf__SC_SYMLOOP_MAX; return 0;} -#endif /* ndef _SC_SYMLOOP_MAX */ -#ifdef _SC_STREAMS - if (x == _SC_STREAMS) - {*r = Mono_Posix_SysConf__SC_STREAMS; return 0;} -#endif /* ndef _SC_STREAMS */ -#ifdef _SC_2_PBS_CHECKPOINT - if (x == _SC_2_PBS_CHECKPOINT) - {*r = Mono_Posix_SysConf__SC_2_PBS_CHECKPOINT; return 0;} -#endif /* ndef _SC_2_PBS_CHECKPOINT */ -#ifdef _SC_V6_ILP32_OFF32 - if (x == _SC_V6_ILP32_OFF32) - {*r = Mono_Posix_SysConf__SC_V6_ILP32_OFF32; return 0;} -#endif /* ndef _SC_V6_ILP32_OFF32 */ -#ifdef _SC_V6_ILP32_OFFBIG - if (x == _SC_V6_ILP32_OFFBIG) - {*r = Mono_Posix_SysConf__SC_V6_ILP32_OFFBIG; return 0;} -#endif /* ndef _SC_V6_ILP32_OFFBIG */ -#ifdef _SC_V6_LP64_OFF64 - if (x == _SC_V6_LP64_OFF64) - {*r = Mono_Posix_SysConf__SC_V6_LP64_OFF64; return 0;} -#endif /* ndef _SC_V6_LP64_OFF64 */ -#ifdef _SC_V6_LPBIG_OFFBIG - if (x == _SC_V6_LPBIG_OFFBIG) - {*r = Mono_Posix_SysConf__SC_V6_LPBIG_OFFBIG; return 0;} -#endif /* ndef _SC_V6_LPBIG_OFFBIG */ -#ifdef _SC_HOST_NAME_MAX - if (x == _SC_HOST_NAME_MAX) - {*r = Mono_Posix_SysConf__SC_HOST_NAME_MAX; return 0;} -#endif /* ndef _SC_HOST_NAME_MAX */ -#ifdef _SC_TRACE - if (x == _SC_TRACE) - {*r = Mono_Posix_SysConf__SC_TRACE; return 0;} -#endif /* ndef _SC_TRACE */ -#ifdef _SC_TRACE_EVENT_FILTER - if (x == _SC_TRACE_EVENT_FILTER) - {*r = Mono_Posix_SysConf__SC_TRACE_EVENT_FILTER; return 0;} -#endif /* ndef _SC_TRACE_EVENT_FILTER */ -#ifdef _SC_TRACE_INHERIT - if (x == _SC_TRACE_INHERIT) - {*r = Mono_Posix_SysConf__SC_TRACE_INHERIT; return 0;} -#endif /* ndef _SC_TRACE_INHERIT */ -#ifdef _SC_TRACE_LOG - if (x == _SC_TRACE_LOG) - {*r = Mono_Posix_SysConf__SC_TRACE_LOG; return 0;} -#endif /* ndef _SC_TRACE_LOG */ -#ifdef _SC_LEVEL1_ICACHE_SIZE - if (x == _SC_LEVEL1_ICACHE_SIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL1_ICACHE_SIZE; return 0;} -#endif /* ndef _SC_LEVEL1_ICACHE_SIZE */ -#ifdef _SC_LEVEL1_ICACHE_ASSOC - if (x == _SC_LEVEL1_ICACHE_ASSOC) - {*r = Mono_Posix_SysConf__SC_LEVEL1_ICACHE_ASSOC; return 0;} -#endif /* ndef _SC_LEVEL1_ICACHE_ASSOC */ -#ifdef _SC_LEVEL1_ICACHE_LINESIZE - if (x == _SC_LEVEL1_ICACHE_LINESIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL1_ICACHE_LINESIZE; return 0;} -#endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */ -#ifdef _SC_LEVEL1_DCACHE_SIZE - if (x == _SC_LEVEL1_DCACHE_SIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL1_DCACHE_SIZE; return 0;} -#endif /* ndef _SC_LEVEL1_DCACHE_SIZE */ -#ifdef _SC_LEVEL1_DCACHE_ASSOC - if (x == _SC_LEVEL1_DCACHE_ASSOC) - {*r = Mono_Posix_SysConf__SC_LEVEL1_DCACHE_ASSOC; return 0;} -#endif /* ndef _SC_LEVEL1_DCACHE_ASSOC */ -#ifdef _SC_LEVEL1_DCACHE_LINESIZE - if (x == _SC_LEVEL1_DCACHE_LINESIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL1_DCACHE_LINESIZE; return 0;} -#endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */ -#ifdef _SC_LEVEL2_CACHE_SIZE - if (x == _SC_LEVEL2_CACHE_SIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL2_CACHE_SIZE; return 0;} -#endif /* ndef _SC_LEVEL2_CACHE_SIZE */ -#ifdef _SC_LEVEL2_CACHE_ASSOC - if (x == _SC_LEVEL2_CACHE_ASSOC) - {*r = Mono_Posix_SysConf__SC_LEVEL2_CACHE_ASSOC; return 0;} -#endif /* ndef _SC_LEVEL2_CACHE_ASSOC */ -#ifdef _SC_LEVEL2_CACHE_LINESIZE - if (x == _SC_LEVEL2_CACHE_LINESIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL2_CACHE_LINESIZE; return 0;} -#endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */ -#ifdef _SC_LEVEL3_CACHE_SIZE - if (x == _SC_LEVEL3_CACHE_SIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL3_CACHE_SIZE; return 0;} -#endif /* ndef _SC_LEVEL3_CACHE_SIZE */ -#ifdef _SC_LEVEL3_CACHE_ASSOC - if (x == _SC_LEVEL3_CACHE_ASSOC) - {*r = Mono_Posix_SysConf__SC_LEVEL3_CACHE_ASSOC; return 0;} -#endif /* ndef _SC_LEVEL3_CACHE_ASSOC */ -#ifdef _SC_LEVEL3_CACHE_LINESIZE - if (x == _SC_LEVEL3_CACHE_LINESIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL3_CACHE_LINESIZE; return 0;} -#endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */ -#ifdef _SC_LEVEL4_CACHE_SIZE - if (x == _SC_LEVEL4_CACHE_SIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL4_CACHE_SIZE; return 0;} -#endif /* ndef _SC_LEVEL4_CACHE_SIZE */ -#ifdef _SC_LEVEL4_CACHE_ASSOC - if (x == _SC_LEVEL4_CACHE_ASSOC) - {*r = Mono_Posix_SysConf__SC_LEVEL4_CACHE_ASSOC; return 0;} -#endif /* ndef _SC_LEVEL4_CACHE_ASSOC */ -#ifdef _SC_LEVEL4_CACHE_LINESIZE - if (x == _SC_LEVEL4_CACHE_LINESIZE) - {*r = Mono_Posix_SysConf__SC_LEVEL4_CACHE_LINESIZE; return 0;} -#endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromConfStr (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_ConfStr__CS_PATH) -#ifdef _CS_PATH - {*r = _CS_PATH; return 0;} -#else /* def _CS_PATH */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_PATH */ - if (x == Mono_Posix_ConfStr__CS_V6_WIDTH_RESTRICTED_ENVS) -#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS - {*r = _CS_V6_WIDTH_RESTRICTED_ENVS; return 0;} -#else /* def _CS_V6_WIDTH_RESTRICTED_ENVS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */ - if (x == Mono_Posix_ConfStr__CS_GNU_LIBC_VERSION) -#ifdef _CS_GNU_LIBC_VERSION - {*r = _CS_GNU_LIBC_VERSION; return 0;} -#else /* def _CS_GNU_LIBC_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_GNU_LIBC_VERSION */ - if (x == Mono_Posix_ConfStr__CS_GNU_LIBPTHREAD_VERSION) -#ifdef _CS_GNU_LIBPTHREAD_VERSION - {*r = _CS_GNU_LIBPTHREAD_VERSION; return 0;} -#else /* def _CS_GNU_LIBPTHREAD_VERSION */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */ - if (x == Mono_Posix_ConfStr__CS_LFS_CFLAGS) -#ifdef _CS_LFS_CFLAGS - {*r = _CS_LFS_CFLAGS; return 0;} -#else /* def _CS_LFS_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_LFS_LDFLAGS) -#ifdef _CS_LFS_LDFLAGS - {*r = _CS_LFS_LDFLAGS; return 0;} -#else /* def _CS_LFS_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_LFS_LIBS) -#ifdef _CS_LFS_LIBS - {*r = _CS_LFS_LIBS; return 0;} -#else /* def _CS_LFS_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS_LIBS */ - if (x == Mono_Posix_ConfStr__CS_LFS_LINTFLAGS) -#ifdef _CS_LFS_LINTFLAGS - {*r = _CS_LFS_LINTFLAGS; return 0;} -#else /* def _CS_LFS_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_LFS64_CFLAGS) -#ifdef _CS_LFS64_CFLAGS - {*r = _CS_LFS64_CFLAGS; return 0;} -#else /* def _CS_LFS64_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS64_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_LFS64_LDFLAGS) -#ifdef _CS_LFS64_LDFLAGS - {*r = _CS_LFS64_LDFLAGS; return 0;} -#else /* def _CS_LFS64_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS64_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_LFS64_LIBS) -#ifdef _CS_LFS64_LIBS - {*r = _CS_LFS64_LIBS; return 0;} -#else /* def _CS_LFS64_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS64_LIBS */ - if (x == Mono_Posix_ConfStr__CS_LFS64_LINTFLAGS) -#ifdef _CS_LFS64_LINTFLAGS - {*r = _CS_LFS64_LINTFLAGS; return 0;} -#else /* def _CS_LFS64_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_LFS64_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_CFLAGS) -#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS - {*r = _CS_XBS5_ILP32_OFF32_CFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFF32_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LDFLAGS) -#ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS - {*r = _CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFF32_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LIBS) -#ifdef _CS_XBS5_ILP32_OFF32_LIBS - {*r = _CS_XBS5_ILP32_OFF32_LIBS; return 0;} -#else /* def _CS_XBS5_ILP32_OFF32_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LINTFLAGS) -#ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS - {*r = _CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFF32_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_CFLAGS) -#ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS - {*r = _CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFFBIG_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LDFLAGS) -#ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS - {*r = _CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFFBIG_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LIBS) -#ifdef _CS_XBS5_ILP32_OFFBIG_LIBS - {*r = _CS_XBS5_ILP32_OFFBIG_LIBS; return 0;} -#else /* def _CS_XBS5_ILP32_OFFBIG_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LINTFLAGS) -#ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS - {*r = _CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;} -#else /* def _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_CFLAGS) -#ifdef _CS_XBS5_LP64_OFF64_CFLAGS - {*r = _CS_XBS5_LP64_OFF64_CFLAGS; return 0;} -#else /* def _CS_XBS5_LP64_OFF64_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LDFLAGS) -#ifdef _CS_XBS5_LP64_OFF64_LDFLAGS - {*r = _CS_XBS5_LP64_OFF64_LDFLAGS; return 0;} -#else /* def _CS_XBS5_LP64_OFF64_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LIBS) -#ifdef _CS_XBS5_LP64_OFF64_LIBS - {*r = _CS_XBS5_LP64_OFF64_LIBS; return 0;} -#else /* def _CS_XBS5_LP64_OFF64_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LINTFLAGS) -#ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS - {*r = _CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;} -#else /* def _CS_XBS5_LP64_OFF64_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_CFLAGS) -#ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS - {*r = _CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;} -#else /* def _CS_XBS5_LPBIG_OFFBIG_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LDFLAGS) -#ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS - {*r = _CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;} -#else /* def _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LIBS) -#ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS - {*r = _CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;} -#else /* def _CS_XBS5_LPBIG_OFFBIG_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */ - if (x == Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS) -#ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS - {*r = _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;} -#else /* def _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_CFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS - {*r = _CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFF32_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LDFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS - {*r = _CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LIBS) -#ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS - {*r = _CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFF32_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS - {*r = _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS - {*r = _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS - {*r = _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LIBS) -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS - {*r = _CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFFBIG_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS) -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS - {*r = _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;} -#else /* def _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_CFLAGS) -#ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS - {*r = _CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LP64_OFF64_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LDFLAGS) -#ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS - {*r = _CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LP64_OFF64_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LIBS) -#ifdef _CS_POSIX_V6_LP64_OFF64_LIBS - {*r = _CS_POSIX_V6_LP64_OFF64_LIBS; return 0;} -#else /* def _CS_POSIX_V6_LP64_OFF64_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LINTFLAGS) -#ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS - {*r = _CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS - {*r = _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS - {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LIBS) -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS - {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;} -#else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */ - if (x == Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS) -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS - {*r = _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;} -#else /* def _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */ - {errno = EINVAL; return -1;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToConfStr (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef _CS_PATH - if (x == _CS_PATH) - {*r = Mono_Posix_ConfStr__CS_PATH; return 0;} -#endif /* ndef _CS_PATH */ -#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS - if (x == _CS_V6_WIDTH_RESTRICTED_ENVS) - {*r = Mono_Posix_ConfStr__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;} -#endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */ -#ifdef _CS_GNU_LIBC_VERSION - if (x == _CS_GNU_LIBC_VERSION) - {*r = Mono_Posix_ConfStr__CS_GNU_LIBC_VERSION; return 0;} -#endif /* ndef _CS_GNU_LIBC_VERSION */ -#ifdef _CS_GNU_LIBPTHREAD_VERSION - if (x == _CS_GNU_LIBPTHREAD_VERSION) - {*r = Mono_Posix_ConfStr__CS_GNU_LIBPTHREAD_VERSION; return 0;} -#endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */ -#ifdef _CS_LFS_CFLAGS - if (x == _CS_LFS_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS_CFLAGS; return 0;} -#endif /* ndef _CS_LFS_CFLAGS */ -#ifdef _CS_LFS_LDFLAGS - if (x == _CS_LFS_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS_LDFLAGS; return 0;} -#endif /* ndef _CS_LFS_LDFLAGS */ -#ifdef _CS_LFS_LIBS - if (x == _CS_LFS_LIBS) - {*r = Mono_Posix_ConfStr__CS_LFS_LIBS; return 0;} -#endif /* ndef _CS_LFS_LIBS */ -#ifdef _CS_LFS_LINTFLAGS - if (x == _CS_LFS_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS_LINTFLAGS; return 0;} -#endif /* ndef _CS_LFS_LINTFLAGS */ -#ifdef _CS_LFS64_CFLAGS - if (x == _CS_LFS64_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS64_CFLAGS; return 0;} -#endif /* ndef _CS_LFS64_CFLAGS */ -#ifdef _CS_LFS64_LDFLAGS - if (x == _CS_LFS64_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS64_LDFLAGS; return 0;} -#endif /* ndef _CS_LFS64_LDFLAGS */ -#ifdef _CS_LFS64_LIBS - if (x == _CS_LFS64_LIBS) - {*r = Mono_Posix_ConfStr__CS_LFS64_LIBS; return 0;} -#endif /* ndef _CS_LFS64_LIBS */ -#ifdef _CS_LFS64_LINTFLAGS - if (x == _CS_LFS64_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_LFS64_LINTFLAGS; return 0;} -#endif /* ndef _CS_LFS64_LINTFLAGS */ -#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS - if (x == _CS_XBS5_ILP32_OFF32_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_CFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_CFLAGS */ -#ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS - if (x == _CS_XBS5_ILP32_OFF32_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LDFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */ -#ifdef _CS_XBS5_ILP32_OFF32_LIBS - if (x == _CS_XBS5_ILP32_OFF32_LIBS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LIBS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */ -#ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS - if (x == _CS_XBS5_ILP32_OFF32_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LINTFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */ -#ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS - if (x == _CS_XBS5_ILP32_OFFBIG_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_CFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */ -#ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS - if (x == _CS_XBS5_ILP32_OFFBIG_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LDFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */ -#ifdef _CS_XBS5_ILP32_OFFBIG_LIBS - if (x == _CS_XBS5_ILP32_OFFBIG_LIBS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LIBS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */ -#ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS - if (x == _CS_XBS5_ILP32_OFFBIG_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LINTFLAGS; return 0;} -#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */ -#ifdef _CS_XBS5_LP64_OFF64_CFLAGS - if (x == _CS_XBS5_LP64_OFF64_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_CFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */ -#ifdef _CS_XBS5_LP64_OFF64_LDFLAGS - if (x == _CS_XBS5_LP64_OFF64_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LDFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LDFLAGS */ -#ifdef _CS_XBS5_LP64_OFF64_LIBS - if (x == _CS_XBS5_LP64_OFF64_LIBS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LIBS; return 0;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LIBS */ -#ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS - if (x == _CS_XBS5_LP64_OFF64_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LINTFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LP64_OFF64_LINTFLAGS */ -#ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS - if (x == _CS_XBS5_LPBIG_OFFBIG_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_CFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_CFLAGS */ -#ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS - if (x == _CS_XBS5_LPBIG_OFFBIG_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LDFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */ -#ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS - if (x == _CS_XBS5_LPBIG_OFFBIG_LIBS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LIBS; return 0;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */ -#ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS - if (x == _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;} -#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS - if (x == _CS_POSIX_V6_ILP32_OFF32_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_CFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_CFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS - if (x == _CS_POSIX_V6_ILP32_OFF32_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LDFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS - if (x == _CS_POSIX_V6_ILP32_OFF32_LIBS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LIBS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LIBS */ -#ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS - if (x == _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS - if (x == _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS - if (x == _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */ -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS - if (x == _CS_POSIX_V6_ILP32_OFFBIG_LIBS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LIBS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LIBS */ -#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS - if (x == _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */ -#ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS - if (x == _CS_POSIX_V6_LP64_OFF64_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_CFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_CFLAGS */ -#ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS - if (x == _CS_POSIX_V6_LP64_OFF64_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LDFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LDFLAGS */ -#ifdef _CS_POSIX_V6_LP64_OFF64_LIBS - if (x == _CS_POSIX_V6_LP64_OFF64_LIBS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LIBS; return 0;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LIBS */ -#ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS - if (x == _CS_POSIX_V6_LP64_OFF64_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LINTFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */ -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS - if (x == _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */ -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS - if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */ -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS - if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LIBS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LIBS; return 0;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */ -#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS - if (x == _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS) - {*r = Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;} -#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromLockfCommand (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if (x == Mono_Posix_LockfCommand_F_ULOCK) -#ifdef F_ULOCK - {*r = F_ULOCK; return 0;} -#else /* def F_ULOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_ULOCK */ - if (x == Mono_Posix_LockfCommand_F_LOCK) -#ifdef F_LOCK - {*r = F_LOCK; return 0;} -#else /* def F_LOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_LOCK */ - if (x == Mono_Posix_LockfCommand_F_TLOCK) -#ifdef F_TLOCK - {*r = F_TLOCK; return 0;} -#else /* def F_TLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef F_TLOCK */ - if (x == Mono_Posix_LockfCommand_F_TEST) -#ifdef F_TEST - {*r = F_TEST; return 0;} -#else /* def F_TEST */ - {errno = EINVAL; return -1;} -#endif /* ndef F_TEST */ - errno = EINVAL; return -1; -} - -int Mono_Posix_ToLockfCommand (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef F_ULOCK - if (x == F_ULOCK) - {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;} -#endif /* ndef F_ULOCK */ -#ifdef F_LOCK - if (x == F_LOCK) - {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;} -#endif /* ndef F_LOCK */ -#ifdef F_TLOCK - if (x == F_TLOCK) - {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;} -#endif /* ndef F_TLOCK */ -#ifdef F_TEST - if (x == F_TEST) - {*r = Mono_Posix_LockfCommand_F_TEST; return 0;} -#endif /* ndef F_TEST */ - errno = EINVAL; return -1; -} - -int Mono_Posix_FromPollEvents (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN) -#ifdef POLLIN - *r |= POLLIN; -#else /* def POLLIN */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLIN */ - if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI) -#ifdef POLLPRI - *r |= POLLPRI; -#else /* def POLLPRI */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLPRI */ - if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT) -#ifdef POLLOUT - *r |= POLLOUT; -#else /* def POLLOUT */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLOUT */ - if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR) -#ifdef POLLERR - *r |= POLLERR; -#else /* def POLLERR */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLERR */ - if ((x & Mono_Posix_PollEvents_POLLHUP) == Mono_Posix_PollEvents_POLLHUP) -#ifdef POLLHUP - *r |= POLLHUP; -#else /* def POLLHUP */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLHUP */ - if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL) -#ifdef POLLNVAL - *r |= POLLNVAL; -#else /* def POLLNVAL */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLNVAL */ - if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM) -#ifdef POLLRDNORM - *r |= POLLRDNORM; -#else /* def POLLRDNORM */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLRDNORM */ - if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND) -#ifdef POLLRDBAND - *r |= POLLRDBAND; -#else /* def POLLRDBAND */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLRDBAND */ - if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM) -#ifdef POLLWRNORM - *r |= POLLWRNORM; -#else /* def POLLWRNORM */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLWRNORM */ - if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND) -#ifdef POLLWRBAND - *r |= POLLWRBAND; -#else /* def POLLWRBAND */ - {errno = EINVAL; return -1;} -#endif /* ndef POLLWRBAND */ - return 0; -} - -int Mono_Posix_ToPollEvents (short x, short *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef POLLIN - if ((x & POLLIN) == POLLIN) - *r |= Mono_Posix_PollEvents_POLLIN; -#endif /* ndef POLLIN */ -#ifdef POLLPRI - if ((x & POLLPRI) == POLLPRI) - *r |= Mono_Posix_PollEvents_POLLPRI; -#endif /* ndef POLLPRI */ -#ifdef POLLOUT - if ((x & POLLOUT) == POLLOUT) - *r |= Mono_Posix_PollEvents_POLLOUT; -#endif /* ndef POLLOUT */ -#ifdef POLLERR - if ((x & POLLERR) == POLLERR) - *r |= Mono_Posix_PollEvents_POLLERR; -#endif /* ndef POLLERR */ -#ifdef POLLHUP - if ((x & POLLHUP) == POLLHUP) - *r |= Mono_Posix_PollEvents_POLLHUP; -#endif /* ndef POLLHUP */ -#ifdef POLLNVAL - if ((x & POLLNVAL) == POLLNVAL) - *r |= Mono_Posix_PollEvents_POLLNVAL; -#endif /* ndef POLLNVAL */ -#ifdef POLLRDNORM - if ((x & POLLRDNORM) == POLLRDNORM) - *r |= Mono_Posix_PollEvents_POLLRDNORM; -#endif /* ndef POLLRDNORM */ -#ifdef POLLRDBAND - if ((x & POLLRDBAND) == POLLRDBAND) - *r |= Mono_Posix_PollEvents_POLLRDBAND; -#endif /* ndef POLLRDBAND */ -#ifdef POLLWRNORM - if ((x & POLLWRNORM) == POLLWRNORM) - *r |= Mono_Posix_PollEvents_POLLWRNORM; -#endif /* ndef POLLWRNORM */ -#ifdef POLLWRBAND - if ((x & POLLWRBAND) == POLLWRBAND) - *r |= Mono_Posix_PollEvents_POLLWRBAND; -#endif /* ndef POLLWRBAND */ - return 0; -} - -int Mono_Posix_FromXattrFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_XattrFlags_XATTR_AUTO) == Mono_Posix_XattrFlags_XATTR_AUTO) -#ifdef XATTR_AUTO - *r |= XATTR_AUTO; -#else /* def XATTR_AUTO */ - {errno = EINVAL; return -1;} -#endif /* ndef XATTR_AUTO */ - if ((x & Mono_Posix_XattrFlags_XATTR_CREATE) == Mono_Posix_XattrFlags_XATTR_CREATE) -#ifdef XATTR_CREATE - *r |= XATTR_CREATE; -#else /* def XATTR_CREATE */ - {errno = EINVAL; return -1;} -#endif /* ndef XATTR_CREATE */ - if ((x & Mono_Posix_XattrFlags_XATTR_REPLACE) == Mono_Posix_XattrFlags_XATTR_REPLACE) -#ifdef XATTR_REPLACE - *r |= XATTR_REPLACE; -#else /* def XATTR_REPLACE */ - {errno = EINVAL; return -1;} -#endif /* ndef XATTR_REPLACE */ - return 0; -} - -int Mono_Posix_ToXattrFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef XATTR_AUTO - if ((x & XATTR_AUTO) == XATTR_AUTO) - *r |= Mono_Posix_XattrFlags_XATTR_AUTO; -#endif /* ndef XATTR_AUTO */ -#ifdef XATTR_CREATE - if ((x & XATTR_CREATE) == XATTR_CREATE) - *r |= Mono_Posix_XattrFlags_XATTR_CREATE; -#endif /* ndef XATTR_CREATE */ -#ifdef XATTR_REPLACE - if ((x & XATTR_REPLACE) == XATTR_REPLACE) - *r |= Mono_Posix_XattrFlags_XATTR_REPLACE; -#endif /* ndef XATTR_REPLACE */ - return 0; -} - -int Mono_Posix_FromMountFlags (guint64 x, guint64 *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MountFlags_ST_RDONLY) == Mono_Posix_MountFlags_ST_RDONLY) -#ifdef ST_RDONLY - *r |= ST_RDONLY; -#else /* def ST_RDONLY */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_RDONLY */ - if ((x & Mono_Posix_MountFlags_ST_NOSUID) == Mono_Posix_MountFlags_ST_NOSUID) -#ifdef ST_NOSUID - *r |= ST_NOSUID; -#else /* def ST_NOSUID */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_NOSUID */ - if ((x & Mono_Posix_MountFlags_ST_NODEV) == Mono_Posix_MountFlags_ST_NODEV) -#ifdef ST_NODEV - *r |= ST_NODEV; -#else /* def ST_NODEV */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_NODEV */ - if ((x & Mono_Posix_MountFlags_ST_SYNCHRONOUS) == Mono_Posix_MountFlags_ST_SYNCHRONOUS) -#ifdef ST_SYNCHRONOUS - *r |= ST_SYNCHRONOUS; -#else /* def ST_SYNCHRONOUS */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_SYNCHRONOUS */ - if ((x & Mono_Posix_MountFlags_ST_MANDLOCK) == Mono_Posix_MountFlags_ST_MANDLOCK) -#ifdef ST_MANDLOCK - *r |= ST_MANDLOCK; -#else /* def ST_MANDLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_MANDLOCK */ - if ((x & Mono_Posix_MountFlags_ST_WRITE) == Mono_Posix_MountFlags_ST_WRITE) -#ifdef ST_WRITE - *r |= ST_WRITE; -#else /* def ST_WRITE */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_WRITE */ - if ((x & Mono_Posix_MountFlags_ST_APPEND) == Mono_Posix_MountFlags_ST_APPEND) -#ifdef ST_APPEND - *r |= ST_APPEND; -#else /* def ST_APPEND */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_APPEND */ - if ((x & Mono_Posix_MountFlags_ST_IMMUTABLE) == Mono_Posix_MountFlags_ST_IMMUTABLE) -#ifdef ST_IMMUTABLE - *r |= ST_IMMUTABLE; -#else /* def ST_IMMUTABLE */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_IMMUTABLE */ - if ((x & Mono_Posix_MountFlags_ST_NOATIME) == Mono_Posix_MountFlags_ST_NOATIME) -#ifdef ST_NOATIME - *r |= ST_NOATIME; -#else /* def ST_NOATIME */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_NOATIME */ - if ((x & Mono_Posix_MountFlags_ST_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME) -#ifdef ST_NODIRATIME - *r |= ST_NODIRATIME; -#else /* def ST_NODIRATIME */ - {errno = EINVAL; return -1;} -#endif /* ndef ST_NODIRATIME */ - return 0; -} - -int Mono_Posix_ToMountFlags (guint64 x, guint64 *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef ST_RDONLY - if ((x & ST_RDONLY) == ST_RDONLY) - *r |= Mono_Posix_MountFlags_ST_RDONLY; -#endif /* ndef ST_RDONLY */ -#ifdef ST_NOSUID - if ((x & ST_NOSUID) == ST_NOSUID) - *r |= Mono_Posix_MountFlags_ST_NOSUID; -#endif /* ndef ST_NOSUID */ -#ifdef ST_NODEV - if ((x & ST_NODEV) == ST_NODEV) - *r |= Mono_Posix_MountFlags_ST_NODEV; -#endif /* ndef ST_NODEV */ -#ifdef ST_SYNCHRONOUS - if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS) - *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS; -#endif /* ndef ST_SYNCHRONOUS */ -#ifdef ST_MANDLOCK - if ((x & ST_MANDLOCK) == ST_MANDLOCK) - *r |= Mono_Posix_MountFlags_ST_MANDLOCK; -#endif /* ndef ST_MANDLOCK */ -#ifdef ST_WRITE - if ((x & ST_WRITE) == ST_WRITE) - *r |= Mono_Posix_MountFlags_ST_WRITE; -#endif /* ndef ST_WRITE */ -#ifdef ST_APPEND - if ((x & ST_APPEND) == ST_APPEND) - *r |= Mono_Posix_MountFlags_ST_APPEND; -#endif /* ndef ST_APPEND */ -#ifdef ST_IMMUTABLE - if ((x & ST_IMMUTABLE) == ST_IMMUTABLE) - *r |= Mono_Posix_MountFlags_ST_IMMUTABLE; -#endif /* ndef ST_IMMUTABLE */ -#ifdef ST_NOATIME - if ((x & ST_NOATIME) == ST_NOATIME) - *r |= Mono_Posix_MountFlags_ST_NOATIME; -#endif /* ndef ST_NOATIME */ -#ifdef ST_NODIRATIME - if ((x & ST_NODIRATIME) == ST_NODIRATIME) - *r |= Mono_Posix_MountFlags_ST_NODIRATIME; -#endif /* ndef ST_NODIRATIME */ - return 0; -} - -int Mono_Posix_FromMmapFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MmapFlags_MAP_SHARED) == Mono_Posix_MmapFlags_MAP_SHARED) -#ifdef MAP_SHARED - *r |= MAP_SHARED; -#else /* def MAP_SHARED */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_SHARED */ - if ((x & Mono_Posix_MmapFlags_MAP_PRIVATE) == Mono_Posix_MmapFlags_MAP_PRIVATE) -#ifdef MAP_PRIVATE - *r |= MAP_PRIVATE; -#else /* def MAP_PRIVATE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_PRIVATE */ - if ((x & Mono_Posix_MmapFlags_MAP_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE) -#ifdef MAP_TYPE - *r |= MAP_TYPE; -#else /* def MAP_TYPE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_TYPE */ - if ((x & Mono_Posix_MmapFlags_MAP_FIXED) == Mono_Posix_MmapFlags_MAP_FIXED) -#ifdef MAP_FIXED - *r |= MAP_FIXED; -#else /* def MAP_FIXED */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_FIXED */ - if ((x & Mono_Posix_MmapFlags_MAP_FILE) == Mono_Posix_MmapFlags_MAP_FILE) -#ifdef MAP_FILE - *r |= MAP_FILE; -#else /* def MAP_FILE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_FILE */ - if ((x & Mono_Posix_MmapFlags_MAP_ANONYMOUS) == Mono_Posix_MmapFlags_MAP_ANONYMOUS) -#ifdef MAP_ANONYMOUS - *r |= MAP_ANONYMOUS; -#else /* def MAP_ANONYMOUS */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_ANONYMOUS */ - if ((x & Mono_Posix_MmapFlags_MAP_ANON) == Mono_Posix_MmapFlags_MAP_ANON) -#ifdef MAP_ANON - *r |= MAP_ANON; -#else /* def MAP_ANON */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_ANON */ - if ((x & Mono_Posix_MmapFlags_MAP_GROWSDOWN) == Mono_Posix_MmapFlags_MAP_GROWSDOWN) -#ifdef MAP_GROWSDOWN - *r |= MAP_GROWSDOWN; -#else /* def MAP_GROWSDOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_GROWSDOWN */ - if ((x & Mono_Posix_MmapFlags_MAP_DENYWRITE) == Mono_Posix_MmapFlags_MAP_DENYWRITE) -#ifdef MAP_DENYWRITE - *r |= MAP_DENYWRITE; -#else /* def MAP_DENYWRITE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_DENYWRITE */ - if ((x & Mono_Posix_MmapFlags_MAP_EXECUTABLE) == Mono_Posix_MmapFlags_MAP_EXECUTABLE) -#ifdef MAP_EXECUTABLE - *r |= MAP_EXECUTABLE; -#else /* def MAP_EXECUTABLE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_EXECUTABLE */ - if ((x & Mono_Posix_MmapFlags_MAP_LOCKED) == Mono_Posix_MmapFlags_MAP_LOCKED) -#ifdef MAP_LOCKED - *r |= MAP_LOCKED; -#else /* def MAP_LOCKED */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_LOCKED */ - if ((x & Mono_Posix_MmapFlags_MAP_NORESERVE) == Mono_Posix_MmapFlags_MAP_NORESERVE) -#ifdef MAP_NORESERVE - *r |= MAP_NORESERVE; -#else /* def MAP_NORESERVE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_NORESERVE */ - if ((x & Mono_Posix_MmapFlags_MAP_POPULATE) == Mono_Posix_MmapFlags_MAP_POPULATE) -#ifdef MAP_POPULATE - *r |= MAP_POPULATE; -#else /* def MAP_POPULATE */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_POPULATE */ - if ((x & Mono_Posix_MmapFlags_MAP_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK) -#ifdef MAP_NONBLOCK - *r |= MAP_NONBLOCK; -#else /* def MAP_NONBLOCK */ - {errno = EINVAL; return -1;} -#endif /* ndef MAP_NONBLOCK */ - return 0; -} - -int Mono_Posix_ToMmapFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef MAP_SHARED - if ((x & MAP_SHARED) == MAP_SHARED) - *r |= Mono_Posix_MmapFlags_MAP_SHARED; -#endif /* ndef MAP_SHARED */ -#ifdef MAP_PRIVATE - if ((x & MAP_PRIVATE) == MAP_PRIVATE) - *r |= Mono_Posix_MmapFlags_MAP_PRIVATE; -#endif /* ndef MAP_PRIVATE */ -#ifdef MAP_TYPE - if ((x & MAP_TYPE) == MAP_TYPE) - *r |= Mono_Posix_MmapFlags_MAP_TYPE; -#endif /* ndef MAP_TYPE */ -#ifdef MAP_FIXED - if ((x & MAP_FIXED) == MAP_FIXED) - *r |= Mono_Posix_MmapFlags_MAP_FIXED; -#endif /* ndef MAP_FIXED */ -#ifdef MAP_FILE - if ((x & MAP_FILE) == MAP_FILE) - *r |= Mono_Posix_MmapFlags_MAP_FILE; -#endif /* ndef MAP_FILE */ -#ifdef MAP_ANONYMOUS - if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS) - *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS; -#endif /* ndef MAP_ANONYMOUS */ -#ifdef MAP_ANON - if ((x & MAP_ANON) == MAP_ANON) - *r |= Mono_Posix_MmapFlags_MAP_ANON; -#endif /* ndef MAP_ANON */ -#ifdef MAP_GROWSDOWN - if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN) - *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN; -#endif /* ndef MAP_GROWSDOWN */ -#ifdef MAP_DENYWRITE - if ((x & MAP_DENYWRITE) == MAP_DENYWRITE) - *r |= Mono_Posix_MmapFlags_MAP_DENYWRITE; -#endif /* ndef MAP_DENYWRITE */ -#ifdef MAP_EXECUTABLE - if ((x & MAP_EXECUTABLE) == MAP_EXECUTABLE) - *r |= Mono_Posix_MmapFlags_MAP_EXECUTABLE; -#endif /* ndef MAP_EXECUTABLE */ -#ifdef MAP_LOCKED - if ((x & MAP_LOCKED) == MAP_LOCKED) - *r |= Mono_Posix_MmapFlags_MAP_LOCKED; -#endif /* ndef MAP_LOCKED */ -#ifdef MAP_NORESERVE - if ((x & MAP_NORESERVE) == MAP_NORESERVE) - *r |= Mono_Posix_MmapFlags_MAP_NORESERVE; -#endif /* ndef MAP_NORESERVE */ -#ifdef MAP_POPULATE - if ((x & MAP_POPULATE) == MAP_POPULATE) - *r |= Mono_Posix_MmapFlags_MAP_POPULATE; -#endif /* ndef MAP_POPULATE */ -#ifdef MAP_NONBLOCK - if ((x & MAP_NONBLOCK) == MAP_NONBLOCK) - *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK; -#endif /* ndef MAP_NONBLOCK */ - return 0; -} - -int Mono_Posix_FromMmapProt (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MmapProt_PROT_READ) == Mono_Posix_MmapProt_PROT_READ) -#ifdef PROT_READ - *r |= PROT_READ; -#else /* def PROT_READ */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_READ */ - if ((x & Mono_Posix_MmapProt_PROT_WRITE) == Mono_Posix_MmapProt_PROT_WRITE) -#ifdef PROT_WRITE - *r |= PROT_WRITE; -#else /* def PROT_WRITE */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_WRITE */ - if ((x & Mono_Posix_MmapProt_PROT_EXEC) == Mono_Posix_MmapProt_PROT_EXEC) -#ifdef PROT_EXEC - *r |= PROT_EXEC; -#else /* def PROT_EXEC */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_EXEC */ - if ((x & Mono_Posix_MmapProt_PROT_NONE) == Mono_Posix_MmapProt_PROT_NONE) -#ifdef PROT_NONE - *r |= PROT_NONE; -#else /* def PROT_NONE */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_NONE */ - if ((x & Mono_Posix_MmapProt_PROT_GROWSDOWN) == Mono_Posix_MmapProt_PROT_GROWSDOWN) -#ifdef PROT_GROWSDOWN - *r |= PROT_GROWSDOWN; -#else /* def PROT_GROWSDOWN */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_GROWSDOWN */ - if ((x & Mono_Posix_MmapProt_PROT_GROWSUP) == Mono_Posix_MmapProt_PROT_GROWSUP) -#ifdef PROT_GROWSUP - *r |= PROT_GROWSUP; -#else /* def PROT_GROWSUP */ - {errno = EINVAL; return -1;} -#endif /* ndef PROT_GROWSUP */ - return 0; -} - -int Mono_Posix_ToMmapProt (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef PROT_READ - if ((x & PROT_READ) == PROT_READ) - *r |= Mono_Posix_MmapProt_PROT_READ; -#endif /* ndef PROT_READ */ -#ifdef PROT_WRITE - if ((x & PROT_WRITE) == PROT_WRITE) - *r |= Mono_Posix_MmapProt_PROT_WRITE; -#endif /* ndef PROT_WRITE */ -#ifdef PROT_EXEC - if ((x & PROT_EXEC) == PROT_EXEC) - *r |= Mono_Posix_MmapProt_PROT_EXEC; -#endif /* ndef PROT_EXEC */ -#ifdef PROT_NONE - if ((x & PROT_NONE) == PROT_NONE) - *r |= Mono_Posix_MmapProt_PROT_NONE; -#endif /* ndef PROT_NONE */ -#ifdef PROT_GROWSDOWN - if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN) - *r |= Mono_Posix_MmapProt_PROT_GROWSDOWN; -#endif /* ndef PROT_GROWSDOWN */ -#ifdef PROT_GROWSUP - if ((x & PROT_GROWSUP) == PROT_GROWSUP) - *r |= Mono_Posix_MmapProt_PROT_GROWSUP; -#endif /* ndef PROT_GROWSUP */ - return 0; -} - -int Mono_Posix_FromMsyncFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MsyncFlags_MS_ASYNC) == Mono_Posix_MsyncFlags_MS_ASYNC) -#ifdef MS_ASYNC - *r |= MS_ASYNC; -#else /* def MS_ASYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef MS_ASYNC */ - if ((x & Mono_Posix_MsyncFlags_MS_SYNC) == Mono_Posix_MsyncFlags_MS_SYNC) -#ifdef MS_SYNC - *r |= MS_SYNC; -#else /* def MS_SYNC */ - {errno = EINVAL; return -1;} -#endif /* ndef MS_SYNC */ - if ((x & Mono_Posix_MsyncFlags_MS_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE) -#ifdef MS_INVALIDATE - *r |= MS_INVALIDATE; -#else /* def MS_INVALIDATE */ - {errno = EINVAL; return -1;} -#endif /* ndef MS_INVALIDATE */ - return 0; -} - -int Mono_Posix_ToMsyncFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef MS_ASYNC - if ((x & MS_ASYNC) == MS_ASYNC) - *r |= Mono_Posix_MsyncFlags_MS_ASYNC; -#endif /* ndef MS_ASYNC */ -#ifdef MS_SYNC - if ((x & MS_SYNC) == MS_SYNC) - *r |= Mono_Posix_MsyncFlags_MS_SYNC; -#endif /* ndef MS_SYNC */ -#ifdef MS_INVALIDATE - if ((x & MS_INVALIDATE) == MS_INVALIDATE) - *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE; -#endif /* ndef MS_INVALIDATE */ - return 0; -} - -int Mono_Posix_FromMlockallFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MlockallFlags_MCL_CURRENT) == Mono_Posix_MlockallFlags_MCL_CURRENT) -#ifdef MCL_CURRENT - *r |= MCL_CURRENT; -#else /* def MCL_CURRENT */ - {errno = EINVAL; return -1;} -#endif /* ndef MCL_CURRENT */ - if ((x & Mono_Posix_MlockallFlags_MCL_FUTURE) == Mono_Posix_MlockallFlags_MCL_FUTURE) -#ifdef MCL_FUTURE - *r |= MCL_FUTURE; -#else /* def MCL_FUTURE */ - {errno = EINVAL; return -1;} -#endif /* ndef MCL_FUTURE */ - return 0; -} - -int Mono_Posix_ToMlockallFlags (int x, int *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef MCL_CURRENT - if ((x & MCL_CURRENT) == MCL_CURRENT) - *r |= Mono_Posix_MlockallFlags_MCL_CURRENT; -#endif /* ndef MCL_CURRENT */ -#ifdef MCL_FUTURE - if ((x & MCL_FUTURE) == MCL_FUTURE) - *r |= Mono_Posix_MlockallFlags_MCL_FUTURE; -#endif /* ndef MCL_FUTURE */ - return 0; -} - -int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r) -{ - *r = 0; - if (x == 0) - return 0; - if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE) -#ifdef MREMAP_MAYMOVE - *r |= MREMAP_MAYMOVE; -#else /* def MREMAP_MAYMOVE */ - {errno = EINVAL; return -1;} -#endif /* ndef MREMAP_MAYMOVE */ - return 0; -} - -int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r) -{ - *r = 0; - if (x == 0) - return 0; -#ifdef MREMAP_MAYMOVE - if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE) - *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE; -#endif /* ndef MREMAP_MAYMOVE */ - return 0; -} - diff --git a/support/map.h b/support/map.h deleted file mode 100644 index 676d8b132c7..00000000000 --- a/support/map.h +++ /dev/null @@ -1,701 +0,0 @@ -/* - * This file was automatically generated by make-map from ../../mcs/class/lib/default/Mono.Posix.dll. - * - * DO NOT MODIFY. - */ -#include - -#ifndef INC_Mono_Posix_map_H -#define INC_Mono_Posix_map_H - -#include - -G_BEGIN_DECLS - -#define Mono_Posix_Error_EPERM 0x00000001 -#define Mono_Posix_Error_ENOENT 0x00000002 -#define Mono_Posix_Error_ESRCH 0x00000003 -#define Mono_Posix_Error_EINTR 0x00000004 -#define Mono_Posix_Error_EIO 0x00000005 -#define Mono_Posix_Error_ENXIO 0x00000006 -#define Mono_Posix_Error_E2BIG 0x00000007 -#define Mono_Posix_Error_ENOEXEC 0x00000008 -#define Mono_Posix_Error_EBADF 0x00000009 -#define Mono_Posix_Error_ECHILD 0x0000000a -#define Mono_Posix_Error_EAGAIN 0x0000000b -#define Mono_Posix_Error_ENOMEM 0x0000000c -#define Mono_Posix_Error_EACCES 0x0000000d -#define Mono_Posix_Error_EFAULT 0x0000000e -#define Mono_Posix_Error_ENOTBLK 0x0000000f -#define Mono_Posix_Error_EBUSY 0x00000010 -#define Mono_Posix_Error_EEXIST 0x00000011 -#define Mono_Posix_Error_EXDEV 0x00000012 -#define Mono_Posix_Error_ENODEV 0x00000013 -#define Mono_Posix_Error_ENOTDIR 0x00000014 -#define Mono_Posix_Error_EISDIR 0x00000015 -#define Mono_Posix_Error_EINVAL 0x00000016 -#define Mono_Posix_Error_ENFILE 0x00000017 -#define Mono_Posix_Error_EMFILE 0x00000018 -#define Mono_Posix_Error_ENOTTY 0x00000019 -#define Mono_Posix_Error_ETXTBSY 0x0000001a -#define Mono_Posix_Error_EFBIG 0x0000001b -#define Mono_Posix_Error_ENOSPC 0x0000001c -#define Mono_Posix_Error_ESPIPE 0x0000001d -#define Mono_Posix_Error_EROFS 0x0000001e -#define Mono_Posix_Error_EMLINK 0x0000001f -#define Mono_Posix_Error_EPIPE 0x00000020 -#define Mono_Posix_Error_EDOM 0x00000021 -#define Mono_Posix_Error_ERANGE 0x00000022 -#define Mono_Posix_Error_EDEADLK 0x00000023 -#define Mono_Posix_Error_ENAMETOOLONG 0x00000024 -#define Mono_Posix_Error_ENOLCK 0x00000025 -#define Mono_Posix_Error_ENOSYS 0x00000026 -#define Mono_Posix_Error_ENOTEMPTY 0x00000027 -#define Mono_Posix_Error_ELOOP 0x00000028 -#define Mono_Posix_Error_EWOULDBLOCK 0x0000000b -#define Mono_Posix_Error_ENOMSG 0x0000002a -#define Mono_Posix_Error_EIDRM 0x0000002b -#define Mono_Posix_Error_ECHRNG 0x0000002c -#define Mono_Posix_Error_EL2NSYNC 0x0000002d -#define Mono_Posix_Error_EL3HLT 0x0000002e -#define Mono_Posix_Error_EL3RST 0x0000002f -#define Mono_Posix_Error_ELNRNG 0x00000030 -#define Mono_Posix_Error_EUNATCH 0x00000031 -#define Mono_Posix_Error_ENOCSI 0x00000032 -#define Mono_Posix_Error_EL2HLT 0x00000033 -#define Mono_Posix_Error_EBADE 0x00000034 -#define Mono_Posix_Error_EBADR 0x00000035 -#define Mono_Posix_Error_EXFULL 0x00000036 -#define Mono_Posix_Error_ENOANO 0x00000037 -#define Mono_Posix_Error_EBADRQC 0x00000038 -#define Mono_Posix_Error_EBADSLT 0x00000039 -#define Mono_Posix_Error_EDEADLOCK 0x00000023 -#define Mono_Posix_Error_EBFONT 0x0000003b -#define Mono_Posix_Error_ENOSTR 0x0000003c -#define Mono_Posix_Error_ENODATA 0x0000003d -#define Mono_Posix_Error_ETIME 0x0000003e -#define Mono_Posix_Error_ENOSR 0x0000003f -#define Mono_Posix_Error_ENONET 0x00000040 -#define Mono_Posix_Error_ENOPKG 0x00000041 -#define Mono_Posix_Error_EREMOTE 0x00000042 -#define Mono_Posix_Error_ENOLINK 0x00000043 -#define Mono_Posix_Error_EADV 0x00000044 -#define Mono_Posix_Error_ESRMNT 0x00000045 -#define Mono_Posix_Error_ECOMM 0x00000046 -#define Mono_Posix_Error_EPROTO 0x00000047 -#define Mono_Posix_Error_EMULTIHOP 0x00000048 -#define Mono_Posix_Error_EDOTDOT 0x00000049 -#define Mono_Posix_Error_EBADMSG 0x0000004a -#define Mono_Posix_Error_EOVERFLOW 0x0000004b -#define Mono_Posix_Error_ENOTUNIQ 0x0000004c -#define Mono_Posix_Error_EBADFD 0x0000004d -#define Mono_Posix_Error_EREMCHG 0x0000004e -#define Mono_Posix_Error_ELIBACC 0x0000004f -#define Mono_Posix_Error_ELIBBAD 0x00000050 -#define Mono_Posix_Error_ELIBSCN 0x00000051 -#define Mono_Posix_Error_ELIBMAX 0x00000052 -#define Mono_Posix_Error_ELIBEXEC 0x00000053 -#define Mono_Posix_Error_EILSEQ 0x00000054 -#define Mono_Posix_Error_ERESTART 0x00000055 -#define Mono_Posix_Error_ESTRPIPE 0x00000056 -#define Mono_Posix_Error_EUSERS 0x00000057 -#define Mono_Posix_Error_ENOTSOCK 0x00000058 -#define Mono_Posix_Error_EDESTADDRREQ 0x00000059 -#define Mono_Posix_Error_EMSGSIZE 0x0000005a -#define Mono_Posix_Error_EPROTOTYPE 0x0000005b -#define Mono_Posix_Error_ENOPROTOOPT 0x0000005c -#define Mono_Posix_Error_EPROTONOSUPPORT 0x0000005d -#define Mono_Posix_Error_ESOCKTNOSUPPORT 0x0000005e -#define Mono_Posix_Error_EOPNOTSUPP 0x0000005f -#define Mono_Posix_Error_EPFNOSUPPORT 0x00000060 -#define Mono_Posix_Error_EAFNOSUPPORT 0x00000061 -#define Mono_Posix_Error_EADDRINUSE 0x00000062 -#define Mono_Posix_Error_EADDRNOTAVAIL 0x00000063 -#define Mono_Posix_Error_ENETDOWN 0x00000064 -#define Mono_Posix_Error_ENETUNREACH 0x00000065 -#define Mono_Posix_Error_ENETRESET 0x00000066 -#define Mono_Posix_Error_ECONNABORTED 0x00000067 -#define Mono_Posix_Error_ECONNRESET 0x00000068 -#define Mono_Posix_Error_ENOBUFS 0x00000069 -#define Mono_Posix_Error_EISCONN 0x0000006a -#define Mono_Posix_Error_ENOTCONN 0x0000006b -#define Mono_Posix_Error_ESHUTDOWN 0x0000006c -#define Mono_Posix_Error_ETOOMANYREFS 0x0000006d -#define Mono_Posix_Error_ETIMEDOUT 0x0000006e -#define Mono_Posix_Error_ECONNREFUSED 0x0000006f -#define Mono_Posix_Error_EHOSTDOWN 0x00000070 -#define Mono_Posix_Error_EHOSTUNREACH 0x00000071 -#define Mono_Posix_Error_EALREADY 0x00000072 -#define Mono_Posix_Error_EINPROGRESS 0x00000073 -#define Mono_Posix_Error_ESTALE 0x00000074 -#define Mono_Posix_Error_EUCLEAN 0x00000075 -#define Mono_Posix_Error_ENOTNAM 0x00000076 -#define Mono_Posix_Error_ENAVAIL 0x00000077 -#define Mono_Posix_Error_EISNAM 0x00000078 -#define Mono_Posix_Error_EREMOTEIO 0x00000079 -#define Mono_Posix_Error_EDQUOT 0x0000007a -#define Mono_Posix_Error_ENOMEDIUM 0x0000007b -#define Mono_Posix_Error_EMEDIUMTYPE 0x0000007c -int Mono_Posix_FromError (int x, int *r); -int Mono_Posix_ToError (int x, int *r); - -#define Mono_Posix_SyslogOptions_LOG_PID 0x00000001 -#define Mono_Posix_SyslogOptions_LOG_CONS 0x00000002 -#define Mono_Posix_SyslogOptions_LOG_ODELAY 0x00000004 -#define Mono_Posix_SyslogOptions_LOG_NDELAY 0x00000008 -#define Mono_Posix_SyslogOptions_LOG_NOWAIT 0x00000010 -#define Mono_Posix_SyslogOptions_LOG_PERROR 0x00000020 -int Mono_Posix_FromSyslogOptions (int x, int *r); -int Mono_Posix_ToSyslogOptions (int x, int *r); - -#define Mono_Posix_SyslogFacility_LOG_KERN 0x00000000 -#define Mono_Posix_SyslogFacility_LOG_USER 0x00000008 -#define Mono_Posix_SyslogFacility_LOG_USRE 0x00000008 -#define Mono_Posix_SyslogFacility_LOG_MAIL 0x00000010 -#define Mono_Posix_SyslogFacility_LOG_DAEMON 0x00000018 -#define Mono_Posix_SyslogFacility_LOG_AUTH 0x00000020 -#define Mono_Posix_SyslogFacility_LOG_SYSLOG 0x00000028 -#define Mono_Posix_SyslogFacility_LOG_LPR 0x00000030 -#define Mono_Posix_SyslogFacility_LOG_NEWS 0x00000038 -#define Mono_Posix_SyslogFacility_LOG_UUCP 0x00000040 -#define Mono_Posix_SyslogFacility_LOG_CRON 0x00000048 -#define Mono_Posix_SyslogFacility_LOG_AUTHPRIV 0x00000050 -#define Mono_Posix_SyslogFacility_LOG_FTP 0x00000058 -#define Mono_Posix_SyslogFacility_LOG_LOCAL0 0x00000080 -#define Mono_Posix_SyslogFacility_LOG_LOCAL1 0x00000088 -#define Mono_Posix_SyslogFacility_LOG_LOCAL2 0x00000090 -#define Mono_Posix_SyslogFacility_LOG_LOCAL3 0x00000098 -#define Mono_Posix_SyslogFacility_LOG_LOCAL4 0x000000a0 -#define Mono_Posix_SyslogFacility_LOG_LOCAL5 0x000000a8 -#define Mono_Posix_SyslogFacility_LOG_LOCAL6 0x000000b0 -#define Mono_Posix_SyslogFacility_LOG_LOCAL7 0x000000b8 -int Mono_Posix_FromSyslogFacility (int x, int *r); -int Mono_Posix_ToSyslogFacility (int x, int *r); - -#define Mono_Posix_SyslogLevel_LOG_EMERG 0x00000000 -#define Mono_Posix_SyslogLevel_LOG_ALERT 0x00000001 -#define Mono_Posix_SyslogLevel_LOG_CRIT 0x00000002 -#define Mono_Posix_SyslogLevel_LOG_ERR 0x00000003 -#define Mono_Posix_SyslogLevel_LOG_WARNING 0x00000004 -#define Mono_Posix_SyslogLevel_LOG_NOTICE 0x00000005 -#define Mono_Posix_SyslogLevel_LOG_INFO 0x00000006 -#define Mono_Posix_SyslogLevel_LOG_DEBUG 0x00000007 -int Mono_Posix_FromSyslogLevel (int x, int *r); -int Mono_Posix_ToSyslogLevel (int x, int *r); - -#define Mono_Posix_OpenFlags_O_RDONLY 0x00000000 -#define Mono_Posix_OpenFlags_O_WRONLY 0x00000001 -#define Mono_Posix_OpenFlags_O_RDWR 0x00000002 -#define Mono_Posix_OpenFlags_O_CREAT 0x00000040 -#define Mono_Posix_OpenFlags_O_EXCL 0x00000080 -#define Mono_Posix_OpenFlags_O_NOCTTY 0x00000100 -#define Mono_Posix_OpenFlags_O_TRUNC 0x00000200 -#define Mono_Posix_OpenFlags_O_APPEND 0x00000400 -#define Mono_Posix_OpenFlags_O_NONBLOCK 0x00000800 -#define Mono_Posix_OpenFlags_O_SYNC 0x00001000 -#define Mono_Posix_OpenFlags_O_NOFOLLOW 0x00020000 -#define Mono_Posix_OpenFlags_O_DIRECTORY 0x00010000 -#define Mono_Posix_OpenFlags_O_DIRECT 0x00004000 -#define Mono_Posix_OpenFlags_O_ASYNC 0x00002000 -#define Mono_Posix_OpenFlags_O_LARGEFILE 0x00008000 -int Mono_Posix_FromOpenFlags (int x, int *r); -int Mono_Posix_ToOpenFlags (int x, int *r); - -#define Mono_Posix_FilePermissions_S_ISUID 0x00000800 -#define Mono_Posix_FilePermissions_S_ISGID 0x00000400 -#define Mono_Posix_FilePermissions_S_ISVTX 0x00000200 -#define Mono_Posix_FilePermissions_S_IRUSR 0x00000100 -#define Mono_Posix_FilePermissions_S_IWUSR 0x00000080 -#define Mono_Posix_FilePermissions_S_IXUSR 0x00000040 -#define Mono_Posix_FilePermissions_S_IRGRP 0x00000020 -#define Mono_Posix_FilePermissions_S_IWGRP 0x00000010 -#define Mono_Posix_FilePermissions_S_IXGRP 0x00000008 -#define Mono_Posix_FilePermissions_S_IROTH 0x00000004 -#define Mono_Posix_FilePermissions_S_IWOTH 0x00000002 -#define Mono_Posix_FilePermissions_S_IXOTH 0x00000001 -#define Mono_Posix_FilePermissions_S_IRWXG 0x00000038 -#define Mono_Posix_FilePermissions_S_IRWXU 0x000001c0 -#define Mono_Posix_FilePermissions_S_IRWXO 0x00000007 -#define Mono_Posix_FilePermissions_ACCESSPERMS 0x000001ff -#define Mono_Posix_FilePermissions_ALLPERMS 0x00000fff -#define Mono_Posix_FilePermissions_DEFFILEMODE 0x000001b6 -#define Mono_Posix_FilePermissions_S_IFMT 0x0000f000 -#define Mono_Posix_FilePermissions_S_IFDIR 0x00004000 -#define Mono_Posix_FilePermissions_S_IFCHR 0x00002000 -#define Mono_Posix_FilePermissions_S_IFBLK 0x00006000 -#define Mono_Posix_FilePermissions_S_IFREG 0x00008000 -#define Mono_Posix_FilePermissions_S_IFIFO 0x00001000 -#define Mono_Posix_FilePermissions_S_IFLNK 0x0000a000 -#define Mono_Posix_FilePermissions_S_IFSOCK 0x0000c000 -int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r); -int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r); - -#define Mono_Posix_FcntlCommand_F_DUPFD 0x00000000 -#define Mono_Posix_FcntlCommand_F_GETFD 0x00000001 -#define Mono_Posix_FcntlCommand_F_SETFD 0x00000002 -#define Mono_Posix_FcntlCommand_F_GETFL 0x00000003 -#define Mono_Posix_FcntlCommand_F_SETFL 0x00000004 -#define Mono_Posix_FcntlCommand_F_GETLK 0x0000000c -#define Mono_Posix_FcntlCommand_F_SETLK 0x0000000d -#define Mono_Posix_FcntlCommand_F_SETLKW 0x0000000e -#define Mono_Posix_FcntlCommand_F_SETOWN 0x00000008 -#define Mono_Posix_FcntlCommand_F_GETOWN 0x00000009 -#define Mono_Posix_FcntlCommand_F_SETSIG 0x0000000a -#define Mono_Posix_FcntlCommand_F_GETSIG 0x0000000b -#define Mono_Posix_FcntlCommand_F_SETLEASE 0x00000400 -#define Mono_Posix_FcntlCommand_F_GETLEASE 0x00000401 -#define Mono_Posix_FcntlCommand_F_NOTIFY 0x00000402 -int Mono_Posix_FromFcntlCommand (int x, int *r); -int Mono_Posix_ToFcntlCommand (int x, int *r); - -#define Mono_Posix_LockType_F_RDLCK 0x00000000 -#define Mono_Posix_LockType_F_WRLCK 0x00000001 -#define Mono_Posix_LockType_F_UNLCK 0x00000002 -int Mono_Posix_FromLockType (short x, short *r); -int Mono_Posix_ToLockType (short x, short *r); - -#define Mono_Posix_SeekFlags_SEEK_SET 0x00000000 -#define Mono_Posix_SeekFlags_SEEK_CUR 0x00000001 -#define Mono_Posix_SeekFlags_SEEK_END 0x00000002 -#define Mono_Posix_SeekFlags_L_SET 0x00000000 -#define Mono_Posix_SeekFlags_L_INCR 0x00000001 -#define Mono_Posix_SeekFlags_L_XTND 0x00000002 -int Mono_Posix_FromSeekFlags (short x, short *r); -int Mono_Posix_ToSeekFlags (short x, short *r); - -#define Mono_Posix_DirectoryNotifyFlags_DN_ACCESS 0x00000001 -#define Mono_Posix_DirectoryNotifyFlags_DN_MODIFY 0x00000002 -#define Mono_Posix_DirectoryNotifyFlags_DN_CREATE 0x00000004 -#define Mono_Posix_DirectoryNotifyFlags_DN_DELETE 0x00000008 -#define Mono_Posix_DirectoryNotifyFlags_DN_RENAME 0x00000010 -#define Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB 0x00000020 -#define Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT 0x80000000 -int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r); -int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r); - -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL 0x00000000 -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM 0x00000001 -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL 0x00000002 -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED 0x00000003 -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED 0x00000004 -#define Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE 0x00000005 -int Mono_Posix_FromPosixFadviseAdvice (int x, int *r); -int Mono_Posix_ToPosixFadviseAdvice (int x, int *r); - -#define Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL 0x00000000 -#define Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM 0x00000001 -#define Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL 0x00000002 -#define Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED 0x00000003 -#define Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED 0x00000004 -int Mono_Posix_FromPosixMadviseAdvice (int x, int *r); -int Mono_Posix_ToPosixMadviseAdvice (int x, int *r); - -#define Mono_Posix_Signum_SIGHUP 0x00000001 -#define Mono_Posix_Signum_SIGINT 0x00000002 -#define Mono_Posix_Signum_SIGQUIT 0x00000003 -#define Mono_Posix_Signum_SIGILL 0x00000004 -#define Mono_Posix_Signum_SIGTRAP 0x00000005 -#define Mono_Posix_Signum_SIGABRT 0x00000006 -#define Mono_Posix_Signum_SIGIOT 0x00000006 -#define Mono_Posix_Signum_SIGBUS 0x00000007 -#define Mono_Posix_Signum_SIGFPE 0x00000008 -#define Mono_Posix_Signum_SIGKILL 0x00000009 -#define Mono_Posix_Signum_SIGUSR1 0x0000000a -#define Mono_Posix_Signum_SIGSEGV 0x0000000b -#define Mono_Posix_Signum_SIGUSR2 0x0000000c -#define Mono_Posix_Signum_SIGPIPE 0x0000000d -#define Mono_Posix_Signum_SIGALRM 0x0000000e -#define Mono_Posix_Signum_SIGTERM 0x0000000f -#define Mono_Posix_Signum_SIGSTKFLT 0x00000010 -#define Mono_Posix_Signum_SIGCHLD 0x00000011 -#define Mono_Posix_Signum_SIGCLD 0x00000011 -#define Mono_Posix_Signum_SIGCONT 0x00000012 -#define Mono_Posix_Signum_SIGSTOP 0x00000013 -#define Mono_Posix_Signum_SIGTSTP 0x00000014 -#define Mono_Posix_Signum_SIGTTIN 0x00000015 -#define Mono_Posix_Signum_SIGTTOU 0x00000016 -#define Mono_Posix_Signum_SIGURG 0x00000017 -#define Mono_Posix_Signum_SIGXCPU 0x00000018 -#define Mono_Posix_Signum_SIGXFSZ 0x00000019 -#define Mono_Posix_Signum_SIGVTALRM 0x0000001a -#define Mono_Posix_Signum_SIGPROF 0x0000001b -#define Mono_Posix_Signum_SIGWINCH 0x0000001c -#define Mono_Posix_Signum_SIGIO 0x0000001d -#define Mono_Posix_Signum_SIGPOLL 0x0000001d -#define Mono_Posix_Signum_SIGPWR 0x0000001e -#define Mono_Posix_Signum_SIGSYS 0x0000001f -#define Mono_Posix_Signum_SIGUNUSED 0x0000001f -int Mono_Posix_FromSignum (int x, int *r); -int Mono_Posix_ToSignum (int x, int *r); - -#define Mono_Posix_WaitOptions_WNOHANG 0x00000001 -#define Mono_Posix_WaitOptions_WUNTRACED 0x00000002 -int Mono_Posix_FromWaitOptions (int x, int *r); -int Mono_Posix_ToWaitOptions (int x, int *r); - -#define Mono_Posix_AccessMode_R_OK 0x00000001 -#define Mono_Posix_AccessMode_W_OK 0x00000002 -#define Mono_Posix_AccessMode_X_OK 0x00000004 -#define Mono_Posix_AccessMode_F_OK 0x00000008 -int Mono_Posix_FromAccessMode (int x, int *r); -int Mono_Posix_ToAccessMode (int x, int *r); - -#define Mono_Posix_PathConf__PC_LINK_MAX 0x00000000 -#define Mono_Posix_PathConf__PC_MAX_CANON 0x00000001 -#define Mono_Posix_PathConf__PC_MAX_INPUT 0x00000002 -#define Mono_Posix_PathConf__PC_NAME_MAX 0x00000003 -#define Mono_Posix_PathConf__PC_PATH_MAX 0x00000004 -#define Mono_Posix_PathConf__PC_PIPE_BUF 0x00000005 -#define Mono_Posix_PathConf__PC_CHOWN_RESTRICTED 0x00000006 -#define Mono_Posix_PathConf__PC_NO_TRUNC 0x00000007 -#define Mono_Posix_PathConf__PC_VDISABLE 0x00000008 -#define Mono_Posix_PathConf__PC_SYNC_IO 0x00000009 -#define Mono_Posix_PathConf__PC_ASYNC_IO 0x0000000a -#define Mono_Posix_PathConf__PC_PRIO_IO 0x0000000b -#define Mono_Posix_PathConf__PC_SOCK_MAXBUF 0x0000000c -#define Mono_Posix_PathConf__PC_FILESIZEBITS 0x0000000d -#define Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE 0x0000000e -#define Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE 0x0000000f -#define Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE 0x00000010 -#define Mono_Posix_PathConf__PC_REC_XFER_ALIGN 0x00000011 -#define Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN 0x00000012 -#define Mono_Posix_PathConf__PC_SYMLINK_MAX 0x00000013 -#define Mono_Posix_PathConf__PC_2_SYMLINKS 0x00000014 -int Mono_Posix_FromPathConf (int x, int *r); -int Mono_Posix_ToPathConf (int x, int *r); - -#define Mono_Posix_SysConf__SC_ARG_MAX 0x00000000 -#define Mono_Posix_SysConf__SC_CHILD_MAX 0x00000001 -#define Mono_Posix_SysConf__SC_CLK_TCK 0x00000002 -#define Mono_Posix_SysConf__SC_NGROUPS_MAX 0x00000003 -#define Mono_Posix_SysConf__SC_OPEN_MAX 0x00000004 -#define Mono_Posix_SysConf__SC_STREAM_MAX 0x00000005 -#define Mono_Posix_SysConf__SC_TZNAME_MAX 0x00000006 -#define Mono_Posix_SysConf__SC_JOB_CONTROL 0x00000007 -#define Mono_Posix_SysConf__SC_SAVED_IDS 0x00000008 -#define Mono_Posix_SysConf__SC_REALTIME_SIGNALS 0x00000009 -#define Mono_Posix_SysConf__SC_PRIORITY_SCHEDULING 0x0000000a -#define Mono_Posix_SysConf__SC_TIMERS 0x0000000b -#define Mono_Posix_SysConf__SC_ASYNCHRONOUS_IO 0x0000000c -#define Mono_Posix_SysConf__SC_PRIORITIZED_IO 0x0000000d -#define Mono_Posix_SysConf__SC_SYNCHRONIZED_IO 0x0000000e -#define Mono_Posix_SysConf__SC_FSYNC 0x0000000f -#define Mono_Posix_SysConf__SC_MAPPED_FILES 0x00000010 -#define Mono_Posix_SysConf__SC_MEMLOCK 0x00000011 -#define Mono_Posix_SysConf__SC_MEMLOCK_RANGE 0x00000012 -#define Mono_Posix_SysConf__SC_MEMORY_PROTECTION 0x00000013 -#define Mono_Posix_SysConf__SC_MESSAGE_PASSING 0x00000014 -#define Mono_Posix_SysConf__SC_SEMAPHORES 0x00000015 -#define Mono_Posix_SysConf__SC_SHARED_MEMORY_OBJECTS 0x00000016 -#define Mono_Posix_SysConf__SC_AIO_LISTIO_MAX 0x00000017 -#define Mono_Posix_SysConf__SC_AIO_MAX 0x00000018 -#define Mono_Posix_SysConf__SC_AIO_PRIO_DELTA_MAX 0x00000019 -#define Mono_Posix_SysConf__SC_DELAYTIMER_MAX 0x0000001a -#define Mono_Posix_SysConf__SC_MQ_OPEN_MAX 0x0000001b -#define Mono_Posix_SysConf__SC_MQ_PRIO_MAX 0x0000001c -#define Mono_Posix_SysConf__SC_VERSION 0x0000001d -#define Mono_Posix_SysConf__SC_PAGESIZE 0x0000001e -#define Mono_Posix_SysConf__SC_RTSIG_MAX 0x0000001f -#define Mono_Posix_SysConf__SC_SEM_NSEMS_MAX 0x00000020 -#define Mono_Posix_SysConf__SC_SEM_VALUE_MAX 0x00000021 -#define Mono_Posix_SysConf__SC_SIGQUEUE_MAX 0x00000022 -#define Mono_Posix_SysConf__SC_TIMER_MAX 0x00000023 -#define Mono_Posix_SysConf__SC_BC_BASE_MAX 0x00000024 -#define Mono_Posix_SysConf__SC_BC_DIM_MAX 0x00000025 -#define Mono_Posix_SysConf__SC_BC_SCALE_MAX 0x00000026 -#define Mono_Posix_SysConf__SC_BC_STRING_MAX 0x00000027 -#define Mono_Posix_SysConf__SC_COLL_WEIGHTS_MAX 0x00000028 -#define Mono_Posix_SysConf__SC_EQUIV_CLASS_MAX 0x00000029 -#define Mono_Posix_SysConf__SC_EXPR_NEST_MAX 0x0000002a -#define Mono_Posix_SysConf__SC_LINE_MAX 0x0000002b -#define Mono_Posix_SysConf__SC_RE_DUP_MAX 0x0000002c -#define Mono_Posix_SysConf__SC_CHARCLASS_NAME_MAX 0x0000002d -#define Mono_Posix_SysConf__SC_2_VERSION 0x0000002e -#define Mono_Posix_SysConf__SC_2_C_BIND 0x0000002f -#define Mono_Posix_SysConf__SC_2_C_DEV 0x00000030 -#define Mono_Posix_SysConf__SC_2_FORT_DEV 0x00000031 -#define Mono_Posix_SysConf__SC_2_FORT_RUN 0x00000032 -#define Mono_Posix_SysConf__SC_2_SW_DEV 0x00000033 -#define Mono_Posix_SysConf__SC_2_LOCALEDEF 0x00000034 -#define Mono_Posix_SysConf__SC_PII 0x00000035 -#define Mono_Posix_SysConf__SC_PII_XTI 0x00000036 -#define Mono_Posix_SysConf__SC_PII_SOCKET 0x00000037 -#define Mono_Posix_SysConf__SC_PII_INTERNET 0x00000038 -#define Mono_Posix_SysConf__SC_PII_OSI 0x00000039 -#define Mono_Posix_SysConf__SC_POLL 0x0000003a -#define Mono_Posix_SysConf__SC_SELECT 0x0000003b -#define Mono_Posix_SysConf__SC_UIO_MAXIOV 0x0000003c -#define Mono_Posix_SysConf__SC_IOV_MAX 0x0000003c -#define Mono_Posix_SysConf__SC_PII_INTERNET_STREAM 0x0000003d -#define Mono_Posix_SysConf__SC_PII_INTERNET_DGRAM 0x0000003e -#define Mono_Posix_SysConf__SC_PII_OSI_COTS 0x0000003f -#define Mono_Posix_SysConf__SC_PII_OSI_CLTS 0x00000040 -#define Mono_Posix_SysConf__SC_PII_OSI_M 0x00000041 -#define Mono_Posix_SysConf__SC_T_IOV_MAX 0x00000042 -#define Mono_Posix_SysConf__SC_THREADS 0x00000043 -#define Mono_Posix_SysConf__SC_THREAD_SAFE_FUNCTIONS 0x00000044 -#define Mono_Posix_SysConf__SC_GETGR_R_SIZE_MAX 0x00000045 -#define Mono_Posix_SysConf__SC_GETPW_R_SIZE_MAX 0x00000046 -#define Mono_Posix_SysConf__SC_LOGIN_NAME_MAX 0x00000047 -#define Mono_Posix_SysConf__SC_TTY_NAME_MAX 0x00000048 -#define Mono_Posix_SysConf__SC_THREAD_DESTRUCTOR_ITERATIONS 0x00000049 -#define Mono_Posix_SysConf__SC_THREAD_KEYS_MAX 0x0000004a -#define Mono_Posix_SysConf__SC_THREAD_STACK_MIN 0x0000004b -#define Mono_Posix_SysConf__SC_THREAD_THREADS_MAX 0x0000004c -#define Mono_Posix_SysConf__SC_THREAD_ATTR_STACKADDR 0x0000004d -#define Mono_Posix_SysConf__SC_THREAD_ATTR_STACKSIZE 0x0000004e -#define Mono_Posix_SysConf__SC_THREAD_PRIORITY_SCHEDULING 0x0000004f -#define Mono_Posix_SysConf__SC_THREAD_PRIO_INHERIT 0x00000050 -#define Mono_Posix_SysConf__SC_THREAD_PRIO_PROTECT 0x00000051 -#define Mono_Posix_SysConf__SC_THREAD_PROCESS_SHARED 0x00000052 -#define Mono_Posix_SysConf__SC_NPROCESSORS_CONF 0x00000053 -#define Mono_Posix_SysConf__SC_NPROCESSORS_ONLN 0x00000054 -#define Mono_Posix_SysConf__SC_PHYS_PAGES 0x00000055 -#define Mono_Posix_SysConf__SC_AVPHYS_PAGES 0x00000056 -#define Mono_Posix_SysConf__SC_ATEXIT_MAX 0x00000057 -#define Mono_Posix_SysConf__SC_PASS_MAX 0x00000058 -#define Mono_Posix_SysConf__SC_XOPEN_VERSION 0x00000059 -#define Mono_Posix_SysConf__SC_XOPEN_XCU_VERSION 0x0000005a -#define Mono_Posix_SysConf__SC_XOPEN_UNIX 0x0000005b -#define Mono_Posix_SysConf__SC_XOPEN_CRYPT 0x0000005c -#define Mono_Posix_SysConf__SC_XOPEN_ENH_I18N 0x0000005d -#define Mono_Posix_SysConf__SC_XOPEN_SHM 0x0000005e -#define Mono_Posix_SysConf__SC_2_CHAR_TERM 0x0000005f -#define Mono_Posix_SysConf__SC_2_C_VERSION 0x00000060 -#define Mono_Posix_SysConf__SC_2_UPE 0x00000061 -#define Mono_Posix_SysConf__SC_XOPEN_XPG2 0x00000062 -#define Mono_Posix_SysConf__SC_XOPEN_XPG3 0x00000063 -#define Mono_Posix_SysConf__SC_XOPEN_XPG4 0x00000064 -#define Mono_Posix_SysConf__SC_CHAR_BIT 0x00000065 -#define Mono_Posix_SysConf__SC_CHAR_MAX 0x00000066 -#define Mono_Posix_SysConf__SC_CHAR_MIN 0x00000067 -#define Mono_Posix_SysConf__SC_INT_MAX 0x00000068 -#define Mono_Posix_SysConf__SC_INT_MIN 0x00000069 -#define Mono_Posix_SysConf__SC_LONG_BIT 0x0000006a -#define Mono_Posix_SysConf__SC_WORD_BIT 0x0000006b -#define Mono_Posix_SysConf__SC_MB_LEN_MAX 0x0000006c -#define Mono_Posix_SysConf__SC_NZERO 0x0000006d -#define Mono_Posix_SysConf__SC_SSIZE_MAX 0x0000006e -#define Mono_Posix_SysConf__SC_SCHAR_MAX 0x0000006f -#define Mono_Posix_SysConf__SC_SCHAR_MIN 0x00000070 -#define Mono_Posix_SysConf__SC_SHRT_MAX 0x00000071 -#define Mono_Posix_SysConf__SC_SHRT_MIN 0x00000072 -#define Mono_Posix_SysConf__SC_UCHAR_MAX 0x00000073 -#define Mono_Posix_SysConf__SC_UINT_MAX 0x00000074 -#define Mono_Posix_SysConf__SC_ULONG_MAX 0x00000075 -#define Mono_Posix_SysConf__SC_USHRT_MAX 0x00000076 -#define Mono_Posix_SysConf__SC_NL_ARGMAX 0x00000077 -#define Mono_Posix_SysConf__SC_NL_LANGMAX 0x00000078 -#define Mono_Posix_SysConf__SC_NL_MSGMAX 0x00000079 -#define Mono_Posix_SysConf__SC_NL_NMAX 0x0000007a -#define Mono_Posix_SysConf__SC_NL_SETMAX 0x0000007b -#define Mono_Posix_SysConf__SC_NL_TEXTMAX 0x0000007c -#define Mono_Posix_SysConf__SC_XBS5_ILP32_OFF32 0x0000007d -#define Mono_Posix_SysConf__SC_XBS5_ILP32_OFFBIG 0x0000007e -#define Mono_Posix_SysConf__SC_XBS5_LP64_OFF64 0x0000007f -#define Mono_Posix_SysConf__SC_XBS5_LPBIG_OFFBIG 0x00000080 -#define Mono_Posix_SysConf__SC_XOPEN_LEGACY 0x00000081 -#define Mono_Posix_SysConf__SC_XOPEN_REALTIME 0x00000082 -#define Mono_Posix_SysConf__SC_XOPEN_REALTIME_THREADS 0x00000083 -#define Mono_Posix_SysConf__SC_ADVISORY_INFO 0x00000084 -#define Mono_Posix_SysConf__SC_BARRIERS 0x00000085 -#define Mono_Posix_SysConf__SC_BASE 0x00000086 -#define Mono_Posix_SysConf__SC_C_LANG_SUPPORT 0x00000087 -#define Mono_Posix_SysConf__SC_C_LANG_SUPPORT_R 0x00000088 -#define Mono_Posix_SysConf__SC_CLOCK_SELECTION 0x00000089 -#define Mono_Posix_SysConf__SC_CPUTIME 0x0000008a -#define Mono_Posix_SysConf__SC_THREAD_CPUTIME 0x0000008b -#define Mono_Posix_SysConf__SC_DEVICE_IO 0x0000008c -#define Mono_Posix_SysConf__SC_DEVICE_SPECIFIC 0x0000008d -#define Mono_Posix_SysConf__SC_DEVICE_SPECIFIC_R 0x0000008e -#define Mono_Posix_SysConf__SC_FD_MGMT 0x0000008f -#define Mono_Posix_SysConf__SC_FIFO 0x00000090 -#define Mono_Posix_SysConf__SC_PIPE 0x00000091 -#define Mono_Posix_SysConf__SC_FILE_ATTRIBUTES 0x00000092 -#define Mono_Posix_SysConf__SC_FILE_LOCKING 0x00000093 -#define Mono_Posix_SysConf__SC_FILE_SYSTEM 0x00000094 -#define Mono_Posix_SysConf__SC_MONOTONIC_CLOCK 0x00000095 -#define Mono_Posix_SysConf__SC_MULTI_PROCESS 0x00000096 -#define Mono_Posix_SysConf__SC_SINGLE_PROCESS 0x00000097 -#define Mono_Posix_SysConf__SC_NETWORKING 0x00000098 -#define Mono_Posix_SysConf__SC_READER_WRITER_LOCKS 0x00000099 -#define Mono_Posix_SysConf__SC_SPIN_LOCKS 0x0000009a -#define Mono_Posix_SysConf__SC_REGEXP 0x0000009b -#define Mono_Posix_SysConf__SC_REGEX_VERSION 0x0000009c -#define Mono_Posix_SysConf__SC_SHELL 0x0000009d -#define Mono_Posix_SysConf__SC_SIGNALS 0x0000009e -#define Mono_Posix_SysConf__SC_SPAWN 0x0000009f -#define Mono_Posix_SysConf__SC_SPORADIC_SERVER 0x000000a0 -#define Mono_Posix_SysConf__SC_THREAD_SPORADIC_SERVER 0x000000a1 -#define Mono_Posix_SysConf__SC_SYSTEM_DATABASE 0x000000a2 -#define Mono_Posix_SysConf__SC_SYSTEM_DATABASE_R 0x000000a3 -#define Mono_Posix_SysConf__SC_TIMEOUTS 0x000000a4 -#define Mono_Posix_SysConf__SC_TYPED_MEMORY_OBJECTS 0x000000a5 -#define Mono_Posix_SysConf__SC_USER_GROUPS 0x000000a6 -#define Mono_Posix_SysConf__SC_USER_GROUPS_R 0x000000a7 -#define Mono_Posix_SysConf__SC_2_PBS 0x000000a8 -#define Mono_Posix_SysConf__SC_2_PBS_ACCOUNTING 0x000000a9 -#define Mono_Posix_SysConf__SC_2_PBS_LOCATE 0x000000aa -#define Mono_Posix_SysConf__SC_2_PBS_MESSAGE 0x000000ab -#define Mono_Posix_SysConf__SC_2_PBS_TRACK 0x000000ac -#define Mono_Posix_SysConf__SC_SYMLOOP_MAX 0x000000ad -#define Mono_Posix_SysConf__SC_STREAMS 0x000000ae -#define Mono_Posix_SysConf__SC_2_PBS_CHECKPOINT 0x000000af -#define Mono_Posix_SysConf__SC_V6_ILP32_OFF32 0x000000b0 -#define Mono_Posix_SysConf__SC_V6_ILP32_OFFBIG 0x000000b1 -#define Mono_Posix_SysConf__SC_V6_LP64_OFF64 0x000000b2 -#define Mono_Posix_SysConf__SC_V6_LPBIG_OFFBIG 0x000000b3 -#define Mono_Posix_SysConf__SC_HOST_NAME_MAX 0x000000b4 -#define Mono_Posix_SysConf__SC_TRACE 0x000000b5 -#define Mono_Posix_SysConf__SC_TRACE_EVENT_FILTER 0x000000b6 -#define Mono_Posix_SysConf__SC_TRACE_INHERIT 0x000000b7 -#define Mono_Posix_SysConf__SC_TRACE_LOG 0x000000b8 -#define Mono_Posix_SysConf__SC_LEVEL1_ICACHE_SIZE 0x000000b9 -#define Mono_Posix_SysConf__SC_LEVEL1_ICACHE_ASSOC 0x000000ba -#define Mono_Posix_SysConf__SC_LEVEL1_ICACHE_LINESIZE 0x000000bb -#define Mono_Posix_SysConf__SC_LEVEL1_DCACHE_SIZE 0x000000bc -#define Mono_Posix_SysConf__SC_LEVEL1_DCACHE_ASSOC 0x000000bd -#define Mono_Posix_SysConf__SC_LEVEL1_DCACHE_LINESIZE 0x000000be -#define Mono_Posix_SysConf__SC_LEVEL2_CACHE_SIZE 0x000000bf -#define Mono_Posix_SysConf__SC_LEVEL2_CACHE_ASSOC 0x000000c0 -#define Mono_Posix_SysConf__SC_LEVEL2_CACHE_LINESIZE 0x000000c1 -#define Mono_Posix_SysConf__SC_LEVEL3_CACHE_SIZE 0x000000c2 -#define Mono_Posix_SysConf__SC_LEVEL3_CACHE_ASSOC 0x000000c3 -#define Mono_Posix_SysConf__SC_LEVEL3_CACHE_LINESIZE 0x000000c4 -#define Mono_Posix_SysConf__SC_LEVEL4_CACHE_SIZE 0x000000c5 -#define Mono_Posix_SysConf__SC_LEVEL4_CACHE_ASSOC 0x000000c6 -#define Mono_Posix_SysConf__SC_LEVEL4_CACHE_LINESIZE 0x000000c7 -int Mono_Posix_FromSysConf (int x, int *r); -int Mono_Posix_ToSysConf (int x, int *r); - -#define Mono_Posix_ConfStr__CS_PATH 0x00000000 -#define Mono_Posix_ConfStr__CS_V6_WIDTH_RESTRICTED_ENVS 0x00000001 -#define Mono_Posix_ConfStr__CS_GNU_LIBC_VERSION 0x00000002 -#define Mono_Posix_ConfStr__CS_GNU_LIBPTHREAD_VERSION 0x00000003 -#define Mono_Posix_ConfStr__CS_LFS_CFLAGS 0x000003e8 -#define Mono_Posix_ConfStr__CS_LFS_LDFLAGS 0x000003e9 -#define Mono_Posix_ConfStr__CS_LFS_LIBS 0x000003ea -#define Mono_Posix_ConfStr__CS_LFS_LINTFLAGS 0x000003eb -#define Mono_Posix_ConfStr__CS_LFS64_CFLAGS 0x000003ec -#define Mono_Posix_ConfStr__CS_LFS64_LDFLAGS 0x000003ed -#define Mono_Posix_ConfStr__CS_LFS64_LIBS 0x000003ee -#define Mono_Posix_ConfStr__CS_LFS64_LINTFLAGS 0x000003ef -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_CFLAGS 0x0000044c -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LDFLAGS 0x0000044d -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LIBS 0x0000044e -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_LINTFLAGS 0x0000044f -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_CFLAGS 0x00000450 -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LDFLAGS 0x00000451 -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LIBS 0x00000452 -#define Mono_Posix_ConfStr__CS_XBS5_ILP32_OFFBIG_LINTFLAGS 0x00000453 -#define Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_CFLAGS 0x00000454 -#define Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LDFLAGS 0x00000455 -#define Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LIBS 0x00000456 -#define Mono_Posix_ConfStr__CS_XBS5_LP64_OFF64_LINTFLAGS 0x00000457 -#define Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_CFLAGS 0x00000458 -#define Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LDFLAGS 0x00000459 -#define Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LIBS 0x0000045a -#define Mono_Posix_ConfStr__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 0x0000045b -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_CFLAGS 0x0000045c -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LDFLAGS 0x0000045d -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LIBS 0x0000045e -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 0x0000045f -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 0x00000460 -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 0x00000461 -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LIBS 0x00000462 -#define Mono_Posix_ConfStr__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 0x00000463 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_CFLAGS 0x00000464 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LDFLAGS 0x00000465 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LIBS 0x00000466 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LP64_OFF64_LINTFLAGS 0x00000467 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 0x00000468 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 0x00000469 -#define Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LIBS 0x0000046a -#define Mono_Posix_ConfStr__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 0x0000046b -int Mono_Posix_FromConfStr (int x, int *r); -int Mono_Posix_ToConfStr (int x, int *r); - -#define Mono_Posix_LockfCommand_F_ULOCK 0x00000000 -#define Mono_Posix_LockfCommand_F_LOCK 0x00000001 -#define Mono_Posix_LockfCommand_F_TLOCK 0x00000002 -#define Mono_Posix_LockfCommand_F_TEST 0x00000003 -int Mono_Posix_FromLockfCommand (int x, int *r); -int Mono_Posix_ToLockfCommand (int x, int *r); - -#define Mono_Posix_PollEvents_POLLIN 0x00000001 -#define Mono_Posix_PollEvents_POLLPRI 0x00000002 -#define Mono_Posix_PollEvents_POLLOUT 0x00000004 -#define Mono_Posix_PollEvents_POLLERR 0x00000008 -#define Mono_Posix_PollEvents_POLLHUP 0x00000010 -#define Mono_Posix_PollEvents_POLLNVAL 0x00000020 -#define Mono_Posix_PollEvents_POLLRDNORM 0x00000040 -#define Mono_Posix_PollEvents_POLLRDBAND 0x00000080 -#define Mono_Posix_PollEvents_POLLWRNORM 0x00000100 -#define Mono_Posix_PollEvents_POLLWRBAND 0x00000200 -int Mono_Posix_FromPollEvents (short x, short *r); -int Mono_Posix_ToPollEvents (short x, short *r); - -#define Mono_Posix_XattrFlags_XATTR_AUTO 0x00000000 -#define Mono_Posix_XattrFlags_XATTR_CREATE 0x00000001 -#define Mono_Posix_XattrFlags_XATTR_REPLACE 0x00000002 -int Mono_Posix_FromXattrFlags (int x, int *r); -int Mono_Posix_ToXattrFlags (int x, int *r); - -#define Mono_Posix_MountFlags_ST_RDONLY 0x00000001 -#define Mono_Posix_MountFlags_ST_NOSUID 0x00000002 -#define Mono_Posix_MountFlags_ST_NODEV 0x00000004 -#define Mono_Posix_MountFlags_ST_SYNCHRONOUS 0x00000010 -#define Mono_Posix_MountFlags_ST_MANDLOCK 0x00000040 -#define Mono_Posix_MountFlags_ST_WRITE 0x00000080 -#define Mono_Posix_MountFlags_ST_APPEND 0x00000100 -#define Mono_Posix_MountFlags_ST_IMMUTABLE 0x00000200 -#define Mono_Posix_MountFlags_ST_NOATIME 0x00000400 -#define Mono_Posix_MountFlags_ST_NODIRATIME 0x00000800 -int Mono_Posix_FromMountFlags (guint64 x, guint64 *r); -int Mono_Posix_ToMountFlags (guint64 x, guint64 *r); - -#define Mono_Posix_MmapFlags_MAP_SHARED 0x00000001 -#define Mono_Posix_MmapFlags_MAP_PRIVATE 0x00000002 -#define Mono_Posix_MmapFlags_MAP_TYPE 0x0000000f -#define Mono_Posix_MmapFlags_MAP_FIXED 0x00000010 -#define Mono_Posix_MmapFlags_MAP_FILE 0x00000000 -#define Mono_Posix_MmapFlags_MAP_ANONYMOUS 0x00000020 -#define Mono_Posix_MmapFlags_MAP_ANON 0x00000020 -#define Mono_Posix_MmapFlags_MAP_GROWSDOWN 0x00000100 -#define Mono_Posix_MmapFlags_MAP_DENYWRITE 0x00000800 -#define Mono_Posix_MmapFlags_MAP_EXECUTABLE 0x00001000 -#define Mono_Posix_MmapFlags_MAP_LOCKED 0x00002000 -#define Mono_Posix_MmapFlags_MAP_NORESERVE 0x00004000 -#define Mono_Posix_MmapFlags_MAP_POPULATE 0x00008000 -#define Mono_Posix_MmapFlags_MAP_NONBLOCK 0x00010000 -int Mono_Posix_FromMmapFlags (int x, int *r); -int Mono_Posix_ToMmapFlags (int x, int *r); - -#define Mono_Posix_MmapProt_PROT_READ 0x00000001 -#define Mono_Posix_MmapProt_PROT_WRITE 0x00000002 -#define Mono_Posix_MmapProt_PROT_EXEC 0x00000004 -#define Mono_Posix_MmapProt_PROT_NONE 0x00000000 -#define Mono_Posix_MmapProt_PROT_GROWSDOWN 0x01000000 -#define Mono_Posix_MmapProt_PROT_GROWSUP 0x02000000 -int Mono_Posix_FromMmapProt (int x, int *r); -int Mono_Posix_ToMmapProt (int x, int *r); - -#define Mono_Posix_MsyncFlags_MS_ASYNC 0x00000001 -#define Mono_Posix_MsyncFlags_MS_SYNC 0x00000004 -#define Mono_Posix_MsyncFlags_MS_INVALIDATE 0x00000002 -int Mono_Posix_FromMsyncFlags (int x, int *r); -int Mono_Posix_ToMsyncFlags (int x, int *r); - -#define Mono_Posix_MlockallFlags_MCL_CURRENT 0x00000001 -#define Mono_Posix_MlockallFlags_MCL_FUTURE 0x00000002 -int Mono_Posix_FromMlockallFlags (int x, int *r); -int Mono_Posix_ToMlockallFlags (int x, int *r); - -#define Mono_Posix_MremapFlags_MREMAP_MAYMOVE 0x00000001 -int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r); -int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r); - -G_END_DECLS - -#endif /* ndef INC_Mono_Posix_map_H */ - diff --git a/support/mph.h b/support/mph.h deleted file mode 100644 index 0c8b37fdd93..00000000000 --- a/support/mph.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Common/shared macros and routines. - * - * This file contains macros of the form - * - * mph_return_if_TYPE_overflow(val); - * - * Which tests `val' for a TYPE underflow/overflow (that is, is `val' within - * the range for TYPE?). If `val' can't fit in TYPE, errno is set to - * EOVERFLOW, and `return -1' is executed (which is why it's a macro). - * - * Assumptions: - * - * I'm working from GLibc, so that's the basis for my assumptions. They may - * not be completely portable, in which case I'll need to fix my assumptions. - * :-( - * - * See the typedefs for type size assumptions. These typedefs *must* be kept - * in sync with the types used in Mono.Posix.dll. - * - * See also: - * http://developer.apple.com/documentation/Darwin/Reference/ManPages/ - */ - -#ifndef INC_mph_H -#define INC_mph_H - -#include - -#include /* LONG_MAX, ULONG_MAX */ -#include /* for ERANGE */ -#include /* for g* types, etc. */ - -#ifdef HAVE_STDINT_H -#include /* for SIZE_MAX */ -#endif - -#include "map-icalls.h" - -#if __APPLE__ || __BSD__ || __FreeBSD__ -#define MPH_ON_BSD -#endif - -#ifdef __GNUC__ -#define MPH_INTERNAL __attribute__((visibility("hidden"))) -#else -#define MPH_INTERNAL -#endif - -#if defined (PLATFORM_WIN32) && !defined (EOVERFLOW) -#define EOVERFLOW 75 -#endif /* def PLATFORM_WIN32 && ndef EOVERFLOW */ - -typedef gint64 mph_blkcnt_t; -typedef gint64 mph_blksize_t; -typedef guint64 mph_dev_t; -typedef guint64 mph_ino_t; -typedef guint64 mph_nlink_t; -typedef gint64 mph_off_t; -typedef guint64 mph_size_t; -typedef gint64 mph_ssize_t; -typedef gint32 mph_pid_t; -typedef guint32 mph_gid_t; -typedef guint32 mph_uid_t; -typedef gint64 mph_time_t; -typedef gint64 mph_clock_t; -typedef guint64 mph_fsblkcnt_t; -typedef guint64 mph_fsfilcnt_t; - -#ifdef HAVE_LARGE_FILE_SUPPORT -#define MPH_OFF_T_MAX G_MAXINT64 -#define MPH_OFF_T_MIN G_MININT64 -#else -#define MPH_OFF_T_MAX G_MAXINT32 -#define MPH_OFF_T_MIN G_MININT32 -#endif - -#ifdef SIZE_MAX -#define MPH_SIZE_T_MAX SIZE_MAX -#elif SIZEOF_SIZE_T == 8 -#define MPH_SIZE_T_MAX G_MAXUINT64 -#elif SIZEOF_SIZE_T == 4 -#define MPH_SIZE_T_MAX G_MAXUINT32 -#else -#error "sizeof(size_t) is unknown!" -#endif - -#define _mph_return_val_if_cb_(val, ret, cb) G_STMT_START{ \ - if (cb (val)) { \ - errno = EOVERFLOW; \ - return ret; \ - }}G_STMT_END - -#define mph_have_long_overflow(var) ((var) > LONG_MAX || (var) < LONG_MIN) - -#define mph_return_val_if_long_overflow(var, ret) \ - _mph_return_val_if_cb_(var, ret, mph_have_long_overflow) - -#define mph_return_if_long_overflow(var) mph_return_val_if_long_overflow(var, -1) - -#define mph_have_ulong_overflow(var) ((var) > ULONG_MAX) - -#define mph_return_val_if_ulong_overflow(var, ret) \ - _mph_return_val_if_cb_(var, ret, mph_have_ulong_overflow) - -#define mph_return_if_ulong_overflow(var) mph_return_val_if_ulong_overflow(var, -1) - -#define mph_have_size_t_overflow(var) ((var) > MPH_SIZE_T_MAX) - -#define mph_return_val_if_size_t_overflow(var, ret) \ - _mph_return_val_if_cb_(var, ret, mph_have_size_t_overflow) - -#define mph_return_val_if_ssize_t_overflow(var, ret) \ - _mph_return_val_if_cb_(var, ret, mph_have_long_overflow) - -#define mph_return_if_size_t_overflow(var) mph_return_val_if_size_t_overflow(var, -1) - -#define mph_return_if_ssize_t_overflow(var) mph_return_val_if_ssize_t_overflow(var, -1) - -#define mph_have_off_t_overflow(var) \ - (((var) < MPH_OFF_T_MIN) || ((var) > MPH_OFF_T_MAX)) - -#define mph_return_val_if_off_t_overflow(var, ret) \ - _mph_return_val_if_cb_(var, ret, mph_have_off_t_overflow) - -#define mph_return_if_off_t_overflow(var) mph_return_val_if_size_t_overflow(var, -1) - -#define mph_return_if_time_t_overflow(var) mph_return_if_long_overflow(var) - -/* - * Helper function for functions which use ERANGE (such as getpwnam_r and - * getgrnam_r). These functions accept buffers which are dynamically - * allocated so that they're only as large as necessary. However, Linux and - * Mac OS X differ on how to signal an error value. - * - * Linux returns the error value directly, while Mac OS X is more traditional, - * returning -1 and setting errno accordingly. - * - * Unify the checking in one place. - */ -static inline int -recheck_range (int ret) -{ - if (ret == ERANGE) - return 1; - if (ret == -1) - return errno == ERANGE; - return 0; -} - -MPH_INTERNAL char* -_mph_copy_structure_strings ( - void *to, const size_t *to_offsets, - const void *from, const size_t *from_offsets, - size_t num_strings); - -#endif /* ndef INC_mph_H */ - -/* - * vim: noexpandtab - */ diff --git a/support/old-map.c b/support/old-map.c deleted file mode 100644 index f35d0d7bacd..00000000000 --- a/support/old-map.c +++ /dev/null @@ -1,178 +0,0 @@ -/* This file was automatically generated by make-map from Mono.Posix.dll */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include "mph.h" -#include "old-map.h" -int map_Mono_Posix_OpenFlags (int x) -{ - int r = 0; - if ((x & Mono_Posix_OpenFlags_O_RDONLY) != 0) - r |= O_RDONLY; - if ((x & Mono_Posix_OpenFlags_O_WRONLY) != 0) - r |= O_WRONLY; - if ((x & Mono_Posix_OpenFlags_O_RDWR) != 0) - r |= O_RDWR; - if ((x & Mono_Posix_OpenFlags_O_CREAT) != 0) - r |= O_CREAT; - if ((x & Mono_Posix_OpenFlags_O_EXCL) != 0) - r |= O_EXCL; - if ((x & Mono_Posix_OpenFlags_O_NOCTTY) != 0) - r |= O_NOCTTY; - if ((x & Mono_Posix_OpenFlags_O_TRUNC) != 0) - r |= O_TRUNC; - if ((x & Mono_Posix_OpenFlags_O_APPEND) != 0) - r |= O_APPEND; - if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) != 0) - r |= O_NONBLOCK; -#ifdef O_SYNC - if ((x & Mono_Posix_OpenFlags_O_SYNC) != 0) - r |= O_SYNC; -#endif - return r; -} - -int map_Mono_Posix_FileMode (int x) -{ - int r = 0; - if ((x & Mono_Posix_FileMode_S_ISUID) != 0) - r |= S_ISUID; - if ((x & Mono_Posix_FileMode_S_ISGID) != 0) - r |= S_ISGID; - if ((x & Mono_Posix_FileMode_S_ISVTX) != 0) - r |= S_ISVTX; - if ((x & Mono_Posix_FileMode_S_IRUSR) != 0) - r |= S_IRUSR; - if ((x & Mono_Posix_FileMode_S_IWUSR) != 0) - r |= S_IWUSR; - if ((x & Mono_Posix_FileMode_S_IXUSR) != 0) - r |= S_IXUSR; - if ((x & Mono_Posix_FileMode_S_IRGRP) != 0) - r |= S_IRGRP; - if ((x & Mono_Posix_FileMode_S_IWGRP) != 0) - r |= S_IWGRP; - if ((x & Mono_Posix_FileMode_S_IXGRP) != 0) - r |= S_IXGRP; - if ((x & Mono_Posix_FileMode_S_IROTH) != 0) - r |= S_IROTH; - if ((x & Mono_Posix_FileMode_S_IWOTH) != 0) - r |= S_IWOTH; - if ((x & Mono_Posix_FileMode_S_IXOTH) != 0) - r |= S_IXOTH; - return r; -} - -int map_Mono_Posix_WaitOptions (int x) -{ - int r = 0; - if ((x & Mono_Posix_WaitOptions_WNOHANG) != 0) - r |= WNOHANG; - if ((x & Mono_Posix_WaitOptions_WUNTRACED) != 0) - r |= WUNTRACED; - return r; -} - -int map_Mono_Posix_AccessMode (int x) -{ - int r = 0; - if ((x & Mono_Posix_AccessMode_R_OK) != 0) - r |= R_OK; - if ((x & Mono_Posix_AccessMode_W_OK) != 0) - r |= W_OK; - if ((x & Mono_Posix_AccessMode_X_OK) != 0) - r |= X_OK; - if ((x & Mono_Posix_AccessMode_F_OK) != 0) - r |= F_OK; - return r; -} - -int map_Mono_Posix_Signals (int x) -{ - if (x == Mono_Posix_Signals_SIGHUP) - return SIGHUP; - if (x == Mono_Posix_Signals_SIGINT) - return SIGINT; - if (x == Mono_Posix_Signals_SIGQUIT) - return SIGQUIT; - if (x == Mono_Posix_Signals_SIGILL) - return SIGILL; - if (x == Mono_Posix_Signals_SIGTRAP) - return SIGTRAP; - if (x == Mono_Posix_Signals_SIGABRT) - return SIGABRT; - if (x == Mono_Posix_Signals_SIGBUS) - return SIGBUS; - if (x == Mono_Posix_Signals_SIGFPE) - return SIGFPE; - if (x == Mono_Posix_Signals_SIGKILL) - return SIGKILL; - if (x == Mono_Posix_Signals_SIGUSR1) - return SIGUSR1; - if (x == Mono_Posix_Signals_SIGSEGV) - return SIGSEGV; - if (x == Mono_Posix_Signals_SIGUSR2) - return SIGUSR2; - if (x == Mono_Posix_Signals_SIGPIPE) - return SIGPIPE; - if (x == Mono_Posix_Signals_SIGALRM) - return SIGALRM; - if (x == Mono_Posix_Signals_SIGTERM) - return SIGTERM; - if (x == Mono_Posix_Signals_SIGCHLD) - return SIGCHLD; - if (x == Mono_Posix_Signals_SIGCONT) - return SIGCONT; - if (x == Mono_Posix_Signals_SIGSTOP) - return SIGSTOP; - if (x == Mono_Posix_Signals_SIGTSTP) - return SIGTSTP; - if (x == Mono_Posix_Signals_SIGTTIN) - return SIGTTIN; - if (x == Mono_Posix_Signals_SIGTTOU) - return SIGTTOU; - if (x == Mono_Posix_Signals_SIGURG) - return SIGURG; - if (x == Mono_Posix_Signals_SIGXCPU) - return SIGXCPU; - if (x == Mono_Posix_Signals_SIGXFSZ) - return SIGXFSZ; - if (x == Mono_Posix_Signals_SIGVTALRM) - return SIGVTALRM; - if (x == Mono_Posix_Signals_SIGPROF) - return SIGPROF; - if (x == Mono_Posix_Signals_SIGWINCH) - return SIGWINCH; - if (x == Mono_Posix_Signals_SIGIO) - return SIGIO; - if (x == Mono_Posix_Signals_SIGSYS) - return SIGSYS; - return -1; -} - -int map_Mono_Posix_PollEvents (int x) -{ - int r = 0; - if ((x & Mono_Posix_PollEvents_POLLIN) != 0) - r |= POLLIN; - if ((x & Mono_Posix_PollEvents_POLLPRI) != 0) - r |= POLLPRI; - if ((x & Mono_Posix_PollEvents_POLLOUT) != 0) - r |= POLLOUT; - if ((x & Mono_Posix_PollEvents_POLLERR) != 0) - r |= POLLERR; - if ((x & Mono_Posix_PollEvents_POLLHUP) != 0) - r |= POLLHUP; - if ((x & Mono_Posix_PollEvents_POLLNVAL) != 0) - r |= POLLNVAL; - return r; -} - diff --git a/support/old-map.h b/support/old-map.h deleted file mode 100644 index 369c1778018..00000000000 --- a/support/old-map.h +++ /dev/null @@ -1,71 +0,0 @@ -/* This file was automatically generated by make-map from Mono.Posix.dll */ - -#define Mono_Posix_OpenFlags_O_RDONLY 0x00000000 -#define Mono_Posix_OpenFlags_O_WRONLY 0x00000001 -#define Mono_Posix_OpenFlags_O_RDWR 0x00000002 -#define Mono_Posix_OpenFlags_O_CREAT 0x00000004 -#define Mono_Posix_OpenFlags_O_EXCL 0x00000008 -#define Mono_Posix_OpenFlags_O_NOCTTY 0x00000010 -#define Mono_Posix_OpenFlags_O_TRUNC 0x00000020 -#define Mono_Posix_OpenFlags_O_APPEND 0x00000040 -#define Mono_Posix_OpenFlags_O_NONBLOCK 0x00000080 -#define Mono_Posix_OpenFlags_O_SYNC 0x00000100 - -#define Mono_Posix_FileMode_S_ISUID 0x00000800 -#define Mono_Posix_FileMode_S_ISGID 0x00000400 -#define Mono_Posix_FileMode_S_ISVTX 0x00000200 -#define Mono_Posix_FileMode_S_IRUSR 0x00000100 -#define Mono_Posix_FileMode_S_IWUSR 0x00000080 -#define Mono_Posix_FileMode_S_IXUSR 0x00000040 -#define Mono_Posix_FileMode_S_IRGRP 0x00000020 -#define Mono_Posix_FileMode_S_IWGRP 0x00000010 -#define Mono_Posix_FileMode_S_IXGRP 0x00000008 -#define Mono_Posix_FileMode_S_IROTH 0x00000004 -#define Mono_Posix_FileMode_S_IWOTH 0x00000002 -#define Mono_Posix_FileMode_S_IXOTH 0x00000001 - -#define Mono_Posix_WaitOptions_WNOHANG 0x00000000 -#define Mono_Posix_WaitOptions_WUNTRACED 0x00000001 - -#define Mono_Posix_AccessMode_R_OK 0x00000001 -#define Mono_Posix_AccessMode_W_OK 0x00000002 -#define Mono_Posix_AccessMode_X_OK 0x00000004 -#define Mono_Posix_AccessMode_F_OK 0x00000008 - -#define Mono_Posix_Signals_SIGHUP 0x00000000 -#define Mono_Posix_Signals_SIGINT 0x00000001 -#define Mono_Posix_Signals_SIGQUIT 0x00000002 -#define Mono_Posix_Signals_SIGILL 0x00000003 -#define Mono_Posix_Signals_SIGTRAP 0x00000004 -#define Mono_Posix_Signals_SIGABRT 0x00000005 -#define Mono_Posix_Signals_SIGBUS 0x00000006 -#define Mono_Posix_Signals_SIGFPE 0x00000007 -#define Mono_Posix_Signals_SIGKILL 0x00000008 -#define Mono_Posix_Signals_SIGUSR1 0x00000009 -#define Mono_Posix_Signals_SIGSEGV 0x0000000a -#define Mono_Posix_Signals_SIGUSR2 0x0000000b -#define Mono_Posix_Signals_SIGPIPE 0x0000000c -#define Mono_Posix_Signals_SIGALRM 0x0000000d -#define Mono_Posix_Signals_SIGTERM 0x0000000e -#define Mono_Posix_Signals_SIGCHLD 0x0000000f -#define Mono_Posix_Signals_SIGCONT 0x00000010 -#define Mono_Posix_Signals_SIGSTOP 0x00000011 -#define Mono_Posix_Signals_SIGTSTP 0x00000012 -#define Mono_Posix_Signals_SIGTTIN 0x00000013 -#define Mono_Posix_Signals_SIGTTOU 0x00000014 -#define Mono_Posix_Signals_SIGURG 0x00000015 -#define Mono_Posix_Signals_SIGXCPU 0x00000016 -#define Mono_Posix_Signals_SIGXFSZ 0x00000017 -#define Mono_Posix_Signals_SIGVTALRM 0x00000018 -#define Mono_Posix_Signals_SIGPROF 0x00000019 -#define Mono_Posix_Signals_SIGWINCH 0x0000001a -#define Mono_Posix_Signals_SIGIO 0x0000001b -#define Mono_Posix_Signals_SIGSYS 0x0000001c - -#define Mono_Posix_PollEvents_POLLIN 0x00000002 -#define Mono_Posix_PollEvents_POLLPRI 0x00000003 -#define Mono_Posix_PollEvents_POLLOUT 0x00000004 -#define Mono_Posix_PollEvents_POLLERR 0x00000005 -#define Mono_Posix_PollEvents_POLLHUP 0x00000006 -#define Mono_Posix_PollEvents_POLLNVAL 0x00000007 - diff --git a/support/pwd.c b/support/pwd.c deleted file mode 100644 index 809934777e2..00000000000 --- a/support/pwd.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include -#include -#include -#include - -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Syscall__Passwd { - /* string */ char *pw_name; - /* string */ char *pw_passwd; - /* uid_t */ mph_uid_t pw_uid; - /* gid_t */ mph_gid_t pw_gid; - /* string */ char *pw_gecos; - /* string */ char *pw_dir; - /* string */ char *pw_shell; - /* string */ char *_pw_buf_; -}; - -static const size_t -passwd_offsets[] = { - offsetof (struct passwd, pw_name), - offsetof (struct passwd, pw_passwd), - offsetof (struct passwd, pw_gecos), - offsetof (struct passwd, pw_dir), - offsetof (struct passwd, pw_shell) -}; - -static const size_t -mph_passwd_offsets[] = { - offsetof (struct Mono_Posix_Syscall__Passwd, pw_name), - offsetof (struct Mono_Posix_Syscall__Passwd, pw_passwd), - offsetof (struct Mono_Posix_Syscall__Passwd, pw_gecos), - offsetof (struct Mono_Posix_Syscall__Passwd, pw_dir), - offsetof (struct Mono_Posix_Syscall__Passwd, pw_shell) -}; - -/* - * Copy the native `passwd' structure to it's managed representation. - * - * To minimize separate mallocs, all the strings are allocated within the same - * memory block (stored in _pw_buf_). - */ -static int -copy_passwd (struct Mono_Posix_Syscall__Passwd *to, struct passwd *from) -{ - char *buf; - buf = _mph_copy_structure_strings (to, mph_passwd_offsets, - from, passwd_offsets, sizeof(passwd_offsets)/sizeof(passwd_offsets[0])); - - to->pw_uid = from->pw_uid; - to->pw_gid = from->pw_gid; - - to->_pw_buf_ = buf; - if (buf == NULL) { - return -1; - } - - return 0; -} - -gint32 -Mono_Posix_Syscall_getpwnam (const char *name, struct Mono_Posix_Syscall__Passwd *pwbuf) -{ - struct passwd *pw; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - pw = getpwnam (name); - if (pw == NULL) - return -1; - - if (copy_passwd (pwbuf, pw) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -gint32 -Mono_Posix_Syscall_getpwuid (mph_uid_t uid, struct Mono_Posix_Syscall__Passwd *pwbuf) -{ - struct passwd *pw; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - pw = getpwuid (uid); - if (pw == NULL) { - return -1; - } - - if (copy_passwd (pwbuf, pw) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -#ifdef HAVE_GETPWNAM_R -gint32 -Mono_Posix_Syscall_getpwnam_r (const char *name, - struct Mono_Posix_Syscall__Passwd *pwbuf, - void **pwbufp) -{ - char *buf, *buf2; - size_t buflen; - int r; - struct passwd _pwbuf; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - buf = buf2 = NULL; - buflen = 2; - - do { - buf2 = realloc (buf, buflen *= 2); - if (buf2 == NULL) { - free (buf); - errno = ENOMEM; - return -1; - } - buf = buf2; - errno = 0; - } while ((r = getpwnam_r (name, &_pwbuf, buf, buflen, (struct passwd**) pwbufp)) && - recheck_range (r)); - - if (r == 0 && !(*pwbufp)) - /* On solaris, this function returns 0 even if the entry was not found */ - r = errno = ENOENT; - - if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1) - r = errno = ENOMEM; - free (buf); - - return r; -} -#endif /* ndef HAVE_GETPWNAM_R */ - -#ifdef HAVE_GETPWUID_R -gint32 -Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid, - struct Mono_Posix_Syscall__Passwd *pwbuf, - void **pwbufp) -{ - char *buf, *buf2; - size_t buflen; - int r; - struct passwd _pwbuf; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - buf = buf2 = NULL; - buflen = 2; - - do { - buf2 = realloc (buf, buflen *= 2); - if (buf2 == NULL) { - free (buf); - errno = ENOMEM; - return -1; - } - buf = buf2; - errno = 0; - } while ((r = getpwuid_r (uid, &_pwbuf, buf, buflen, (struct passwd**) pwbufp)) && - recheck_range (r)); - - if (r == 0 && copy_passwd (pwbuf, &_pwbuf) == -1) - r = errno = ENOMEM; - free (buf); - - return r; -} -#endif /* ndef HAVE_GETPWUID_R */ - -gint32 -Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf) -{ - struct passwd *pw; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - pw = getpwent (); - if (pw == NULL) - return -1; - - if (copy_passwd (pwbuf, pw) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} - -#ifdef HAVE_FGETPWENT -gint32 -Mono_Posix_Syscall_fgetpwent (void *stream, struct Mono_Posix_Syscall__Passwd *pwbuf) -{ - struct passwd *pw; - - if (pwbuf == NULL) { - errno = EFAULT; - return -1; - } - - errno = 0; - pw = fgetpwent ((FILE*) stream); - if (pw == NULL) - return -1; - - if (copy_passwd (pwbuf, pw) == -1) { - errno = ENOMEM; - return -1; - } - return 0; -} -#endif /* ndef HAVE_FGETPWENT */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/serial.c b/support/serial.c deleted file mode 100644 index 8ae46b8a6bf..00000000000 --- a/support/serial.c +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* serial port functions - * - * Author: Chris Toshok - */ - -#include -#include -#include -#include -#include - -#include - -int -open_serial (char* devfile) -{ - int fd; - struct termios newtio; - - fd = open (devfile, O_RDWR); - - if (fd == -1) - return -1; - - newtio.c_cflag = CLOCAL | CREAD; - newtio.c_iflag = 0; - newtio.c_oflag = 0; - newtio.c_lflag = 0; - - tcflush(fd, TCIOFLUSH); - tcsetattr(fd,TCSANOW,&newtio); - - fcntl (fd, F_SETFL, O_NONBLOCK); - - return fd; -} - -void -close_serial (int unix_fd) -{ - close (unix_fd); -} - -guint32 -read_serial (int fd, guchar *buffer, int offset, int count, int timeout) -{ - guint32 n; - struct pollfd ufd; - - ufd.fd = fd; - ufd.events = POLLHUP | POLLIN | POLLERR; - - poll (&ufd, 1, timeout); - - if ((ufd.revents & POLLIN) != POLLIN) { - return -1; - } - - n = read (fd, buffer + offset, count); - - return (guint32) n; -} - -void -write_serial (int fd, guchar *buffer, int offset, int count, int timeout) -{ - guint32 n; - - struct pollfd ufd; - - ufd.fd = fd; - ufd.events = POLLHUP | POLLOUT | POLLERR; - - poll (&ufd, 1, timeout); - - if ((ufd.revents & POLLOUT) != POLLOUT) { - return; - } - - n = write (fd, buffer + offset, count); -} - -void -discard_buffer (int fd, gboolean input) -{ - tcflush(fd, input ? TCIFLUSH : TCOFLUSH); -} - -gboolean -set_attributes (int fd, int baud_rate, int parity, int dataBits, int stopBits, int handshake) -{ - struct termios newtio; - - tcgetattr (fd, &newtio); - - switch (baud_rate) { - case 230400: baud_rate = B230400; break; - case 115200: baud_rate = B115200; break; - case 57600: baud_rate = B57600; break; - case 38400: baud_rate = B38400; break; - case 19200: baud_rate = B19200; break; - case 9600: baud_rate = B9600; break; - case 4800: baud_rate = B4800; break; - case 2400: baud_rate = B2400; break; - case 1800: baud_rate = B1800; break; - case 1200: baud_rate = B1200; break; - case 600: baud_rate = B600; break; - case 300: baud_rate = B300; break; - case 200: baud_rate = B200; break; - case 150: baud_rate = B150; break; - case 134: baud_rate = B134; break; - case 110: baud_rate = B110; break; - case 75: baud_rate = B75; break; - case 50: - case 0: - default: - baud_rate = B9600; - break; - } - - switch (parity) { - case 0: /* Even */ - newtio.c_iflag &= ~IGNPAR; - newtio.c_cflag |= PARENB; - break; - case 1: /* Mark */ - /* XXX unhandled */ - break; - case 2: /* None */ - newtio.c_iflag |= IGNPAR; - newtio.c_cflag &= ~(PARENB | PARODD); - break; - case 3: /* Odd */ - newtio.c_iflag &= ~IGNPAR; - newtio.c_cflag |= PARENB | PARODD; - break; - case 4: /* Space */ - /* XXX unhandled */ - break; - } - - newtio.c_cflag &= ~CSIZE; - switch (dataBits) { - case 5: newtio.c_cflag |= CS5; break; - case 6: newtio.c_cflag |= CS6; break; - case 7: newtio.c_cflag |= CS7; break; - case 8: - default: - newtio.c_cflag |= CS8; - break; - } - - newtio.c_cflag &= ~CSTOPB; - switch (stopBits) { - case 0: /* One */ - /* do nothing, the default is one stop bit */ - break; - case 1: /* OnePointFive */ - /* XXX unhandled */ - break; - case 2: /* Two */ - newtio.c_cflag |= CSTOPB; - break; - } - - newtio.c_iflag &= ~IXOFF; - newtio.c_oflag &= ~IXON; -#ifdef CRTSCTS - newtio.c_cflag &= ~CRTSCTS; -#endif /* def CRTSCTS */ - switch (handshake) { - case 0: /* None */ - /* do nothing */ - break; - case 1: /* RequestToSend (RTS) */ -#ifdef CRTSCTS - newtio.c_cflag |= CRTSCTS; -#endif /* def CRTSCTS */ - break; - case 2: /* RequestToSendXOnXOff (RTS + XON/XOFF) */ -#ifdef CRTSCTS - newtio.c_cflag |= CRTSCTS; -#endif /* def CRTSCTS */ - /* fall through */ - case 3: /* XOnXOff */ - newtio.c_iflag |= IXOFF; - // newtio.c_oflag |= IXON; - break; - } - - cfsetospeed (&newtio, baud_rate); - cfsetispeed (&newtio, baud_rate); - - tcsetattr(fd,TCSADRAIN,&newtio); - - return TRUE; -} - -/* - * mono internals should not be used here. - * this serial stuff needs to be implemented with icalls. - * make this at least compile until the code is moved elsewhere - * defined(linux) is wrong, too - */ -void* -list_serial_devices (void) -{ - return NULL; -} - -#if 0 -MonoArray * -list_serial_devices (void) -{ - MonoArray *array; -#if defined(linux) - /* Linux serial files are of the form ttyS[0-9]+ */ - GSList *l, *list = NULL; - GDir* dir = g_dir_open ("/dev", 0, NULL); - const char *filename; - int i = 0; - - while ((filename = g_dir_read_name (dir))) { - if (filename) { - if (!strncmp (filename, "ttyS", 4)) - list = g_slist_append (list, g_strconcat ("/dev/", filename, NULL)); - } - } - - g_dir_close (dir); - - array = mono_array_new (mono_domain_get (), mono_get_string_class (), g_slist_length (list)); - for (l = list; l; l = l->next) { - mono_array_set (array, gpointer, i++, mono_string_new (mono_domain_get (), (char*)l->data)); - g_free (l->data); - } - - g_slist_free (list); - -#else -#warning "list_serial_devices isn't ported to this OS" -#endif - - return array; -} -#endif - diff --git a/support/signal.c b/support/signal.c deleted file mode 100644 index d0eaf1df414..00000000000 --- a/support/signal.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * wrapper functions. - */ - -#include - -#include "mph.h" - -G_BEGIN_DECLS - -typedef void (*mph_sighandler_t)(int); - -void* -Mono_Posix_Stdlib_SIG_DFL (void) -{ - return SIG_DFL; -} - -void* -Mono_Posix_Stdlib_SIG_ERR (void) -{ - return SIG_ERR; -} - -void* -Mono_Posix_Stdlib_SIG_IGN (void) -{ - return SIG_IGN; -} - -void -Mono_Posix_Stdlib_InvokeSignalHandler (int signum, void *handler) -{ - mph_sighandler_t _h = (mph_sighandler_t) handler; - _h (signum); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/stdio.c b/support/stdio.c deleted file mode 100644 index 4fe6d26deff..00000000000 --- a/support/stdio.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004-2005 Jonathan Pryor - */ - -#include -#include -#include - -#include "mph.h" - -G_BEGIN_DECLS - -#ifndef PLATFORM_WIN32 -gint32 -Mono_Posix_Syscall_L_ctermid (void) -{ - return L_ctermid; -} - -gint32 -Mono_Posix_Syscall_L_cuserid (void) -{ - return L_cuserid; -} -#endif /* ndef PLATFORM_WIN32 */ - -mph_size_t -Mono_Posix_Stdlib_fread (void *ptr, mph_size_t size, mph_size_t nmemb, void *stream) -{ - mph_return_if_size_t_overflow (size); - mph_return_if_size_t_overflow (nmemb); - - return fread (ptr, (size_t) size, (size_t) nmemb, (FILE*) stream); -} - -mph_size_t -Mono_Posix_Stdlib_fwrite (void *ptr, mph_size_t size, mph_size_t nmemb, void *stream) -{ - mph_return_if_size_t_overflow (size); - mph_return_if_size_t_overflow (nmemb); - - return fwrite (ptr, (size_t) size, (size_t) nmemb, (FILE*) stream); -} - -#ifdef HAVE_VSNPRINTF -gint32 -Mono_Posix_Stdlib_snprintf (char *s, mph_size_t n, char *format, ...); -gint32 -Mono_Posix_Stdlib_snprintf (char *s, mph_size_t n, char *format, ...) -{ - va_list ap; - gint32 r; - mph_return_if_size_t_overflow (n); - - va_start (ap, format); - r = vsnprintf (s, (size_t) n, format, ap); - va_end (ap); - - return r; -} -#endif /* def HAVE_SNPRINTF */ - -gint32 -Mono_Posix_Stdlib__IOFBF (void) -{ - return _IOFBF; -} - -gint32 -Mono_Posix_Stdlib__IOLBF (void) -{ - return _IOLBF; -} - -gint32 -Mono_Posix_Stdlib__IONBF (void) -{ - return _IONBF; -} - -gint32 -Mono_Posix_Stdlib_BUFSIZ (void) -{ - return BUFSIZ; -} - -gint32 -Mono_Posix_Stdlib_EOF (void) -{ - return EOF; -} - -gint32 -Mono_Posix_Stdlib_FOPEN_MAX (void) -{ - return FOPEN_MAX; -} - -gint32 -Mono_Posix_Stdlib_FILENAME_MAX (void) -{ - return FILENAME_MAX; -} - -gint32 -Mono_Posix_Stdlib_L_tmpnam (void) -{ - return L_tmpnam; -} - -void* -Mono_Posix_Stdlib_stdin (void) -{ - return stdin; -} - -void* -Mono_Posix_Stdlib_stdout (void) -{ - return stdout; -} - -void* -Mono_Posix_Stdlib_stderr (void) -{ - return stderr; -} - -gint32 -Mono_Posix_Stdlib_TMP_MAX (void) -{ - return TMP_MAX; -} - -gint32 -Mono_Posix_Stdlib_setvbuf (void* stream, void *buf, int mode, mph_size_t size) -{ - mph_return_if_size_t_overflow (size); - return setvbuf (stream, (char *) buf, mode, (size_t) size); -} - -gint32 -Mono_Posix_Stdlib_fseek (void* stream, gint64 offset, int origin) -{ - mph_return_if_long_overflow (offset); - - return fseek (stream, offset, origin); -} - -gint64 -Mono_Posix_Stdlib_ftell (void* stream) -{ - return ftell (stream); -} - -void* -Mono_Posix_Stdlib_CreateFilePosition (void) -{ - fpos_t* pos = malloc (sizeof(fpos_t)); - return pos; -} - -gint32 -Mono_Posix_Stdlib_fgetpos (void* stream, void *pos) -{ - return fgetpos (stream, (fpos_t*) pos); -} - -gint32 -Mono_Posix_Stdlib_fsetpos (void* stream, void *pos) -{ - return fsetpos (stream, (fpos_t*) pos); -} - -#define MPH_FPOS_LENGTH (sizeof(fpos_t)*2) - -int -Mono_Posix_Stdlib_DumpFilePosition (char *dest, void *pos, gint32 len) -{ - char *destp; - unsigned char *posp, *pose; - - if (dest == NULL) - return MPH_FPOS_LENGTH; - - if (pos == NULL || len <= 0) { - errno = EINVAL; - return -1; - } - - posp = (unsigned char*) pos; - pose = posp + sizeof(fpos_t); - destp = dest; - - for ( ; posp < pose && len > 1; destp += 2, ++posp, len -= 2) { - sprintf (destp, "%02X", *posp); - } - - if (len) - dest[MPH_FPOS_LENGTH] = '\0'; - - return destp - dest; -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/stdlib.c b/support/stdlib.c deleted file mode 100644 index 16e5ea04610..00000000000 --- a/support/stdlib.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include - -#include "mph.h" - -G_BEGIN_DECLS - -gint32 -Mono_Posix_Stdlib_EXIT_FAILURE (void) -{ - return EXIT_FAILURE; -} - -gint32 -Mono_Posix_Stdlib_EXIT_SUCCESS (void) -{ - return EXIT_SUCCESS; -} - -gint32 -Mono_Posix_Stdlib_MB_CUR_MAX (void) -{ - return MB_CUR_MAX; -} - -gint32 -Mono_Posix_Stdlib_RAND_MAX (void) -{ - return RAND_MAX; -} - -void* -Mono_Posix_Stdlib_calloc (mph_size_t nmemb, mph_size_t size) -{ - if (mph_have_size_t_overflow(nmemb) || mph_have_size_t_overflow(size)) - return NULL; - - return calloc ((size_t) nmemb, (size_t) size); -} - -void* -Mono_Posix_Stdlib_malloc (mph_size_t size) -{ - if (mph_have_size_t_overflow(size)) - return NULL; - - return malloc ((size_t) size); -} - -void* -Mono_Posix_Stdlib_realloc (void* ptr, mph_size_t size) -{ - if (mph_have_size_t_overflow(size)) - return NULL; - - return realloc (ptr, (size_t) size); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/supportw.c b/support/supportw.c deleted file mode 100644 index 158fce068be..00000000000 --- a/support/supportw.c +++ /dev/null @@ -1,230 +0,0 @@ -#include -#include -#include -#include -#include "supportw.h" -#include "mono/metadata/assembly.h" -#include "mono/metadata/class.h" -#include "mono/metadata/object.h" -#include "mono/metadata/tabledefs.h" -#include "mono/io-layer/wapi.h" - -typedef struct { - const char *fname; - void *fnptr; -} FnPtr; - -gpointer FindWindowExW (gpointer hwndParent, gpointer hwndChildAfter, - const char *classw, const char *window); - -gpointer HeapAlloc (gpointer unused1, gint32 unused2, gint32 nbytes); -gpointer HeapCreate (gint32 flags, gint32 initial_size, gint32 max_size); -gboolean HeapSetInformation (gpointer handle, gpointer heap_info_class, - gpointer heap_info, gint32 head_info_length); - -gboolean HeapQueryInformation (gpointer handle, gpointer heap_info_class, - gpointer heap_info, gint32 head_info_length, gint32 *ret_length); - -gpointer HeapAlloc (gpointer handle, gint32 flags, gint32 nbytes); -gpointer HeapReAlloc (gpointer handle, gint32 flags, gpointer mem, gint32 nbytes); -gint32 HeapSize (gpointer handle, gint32 flags, gpointer mem); -gboolean HeapFree (gpointer handle, gint32 flags, gpointer mem); -gboolean HeapValidate (gpointer handle, gpointer mem); -gboolean HeapDestroy (gpointer handle); -gpointer GetProcessHeap (void); - -static FnPtr functions [] = { - { "FindWindowExW", NULL }, /* user32 */ -}; -#define NFUNCTIONS (sizeof (functions)/sizeof (FnPtr)) - -static int swf_registered; - -static int -compare_names (const void *key, const void *p) -{ - FnPtr *ptr = (FnPtr *) p; - return strcmp (key, ptr->fname); -} - -static gpointer -get_function (const char *name) -{ - FnPtr *ptr; - - ptr = bsearch (name, functions, NFUNCTIONS, sizeof (FnPtr), - compare_names); - - if (ptr == NULL) { - g_warning ("Function '%s' not not found.", name); - return NULL; - } - - return ptr->fnptr; -} - -gboolean -supportw_register_delegate (const char *function_name, void *fnptr) -{ - FnPtr *ptr; - - g_return_val_if_fail (function_name && fnptr, FALSE); - - ptr = bsearch (function_name, functions, NFUNCTIONS, sizeof (FnPtr), - compare_names); - - if (ptr == NULL) { - g_warning ("Function '%s' not supported.", function_name); - return FALSE; - } - - ptr->fnptr = fnptr; - return TRUE; -} - -#define M_ATTRS (METHOD_ATTRIBUTE_PUBLIC | METHOD_ATTRIBUTE_STATIC) -static gboolean -register_assembly (const char *name, int *registered) -{ -/* we can't use mono or wapi funcions in a support lib */ -#if 0 - MonoAssembly *assembly; - MonoImageOpenStatus status; - MonoImage *image; - MonoClass *klass; - MonoMethod *method; - MonoObject *exc; - - if (*registered) - return TRUE; - - assembly = mono_assembly_load_with_partial_name (name, &status); - if (assembly == NULL) { - g_warning ("Cannot load assembly '%s'.", name); - return FALSE; - } - - image = mono_assembly_get_image (assembly); - klass = mono_class_from_name (image, name, "LibSupport"); - if (klass == NULL) { - g_warning ("Cannot load class %s.LibSupport", name); - mono_assembly_close (assembly); - return FALSE; - } - - method = mono_class_get_method_from_name_flags (klass, "Register", 0, M_ATTRS); - if (klass == NULL) { - g_warning ("Cannot load method Register from klass %s.LibSupport", name); - mono_assembly_close (assembly); - return FALSE; - } - - exc = NULL; - mono_runtime_invoke (method, NULL, NULL, &exc); - if (exc != NULL) { - mono_assembly_close (assembly); - mono_print_unhandled_exception (exc); - return FALSE; - } - *registered = 1; - mono_assembly_close (assembly); - return TRUE; -#else - return FALSE; -#endif -} - -void -supportw_test_all () -{ - int i; - - register_assembly ("System.Windows.Forms", &swf_registered); - for (i = 0; i < NFUNCTIONS; i++) { - FnPtr *ptr = &functions [i]; - if (ptr->fnptr == NULL) - g_warning ("%s wasn't registered.", ptr->fname); - } -} - -gpointer -FindWindowExW (gpointer hwndParent, gpointer hwndChildAfter, const char *classw, const char *window) -{ - typedef gpointer (*func_type) (gpointer hwndParent, gpointer hwndChildAfter, - const char *classw, const char *window); - static func_type func; - - g_return_val_if_fail (register_assembly ("System.Windows.Forms", &swf_registered), NULL); - if (func == NULL) - func = (func_type) get_function ("FindWindowExW"); - - return func (hwndParent, hwndChildAfter, classw, window); -} - -/* begin Heap* functions */ -gpointer -HeapCreate (gint32 flags, gint32 initial_size, gint32 max_size) -{ - return (gpointer) 0xDEADBEEF; -} - -gboolean -HeapSetInformation (gpointer handle, gpointer heap_info_class, gpointer heap_info, - gint32 head_info_length) -{ - return TRUE; -} - -gboolean -HeapQueryInformation (gpointer handle, gpointer heap_info_class, gpointer heap_info, - gint32 head_info_length, gint32 *ret_length) -{ - *ret_length = 0; - return TRUE; -} - -gpointer -HeapAlloc (gpointer handle, gint32 flags, gint32 nbytes) -{ - return g_malloc0 (nbytes); -} - -gpointer -HeapReAlloc (gpointer handle, gint32 flags, gpointer mem, gint32 nbytes) -{ - return g_realloc (mem, nbytes); -} - -gint32 -HeapSize (gpointer handle, gint32 flags, gpointer mem) -{ - return 0; -} - -gboolean -HeapFree (gpointer handle, gint32 flags, gpointer mem) -{ - g_free (mem); - return TRUE; -} - -gboolean -HeapValidate (gpointer handle, gpointer mem) -{ - return TRUE; -} - -gboolean -HeapDestroy (gpointer handle) -{ - return TRUE; -} - - -gpointer -GetProcessHeap () -{ - return (gpointer) 0xDEADBEEF; -} -/* end Heap* functions */ - diff --git a/support/supportw.h b/support/supportw.h deleted file mode 100644 index 2f186e2a9e4..00000000000 --- a/support/supportw.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __SUPPORTW_H -#define __SUPPORTW_H - -G_BEGIN_DECLS - -gboolean supportw_register_delegate (const char *function_name, void *fnptr); -void supportw_test_all (void); - -G_END_DECLS - -#endif /* __SUPPORTW_H */ - diff --git a/support/sys-mman.c b/support/sys-mman.c deleted file mode 100644 index a8463bcb00c..00000000000 --- a/support/sys-mman.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include - -#include "map.h" -#include "mph.h" - -G_BEGIN_DECLS - -void* -Mono_Posix_Syscall_mmap (void *start, mph_size_t length, int prot, int flags, - int fd, mph_off_t offset) -{ - int _prot, _flags; - - mph_return_val_if_size_t_overflow (length, MAP_FAILED); - mph_return_val_if_off_t_overflow (offset, MAP_FAILED); - - if (Mono_Posix_FromMmapProt (prot, &_prot) == -1) - return MAP_FAILED; - if (Mono_Posix_FromMmapFlags (flags, &_flags) == -1) - return MAP_FAILED; - - return mmap (start, (size_t) length, _prot, _flags, fd, (off_t) offset); -} - -int -Mono_Posix_Syscall_munmap (void *start, mph_size_t length) -{ - mph_return_if_size_t_overflow (length); - - return munmap (start, (size_t) length); -} - -int -Mono_Posix_Syscall_mprotect (void *start, mph_size_t len, int prot) -{ - int _prot; - mph_return_if_size_t_overflow (len); - - if (Mono_Posix_FromMmapProt (prot, &_prot) == -1) - return -1; - - return mprotect (start, (size_t) len, _prot); -} - -int -Mono_Posix_Syscall_msync (void *start, mph_size_t len, int flags) -{ - int _flags; - mph_return_if_size_t_overflow (len); - - if (Mono_Posix_FromMsyncFlags (flags, &_flags) == -1) - return -1; - - return msync (start, (size_t) len, _flags); -} - -int -Mono_Posix_Syscall_mlock (void *start, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - - return mlock (start, (size_t) len); -} - -int -Mono_Posix_Syscall_munlock (void *start, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - - return munlock (start, (size_t) len); -} - -#ifdef HAVE_MREMAP -void* -Mono_Posix_Syscall_mremap (void *old_address, mph_size_t old_size, - mph_size_t new_size, guint64 flags) -{ - guint64 _flags; - - mph_return_val_if_size_t_overflow (old_size, MAP_FAILED); - mph_return_val_if_size_t_overflow (new_size, MAP_FAILED); - - if (Mono_Posix_FromMremapFlags (flags, &_flags) == -1) - return MAP_FAILED; - - return mremap (old_address, (size_t) old_size, (size_t) new_size, - (unsigned long) _flags); -} -#endif /* def HAVE_MREMAP */ - -int -Mono_Posix_Syscall_mincore (void *start, mph_size_t length, void *vec) -{ - mph_return_if_size_t_overflow (length); - - return mincore (start, (size_t) length, (unsigned char*) vec); -} - -#ifdef HAVE_POSIX_MADVISE -gint32 -Mono_Posix_Syscall_posix_madvise (void *addr, mph_size_t len, gint32 advice) -{ - mph_return_if_size_t_overflow (len); - - if (Mono_Posix_FromPosixMadviseAdvice (advice, &advice) == -1) - return -1; - - return posix_madvise (addr, (size_t) len, advice); -} -#endif /* def HAVE_POSIX_MADVISE */ - -#ifdef HAVE_REMAP_FILE_PAGES -int -Mono_Posix_Syscall_remap_file_pages (void *start, mph_size_t size, - int prot, mph_ssize_t pgoff, int flags) -{ - int _prot, _flags; - - mph_return_if_size_t_overflow (size); - mph_return_if_ssize_t_overflow (pgoff); - - if (Mono_Posix_FromMmapProt (prot, &_prot) == -1) - return -1; - if (Mono_Posix_FromMmapFlags (flags, &_flags) == -1) - return -1; - - return remap_file_pages (start, (size_t) size, _prot, (ssize_t) pgoff, _flags); -} -#endif /* def HAVE_REMAP_FILE_PAGES */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-sendfile.c b/support/sys-sendfile.c deleted file mode 100644 index 976b01d7870..00000000000 --- a/support/sys-sendfile.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include - -#include "mph.h" - -#ifdef HAVE_SYS_SENDFILE_H -#include -#endif /* ndef HAVE_SYS_SENDFILE_H */ - -G_BEGIN_DECLS - -#ifdef HAVE_SENDFILE -mph_ssize_t -Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_t count) -{ - off_t _offset; - ssize_t r; - mph_return_if_off_t_overflow (*offset); - - _offset = *offset; - - r = sendfile (out_fd, in_fd, &_offset, (size_t) count); - - *offset = _offset; - - return r; -} -#endif /* ndef HAVE_SENDFILE */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-stat.c b/support/sys-stat.c deleted file mode 100644 index 8ee2dabf9b9..00000000000 --- a/support/sys-stat.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif /* ndef _GNU_SOURCE */ - -#include -#include -#include -#include -#include - -#include "map.h" -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Stat { - /* dev_t */ mph_dev_t st_dev; /* device */ - /* ino_t */ mph_ino_t st_ino; /* inode */ - /* mode_t */ guint32 st_mode; /* protection */ - guint32 _padding_; /* structure padding */ - /* nlink_t */ mph_nlink_t st_nlink; /* number of hard links */ - /* uid_t */ mph_uid_t st_uid; /* user ID of owner */ - /* gid_t */ mph_gid_t st_gid; /* group ID of owner */ - /* dev_t */ mph_dev_t st_rdev; /* device type (if inode device) */ - /* off_t */ mph_off_t st_size; /* total size, in bytes */ - /* blksize_t */ mph_blksize_t st_blksize; /* blocksize for filesystem I/O */ - /* blkcnt_t */ mph_blkcnt_t st_blocks; /* number of blocks allocated */ - - /* st_atime, st_mtime, and st_ctime are macros (!), so use a slightly - * different name to appease CPP */ - - /* time_t */ mph_time_t st_atime_; /* time of last access */ - /* time_t */ mph_time_t st_mtime_; /* time of last modification */ - /* time_t */ mph_time_t st_ctime_; /* time of last status change */ -}; - -static int -copy_stat (struct Mono_Posix_Stat *to, struct stat *from) -{ - if (Mono_Posix_ToFilePermissions (from->st_mode, &to->st_mode) == -1) - return -1; - to->st_dev = from->st_dev; - to->st_ino = from->st_ino; - to->st_nlink = from->st_nlink; - to->st_uid = from->st_uid; - to->st_gid = from->st_gid; - to->st_rdev = from->st_rdev; - to->st_size = from->st_size; - to->st_blksize = from->st_blksize; - to->st_blocks = from->st_blocks; - to->st_atime_ = from->st_atime; - to->st_mtime_ = from->st_mtime; - to->st_ctime_ = from->st_ctime; - return 0; -} - -gint32 -Mono_Posix_Syscall_stat (const char *file_name, struct Mono_Posix_Stat *buf) -{ - int r; - struct stat _buf; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - r = stat (file_name, &_buf); - if (r != -1 && copy_stat (buf, &_buf) == -1) - r = -1; - return r; -} - -gint32 -Mono_Posix_Syscall_fstat (int filedes, struct Mono_Posix_Stat *buf) -{ - int r; - struct stat _buf; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - r = fstat (filedes, &_buf); - if (r != -1 && copy_stat (buf, &_buf) == -1) - r = -1; - return r; -} - -gint32 -Mono_Posix_Syscall_lstat (const char *file_name, struct Mono_Posix_Stat *buf) -{ - int r; - struct stat _buf; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - r = lstat (file_name, &_buf); - if (r != -1 && copy_stat (buf, &_buf) == -1) - r = -1; - return r; -} - -gint32 -Mono_Posix_Syscall_mknod (const char *pathname, guint32 mode, mph_dev_t dev) -{ - if (Mono_Posix_FromFilePermissions (mode, &mode) == -1) - return -1; - return mknod (pathname, mode, dev); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-statvfs.c b/support/sys-statvfs.c deleted file mode 100644 index 81680619767..00000000000 --- a/support/sys-statvfs.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include - -#include - -#include "mph.h" -#include "map.h" - -#ifdef HAVE_SYS_STATVFS_H -#include -#endif /* def HAVE_SYS_STATVFS_H */ - -#ifdef HAVE_GETFSSTAT -#include -#include -#include -#include /* for pathconf */ -#endif /* def HAVE_GETFSSTAT */ - -G_BEGIN_DECLS - -struct Mono_Posix_Statvfs { - guint64 f_bsize; /* file system block size */ - guint64 f_frsize; /* fragment size */ - mph_fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ - mph_fsblkcnt_t f_bfree; /* # free blocks */ - mph_fsblkcnt_t f_bavail; /* # free blocks for non-root */ - mph_fsfilcnt_t f_files; /* # inodes */ - mph_fsfilcnt_t f_ffree; /* # free inodes */ - mph_fsfilcnt_t f_favail; /* # free inodes for non-root */ - guint64 f_fsid; /* file system id */ - guint64 f_flag; /* mount flags */ - guint64 f_namemax; /* maximum filename length */ -}; - -#ifdef HAVE_SYS_STATVFS_H -static void -copy_statvfs (struct Mono_Posix_Statvfs *to, struct statvfs *from) -{ - to->f_bsize = from->f_bsize; - to->f_frsize = from->f_frsize; - to->f_blocks = from->f_blocks; - to->f_bfree = from->f_bfree; - to->f_bavail = from->f_bavail; - to->f_files = from->f_files; - to->f_ffree = from->f_ffree; - to->f_favail = from->f_favail; - to->f_fsid = from->f_fsid; - Mono_Posix_ToMountFlags (from->f_flag, &to->f_flag); - to->f_namemax = from->f_namemax; -} -#endif /* ndef HAVE_SYS_STATVFS_H */ - -/* - * System V-compatible definitions - */ - -#ifdef HAVE_STATVFS -gint32 -Mono_Posix_Syscall_statvfs (const char *path, struct Mono_Posix_Statvfs *buf) -{ - struct statvfs s; - int r; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - - if ((r = statvfs (path, &s)) == 0) - copy_statvfs (buf, &s); - - return r; -} -#endif /* ndef HAVA_STATVFS */ - -#ifdef HAVE_FSTATVFS -gint32 -Mono_Posix_Syscall_fstatvfs (gint32 fd, struct Mono_Posix_Statvfs *buf) -{ - struct statvfs s; - int r; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - - if ((r = fstatvfs (fd, &s)) == 0) - copy_statvfs (buf, &s); - - return r; -} -#endif /* ndef HAVA_FSTATVFS */ - -/* - * BSD-compatible definitions. - * - * Linux also provides these, but are deprecated in favor of (f)statvfs. - */ - -#if (defined (HAVE_STATFS) || defined (HAVE_FSTATFS)) && !defined (HAVE_STATVFS) -static void -copy_statfs (struct Mono_Posix_Statvfs *to, struct statfs *from) -{ - to->f_bsize = from->f_bsize; - to->f_frsize = from->f_bsize; - to->f_blocks = from->f_blocks; - to->f_bfree = from->f_bfree; - to->f_bavail = from->f_bavail; - to->f_files = from->f_files; - to->f_ffree = from->f_ffree; - to->f_favail = from->f_ffree; /* OSX doesn't have f_avail */ - Mono_Posix_ToMountFlags (from->f_flags, &to->f_flag); - // from->f_fsid is an int32[2], to->f_fsid is a uint64, - // so this shouldn't lose anything. - memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid)); -} - -static void -set_namemax (const char *path, struct Mono_Posix_Statvfs *buf) -{ - buf->f_namemax = pathconf (path, _PC_NAME_MAX); -} - -static void -set_fnamemax (int fd, struct Mono_Posix_Statvfs *buf) -{ - buf->f_namemax = fpathconf (fd, _PC_NAME_MAX); -} -#endif /* (def HAVE_STATFS || def HAVE_FSTATFS) && !def HAVE_STATVFS */ - -#if !defined (HAVE_STATVFS) && defined (HAVE_STATFS) -gint32 -Mono_Posix_Syscall_statvfs (const char *path, struct Mono_Posix_Statvfs *buf) -{ - struct statfs s; - int r; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - - if ((r = statfs (path, &s)) == 0) { - copy_statfs (buf, &s); - set_namemax (path, buf); - } - - return r; -} -#endif /* !def HAVE_STATVFS && def HAVE_STATFS */ - -#if !defined (HAVE_STATVFS) && defined (HAVE_STATFS) -gint32 -Mono_Posix_Syscall_fstatvfs (gint32 fd, struct Mono_Posix_Statvfs *buf) -{ - struct statfs s; - int r; - - if (buf == NULL) { - errno = EFAULT; - return -1; - } - - if ((r = fstatfs (fd, &s)) == 0) { - copy_statfs (buf, &s); - set_fnamemax (fd, buf); - } - - return r; -} -#endif /* !def HAVE_FSTATVFS && def HAVE_STATFS */ - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-time.c b/support/sys-time.c deleted file mode 100644 index b81f4657ebd..00000000000 --- a/support/sys-time.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include -#include - -#include "map.h" -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Timeval { - /* time_t */ mph_time_t tv_sec; /* seconds */ - /* suseconds_t */ gint64 tv_usec; /* microseconds */ -}; - -struct Mono_Posix_Timezone { - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* ignored */ -}; - -gint32 -Mono_Posix_Syscall_gettimeofday ( - struct Mono_Posix_Timeval *tv, - void *tz) -{ - struct timeval _tv; - struct timezone _tz; - int r; - - r = gettimeofday (&_tv, &_tz); - - if (r == 0) { - if (tv) { - tv->tv_sec = _tv.tv_sec; - tv->tv_usec = _tv.tv_usec; - } - if (tz) { - struct Mono_Posix_Timezone *tz_ = (struct Mono_Posix_Timezone *) tz; - tz_->tz_minuteswest = _tz.tz_minuteswest; - tz_->tz_dsttime = 0; - } - } - - return r; -} - -gint32 -Mono_Posix_Syscall_settimeofday ( - struct Mono_Posix_Timeval *tv, - struct Mono_Posix_Timezone *tz) -{ - struct timeval _tv = {0}; - struct timeval *ptv = NULL; - struct timezone _tz = {0}; - struct timezone *ptz = NULL; - int r; - - if (tv) { - _tv.tv_sec = tv->tv_sec; - _tv.tv_usec = tv->tv_usec; - ptv = &_tv; - } - if (tz) { - _tz.tz_minuteswest = tz->tz_minuteswest; - _tz.tz_dsttime = 0; - ptz = &_tz; - } - - r = settimeofday (ptv, ptz); - - return r; -} - -gint32 -Mono_Posix_Syscall_utimes (const char *filename, - struct Mono_Posix_Timeval *tv) -{ - struct timeval _tv; - struct timeval *ptv = NULL; - - if (tv) { - _tv.tv_sec = tv->tv_sec; - _tv.tv_usec = tv->tv_usec; - ptv = &_tv; - } - - return utimes (filename, ptv); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-wait.c b/support/sys-wait.c deleted file mode 100644 index be2def7bda2..00000000000 --- a/support/sys-wait.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include - -#include - -#include "mph.h" -#include "map.h" - -G_BEGIN_DECLS - -gint32 -Mono_Posix_Syscall_WIFEXITED (gint32 status) -{ - return WIFEXITED (status); -} - -gint32 -Mono_Posix_Syscall_WEXITSTATUS (gint32 status) -{ - return WEXITSTATUS (status); -} - -gint32 -Mono_Posix_Syscall_WIFSIGNALED (gint32 status) -{ - return WIFSIGNALED (status); -} - -gint32 -Mono_Posix_Syscall_WTERMSIG (gint32 status) -{ - return WTERMSIG (status); -} - -gint32 -Mono_Posix_Syscall_WIFSTOPPED (gint32 status) -{ - return WIFSTOPPED (status); -} - -gint32 -Mono_Posix_Syscall_WSTOPSIG (gint32 status) -{ - return WSTOPSIG (status); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/sys-xattr.c b/support/sys-xattr.c deleted file mode 100644 index 7e4cce239c1..00000000000 --- a/support/sys-xattr.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Wrapper functions for (or ) and - * - * Authors: - * Daniel Drake (dsd@gentoo.org) - * - * Copyright (C) 2005 Daniel Drake - */ - -#include - -#if defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_ATTR_H) || defined(HAVE_SYS_EXTATTR_H) - -#include - -/* - * Where available, we prefer to use the libc implementation of the xattr - * syscalls. However, we also support using libattr for this on systems where - * libc does not provide this (e.g. glibc-2.2 and older) - * (configure-time magic is used to select which library to link to) - */ -#ifdef HAVE_SYS_XATTR_H -// libc -#include -#define EA_UNIX -#elif HAVE_ATTR_ATTR_H -// libattr -#include -#define EA_UNIX -#endif /* HAVE_SYS_XATTR_H */ - -#ifdef HAVE_SYS_EXTATTR_H -#include -#include -#define EA_BSD -#endif - -#include -#include -#include -#include -#include - -#include "map.h" -#include "mph.h" - -/* - * Linux provides extended attributes through the API. - * Any file or link can have attributes assigned to it (provided that they are - * supported by the backing filesystem). Each attribute has to be placed in a - * namespace, of which "user" is the most common. Namespaces are specified as - * a prefix to the attribute name, proceeded by a '.' (e.g. user.myattribute) - * - * FreeBSD provides extended attributes through the API. - * Behaviour is very similar to Linux EA's, but the namespace is specified - * through an enum-style parameter rather than as a prefix to an attribute - * name. There are also differences in the behaviour of the "list attributes" - * system calls. - * - * This file merges the two implementations into a single API for use by the - * Mono.Unix.Syscall.*xattr methods. No matter which OS you are on, things - * should "just work" the same as anywhere else. - * - * The API provided here leans more towards the Linux implementation. Attribute - * namespaces are provided as prefixes to the attribute name (followed by '.'). - * There is no limit to the namespaces accepted by the Linux side of this - * implementation, but you are obviously limited to the ones available to you - * on the system. - * FreeBSD namespaces have to be converted from the textual prefix into their - * relevant number so that they can be used in the FreeBSD system calls. - * This means that the only namespaces available are the ones known by in this - * file (see bsd_extattr_namespaces). However, you can also specify the - * numericalnamespace index yourself, by using an attribute name such as - * "5.myattr". - * (this will obviously fail on Linux, your code will no longer be 'portable') - * - * Linux {,l,f}setxattr calls have a flags parameter which allow you to control - * what should happen if an attribute with the same name does (or doesn't) - * already exist. The 'flags' parameter is available here, but because FreeBSD - * does not support this kind of refinement, it will fail on FreeBSD if you - * specify anything other than XATTR_AUTO (XATTR_AUTO will create the attribute - * if it doesn't already exist, and overwrite the existing attribute if it - * already set). - * - * For usage and behaviour information, see the monodoc documentation on the - * Mono.Unix.Syscall class. - */ - -G_BEGIN_DECLS - -// -// HELPER FUNCTIONS -// - -#ifdef EA_BSD - -struct BsdNamespaceInfo { - const char *name; - int value; -}; - -static struct BsdNamespaceInfo bsd_extattr_namespaces[] = { - {"user" , EXTATTR_NAMESPACE_USER}, - {"system" , EXTATTR_NAMESPACE_SYSTEM} -}; - -static int bsd_check_flags (gint32 flags) -{ - // BSD doesn't support flags, but always provides the same behaviour as - // XATTR_AUTO. So we enforce that here. - if (flags != Mono_Posix_XattrFlags_XATTR_AUTO) { - errno = EINVAL; - return -1; - } - return 0; -} - -// On FreeBSD, we need to convert "user.blah" into namespace 1 and attribute -// name "blah", or maybe "6.blah" into namespace 6 attribute "blah" -static int -bsd_handle_nsprefix (const char *name, char **_name, int *namespace) -{ - int i; - gchar **components = g_strsplit (name, ".", 2); - - // Find namespace number from textual representation - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) - if (strcmp (bsd_extattr_namespaces[i].name, components[0]) == 0) { - *namespace = bsd_extattr_namespaces[i].value; - break; - } - - if (*namespace == 0) { - // Perhaps they specified the namespace number themselves..? - char *endptr; - *namespace = (int) strtol (components[0], &endptr, 10); - if (*endptr != '\0') - return -1; - } - - *_name = g_strdup (components[1]); - g_strfreev (components); - return 0; -} - -static void -init_attrlists (char *attrlists[]) -{ - memset (attrlists, 0, G_N_ELEMENTS(bsd_extattr_namespaces) * sizeof(char*)); -} - -static void -free_attrlists (char *attrlists[]) -{ - int i; - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) - g_free (attrlists[i]); -} - -// Counts the number of attributes in the result of a -// extattr_list_*() call. Note that the format of the data -// is: \3one\3two\6eleven where the leading charaters represent the length -// of the following attribute. (the description in the man-page is wrong) -static unsigned int -count_num_attrs (char *attrs, size_t size) -{ - size_t i = 0; - unsigned int num_attrs = 0; - - if (!attrs || !size) - return 0; - - while (i < size) { - num_attrs++; - i += attrs[i] + 1; - } - - return num_attrs; -} - -// Convert a BSD-style list buffer (see the description for count_num_attrs) -// into a Linux-style NULL-terminated list including namespace prefix. -static char -*bsd_convert_list (const char *nsprefix, const char *src, size_t size, char *dest) -{ - size_t i = 0; - if (src == NULL || dest == NULL || size == 0) - return NULL; - - while (i < size) { - // Read length - int attr_len = (int) src[i]; - int prefix_len = strlen (nsprefix); - - // Add namespace prefix - strncpy (dest, nsprefix, prefix_len); - dest[prefix_len] = '.'; - dest += prefix_len + 1; - - // Copy attribute - memcpy(dest, src + ++i, attr_len); - - // NULL-terminate - i += attr_len; - dest[attr_len] = '\0'; - dest += attr_len + 1; - } - - return dest; -} - -// Combine all the lists of attributes that we know about into a single -// Linux-style buffer -static ssize_t -bsd_combine_lists (char *attrlists[], char *dest, size_t dest_size_needed, size_t dest_size) -{ - int i; - if (!dest) - return dest_size_needed; - - if (dest_size < dest_size_needed) { - errno = ERANGE; - return -1; - } - - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) - if (attrlists[i]) - dest = bsd_convert_list (bsd_extattr_namespaces[i].name, attrlists[i], strlen (attrlists[i]), dest); - - return dest_size_needed; -} - -static mph_ssize_t -bsd_listxattr (const char *path, void *list, mph_size_t size) -{ - size_t full_size = 0; - int i; - char *attrlists[G_N_ELEMENTS(bsd_extattr_namespaces)]; - - init_attrlists (attrlists); - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) { - size_t buf_size; - int num_attrs; - - buf_size = (size_t) extattr_list_file (path, i + 1, NULL, 0); - if (buf_size == -1) - continue; - - attrlists[i] = g_malloc0 (buf_size + 1); - buf_size = (size_t) extattr_list_file (path, i + 1, attrlists[i], buf_size); - if (buf_size == -1) - continue; - - num_attrs = count_num_attrs(attrlists[i], buf_size); - full_size += buf_size + (num_attrs * (strlen (bsd_extattr_namespaces[i].name) + 1)); - } - - full_size = bsd_combine_lists (attrlists, (char *) list, full_size, size); - free_attrlists (attrlists); - return full_size; -} - -static mph_ssize_t -bsd_llistxattr (const char *path, void *list, mph_size_t size) -{ - size_t full_size = 0; - int i; - char *attrlists[G_N_ELEMENTS(bsd_extattr_namespaces)]; - - init_attrlists (attrlists); - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) { - size_t buf_size; - int num_attrs; - - buf_size = (size_t) extattr_list_link (path, i + 1, NULL, 0); - if (buf_size == -1) - continue; - - attrlists[i] = g_malloc0 (buf_size + 1); - buf_size = (size_t) extattr_list_link (path, i + 1, attrlists[i], buf_size); - if (buf_size == -1) - continue; - - num_attrs = count_num_attrs(attrlists[i], buf_size); - full_size += buf_size + (num_attrs * (strlen (bsd_extattr_namespaces[i].name) + 1)); - } - - full_size = bsd_combine_lists (attrlists, (char *) list, full_size, size); - free_attrlists (attrlists); - return full_size; -} - -static mph_ssize_t -bsd_flistxattr (int fd, void *list, mph_size_t size) -{ - size_t full_size = 0; - int i; - char *attrlists[G_N_ELEMENTS(bsd_extattr_namespaces)]; - - init_attrlists (attrlists); - for (i = 0; i < G_N_ELEMENTS(bsd_extattr_namespaces); i++) { - size_t buf_size; - int num_attrs; - - buf_size = (size_t) extattr_list_fd (fd, i + 1, NULL, 0); - if (buf_size == -1) - continue; - - attrlists[i] = g_malloc0 (buf_size + 1); - buf_size = (size_t) extattr_list_fd (fd, i + 1, attrlists[i], buf_size); - if (buf_size == -1) - continue; - - num_attrs = count_num_attrs(attrlists[i], buf_size); - full_size += buf_size + (num_attrs * (strlen (bsd_extattr_namespaces[i].name) + 1)); - } - - full_size = bsd_combine_lists (attrlists, (char *) list, full_size, size); - free_attrlists (attrlists); - return full_size; -} - -#endif /* EA_BSD */ - -// -// THE PROVIDED API -// - -gint32 -Mono_Posix_Syscall_setxattr (const char *path, const char *name, void *value, mph_size_t size, gint32 flags) -{ - gint32 ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX - { - int _flags; - if (Mono_Posix_FromXattrFlags (flags, &_flags) == -1) - return -1; -#if __APPLE__ - ret = setxattr (path, name, value, (size_t) size, 0, _flags); -#else /* __APPLE__ */ - ret = setxattr (path, name, value, (size_t) size, _flags); -#endif /* __APPLE__ */ - } -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_check_flags (flags) == -1) - return -1; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_set_file (path, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -#if !__APPLE__ -gint32 -Mono_Posix_Syscall_lsetxattr (const char *path, const char *name, void *value, mph_size_t size, gint32 flags) -{ - gint32 ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX - { - int _flags; - if (Mono_Posix_FromXattrFlags (flags, &_flags) == -1) - return -1; - ret = lsetxattr (path, name, value, size, _flags); - } -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_check_flags (flags) == -1) - return -1; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_set_link (path, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} -#endif /* !__APPLE__ */ - -gint32 -Mono_Posix_Syscall_fsetxattr (int fd, const char *name, void *value, mph_size_t size, gint32 flags) -{ - gint32 ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX - { - int _flags; - if (Mono_Posix_FromXattrFlags (flags, &_flags) == -1) - return -1; -#if __APPLE__ - ret = fsetxattr (fd, name, value, (size_t) size, 0, _flags); -#else /* __APPLE__ */ - ret = fsetxattr (fd, name, value, (size_t) size, _flags); -#endif /* __APPLE__ */ - } -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_check_flags (flags) == -1) - return -1; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_set_fd (fd, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -mph_ssize_t -Mono_Posix_Syscall_getxattr (const char *path, const char *name, void *value, mph_size_t size) -{ - mph_ssize_t ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX -#if __APPLE__ - ret = getxattr (path, name, value, (size_t) size, 0, 0); -#else /* __APPLE__ */ - ret = getxattr (path, name, value, (size_t) size); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_get_file (path, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -#if !__APPLE__ -mph_ssize_t -Mono_Posix_Syscall_lgetxattr (const char *path, const char *name, void *value, mph_size_t size) -{ - mph_ssize_t ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX - ret = lgetxattr (path, name, value, (size_t) size); -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_get_link (path, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} -#endif /* !__APPLE__ */ - -mph_ssize_t -Mono_Posix_Syscall_fgetxattr (int fd, const char *name, void *value, mph_size_t size) -{ - mph_ssize_t ret; - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX -#if __APPLE__ - ret = fgetxattr (fd, name, value, (size_t) size, 0, 0); -#else /* __APPLE__ */ - ret = fgetxattr (fd, name, value, (size_t) size); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_get_fd (fd, namespace, _name, value, (size_t) size); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -mph_ssize_t -Mono_Posix_Syscall_listxattr (const char *path, void *list, mph_size_t size) -{ - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX -#if __APPLE__ - return listxattr (path, list, (size_t) size, 0); -#else /* __APPLE__ */ - return listxattr (path, list, (size_t) size); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - return bsd_listxattr (path, list, size); -#endif /* EA_UNIX */ -} - -#if !__APPLE__ -mph_ssize_t -Mono_Posix_Syscall_llistxattr (const char *path, void *list, mph_size_t size) -{ - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX - return llistxattr (path, list, (size_t) size); -#else /* EA_UNIX */ - return bsd_llistxattr (path, list, size); -#endif /* EA_UNIX */ -} -#endif /* !__APPLE__ */ - -mph_ssize_t -Mono_Posix_Syscall_flistxattr (int fd, void *list, mph_size_t size) -{ - mph_return_if_size_t_overflow (size); - -#ifdef EA_UNIX -#if __APPLE__ - return flistxattr (fd, list, (size_t) size, 0); -#else /* __APPLE__ */ - return flistxattr (fd, list, (size_t) size); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - return bsd_flistxattr (fd, list, size); -#endif /* EA_UNIX */ -} - -gint32 -Mono_Posix_Syscall_removexattr (const char *path, const char *name) -{ - gint32 ret; - -#ifdef EA_UNIX -#if __APPLE__ - ret = removexattr (path, name, 0); -#else /* __APPLE__ */ - ret = removexattr (path, name); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_delete_file (path, namespace, _name); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -#if !__APPLE__ -gint32 -Mono_Posix_Syscall_lremovexattr (const char *path, const char *name) -{ - gint32 ret; - -#ifdef EA_UNIX - ret = lremovexattr (path, name); -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_delete_link (path, namespace, _name); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} -#endif /* !__APPLE__ */ - -gint32 -Mono_Posix_Syscall_fremovexattr (int fd, const char *name) -{ - gint32 ret; - -#ifdef EA_UNIX -#if __APPLE__ - ret = fremovexattr (fd, name, 0); -#else /* __APPLE__ */ - ret = fremovexattr (fd, name); -#endif /* __APPLE__ */ -#else /* EA_UNIX */ - { - char *_name; - int namespace; - if (bsd_handle_nsprefix (name, &_name, &namespace) == -1) - return -1; - ret = extattr_delete_fd (fd, namespace, _name); - g_free (_name); - } -#endif /* EA_UNIX */ - - return ret; -} - -G_END_DECLS - -#endif /* HAVE_SYS_XATTR_H || HAVE_ATTR_ATTR_H || HAVE_SYS_EXTATTR_H */ - -/* - * vim: noexpandtab - */ diff --git a/support/time.c b/support/time.c deleted file mode 100644 index 71bbae9d037..00000000000 --- a/support/time.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#define _SVID_SOURCE -#include -#include - -#include "mph.h" -#include - -G_BEGIN_DECLS - -#ifdef HAVE_STIME -gint32 -Mono_Posix_Syscall_stime (mph_time_t *t) -{ - time_t _t; - if (t == NULL) { - errno = EFAULT; - return -1; - } - mph_return_if_time_t_overflow (*t); - _t = (time_t) *t; - return stime (&_t); -} -#endif /* ndef HAVE_STIME */ - -mph_time_t -Mono_Posix_Syscall_time (mph_time_t *t) -{ - time_t _t, r; - if (t == NULL) { - errno = EFAULT; - return -1; - } - - mph_return_if_time_t_overflow (*t); - - _t = (time_t) *t; - r = time (&_t); - *t = _t; - - return r; -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/unistd.c b/support/unistd.c deleted file mode 100644 index 0de6f228534..00000000000 --- a/support/unistd.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif /* ndef _GNU_SOURCE */ - -#include -#include -#include -#include -#include -#include -#include /* for swab(3) on Mac OS X */ - -#include "map.h" -#include "mph.h" - -G_BEGIN_DECLS - -mph_off_t -Mono_Posix_Syscall_lseek (gint32 fd, mph_off_t offset, gint32 whence) -{ - mph_return_if_off_t_overflow (offset); - - return lseek (fd, offset, whence); -} - -mph_ssize_t -Mono_Posix_Syscall_read (gint32 fd, void *buf, mph_size_t count) -{ - mph_return_if_size_t_overflow (count); - return read (fd, buf, (size_t) count); -} - -mph_ssize_t -Mono_Posix_Syscall_write (gint32 fd, void *buf, mph_size_t count) -{ - mph_return_if_size_t_overflow (count); - return write (fd, buf, (size_t) count); -} - -mph_ssize_t -Mono_Posix_Syscall_pread (gint32 fd, void *buf, mph_size_t count, mph_off_t offset) -{ - mph_return_if_size_t_overflow (count); - mph_return_if_off_t_overflow (offset); - - return pread (fd, buf, (size_t) count, (off_t) offset); -} - -mph_ssize_t -Mono_Posix_Syscall_pwrite (gint32 fd, void *buf, mph_size_t count, mph_off_t offset) -{ - mph_return_if_size_t_overflow (count); - mph_return_if_off_t_overflow (offset); - - return pwrite (fd, buf, (size_t) count, (off_t) offset); -} - -gint32 -Mono_Posix_Syscall_pipe (gint32 *reading, gint32 *writing) -{ - int filedes[2] = {-1, -1}; - int r; - - if (reading == NULL || writing == NULL) { - errno = EFAULT; - return -1; - } - - r = pipe (filedes); - - *reading = filedes[0]; - *writing = filedes[1]; - return r; -} - -void* -Mono_Posix_Syscall_getcwd (char *buf, mph_size_t size) -{ - mph_return_val_if_size_t_overflow (size, NULL); - return getcwd (buf, (size_t) size); -} - -gint64 -Mono_Posix_Syscall_fpathconf (int filedes, int name) -{ - if (Mono_Posix_FromPathConf (name, &name) == -1) - return -1; - return fpathconf (filedes, name); -} - -gint64 -Mono_Posix_Syscall_pathconf (const char *path, int name) -{ - if (Mono_Posix_FromPathConf (name, &name) == -1) - return -1; - return pathconf (path, name); -} - -gint64 -Mono_Posix_Syscall_sysconf (int name) -{ - if (Mono_Posix_FromSysConf (name, &name) == -1) - return -1; - return sysconf (name); -} - -mph_size_t -Mono_Posix_Syscall_confstr (int name, char *buf, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - if (Mono_Posix_FromConfStr (name, &name) == -1) - return -1; - return confstr (name, buf, (size_t) len); -} - -#ifdef HAVE_TTYNAME_R -gint32 -Mono_Posix_Syscall_ttyname_r (int fd, char *buf, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return ttyname_r (fd, buf, (size_t) len); -} -#endif /* ndef HAVE_TTYNAME_R */ - -gint32 -Mono_Posix_Syscall_readlink (const char *path, char *buf, mph_size_t len) -{ - int r; - mph_return_if_size_t_overflow (len); - r = readlink (path, buf, (size_t) len); - if (r >= 0 && r < len) - buf [r] = '\0'; - return r; -} - -gint32 -Mono_Posix_Syscall_getlogin_r (char *buf, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return getlogin_r (buf, (size_t) len); -} - -gint32 -Mono_Posix_Syscall_gethostname (char *buf, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return gethostname (buf, (size_t) len); -} - -gint32 -Mono_Posix_Syscall_sethostname (const char *name, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return sethostname (name, (size_t) len); -} - -gint64 -Mono_Posix_Syscall_gethostid (void) -{ - return gethostid (); -} - -#ifdef HAVE_SETHOSTID -gint32 -Mono_Posix_Syscall_sethostid (gint64 hostid) -{ - mph_return_if_long_overflow (hostid); -#ifdef MPH_ON_BSD - sethostid ((long) hostid); - return 0; -#else - return sethostid ((long) hostid); -#endif -} -#endif /* def HAVE_SETHOSTID */ - -#ifdef HAVE_GETDOMAINNAME -gint32 -Mono_Posix_Syscall_getdomainname (char *name, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return getdomainname (name, (size_t) len); -} -#endif /* def HAVE_GETDOMAINNAME */ - -#ifdef HAVE_SETDOMAINNAME -gint32 -Mono_Posix_Syscall_setdomainname (const char *name, mph_size_t len) -{ - mph_return_if_size_t_overflow (len); - return setdomainname (name, (size_t) len); -} -#endif /* def HAVE_SETDOMAINNAME */ - -gint32 -Mono_Posix_Syscall_truncate (const char *path, mph_off_t length) -{ - mph_return_if_off_t_overflow (length); - return truncate (path, (off_t) length); -} - -gint32 -Mono_Posix_Syscall_ftruncate (int fd, mph_off_t length) -{ - mph_return_if_off_t_overflow (length); - return ftruncate (fd, (off_t) length); -} - -gint32 -Mono_Posix_Syscall_lockf (int fd, int cmd, mph_off_t len) -{ - mph_return_if_off_t_overflow (len); - if (Mono_Posix_FromLockfCommand (cmd, &cmd) == -1) - return -1; - return lockf (fd, cmd, (off_t) len); -} - -void -Mono_Posix_Syscall_swab (void *from, void *to, mph_ssize_t n) -{ - if (mph_have_long_overflow (n)) - return; - swab (from, to, (ssize_t) n); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/utime.c b/support/utime.c deleted file mode 100644 index dd908c7aba9..00000000000 --- a/support/utime.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * wrapper functions. - * - * Authors: - * Jonathan Pryor (jonpryor@vt.edu) - * - * Copyright (C) 2004 Jonathan Pryor - */ - -#include -#include - -#include "mph.h" - -G_BEGIN_DECLS - -struct Mono_Posix_Utimbuf { - /* time_t */ mph_time_t actime; /* access time */ - /* time_t */ mph_time_t modtime; /* modification time */ -}; - -gint32 -Mono_Posix_Syscall_utime (const char *filename, struct Mono_Posix_Utimbuf *buf, - int use_buf) -{ - struct utimbuf _buf; - struct utimbuf *pbuf = NULL; - - if (buf && use_buf) { - _buf.actime = buf->actime; - _buf.modtime = buf->modtime; - pbuf = &_buf; - } - - return utime (filename, pbuf); -} - -G_END_DECLS - -/* - * vim: noexpandtab - */ diff --git a/support/x-struct-str.c b/support/x-struct-str.c deleted file mode 100644 index 68925ed2cf8..00000000000 --- a/support/x-struct-str.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * A helper routine to copy the strings between differing structures. - */ - -#include -#include -#include - -#include "mph.h" - -#define MAX_OFFSETS 10 - -#define str_at(p, n) (*(char**)(((char*)p)+n)) - -char* MPH_INTERNAL -_mph_copy_structure_strings ( - void *to, const size_t *to_offsets, - const void *from, const size_t *from_offsets, - size_t num_strings) -{ - int i; - size_t buflen; - int len[MAX_OFFSETS]; - char *buf, *cur = NULL; - - g_assert (num_strings < MAX_OFFSETS); - - for (i = 0; i < num_strings; ++i) { - str_at (to, to_offsets[i]) = NULL; - } - - buflen = num_strings; - for (i = 0; i < num_strings; ++i) { - len[i] = strlen (str_at(from, from_offsets[i])); - if (len[i] < INT_MAX - buflen) - buflen += len[i]; - else - len[i] = -1; - } - - cur = buf = malloc (buflen); - if (buf == NULL) { - return NULL; - } - - for (i = 0; i < num_strings; ++i) { - if (len[i] > 0) { - str_at (to, to_offsets[i]) = - strcpy (cur, str_at (from, from_offsets[i])); - cur += (len[i] +1); - } - } - - return buf; -} - -#ifdef TEST - -#include - -struct foo { - char *a; - int b; - char *c; -}; - -struct bar { - int b; - char *a; - double d; - char *c; -}; - -int -main () -{ - /* test copying foo to bar */ - struct foo f = {"hello", 42, "world"}; - struct bar b; - size_t foo_offsets[] = {offsetof(struct foo, a), offsetof(struct foo, c)}; - size_t bar_offsets[] = {offsetof(struct bar, a), offsetof(struct bar, c)}; - char *buf; - - buf = _mph_copy_structure_strings (&b, bar_offsets, - &f, foo_offsets, 2); - printf ("b.a=%s\n", b.a); - printf ("b.c=%s\n", b.c); - - return 0; -} -#endif - diff --git a/support/zlib_macros.c b/support/zlib_macros.c deleted file mode 100644 index dc851a7f6c2..00000000000 --- a/support/zlib_macros.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Helper routines to use Zlib - * - * Author: - * Christopher Lahey (clahey@ximian.co) - * - * (C) 2004 Novell, Inc. - */ -#include -#include - -z_stream * -create_z_stream(int compress, unsigned char gzip) -{ - z_stream *z; - int retval; - -#if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204) - /* Older versions of zlib do not support raw deflate or gzip */ - return NULL; -#endif - - z = malloc (sizeof (z_stream)); - z->next_in = Z_NULL; - z->avail_in = 0; - z->next_out = Z_NULL; - z->avail_out = 0; - z->zalloc = Z_NULL; - z->zfree = Z_NULL; - z->opaque = NULL; - if (compress) { - retval = deflateInit2 (z, Z_DEFAULT_COMPRESSION, Z_DEFLATED, gzip ? 31 : -15, 8, Z_DEFAULT_STRATEGY); - } else { - retval = inflateInit2 (z, gzip ? 31 : -15); - } - - if (retval == Z_OK) - return z; - - free (z); - return NULL; -} - -void -free_z_stream(z_stream *z, int compress) -{ - if (compress) { - deflateEnd (z); - } else { - inflateEnd (z); - } - free (z); -} - -void -z_stream_set_next_in(z_stream *z, unsigned char *next_in) -{ - z->next_in = next_in; -} - -void -z_stream_set_avail_in(z_stream *z, int avail_in) -{ - z->avail_in = avail_in; -} - -int -z_stream_get_avail_in(z_stream *z) -{ - return z->avail_in; -} - -void -z_stream_set_next_out(z_stream *z, unsigned char *next_out) -{ - z->next_out = next_out; -} - -void -z_stream_set_avail_out(z_stream *z, int avail_out) -{ - z->avail_out = avail_out; -} - -int -z_stream_deflate (z_stream *z, int flush, unsigned char *next_out, int *avail_out) -{ - int ret_val; - - z->next_out = next_out; - z->avail_out = *avail_out; - - ret_val = deflate (z, flush); - - *avail_out = z->avail_out; - - return ret_val; -} - -int -z_stream_inflate (z_stream *z, int *avail_out) -{ - int ret_val; - - z->avail_out = *avail_out; - - ret_val = inflate (z, Z_NO_FLUSH); - - *avail_out = z->avail_out; - - return ret_val; -} -- 2.25.1