Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / support / map.c
index 5c4298d36c53b96a41f557e6cd6da1e9b4dcf9af..a0580964684a6c532f2f9378dd11e31005a21ee7 100644 (file)
 /*
- * This file was automatically generated by make-map from ../../mcs/class/lib/default/Mono.Posix.dll.
+ * This file was automatically generated by create-native-map from ../mcs/class/lib/net_4_x/Mono.Posix.dll.
  *
  * DO NOT MODIFY.
  */
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif /* ndef HAVE_CONFIG_H */
 
-#include "map.h"
+#include <stdlib.h>
+#include <string.h>
 
+/*
+ * Implementation Macros
+ */
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif /* ndef _GNU_SOURCE */
+
 #ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE
 #endif /* ndef _XOPEN_SOURCE */
+
+
+/*
+ * Implementation Includes
+ */
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif /* ndef HAVE_NETINET_IN_H */
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* ndef HAVE_SYS_TIME_H */
 #ifdef HAVE_SYS_POLL_H
 #include <sys/poll.h>
-#endif
+#endif /* ndef HAVE_SYS_POLL_H */
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
-#endif
+#endif /* ndef HAVE_SYS_WAIT_H */
 #ifdef HAVE_SYS_STATVFS_H
 #include <sys/statvfs.h>
-#endif
+#endif /* ndef HAVE_SYS_STATVFS_H */
 #ifdef HAVE_SYS_XATTR_H
 #include <sys/xattr.h>
-#endif
+#endif /* ndef HAVE_SYS_XATTR_H */
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
-#endif
+#endif /* ndef HAVE_SYS_MMAN_H */
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif /* ndef HAVE_SYS_SOCKET_H */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif /* ndef HAVE_SYS_UIO_H */
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif /* ndef HAVE_UNISTD_H */
 #include <fcntl.h>
 #include <signal.h>
 #ifdef HAVE_POLL_H
 #include <poll.h>
-#endif
+#endif /* ndef HAVE_POLL_H */
 #ifdef HAVE_GRP_H
 #include <grp.h>
-#endif
+#endif /* ndef HAVE_GRP_H */
 #include <errno.h>
 #ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#endif /* ndef HAVE_SYSLOG_H */
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif /* ndef HAVE_DIRENT_H */
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif /* ndef HAVE_UTIME_H */
+#include <time.h>
+#include "mph.h"
+
+#include "map.h"
+
+#include <errno.h>    /* errno, EOVERFLOW */
+#include <glib.h>     /* g* types, g_assert_not_reached() */
+
+#if defined (G_MININT8)
+#define CNM_MININT8 G_MININT8
+#else
+#define CNM_MININT8 (-128)
+#endif
+
+#if defined (G_MAXINT8)
+#define CNM_MAXINT8 G_MAXINT8
+#else
+#define CNM_MAXINT8 (127)
+#endif
+
+#if defined (G_MAXUINT8)
+#define CNM_MAXUINT8 G_MAXUINT8
+#else
+#define CNM_MAXUINT8 (255)
+#endif
+
+#if defined (G_MININT16)
+#define CNM_MININT16 G_MININT16
+#else
+#define CNM_MININT16 (-32768)
+#endif
+
+#if defined (G_MAXINT16)
+#define CNM_MAXINT16 G_MAXINT16
+#else
+#define CNM_MAXINT16 (32767)
+#endif
+
+#if defined (G_MAXUINT16)
+#define CNM_MAXUINT16 G_MAXUINT16
+#else
+#define CNM_MAXUINT16 (65535)
+#endif
+
+#if defined (G_MININT32)
+#define CNM_MININT32 G_MININT32
+#else
+#define CNM_MININT32 (-2147483648)
+#endif
+
+#if defined (G_MAXINT32)
+#define CNM_MAXINT32 G_MAXINT32
+#else
+#define CNM_MAXINT32 (2147483647)
+#endif
+
+#if defined (G_MAXUINT32)
+#define CNM_MAXUINT32 G_MAXUINT32
+#else
+#define CNM_MAXUINT32 (4294967295U)
+#endif
+
+#if defined (G_MININT64)
+#define CNM_MININT64 G_MININT64
+#else
+#define CNM_MININT64 (-9223372036854775808LL)
+#endif
+
+#if defined (G_MAXINT64)
+#define CNM_MAXINT64 G_MAXINT64
+#else
+#define CNM_MAXINT64 (9223372036854775807LL)
+#endif
+
+#if defined (G_MAXUINT64)
+#define CNM_MAXUINT64 G_MAXUINT64
+#else
+#define CNM_MAXUINT64 (18446744073709551615ULL)
 #endif
 
-int Mono_Posix_FromAccessMode (int x, int *r)
+
+/* returns TRUE if @type is an unsigned type */
+#define _cnm_integral_type_is_unsigned(type) \
+    (sizeof(type) == sizeof(gint8)           \
+      ? (((type)-1) > CNM_MAXINT8)             \
+      : sizeof(type) == sizeof(gint16)       \
+        ? (((type)-1) > CNM_MAXINT16)          \
+        : sizeof(type) == sizeof(gint32)     \
+          ? (((type)-1) > CNM_MAXINT32)        \
+          : sizeof(type) == sizeof(gint64)   \
+            ? (((type)-1) > CNM_MAXINT64)      \
+            : (g_assert_not_reached (), 0))
+
+/* returns the minimum value of @type as a gint64 */
+#define _cnm_integral_type_min(type)          \
+    (_cnm_integral_type_is_unsigned (type)    \
+      ? 0                                     \
+      : sizeof(type) == sizeof(gint8)         \
+        ? CNM_MININT8                           \
+        : sizeof(type) == sizeof(gint16)      \
+          ? CNM_MININT16                        \
+          : sizeof(type) == sizeof(gint32)    \
+            ? CNM_MININT32                      \
+            : sizeof(type) == sizeof(gint64)  \
+              ? CNM_MININT64                    \
+              : (g_assert_not_reached (), 0))
+
+/* returns the maximum value of @type as a guint64 */
+#define _cnm_integral_type_max(type)            \
+    (_cnm_integral_type_is_unsigned (type)      \
+      ? sizeof(type) == sizeof(gint8)           \
+        ? CNM_MAXUINT8                            \
+        : sizeof(type) == sizeof(gint16)        \
+          ? CNM_MAXUINT16                         \
+          : sizeof(type) == sizeof(gint32)      \
+            ? CNM_MAXUINT32                       \
+            : sizeof(type) == sizeof(gint64)    \
+              ? CNM_MAXUINT64                     \
+              : (g_assert_not_reached (), 0)    \
+      : sizeof(type) == sizeof(gint8)           \
+          ? CNM_MAXINT8                           \
+          : sizeof(type) == sizeof(gint16)      \
+            ? CNM_MAXINT16                        \
+            : sizeof(type) == sizeof(gint32)    \
+              ? CNM_MAXINT32                      \
+              : sizeof(type) == sizeof(gint64)  \
+                ? CNM_MAXINT64                    \
+                : (g_assert_not_reached (), 0))
+
+#ifdef _CNM_DUMP
+#define _cnm_dump(to_t,from)                                             \
+  printf ("# %s -> %s: uns=%i; min=%llx; max=%llx; value=%llx; lt=%i; l0=%i; gt=%i; e=%i\n", \
+    #from, #to_t,                                                        \
+    (int) _cnm_integral_type_is_unsigned (to_t),                         \
+    (gint64) (_cnm_integral_type_min (to_t)),                            \
+    (gint64) (_cnm_integral_type_max (to_t)),                            \
+    (gint64) (from),                                                     \
+    (((gint64) _cnm_integral_type_min (to_t)) <= (gint64) from),         \
+    (from < 0),                                                          \
+    (((guint64) from) <= (guint64) _cnm_integral_type_max (to_t)),       \
+    !((int) _cnm_integral_type_is_unsigned (to_t)                        \
+      ? ((0 <= from) &&                                                  \
+         ((guint64) from <= (guint64) _cnm_integral_type_max (to_t)))    \
+      : ((gint64) _cnm_integral_type_min(to_t) <= (gint64) from &&       \
+         (guint64) from <= (guint64) _cnm_integral_type_max (to_t)))     \
+  )
+#else /* ndef _CNM_DUMP */
+#define _cnm_dump(to_t, from) do {} while (0)
+#endif /* def _CNM_DUMP */
+
+#ifdef DEBUG
+#define _cnm_return_val_if_overflow(to_t,from,val)  G_STMT_START {   \
+    int     uns = _cnm_integral_type_is_unsigned (to_t);             \
+    gint64  min = (gint64)  _cnm_integral_type_min (to_t);           \
+    guint64 max = (guint64) _cnm_integral_type_max (to_t);           \
+    gint64  sf  = (gint64)  from;                                    \
+    guint64 uf  = (guint64) from;                                    \
+    if (!(uns ? ((0 <= from) && (uf <= max))                         \
+              : (min <= sf && (from < 0 || uf <= max)))) {           \
+      _cnm_dump(to_t, from);                                         \
+      errno = EOVERFLOW;                                             \
+      return (val);                                                  \
+    }                                                                \
+  } G_STMT_END
+#else /* !def DEBUG */
+/* don't do any overflow checking */
+#define _cnm_return_val_if_overflow(to_t,from,val)  G_STMT_START {   \
+  } G_STMT_END
+#endif /* def DEBUG */
+
+int Mono_Posix_FromAccessModes (int x, int *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
-       if ((x & Mono_Posix_AccessMode_F_OK) == Mono_Posix_AccessMode_F_OK)
+       if ((x & Mono_Posix_AccessModes_F_OK) == Mono_Posix_AccessModes_F_OK)
 #ifdef F_OK
                *r |= F_OK;
 #else /* def F_OK */
                {errno = EINVAL; return -1;}
 #endif /* ndef F_OK */
-       if ((x & Mono_Posix_AccessMode_R_OK) == Mono_Posix_AccessMode_R_OK)
+       if ((x & Mono_Posix_AccessModes_R_OK) == Mono_Posix_AccessModes_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)
+       if ((x & Mono_Posix_AccessModes_W_OK) == Mono_Posix_AccessModes_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)
+       if ((x & Mono_Posix_AccessModes_X_OK) == Mono_Posix_AccessModes_X_OK)
 #ifdef X_OK
                *r |= X_OK;
 #else /* def X_OK */
                {errno = EINVAL; return -1;}
 #endif /* ndef X_OK */
+       if (x == 0)
+               return 0;
        return 0;
 }
 
-int Mono_Posix_ToAccessMode (int x, int *r)
+int Mono_Posix_ToAccessModes (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
 #ifdef F_OK
        if ((x & F_OK) == F_OK)
-               *r |= Mono_Posix_AccessMode_F_OK;
+               *r |= Mono_Posix_AccessModes_F_OK;
 #endif /* ndef F_OK */
 #ifdef R_OK
        if ((x & R_OK) == R_OK)
-               *r |= Mono_Posix_AccessMode_R_OK;
+               *r |= Mono_Posix_AccessModes_R_OK;
 #endif /* ndef R_OK */
 #ifdef W_OK
        if ((x & W_OK) == W_OK)
-               *r |= Mono_Posix_AccessMode_W_OK;
+               *r |= Mono_Posix_AccessModes_W_OK;
 #endif /* ndef W_OK */
 #ifdef X_OK
        if ((x & X_OK) == X_OK)
-               *r |= Mono_Posix_AccessMode_X_OK;
+               *r |= Mono_Posix_AccessModes_X_OK;
 #endif /* ndef X_OK */
        return 0;
 }
 
-int Mono_Posix_FromConfStr (int x, int *r)
+int Mono_Posix_FromAtFlags (int x, int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_AtFlags_AT_EMPTY_PATH) == Mono_Posix_AtFlags_AT_EMPTY_PATH)
+#ifdef AT_EMPTY_PATH
+               *r |= AT_EMPTY_PATH;
+#else /* def AT_EMPTY_PATH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AT_EMPTY_PATH */
+       if ((x & Mono_Posix_AtFlags_AT_NO_AUTOMOUNT) == Mono_Posix_AtFlags_AT_NO_AUTOMOUNT)
+#ifdef AT_NO_AUTOMOUNT
+               *r |= AT_NO_AUTOMOUNT;
+#else /* def AT_NO_AUTOMOUNT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AT_NO_AUTOMOUNT */
+       if ((x & Mono_Posix_AtFlags_AT_REMOVEDIR) == Mono_Posix_AtFlags_AT_REMOVEDIR)
+#ifdef AT_REMOVEDIR
+               *r |= AT_REMOVEDIR;
+#else /* def AT_REMOVEDIR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AT_REMOVEDIR */
+       if ((x & Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW)
+#ifdef AT_SYMLINK_FOLLOW
+               *r |= AT_SYMLINK_FOLLOW;
+#else /* def AT_SYMLINK_FOLLOW */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AT_SYMLINK_FOLLOW */
+       if ((x & Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW) == Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW)
+#ifdef AT_SYMLINK_NOFOLLOW
+               *r |= AT_SYMLINK_NOFOLLOW;
+#else /* def AT_SYMLINK_NOFOLLOW */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AT_SYMLINK_NOFOLLOW */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToAtFlags (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
-       if (x == Mono_Posix_ConfStr__CS_GNU_LIBC_VERSION)
+#ifdef AT_EMPTY_PATH
+       if ((x & AT_EMPTY_PATH) == AT_EMPTY_PATH)
+               *r |= Mono_Posix_AtFlags_AT_EMPTY_PATH;
+#endif /* ndef AT_EMPTY_PATH */
+#ifdef AT_NO_AUTOMOUNT
+       if ((x & AT_NO_AUTOMOUNT) == AT_NO_AUTOMOUNT)
+               *r |= Mono_Posix_AtFlags_AT_NO_AUTOMOUNT;
+#endif /* ndef AT_NO_AUTOMOUNT */
+#ifdef AT_REMOVEDIR
+       if ((x & AT_REMOVEDIR) == AT_REMOVEDIR)
+               *r |= Mono_Posix_AtFlags_AT_REMOVEDIR;
+#endif /* ndef AT_REMOVEDIR */
+#ifdef AT_SYMLINK_FOLLOW
+       if ((x & AT_SYMLINK_FOLLOW) == AT_SYMLINK_FOLLOW)
+               *r |= Mono_Posix_AtFlags_AT_SYMLINK_FOLLOW;
+#endif /* ndef AT_SYMLINK_FOLLOW */
+#ifdef AT_SYMLINK_NOFOLLOW
+       if ((x & AT_SYMLINK_NOFOLLOW) == AT_SYMLINK_NOFOLLOW)
+               *r |= Mono_Posix_AtFlags_AT_SYMLINK_NOFOLLOW;
+#endif /* ndef AT_SYMLINK_NOFOLLOW */
+       return 0;
+}
+
+#ifdef HAVE_STRUCT_CMSGHDR
+int
+Mono_Posix_FromCmsghdr (struct Mono_Posix_Cmsghdr *from, struct cmsghdr *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->cmsg_len, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->cmsg_len   = from->cmsg_len;
+       if (Mono_Posix_FromUnixSocketProtocol (from->cmsg_level, &to->cmsg_level) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_FromUnixSocketControlMessage (from->cmsg_type, &to->cmsg_type) != 0) {
+               return -1;
+       }
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_CMSGHDR */
+
+
+#ifdef HAVE_STRUCT_CMSGHDR
+int
+Mono_Posix_ToCmsghdr (struct cmsghdr *from, struct Mono_Posix_Cmsghdr *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->cmsg_len, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->cmsg_len   = from->cmsg_len;
+       if (Mono_Posix_ToUnixSocketProtocol (from->cmsg_level, &to->cmsg_level) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_ToUnixSocketControlMessage (from->cmsg_type, &to->cmsg_type) != 0) {
+               return -1;
+       }
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_CMSGHDR */
+
+
+int Mono_Posix_FromConfstrName (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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_LFS64_CFLAGS)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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_LFS_CFLAGS)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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_PATH)
+       if (x == Mono_Posix_ConfstrName__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_POSIX_V6_ILP32_OFF32_CFLAGS)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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 */
-       if (x == Mono_Posix_ConfStr__CS_V6_WIDTH_RESTRICTED_ENVS)
+       if (x == Mono_Posix_ConfstrName__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_XBS5_ILP32_OFF32_CFLAGS)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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)
+       if (x == Mono_Posix_ConfstrName__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 == 0)
+               return 0;
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToConfStr (int x, int *r)
+int Mono_Posix_ToConfstrName (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
 #ifdef _CS_GNU_LIBC_VERSION
        if (x == _CS_GNU_LIBC_VERSION)
-               {*r = Mono_Posix_ConfStr__CS_GNU_LIBC_VERSION; return 0;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__CS_GNU_LIBPTHREAD_VERSION; return 0;}
 #endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
 #ifdef _CS_LFS64_CFLAGS
        if (x == _CS_LFS64_CFLAGS)
-               {*r = Mono_Posix_ConfStr__CS_LFS64_CFLAGS; return 0;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS; return 0;}
 #endif /* ndef _CS_LFS64_LINTFLAGS */
 #ifdef _CS_LFS_CFLAGS
        if (x == _CS_LFS_CFLAGS)
-               {*r = Mono_Posix_ConfStr__CS_LFS_CFLAGS; return 0;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS; return 0;}
 #endif /* ndef _CS_LFS_LINTFLAGS */
 #ifdef _CS_PATH
        if (x == _CS_PATH)
-               {*r = Mono_Posix_ConfStr__CS_PATH; return 0;}
+               {*r = Mono_Posix_ConfstrName__CS_PATH; return 0;}
 #endif /* ndef _CS_PATH */
 #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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
 #endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
        if (x == _CS_V6_WIDTH_RESTRICTED_ENVS)
-               {*r = Mono_Posix_ConfStr__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
+               {*r = Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
 #endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
        if (x == _CS_XBS5_ILP32_OFF32_CFLAGS)
-               {*r = Mono_Posix_ConfStr__CS_XBS5_ILP32_OFF32_CFLAGS; return 0;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__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;}
+               {*r = Mono_Posix_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
 #endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_FromError (int x, int *r)
+int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
-       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_EACCES)
-#ifdef EACCES
-               {*r = EACCES; return 0;}
-#else /* def EACCES */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EACCES */
-       if (x == Mono_Posix_Error_EADDRINUSE)
-#ifdef EADDRINUSE
-               {*r = EADDRINUSE; return 0;}
-#else /* def EADDRINUSE */
+       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 EADDRINUSE */
-       if (x == Mono_Posix_Error_EADDRNOTAVAIL)
-#ifdef EADDRNOTAVAIL
-               {*r = EADDRNOTAVAIL; return 0;}
-#else /* def EADDRNOTAVAIL */
+#endif /* ndef DN_ACCESS */
+       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 EADDRNOTAVAIL */
-       if (x == Mono_Posix_Error_EADV)
-#ifdef EADV
-               {*r = EADV; return 0;}
-#else /* def EADV */
+#endif /* ndef DN_ATTRIB */
+       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 EADV */
-       if (x == Mono_Posix_Error_EAFNOSUPPORT)
-#ifdef EAFNOSUPPORT
-               {*r = EAFNOSUPPORT; return 0;}
-#else /* def EAFNOSUPPORT */
+#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 EAFNOSUPPORT */
-       if (x == Mono_Posix_Error_EAGAIN)
-#ifdef EAGAIN
-               {*r = EAGAIN; return 0;}
-#else /* def EAGAIN */
+#endif /* ndef DN_DELETE */
+       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 EAGAIN */
-       if (x == Mono_Posix_Error_EALREADY)
-#ifdef EALREADY
-               {*r = EALREADY; return 0;}
-#else /* def EALREADY */
+#endif /* ndef DN_MODIFY */
+       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 EALREADY */
-       if (x == Mono_Posix_Error_EBADE)
-#ifdef EBADE
-               {*r = EBADE; return 0;}
-#else /* def EBADE */
+#endif /* ndef DN_MULTISHOT */
+       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 EBADE */
-       if (x == Mono_Posix_Error_EBADF)
+#endif /* ndef DN_RENAME */
+       if (x == 0)
+               return 0;
+       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_ATTRIB
+       if ((x & DN_ATTRIB) == DN_ATTRIB)
+               *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
+#endif /* ndef DN_ATTRIB */
+#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_MODIFY
+       if ((x & DN_MODIFY) == DN_MODIFY)
+               *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
+#endif /* ndef DN_MODIFY */
+#ifdef DN_MULTISHOT
+       if ((x & DN_MULTISHOT) == DN_MULTISHOT)
+               *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
+#endif /* ndef DN_MULTISHOT */
+#ifdef DN_RENAME
+       if ((x & DN_RENAME) == DN_RENAME)
+               *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
+#endif /* ndef DN_RENAME */
+       return 0;
+}
+
+int Mono_Posix_FromEpollEvents (unsigned int x, unsigned int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_EpollEvents_EPOLLERR) == Mono_Posix_EpollEvents_EPOLLERR)
+#ifdef EPOLLERR
+               *r |= EPOLLERR;
+#else /* def EPOLLERR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLERR */
+       if ((x & Mono_Posix_EpollEvents_EPOLLET) == Mono_Posix_EpollEvents_EPOLLET)
+#ifdef EPOLLET
+               *r |= EPOLLET;
+#else /* def EPOLLET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLET */
+       if ((x & Mono_Posix_EpollEvents_EPOLLHUP) == Mono_Posix_EpollEvents_EPOLLHUP)
+#ifdef EPOLLHUP
+               *r |= EPOLLHUP;
+#else /* def EPOLLHUP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLHUP */
+       if ((x & Mono_Posix_EpollEvents_EPOLLIN) == Mono_Posix_EpollEvents_EPOLLIN)
+#ifdef EPOLLIN
+               *r |= EPOLLIN;
+#else /* def EPOLLIN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLIN */
+       if ((x & Mono_Posix_EpollEvents_EPOLLMSG) == Mono_Posix_EpollEvents_EPOLLMSG)
+#ifdef EPOLLMSG
+               *r |= EPOLLMSG;
+#else /* def EPOLLMSG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLMSG */
+       if ((x & Mono_Posix_EpollEvents_EPOLLONESHOT) == Mono_Posix_EpollEvents_EPOLLONESHOT)
+#ifdef EPOLLONESHOT
+               *r |= EPOLLONESHOT;
+#else /* def EPOLLONESHOT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLONESHOT */
+       if ((x & Mono_Posix_EpollEvents_EPOLLOUT) == Mono_Posix_EpollEvents_EPOLLOUT)
+#ifdef EPOLLOUT
+               *r |= EPOLLOUT;
+#else /* def EPOLLOUT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLOUT */
+       if ((x & Mono_Posix_EpollEvents_EPOLLPRI) == Mono_Posix_EpollEvents_EPOLLPRI)
+#ifdef EPOLLPRI
+               *r |= EPOLLPRI;
+#else /* def EPOLLPRI */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLPRI */
+       if ((x & Mono_Posix_EpollEvents_EPOLLRDBAND) == Mono_Posix_EpollEvents_EPOLLRDBAND)
+#ifdef EPOLLRDBAND
+               *r |= EPOLLRDBAND;
+#else /* def EPOLLRDBAND */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLRDBAND */
+       if ((x & Mono_Posix_EpollEvents_EPOLLRDHUP) == Mono_Posix_EpollEvents_EPOLLRDHUP)
+#ifdef EPOLLRDHUP
+               *r |= EPOLLRDHUP;
+#else /* def EPOLLRDHUP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLRDHUP */
+       if ((x & Mono_Posix_EpollEvents_EPOLLRDNORM) == Mono_Posix_EpollEvents_EPOLLRDNORM)
+#ifdef EPOLLRDNORM
+               *r |= EPOLLRDNORM;
+#else /* def EPOLLRDNORM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLRDNORM */
+       if ((x & Mono_Posix_EpollEvents_EPOLLWRBAND) == Mono_Posix_EpollEvents_EPOLLWRBAND)
+#ifdef EPOLLWRBAND
+               *r |= EPOLLWRBAND;
+#else /* def EPOLLWRBAND */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLWRBAND */
+       if ((x & Mono_Posix_EpollEvents_EPOLLWRNORM) == Mono_Posix_EpollEvents_EPOLLWRNORM)
+#ifdef EPOLLWRNORM
+               *r |= EPOLLWRNORM;
+#else /* def EPOLLWRNORM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLLWRNORM */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToEpollEvents (unsigned int x, unsigned int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef EPOLLERR
+       if ((x & EPOLLERR) == EPOLLERR)
+               *r |= Mono_Posix_EpollEvents_EPOLLERR;
+#endif /* ndef EPOLLERR */
+#ifdef EPOLLET
+       if ((x & EPOLLET) == EPOLLET)
+               *r |= Mono_Posix_EpollEvents_EPOLLET;
+#endif /* ndef EPOLLET */
+#ifdef EPOLLHUP
+       if ((x & EPOLLHUP) == EPOLLHUP)
+               *r |= Mono_Posix_EpollEvents_EPOLLHUP;
+#endif /* ndef EPOLLHUP */
+#ifdef EPOLLIN
+       if ((x & EPOLLIN) == EPOLLIN)
+               *r |= Mono_Posix_EpollEvents_EPOLLIN;
+#endif /* ndef EPOLLIN */
+#ifdef EPOLLMSG
+       if ((x & EPOLLMSG) == EPOLLMSG)
+               *r |= Mono_Posix_EpollEvents_EPOLLMSG;
+#endif /* ndef EPOLLMSG */
+#ifdef EPOLLONESHOT
+       if ((x & EPOLLONESHOT) == EPOLLONESHOT)
+               *r |= Mono_Posix_EpollEvents_EPOLLONESHOT;
+#endif /* ndef EPOLLONESHOT */
+#ifdef EPOLLOUT
+       if ((x & EPOLLOUT) == EPOLLOUT)
+               *r |= Mono_Posix_EpollEvents_EPOLLOUT;
+#endif /* ndef EPOLLOUT */
+#ifdef EPOLLPRI
+       if ((x & EPOLLPRI) == EPOLLPRI)
+               *r |= Mono_Posix_EpollEvents_EPOLLPRI;
+#endif /* ndef EPOLLPRI */
+#ifdef EPOLLRDBAND
+       if ((x & EPOLLRDBAND) == EPOLLRDBAND)
+               *r |= Mono_Posix_EpollEvents_EPOLLRDBAND;
+#endif /* ndef EPOLLRDBAND */
+#ifdef EPOLLRDHUP
+       if ((x & EPOLLRDHUP) == EPOLLRDHUP)
+               *r |= Mono_Posix_EpollEvents_EPOLLRDHUP;
+#endif /* ndef EPOLLRDHUP */
+#ifdef EPOLLRDNORM
+       if ((x & EPOLLRDNORM) == EPOLLRDNORM)
+               *r |= Mono_Posix_EpollEvents_EPOLLRDNORM;
+#endif /* ndef EPOLLRDNORM */
+#ifdef EPOLLWRBAND
+       if ((x & EPOLLWRBAND) == EPOLLWRBAND)
+               *r |= Mono_Posix_EpollEvents_EPOLLWRBAND;
+#endif /* ndef EPOLLWRBAND */
+#ifdef EPOLLWRNORM
+       if ((x & EPOLLWRNORM) == EPOLLWRNORM)
+               *r |= Mono_Posix_EpollEvents_EPOLLWRNORM;
+#endif /* ndef EPOLLWRNORM */
+       return 0;
+}
+
+int Mono_Posix_FromEpollFlags (int x, int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_EpollFlags_EPOLL_CLOEXEC) == Mono_Posix_EpollFlags_EPOLL_CLOEXEC)
+#ifdef EPOLL_CLOEXEC
+               *r |= EPOLL_CLOEXEC;
+#else /* def EPOLL_CLOEXEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLL_CLOEXEC */
+       if ((x & Mono_Posix_EpollFlags_EPOLL_NONBLOCK) == Mono_Posix_EpollFlags_EPOLL_NONBLOCK)
+#ifdef EPOLL_NONBLOCK
+               *r |= EPOLL_NONBLOCK;
+#else /* def EPOLL_NONBLOCK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPOLL_NONBLOCK */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToEpollFlags (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef EPOLL_CLOEXEC
+       if ((x & EPOLL_CLOEXEC) == EPOLL_CLOEXEC)
+               *r |= Mono_Posix_EpollFlags_EPOLL_CLOEXEC;
+#endif /* ndef EPOLL_CLOEXEC */
+#ifdef EPOLL_NONBLOCK
+       if ((x & EPOLL_NONBLOCK) == EPOLL_NONBLOCK)
+               *r |= Mono_Posix_EpollFlags_EPOLL_NONBLOCK;
+#endif /* ndef EPOLL_NONBLOCK */
+       return 0;
+}
+
+int Mono_Posix_FromErrno (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_Errno_E2BIG)
+#ifdef E2BIG
+               {*r = E2BIG; return 0;}
+#else /* def E2BIG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef E2BIG */
+       if (x == Mono_Posix_Errno_EACCES)
+#ifdef EACCES
+               {*r = EACCES; return 0;}
+#else /* def EACCES */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EACCES */
+       if (x == Mono_Posix_Errno_EADDRINUSE)
+#ifdef EADDRINUSE
+               {*r = EADDRINUSE; return 0;}
+#else /* def EADDRINUSE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EADDRINUSE */
+       if (x == Mono_Posix_Errno_EADDRNOTAVAIL)
+#ifdef EADDRNOTAVAIL
+               {*r = EADDRNOTAVAIL; return 0;}
+#else /* def EADDRNOTAVAIL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EADDRNOTAVAIL */
+       if (x == Mono_Posix_Errno_EADV)
+#ifdef EADV
+               {*r = EADV; return 0;}
+#else /* def EADV */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EADV */
+       if (x == Mono_Posix_Errno_EAFNOSUPPORT)
+#ifdef EAFNOSUPPORT
+               {*r = EAFNOSUPPORT; return 0;}
+#else /* def EAFNOSUPPORT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EAFNOSUPPORT */
+       if (x == Mono_Posix_Errno_EAGAIN)
+#ifdef EAGAIN
+               {*r = EAGAIN; return 0;}
+#else /* def EAGAIN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EAGAIN */
+       if (x == Mono_Posix_Errno_EALREADY)
+#ifdef EALREADY
+               {*r = EALREADY; return 0;}
+#else /* def EALREADY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EALREADY */
+       if (x == Mono_Posix_Errno_EAUTH)
+#ifdef EAUTH
+               {*r = EAUTH; return 0;}
+#else /* def EAUTH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EAUTH */
+       if (x == Mono_Posix_Errno_EBADARCH)
+#ifdef EBADARCH
+               {*r = EBADARCH; return 0;}
+#else /* def EBADARCH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EBADARCH */
+       if (x == Mono_Posix_Errno_EBADE)
+#ifdef EBADE
+               {*r = EBADE; return 0;}
+#else /* def EBADE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EBADE */
+       if (x == Mono_Posix_Errno_EBADEXEC)
+#ifdef EBADEXEC
+               {*r = EBADEXEC; return 0;}
+#else /* def EBADEXEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EBADEXEC */
+       if (x == Mono_Posix_Errno_EBADF)
 #ifdef EBADF
                {*r = EBADF; return 0;}
 #else /* def EBADF */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADF */
-       if (x == Mono_Posix_Error_EBADFD)
+       if (x == Mono_Posix_Errno_EBADFD)
 #ifdef EBADFD
                {*r = EBADFD; return 0;}
 #else /* def EBADFD */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADFD */
-       if (x == Mono_Posix_Error_EBADMSG)
+       if (x == Mono_Posix_Errno_EBADMACHO)
+#ifdef EBADMACHO
+               {*r = EBADMACHO; return 0;}
+#else /* def EBADMACHO */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EBADMACHO */
+       if (x == Mono_Posix_Errno_EBADMSG)
 #ifdef EBADMSG
                {*r = EBADMSG; return 0;}
 #else /* def EBADMSG */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADMSG */
-       if (x == Mono_Posix_Error_EBADR)
+       if (x == Mono_Posix_Errno_EBADR)
 #ifdef EBADR
                {*r = EBADR; return 0;}
 #else /* def EBADR */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADR */
-       if (x == Mono_Posix_Error_EBADRQC)
+       if (x == Mono_Posix_Errno_EBADRPC)
+#ifdef EBADRPC
+               {*r = EBADRPC; return 0;}
+#else /* def EBADRPC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EBADRPC */
+       if (x == Mono_Posix_Errno_EBADRQC)
 #ifdef EBADRQC
                {*r = EBADRQC; return 0;}
 #else /* def EBADRQC */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADRQC */
-       if (x == Mono_Posix_Error_EBADSLT)
+       if (x == Mono_Posix_Errno_EBADSLT)
 #ifdef EBADSLT
                {*r = EBADSLT; return 0;}
 #else /* def EBADSLT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBADSLT */
-       if (x == Mono_Posix_Error_EBFONT)
+       if (x == Mono_Posix_Errno_EBFONT)
 #ifdef EBFONT
                {*r = EBFONT; return 0;}
 #else /* def EBFONT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBFONT */
-       if (x == Mono_Posix_Error_EBUSY)
+       if (x == Mono_Posix_Errno_EBUSY)
 #ifdef EBUSY
                {*r = EBUSY; return 0;}
 #else /* def EBUSY */
                {errno = EINVAL; return -1;}
 #endif /* ndef EBUSY */
-       if (x == Mono_Posix_Error_ECHILD)
+       if (x == Mono_Posix_Errno_ECANCELED)
+#ifdef ECANCELED
+               {*r = ECANCELED; return 0;}
+#else /* def ECANCELED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ECANCELED */
+       if (x == Mono_Posix_Errno_ECHILD)
 #ifdef ECHILD
                {*r = ECHILD; return 0;}
 #else /* def ECHILD */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECHILD */
-       if (x == Mono_Posix_Error_ECHRNG)
+       if (x == Mono_Posix_Errno_ECHRNG)
 #ifdef ECHRNG
                {*r = ECHRNG; return 0;}
 #else /* def ECHRNG */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECHRNG */
-       if (x == Mono_Posix_Error_ECOMM)
+       if (x == Mono_Posix_Errno_ECOMM)
 #ifdef ECOMM
                {*r = ECOMM; return 0;}
 #else /* def ECOMM */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECOMM */
-       if (x == Mono_Posix_Error_ECONNABORTED)
+       if (x == Mono_Posix_Errno_ECONNABORTED)
 #ifdef ECONNABORTED
                {*r = ECONNABORTED; return 0;}
 #else /* def ECONNABORTED */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECONNABORTED */
-       if (x == Mono_Posix_Error_ECONNREFUSED)
+       if (x == Mono_Posix_Errno_ECONNREFUSED)
 #ifdef ECONNREFUSED
                {*r = ECONNREFUSED; return 0;}
 #else /* def ECONNREFUSED */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECONNREFUSED */
-       if (x == Mono_Posix_Error_ECONNRESET)
+       if (x == Mono_Posix_Errno_ECONNRESET)
 #ifdef ECONNRESET
                {*r = ECONNRESET; return 0;}
 #else /* def ECONNRESET */
                {errno = EINVAL; return -1;}
 #endif /* ndef ECONNRESET */
-       if (x == Mono_Posix_Error_EDEADLK)
+       if (x == Mono_Posix_Errno_EDEADLK)
 #ifdef EDEADLK
                {*r = EDEADLK; return 0;}
 #else /* def EDEADLK */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDEADLK */
-       if (x == Mono_Posix_Error_EDEADLOCK)
+       if (x == Mono_Posix_Errno_EDEADLOCK)
 #ifdef EDEADLOCK
                {*r = EDEADLOCK; return 0;}
 #else /* def EDEADLOCK */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDEADLOCK */
-       if (x == Mono_Posix_Error_EDESTADDRREQ)
+       if (x == Mono_Posix_Errno_EDESTADDRREQ)
 #ifdef EDESTADDRREQ
                {*r = EDESTADDRREQ; return 0;}
 #else /* def EDESTADDRREQ */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDESTADDRREQ */
-       if (x == Mono_Posix_Error_EDOM)
+       if (x == Mono_Posix_Errno_EDEVERR)
+#ifdef EDEVERR
+               {*r = EDEVERR; return 0;}
+#else /* def EDEVERR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EDEVERR */
+       if (x == Mono_Posix_Errno_EDOM)
 #ifdef EDOM
                {*r = EDOM; return 0;}
 #else /* def EDOM */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDOM */
-       if (x == Mono_Posix_Error_EDOTDOT)
+       if (x == Mono_Posix_Errno_EDOTDOT)
 #ifdef EDOTDOT
                {*r = EDOTDOT; return 0;}
 #else /* def EDOTDOT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDOTDOT */
-       if (x == Mono_Posix_Error_EDQUOT)
+       if (x == Mono_Posix_Errno_EDQUOT)
 #ifdef EDQUOT
                {*r = EDQUOT; return 0;}
 #else /* def EDQUOT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EDQUOT */
-       if (x == Mono_Posix_Error_EEXIST)
+       if (x == Mono_Posix_Errno_EEXIST)
 #ifdef EEXIST
                {*r = EEXIST; return 0;}
 #else /* def EEXIST */
                {errno = EINVAL; return -1;}
 #endif /* ndef EEXIST */
-       if (x == Mono_Posix_Error_EFAULT)
+       if (x == Mono_Posix_Errno_EFAULT)
 #ifdef EFAULT
                {*r = EFAULT; return 0;}
 #else /* def EFAULT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EFAULT */
-       if (x == Mono_Posix_Error_EFBIG)
+       if (x == Mono_Posix_Errno_EFBIG)
 #ifdef EFBIG
                {*r = EFBIG; return 0;}
 #else /* def EFBIG */
                {errno = EINVAL; return -1;}
 #endif /* ndef EFBIG */
-       if (x == Mono_Posix_Error_EHOSTDOWN)
+       if (x == Mono_Posix_Errno_EFTYPE)
+#ifdef EFTYPE
+               {*r = EFTYPE; return 0;}
+#else /* def EFTYPE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EFTYPE */
+       if (x == Mono_Posix_Errno_EHOSTDOWN)
 #ifdef EHOSTDOWN
                {*r = EHOSTDOWN; return 0;}
 #else /* def EHOSTDOWN */
                {errno = EINVAL; return -1;}
 #endif /* ndef EHOSTDOWN */
-       if (x == Mono_Posix_Error_EHOSTUNREACH)
+       if (x == Mono_Posix_Errno_EHOSTUNREACH)
 #ifdef EHOSTUNREACH
                {*r = EHOSTUNREACH; return 0;}
 #else /* def EHOSTUNREACH */
                {errno = EINVAL; return -1;}
 #endif /* ndef EHOSTUNREACH */
-       if (x == Mono_Posix_Error_EIDRM)
+       if (x == Mono_Posix_Errno_EIDRM)
 #ifdef EIDRM
                {*r = EIDRM; return 0;}
 #else /* def EIDRM */
                {errno = EINVAL; return -1;}
 #endif /* ndef EIDRM */
-       if (x == Mono_Posix_Error_EILSEQ)
+       if (x == Mono_Posix_Errno_EILSEQ)
 #ifdef EILSEQ
                {*r = EILSEQ; return 0;}
 #else /* def EILSEQ */
                {errno = EINVAL; return -1;}
 #endif /* ndef EILSEQ */
-       if (x == Mono_Posix_Error_EINPROGRESS)
+       if (x == Mono_Posix_Errno_EINPROGRESS)
 #ifdef EINPROGRESS
                {*r = EINPROGRESS; return 0;}
 #else /* def EINPROGRESS */
                {errno = EINVAL; return -1;}
 #endif /* ndef EINPROGRESS */
-       if (x == Mono_Posix_Error_EINTR)
+       if (x == Mono_Posix_Errno_EINTR)
 #ifdef EINTR
                {*r = EINTR; return 0;}
 #else /* def EINTR */
                {errno = EINVAL; return -1;}
 #endif /* ndef EINTR */
-       if (x == Mono_Posix_Error_EINVAL)
+       if (x == Mono_Posix_Errno_EINVAL)
 #ifdef EINVAL
                {*r = EINVAL; return 0;}
 #else /* def EINVAL */
                {errno = EINVAL; return -1;}
 #endif /* ndef EINVAL */
-       if (x == Mono_Posix_Error_EIO)
+       if (x == Mono_Posix_Errno_EIO)
 #ifdef EIO
                {*r = EIO; return 0;}
 #else /* def EIO */
                {errno = EINVAL; return -1;}
 #endif /* ndef EIO */
-       if (x == Mono_Posix_Error_EISCONN)
+       if (x == Mono_Posix_Errno_EISCONN)
 #ifdef EISCONN
                {*r = EISCONN; return 0;}
 #else /* def EISCONN */
                {errno = EINVAL; return -1;}
 #endif /* ndef EISCONN */
-       if (x == Mono_Posix_Error_EISDIR)
+       if (x == Mono_Posix_Errno_EISDIR)
 #ifdef EISDIR
                {*r = EISDIR; return 0;}
 #else /* def EISDIR */
                {errno = EINVAL; return -1;}
 #endif /* ndef EISDIR */
-       if (x == Mono_Posix_Error_EISNAM)
+       if (x == Mono_Posix_Errno_EISNAM)
 #ifdef EISNAM
                {*r = EISNAM; return 0;}
 #else /* def EISNAM */
                {errno = EINVAL; return -1;}
 #endif /* ndef EISNAM */
-       if (x == Mono_Posix_Error_EL2HLT)
+       if (x == Mono_Posix_Errno_EKEYEXPIRED)
+#ifdef EKEYEXPIRED
+               {*r = EKEYEXPIRED; return 0;}
+#else /* def EKEYEXPIRED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EKEYEXPIRED */
+       if (x == Mono_Posix_Errno_EKEYREJECTED)
+#ifdef EKEYREJECTED
+               {*r = EKEYREJECTED; return 0;}
+#else /* def EKEYREJECTED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EKEYREJECTED */
+       if (x == Mono_Posix_Errno_EKEYREVOKED)
+#ifdef EKEYREVOKED
+               {*r = EKEYREVOKED; return 0;}
+#else /* def EKEYREVOKED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EKEYREVOKED */
+       if (x == Mono_Posix_Errno_EL2HLT)
 #ifdef EL2HLT
                {*r = EL2HLT; return 0;}
 #else /* def EL2HLT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EL2HLT */
-       if (x == Mono_Posix_Error_EL2NSYNC)
+       if (x == Mono_Posix_Errno_EL2NSYNC)
 #ifdef EL2NSYNC
                {*r = EL2NSYNC; return 0;}
 #else /* def EL2NSYNC */
                {errno = EINVAL; return -1;}
 #endif /* ndef EL2NSYNC */
-       if (x == Mono_Posix_Error_EL3HLT)
+       if (x == Mono_Posix_Errno_EL3HLT)
 #ifdef EL3HLT
                {*r = EL3HLT; return 0;}
 #else /* def EL3HLT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EL3HLT */
-       if (x == Mono_Posix_Error_EL3RST)
+       if (x == Mono_Posix_Errno_EL3RST)
 #ifdef EL3RST
                {*r = EL3RST; return 0;}
 #else /* def EL3RST */
                {errno = EINVAL; return -1;}
 #endif /* ndef EL3RST */
-       if (x == Mono_Posix_Error_ELIBACC)
+       if (x == Mono_Posix_Errno_ELIBACC)
 #ifdef ELIBACC
                {*r = ELIBACC; return 0;}
 #else /* def ELIBACC */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELIBACC */
-       if (x == Mono_Posix_Error_ELIBBAD)
+       if (x == Mono_Posix_Errno_ELIBBAD)
 #ifdef ELIBBAD
                {*r = ELIBBAD; return 0;}
 #else /* def ELIBBAD */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELIBBAD */
-       if (x == Mono_Posix_Error_ELIBEXEC)
+       if (x == Mono_Posix_Errno_ELIBEXEC)
 #ifdef ELIBEXEC
                {*r = ELIBEXEC; return 0;}
 #else /* def ELIBEXEC */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELIBEXEC */
-       if (x == Mono_Posix_Error_ELIBMAX)
+       if (x == Mono_Posix_Errno_ELIBMAX)
 #ifdef ELIBMAX
                {*r = ELIBMAX; return 0;}
 #else /* def ELIBMAX */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELIBMAX */
-       if (x == Mono_Posix_Error_ELIBSCN)
+       if (x == Mono_Posix_Errno_ELIBSCN)
 #ifdef ELIBSCN
                {*r = ELIBSCN; return 0;}
 #else /* def ELIBSCN */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELIBSCN */
-       if (x == Mono_Posix_Error_ELNRNG)
+       if (x == Mono_Posix_Errno_ELNRNG)
 #ifdef ELNRNG
                {*r = ELNRNG; return 0;}
 #else /* def ELNRNG */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELNRNG */
-       if (x == Mono_Posix_Error_ELOOP)
+       if (x == Mono_Posix_Errno_ELOOP)
 #ifdef ELOOP
                {*r = ELOOP; return 0;}
 #else /* def ELOOP */
                {errno = EINVAL; return -1;}
 #endif /* ndef ELOOP */
-       if (x == Mono_Posix_Error_EMEDIUMTYPE)
+       if (x == Mono_Posix_Errno_EMEDIUMTYPE)
 #ifdef EMEDIUMTYPE
                {*r = EMEDIUMTYPE; return 0;}
 #else /* def EMEDIUMTYPE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EMEDIUMTYPE */
-       if (x == Mono_Posix_Error_EMFILE)
+       if (x == Mono_Posix_Errno_EMFILE)
 #ifdef EMFILE
                {*r = EMFILE; return 0;}
 #else /* def EMFILE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EMFILE */
-       if (x == Mono_Posix_Error_EMLINK)
+       if (x == Mono_Posix_Errno_EMLINK)
 #ifdef EMLINK
                {*r = EMLINK; return 0;}
 #else /* def EMLINK */
                {errno = EINVAL; return -1;}
 #endif /* ndef EMLINK */
-       if (x == Mono_Posix_Error_EMSGSIZE)
+       if (x == Mono_Posix_Errno_EMSGSIZE)
 #ifdef EMSGSIZE
                {*r = EMSGSIZE; return 0;}
 #else /* def EMSGSIZE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EMSGSIZE */
-       if (x == Mono_Posix_Error_EMULTIHOP)
+       if (x == Mono_Posix_Errno_EMULTIHOP)
 #ifdef EMULTIHOP
                {*r = EMULTIHOP; return 0;}
 #else /* def EMULTIHOP */
                {errno = EINVAL; return -1;}
 #endif /* ndef EMULTIHOP */
-       if (x == Mono_Posix_Error_ENAMETOOLONG)
+       if (x == Mono_Posix_Errno_ENAMETOOLONG)
 #ifdef ENAMETOOLONG
                {*r = ENAMETOOLONG; return 0;}
 #else /* def ENAMETOOLONG */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENAMETOOLONG */
-       if (x == Mono_Posix_Error_ENAVAIL)
+       if (x == Mono_Posix_Errno_ENAVAIL)
 #ifdef ENAVAIL
                {*r = ENAVAIL; return 0;}
 #else /* def ENAVAIL */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENAVAIL */
-       if (x == Mono_Posix_Error_ENETDOWN)
+       if (x == Mono_Posix_Errno_ENEEDAUTH)
+#ifdef ENEEDAUTH
+               {*r = ENEEDAUTH; return 0;}
+#else /* def ENEEDAUTH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ENEEDAUTH */
+       if (x == Mono_Posix_Errno_ENETDOWN)
 #ifdef ENETDOWN
                {*r = ENETDOWN; return 0;}
 #else /* def ENETDOWN */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENETDOWN */
-       if (x == Mono_Posix_Error_ENETRESET)
+       if (x == Mono_Posix_Errno_ENETRESET)
 #ifdef ENETRESET
                {*r = ENETRESET; return 0;}
 #else /* def ENETRESET */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENETRESET */
-       if (x == Mono_Posix_Error_ENETUNREACH)
+       if (x == Mono_Posix_Errno_ENETUNREACH)
 #ifdef ENETUNREACH
                {*r = ENETUNREACH; return 0;}
 #else /* def ENETUNREACH */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENETUNREACH */
-       if (x == Mono_Posix_Error_ENFILE)
+       if (x == Mono_Posix_Errno_ENFILE)
 #ifdef ENFILE
                {*r = ENFILE; return 0;}
 #else /* def ENFILE */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENFILE */
-       if (x == Mono_Posix_Error_ENOANO)
+       if (x == Mono_Posix_Errno_ENOANO)
 #ifdef ENOANO
                {*r = ENOANO; return 0;}
 #else /* def ENOANO */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOANO */
-       if (x == Mono_Posix_Error_ENOBUFS)
+       if (x == Mono_Posix_Errno_ENOATTR)
+#ifdef ENOATTR
+               {*r = ENOATTR; return 0;}
+#else /* def ENOATTR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ENOATTR */
+       if (x == Mono_Posix_Errno_ENOBUFS)
 #ifdef ENOBUFS
                {*r = ENOBUFS; return 0;}
 #else /* def ENOBUFS */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOBUFS */
-       if (x == Mono_Posix_Error_ENOCSI)
+       if (x == Mono_Posix_Errno_ENOCSI)
 #ifdef ENOCSI
                {*r = ENOCSI; return 0;}
 #else /* def ENOCSI */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOCSI */
-       if (x == Mono_Posix_Error_ENODATA)
+       if (x == Mono_Posix_Errno_ENODATA)
 #ifdef ENODATA
                {*r = ENODATA; return 0;}
 #else /* def ENODATA */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENODATA */
-       if (x == Mono_Posix_Error_ENODEV)
+       if (x == Mono_Posix_Errno_ENODEV)
 #ifdef ENODEV
                {*r = ENODEV; return 0;}
 #else /* def ENODEV */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENODEV */
-       if (x == Mono_Posix_Error_ENOENT)
+       if (x == Mono_Posix_Errno_ENOENT)
 #ifdef ENOENT
                {*r = ENOENT; return 0;}
 #else /* def ENOENT */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOENT */
-       if (x == Mono_Posix_Error_ENOEXEC)
+       if (x == Mono_Posix_Errno_ENOEXEC)
 #ifdef ENOEXEC
                {*r = ENOEXEC; return 0;}
 #else /* def ENOEXEC */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOEXEC */
-       if (x == Mono_Posix_Error_ENOLCK)
+       if (x == Mono_Posix_Errno_ENOKEY)
+#ifdef ENOKEY
+               {*r = ENOKEY; return 0;}
+#else /* def ENOKEY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ENOKEY */
+       if (x == Mono_Posix_Errno_ENOLCK)
 #ifdef ENOLCK
                {*r = ENOLCK; return 0;}
 #else /* def ENOLCK */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOLCK */
-       if (x == Mono_Posix_Error_ENOLINK)
+       if (x == Mono_Posix_Errno_ENOLINK)
 #ifdef ENOLINK
                {*r = ENOLINK; return 0;}
 #else /* def ENOLINK */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOLINK */
-       if (x == Mono_Posix_Error_ENOMEDIUM)
+       if (x == Mono_Posix_Errno_ENOMEDIUM)
 #ifdef ENOMEDIUM
                {*r = ENOMEDIUM; return 0;}
 #else /* def ENOMEDIUM */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOMEDIUM */
-       if (x == Mono_Posix_Error_ENOMEM)
+       if (x == Mono_Posix_Errno_ENOMEM)
 #ifdef ENOMEM
                {*r = ENOMEM; return 0;}
 #else /* def ENOMEM */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOMEM */
-       if (x == Mono_Posix_Error_ENOMSG)
+       if (x == Mono_Posix_Errno_ENOMSG)
 #ifdef ENOMSG
                {*r = ENOMSG; return 0;}
 #else /* def ENOMSG */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOMSG */
-       if (x == Mono_Posix_Error_ENONET)
+       if (x == Mono_Posix_Errno_ENONET)
 #ifdef ENONET
                {*r = ENONET; return 0;}
 #else /* def ENONET */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENONET */
-       if (x == Mono_Posix_Error_ENOPKG)
+       if (x == Mono_Posix_Errno_ENOPKG)
 #ifdef ENOPKG
                {*r = ENOPKG; return 0;}
 #else /* def ENOPKG */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOPKG */
-       if (x == Mono_Posix_Error_ENOPROTOOPT)
+       if (x == Mono_Posix_Errno_ENOPOLICY)
+#ifdef ENOPOLICY
+               {*r = ENOPOLICY; return 0;}
+#else /* def ENOPOLICY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ENOPOLICY */
+       if (x == Mono_Posix_Errno_ENOPROTOOPT)
 #ifdef ENOPROTOOPT
                {*r = ENOPROTOOPT; return 0;}
 #else /* def ENOPROTOOPT */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOPROTOOPT */
-       if (x == Mono_Posix_Error_ENOSPC)
+       if (x == Mono_Posix_Errno_ENOSPC)
 #ifdef ENOSPC
                {*r = ENOSPC; return 0;}
 #else /* def ENOSPC */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOSPC */
-       if (x == Mono_Posix_Error_ENOSR)
+       if (x == Mono_Posix_Errno_ENOSR)
 #ifdef ENOSR
                {*r = ENOSR; return 0;}
 #else /* def ENOSR */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOSR */
-       if (x == Mono_Posix_Error_ENOSTR)
+       if (x == Mono_Posix_Errno_ENOSTR)
 #ifdef ENOSTR
                {*r = ENOSTR; return 0;}
 #else /* def ENOSTR */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOSTR */
-       if (x == Mono_Posix_Error_ENOSYS)
+       if (x == Mono_Posix_Errno_ENOSYS)
 #ifdef ENOSYS
                {*r = ENOSYS; return 0;}
 #else /* def ENOSYS */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOSYS */
-       if (x == Mono_Posix_Error_ENOTBLK)
+       if (x == Mono_Posix_Errno_ENOTBLK)
 #ifdef ENOTBLK
                {*r = ENOTBLK; return 0;}
 #else /* def ENOTBLK */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTBLK */
-       if (x == Mono_Posix_Error_ENOTCONN)
+       if (x == Mono_Posix_Errno_ENOTCONN)
 #ifdef ENOTCONN
                {*r = ENOTCONN; return 0;}
 #else /* def ENOTCONN */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTCONN */
-       if (x == Mono_Posix_Error_ENOTDIR)
+       if (x == Mono_Posix_Errno_ENOTDIR)
 #ifdef ENOTDIR
                {*r = ENOTDIR; return 0;}
 #else /* def ENOTDIR */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTDIR */
-       if (x == Mono_Posix_Error_ENOTEMPTY)
+       if (x == Mono_Posix_Errno_ENOTEMPTY)
 #ifdef ENOTEMPTY
                {*r = ENOTEMPTY; return 0;}
 #else /* def ENOTEMPTY */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTEMPTY */
-       if (x == Mono_Posix_Error_ENOTNAM)
+       if (x == Mono_Posix_Errno_ENOTNAM)
 #ifdef ENOTNAM
                {*r = ENOTNAM; return 0;}
 #else /* def ENOTNAM */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTNAM */
-       if (x == Mono_Posix_Error_ENOTSOCK)
+       if (x == Mono_Posix_Errno_ENOTRECOVERABLE)
+#ifdef ENOTRECOVERABLE
+               {*r = ENOTRECOVERABLE; return 0;}
+#else /* def ENOTRECOVERABLE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ENOTRECOVERABLE */
+       if (x == Mono_Posix_Errno_ENOTSOCK)
 #ifdef ENOTSOCK
                {*r = ENOTSOCK; return 0;}
 #else /* def ENOTSOCK */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTSOCK */
-       if (x == Mono_Posix_Error_ENOTTY)
+       if (x == Mono_Posix_Errno_ENOTTY)
 #ifdef ENOTTY
                {*r = ENOTTY; return 0;}
 #else /* def ENOTTY */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTTY */
-       if (x == Mono_Posix_Error_ENOTUNIQ)
+       if (x == Mono_Posix_Errno_ENOTUNIQ)
 #ifdef ENOTUNIQ
                {*r = ENOTUNIQ; return 0;}
 #else /* def ENOTUNIQ */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENOTUNIQ */
-       if (x == Mono_Posix_Error_ENXIO)
+       if (x == Mono_Posix_Errno_ENXIO)
 #ifdef ENXIO
                {*r = ENXIO; return 0;}
 #else /* def ENXIO */
                {errno = EINVAL; return -1;}
 #endif /* ndef ENXIO */
-       if (x == Mono_Posix_Error_EOPNOTSUPP)
+       if (x == Mono_Posix_Errno_EOPNOTSUPP)
 #ifdef EOPNOTSUPP
                {*r = EOPNOTSUPP; return 0;}
 #else /* def EOPNOTSUPP */
                {errno = EINVAL; return -1;}
 #endif /* ndef EOPNOTSUPP */
-       if (x == Mono_Posix_Error_EOVERFLOW)
+       if (x == Mono_Posix_Errno_EOVERFLOW)
 #ifdef EOVERFLOW
                {*r = EOVERFLOW; return 0;}
 #else /* def EOVERFLOW */
                {errno = EINVAL; return -1;}
 #endif /* ndef EOVERFLOW */
-       if (x == Mono_Posix_Error_EPERM)
+       if (x == Mono_Posix_Errno_EOWNERDEAD)
+#ifdef EOWNERDEAD
+               {*r = EOWNERDEAD; return 0;}
+#else /* def EOWNERDEAD */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EOWNERDEAD */
+       if (x == Mono_Posix_Errno_EPERM)
 #ifdef EPERM
                {*r = EPERM; return 0;}
 #else /* def EPERM */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPERM */
-       if (x == Mono_Posix_Error_EPFNOSUPPORT)
+       if (x == Mono_Posix_Errno_EPFNOSUPPORT)
 #ifdef EPFNOSUPPORT
                {*r = EPFNOSUPPORT; return 0;}
 #else /* def EPFNOSUPPORT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPFNOSUPPORT */
-       if (x == Mono_Posix_Error_EPIPE)
+       if (x == Mono_Posix_Errno_EPIPE)
 #ifdef EPIPE
                {*r = EPIPE; return 0;}
 #else /* def EPIPE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPIPE */
-       if (x == Mono_Posix_Error_EPROTO)
+       if (x == Mono_Posix_Errno_EPROCLIM)
+#ifdef EPROCLIM
+               {*r = EPROCLIM; return 0;}
+#else /* def EPROCLIM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPROCLIM */
+       if (x == Mono_Posix_Errno_EPROCUNAVAIL)
+#ifdef EPROCUNAVAIL
+               {*r = EPROCUNAVAIL; return 0;}
+#else /* def EPROCUNAVAIL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPROCUNAVAIL */
+       if (x == Mono_Posix_Errno_EPROGMISMATCH)
+#ifdef EPROGMISMATCH
+               {*r = EPROGMISMATCH; return 0;}
+#else /* def EPROGMISMATCH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPROGMISMATCH */
+       if (x == Mono_Posix_Errno_EPROGUNAVAIL)
+#ifdef EPROGUNAVAIL
+               {*r = EPROGUNAVAIL; return 0;}
+#else /* def EPROGUNAVAIL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPROGUNAVAIL */
+       if (x == Mono_Posix_Errno_EPROTO)
 #ifdef EPROTO
                {*r = EPROTO; return 0;}
 #else /* def EPROTO */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPROTO */
-       if (x == Mono_Posix_Error_EPROTONOSUPPORT)
+       if (x == Mono_Posix_Errno_EPROTONOSUPPORT)
 #ifdef EPROTONOSUPPORT
                {*r = EPROTONOSUPPORT; return 0;}
 #else /* def EPROTONOSUPPORT */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPROTONOSUPPORT */
-       if (x == Mono_Posix_Error_EPROTOTYPE)
+       if (x == Mono_Posix_Errno_EPROTOTYPE)
 #ifdef EPROTOTYPE
                {*r = EPROTOTYPE; return 0;}
 #else /* def EPROTOTYPE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EPROTOTYPE */
-       if (x == Mono_Posix_Error_ERANGE)
+       if (x == Mono_Posix_Errno_EPWROFF)
+#ifdef EPWROFF
+               {*r = EPWROFF; return 0;}
+#else /* def EPWROFF */
+               {errno = EINVAL; return -1;}
+#endif /* ndef EPWROFF */
+       if (x == Mono_Posix_Errno_ERANGE)
 #ifdef ERANGE
                {*r = ERANGE; return 0;}
 #else /* def ERANGE */
                {errno = EINVAL; return -1;}
 #endif /* ndef ERANGE */
-       if (x == Mono_Posix_Error_EREMCHG)
+       if (x == Mono_Posix_Errno_EREMCHG)
 #ifdef EREMCHG
                {*r = EREMCHG; return 0;}
 #else /* def EREMCHG */
                {errno = EINVAL; return -1;}
 #endif /* ndef EREMCHG */
-       if (x == Mono_Posix_Error_EREMOTE)
+       if (x == Mono_Posix_Errno_EREMOTE)
 #ifdef EREMOTE
                {*r = EREMOTE; return 0;}
 #else /* def EREMOTE */
                {errno = EINVAL; return -1;}
 #endif /* ndef EREMOTE */
-       if (x == Mono_Posix_Error_EREMOTEIO)
+       if (x == Mono_Posix_Errno_EREMOTEIO)
 #ifdef EREMOTEIO
                {*r = EREMOTEIO; return 0;}
 #else /* def EREMOTEIO */
                {errno = EINVAL; return -1;}
 #endif /* ndef EREMOTEIO */
-       if (x == Mono_Posix_Error_ERESTART)
+       if (x == Mono_Posix_Errno_ERESTART)
 #ifdef ERESTART
                {*r = ERESTART; return 0;}
 #else /* def ERESTART */
                {errno = EINVAL; return -1;}
 #endif /* ndef ERESTART */
-       if (x == Mono_Posix_Error_EROFS)
+       if (x == Mono_Posix_Errno_EROFS)
 #ifdef EROFS
                {*r = EROFS; return 0;}
 #else /* def EROFS */
                {errno = EINVAL; return -1;}
 #endif /* ndef EROFS */
-       if (x == Mono_Posix_Error_ESHUTDOWN)
+       if (x == Mono_Posix_Errno_ERPCMISMATCH)
+#ifdef ERPCMISMATCH
+               {*r = ERPCMISMATCH; return 0;}
+#else /* def ERPCMISMATCH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ERPCMISMATCH */
+       if (x == Mono_Posix_Errno_ESHLIBVERS)
+#ifdef ESHLIBVERS
+               {*r = ESHLIBVERS; return 0;}
+#else /* def ESHLIBVERS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef ESHLIBVERS */
+       if (x == Mono_Posix_Errno_ESHUTDOWN)
 #ifdef ESHUTDOWN
                {*r = ESHUTDOWN; return 0;}
 #else /* def ESHUTDOWN */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESHUTDOWN */
-       if (x == Mono_Posix_Error_ESOCKTNOSUPPORT)
+       if (x == Mono_Posix_Errno_ESOCKTNOSUPPORT)
 #ifdef ESOCKTNOSUPPORT
                {*r = ESOCKTNOSUPPORT; return 0;}
 #else /* def ESOCKTNOSUPPORT */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESOCKTNOSUPPORT */
-       if (x == Mono_Posix_Error_ESPIPE)
+       if (x == Mono_Posix_Errno_ESPIPE)
 #ifdef ESPIPE
                {*r = ESPIPE; return 0;}
 #else /* def ESPIPE */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESPIPE */
-       if (x == Mono_Posix_Error_ESRCH)
+       if (x == Mono_Posix_Errno_ESRCH)
 #ifdef ESRCH
                {*r = ESRCH; return 0;}
 #else /* def ESRCH */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESRCH */
-       if (x == Mono_Posix_Error_ESRMNT)
+       if (x == Mono_Posix_Errno_ESRMNT)
 #ifdef ESRMNT
                {*r = ESRMNT; return 0;}
 #else /* def ESRMNT */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESRMNT */
-       if (x == Mono_Posix_Error_ESTALE)
+       if (x == Mono_Posix_Errno_ESTALE)
 #ifdef ESTALE
                {*r = ESTALE; return 0;}
 #else /* def ESTALE */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESTALE */
-       if (x == Mono_Posix_Error_ESTRPIPE)
+       if (x == Mono_Posix_Errno_ESTRPIPE)
 #ifdef ESTRPIPE
                {*r = ESTRPIPE; return 0;}
 #else /* def ESTRPIPE */
                {errno = EINVAL; return -1;}
 #endif /* ndef ESTRPIPE */
-       if (x == Mono_Posix_Error_ETIME)
+       if (x == Mono_Posix_Errno_ETIME)
 #ifdef ETIME
                {*r = ETIME; return 0;}
 #else /* def ETIME */
                {errno = EINVAL; return -1;}
 #endif /* ndef ETIME */
-       if (x == Mono_Posix_Error_ETIMEDOUT)
+       if (x == Mono_Posix_Errno_ETIMEDOUT)
 #ifdef ETIMEDOUT
                {*r = ETIMEDOUT; return 0;}
 #else /* def ETIMEDOUT */
                {errno = EINVAL; return -1;}
 #endif /* ndef ETIMEDOUT */
-       if (x == Mono_Posix_Error_ETOOMANYREFS)
+       if (x == Mono_Posix_Errno_ETOOMANYREFS)
 #ifdef ETOOMANYREFS
                {*r = ETOOMANYREFS; return 0;}
 #else /* def ETOOMANYREFS */
                {errno = EINVAL; return -1;}
 #endif /* ndef ETOOMANYREFS */
-       if (x == Mono_Posix_Error_ETXTBSY)
+       if (x == Mono_Posix_Errno_ETXTBSY)
 #ifdef ETXTBSY
                {*r = ETXTBSY; return 0;}
 #else /* def ETXTBSY */
                {errno = EINVAL; return -1;}
 #endif /* ndef ETXTBSY */
-       if (x == Mono_Posix_Error_EUCLEAN)
+       if (x == Mono_Posix_Errno_EUCLEAN)
 #ifdef EUCLEAN
                {*r = EUCLEAN; return 0;}
 #else /* def EUCLEAN */
                {errno = EINVAL; return -1;}
 #endif /* ndef EUCLEAN */
-       if (x == Mono_Posix_Error_EUNATCH)
+       if (x == Mono_Posix_Errno_EUNATCH)
 #ifdef EUNATCH
                {*r = EUNATCH; return 0;}
 #else /* def EUNATCH */
                {errno = EINVAL; return -1;}
 #endif /* ndef EUNATCH */
-       if (x == Mono_Posix_Error_EUSERS)
+       if (x == Mono_Posix_Errno_EUSERS)
 #ifdef EUSERS
                {*r = EUSERS; return 0;}
 #else /* def EUSERS */
                {errno = EINVAL; return -1;}
 #endif /* ndef EUSERS */
-       if (x == Mono_Posix_Error_EWOULDBLOCK)
+       if (x == Mono_Posix_Errno_EWOULDBLOCK)
 #ifdef EWOULDBLOCK
                {*r = EWOULDBLOCK; return 0;}
 #else /* def EWOULDBLOCK */
                {errno = EINVAL; return -1;}
 #endif /* ndef EWOULDBLOCK */
-       if (x == Mono_Posix_Error_EXDEV)
+       if (x == Mono_Posix_Errno_EXDEV)
 #ifdef EXDEV
                {*r = EXDEV; return 0;}
 #else /* def EXDEV */
                {errno = EINVAL; return -1;}
 #endif /* ndef EXDEV */
-       if (x == Mono_Posix_Error_EXFULL)
+       if (x == Mono_Posix_Errno_EXFULL)
 #ifdef EXFULL
                {*r = EXFULL; return 0;}
 #else /* def EXFULL */
                {errno = EINVAL; return -1;}
 #endif /* ndef EXFULL */
-       errno = EINVAL; return -1;
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToError (int x, int *r)
+int Mono_Posix_ToErrno (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
 #ifdef E2BIG
        if (x == E2BIG)
-               {*r = Mono_Posix_Error_E2BIG; return 0;}
+               {*r = Mono_Posix_Errno_E2BIG; return 0;}
 #endif /* ndef E2BIG */
 #ifdef EACCES
        if (x == EACCES)
-               {*r = Mono_Posix_Error_EACCES; return 0;}
+               {*r = Mono_Posix_Errno_EACCES; return 0;}
 #endif /* ndef EACCES */
 #ifdef EADDRINUSE
        if (x == EADDRINUSE)
-               {*r = Mono_Posix_Error_EADDRINUSE; return 0;}
+               {*r = Mono_Posix_Errno_EADDRINUSE; return 0;}
 #endif /* ndef EADDRINUSE */
 #ifdef EADDRNOTAVAIL
        if (x == EADDRNOTAVAIL)
-               {*r = Mono_Posix_Error_EADDRNOTAVAIL; return 0;}
+               {*r = Mono_Posix_Errno_EADDRNOTAVAIL; return 0;}
 #endif /* ndef EADDRNOTAVAIL */
 #ifdef EADV
        if (x == EADV)
-               {*r = Mono_Posix_Error_EADV; return 0;}
+               {*r = Mono_Posix_Errno_EADV; return 0;}
 #endif /* ndef EADV */
 #ifdef EAFNOSUPPORT
        if (x == EAFNOSUPPORT)
-               {*r = Mono_Posix_Error_EAFNOSUPPORT; return 0;}
+               {*r = Mono_Posix_Errno_EAFNOSUPPORT; return 0;}
 #endif /* ndef EAFNOSUPPORT */
 #ifdef EAGAIN
        if (x == EAGAIN)
-               {*r = Mono_Posix_Error_EAGAIN; return 0;}
+               {*r = Mono_Posix_Errno_EAGAIN; return 0;}
 #endif /* ndef EAGAIN */
 #ifdef EALREADY
        if (x == EALREADY)
-               {*r = Mono_Posix_Error_EALREADY; return 0;}
+               {*r = Mono_Posix_Errno_EALREADY; return 0;}
 #endif /* ndef EALREADY */
+#ifdef EAUTH
+       if (x == EAUTH)
+               {*r = Mono_Posix_Errno_EAUTH; return 0;}
+#endif /* ndef EAUTH */
+#ifdef EBADARCH
+       if (x == EBADARCH)
+               {*r = Mono_Posix_Errno_EBADARCH; return 0;}
+#endif /* ndef EBADARCH */
 #ifdef EBADE
        if (x == EBADE)
-               {*r = Mono_Posix_Error_EBADE; return 0;}
+               {*r = Mono_Posix_Errno_EBADE; return 0;}
 #endif /* ndef EBADE */
+#ifdef EBADEXEC
+       if (x == EBADEXEC)
+               {*r = Mono_Posix_Errno_EBADEXEC; return 0;}
+#endif /* ndef EBADEXEC */
 #ifdef EBADF
        if (x == EBADF)
-               {*r = Mono_Posix_Error_EBADF; return 0;}
+               {*r = Mono_Posix_Errno_EBADF; return 0;}
 #endif /* ndef EBADF */
 #ifdef EBADFD
        if (x == EBADFD)
-               {*r = Mono_Posix_Error_EBADFD; return 0;}
+               {*r = Mono_Posix_Errno_EBADFD; return 0;}
 #endif /* ndef EBADFD */
+#ifdef EBADMACHO
+       if (x == EBADMACHO)
+               {*r = Mono_Posix_Errno_EBADMACHO; return 0;}
+#endif /* ndef EBADMACHO */
 #ifdef EBADMSG
        if (x == EBADMSG)
-               {*r = Mono_Posix_Error_EBADMSG; return 0;}
+               {*r = Mono_Posix_Errno_EBADMSG; return 0;}
 #endif /* ndef EBADMSG */
 #ifdef EBADR
        if (x == EBADR)
-               {*r = Mono_Posix_Error_EBADR; return 0;}
+               {*r = Mono_Posix_Errno_EBADR; return 0;}
 #endif /* ndef EBADR */
+#ifdef EBADRPC
+       if (x == EBADRPC)
+               {*r = Mono_Posix_Errno_EBADRPC; return 0;}
+#endif /* ndef EBADRPC */
 #ifdef EBADRQC
        if (x == EBADRQC)
-               {*r = Mono_Posix_Error_EBADRQC; return 0;}
+               {*r = Mono_Posix_Errno_EBADRQC; return 0;}
 #endif /* ndef EBADRQC */
 #ifdef EBADSLT
        if (x == EBADSLT)
-               {*r = Mono_Posix_Error_EBADSLT; return 0;}
+               {*r = Mono_Posix_Errno_EBADSLT; return 0;}
 #endif /* ndef EBADSLT */
 #ifdef EBFONT
        if (x == EBFONT)
-               {*r = Mono_Posix_Error_EBFONT; return 0;}
+               {*r = Mono_Posix_Errno_EBFONT; return 0;}
 #endif /* ndef EBFONT */
 #ifdef EBUSY
        if (x == EBUSY)
-               {*r = Mono_Posix_Error_EBUSY; return 0;}
+               {*r = Mono_Posix_Errno_EBUSY; return 0;}
 #endif /* ndef EBUSY */
+#ifdef ECANCELED
+       if (x == ECANCELED)
+               {*r = Mono_Posix_Errno_ECANCELED; return 0;}
+#endif /* ndef ECANCELED */
 #ifdef ECHILD
        if (x == ECHILD)
-               {*r = Mono_Posix_Error_ECHILD; return 0;}
+               {*r = Mono_Posix_Errno_ECHILD; return 0;}
 #endif /* ndef ECHILD */
 #ifdef ECHRNG
        if (x == ECHRNG)
-               {*r = Mono_Posix_Error_ECHRNG; return 0;}
+               {*r = Mono_Posix_Errno_ECHRNG; return 0;}
 #endif /* ndef ECHRNG */
 #ifdef ECOMM
        if (x == ECOMM)
-               {*r = Mono_Posix_Error_ECOMM; return 0;}
+               {*r = Mono_Posix_Errno_ECOMM; return 0;}
 #endif /* ndef ECOMM */
 #ifdef ECONNABORTED
        if (x == ECONNABORTED)
-               {*r = Mono_Posix_Error_ECONNABORTED; return 0;}
+               {*r = Mono_Posix_Errno_ECONNABORTED; return 0;}
 #endif /* ndef ECONNABORTED */
 #ifdef ECONNREFUSED
        if (x == ECONNREFUSED)
-               {*r = Mono_Posix_Error_ECONNREFUSED; return 0;}
+               {*r = Mono_Posix_Errno_ECONNREFUSED; return 0;}
 #endif /* ndef ECONNREFUSED */
 #ifdef ECONNRESET
        if (x == ECONNRESET)
-               {*r = Mono_Posix_Error_ECONNRESET; return 0;}
+               {*r = Mono_Posix_Errno_ECONNRESET; return 0;}
 #endif /* ndef ECONNRESET */
 #ifdef EDEADLK
        if (x == EDEADLK)
-               {*r = Mono_Posix_Error_EDEADLK; return 0;}
+               {*r = Mono_Posix_Errno_EDEADLK; return 0;}
 #endif /* ndef EDEADLK */
 #ifdef EDEADLOCK
        if (x == EDEADLOCK)
-               {*r = Mono_Posix_Error_EDEADLOCK; return 0;}
+               {*r = Mono_Posix_Errno_EDEADLOCK; return 0;}
 #endif /* ndef EDEADLOCK */
 #ifdef EDESTADDRREQ
        if (x == EDESTADDRREQ)
-               {*r = Mono_Posix_Error_EDESTADDRREQ; return 0;}
+               {*r = Mono_Posix_Errno_EDESTADDRREQ; return 0;}
 #endif /* ndef EDESTADDRREQ */
+#ifdef EDEVERR
+       if (x == EDEVERR)
+               {*r = Mono_Posix_Errno_EDEVERR; return 0;}
+#endif /* ndef EDEVERR */
 #ifdef EDOM
        if (x == EDOM)
-               {*r = Mono_Posix_Error_EDOM; return 0;}
+               {*r = Mono_Posix_Errno_EDOM; return 0;}
 #endif /* ndef EDOM */
 #ifdef EDOTDOT
        if (x == EDOTDOT)
-               {*r = Mono_Posix_Error_EDOTDOT; return 0;}
+               {*r = Mono_Posix_Errno_EDOTDOT; return 0;}
 #endif /* ndef EDOTDOT */
 #ifdef EDQUOT
        if (x == EDQUOT)
-               {*r = Mono_Posix_Error_EDQUOT; return 0;}
+               {*r = Mono_Posix_Errno_EDQUOT; return 0;}
 #endif /* ndef EDQUOT */
 #ifdef EEXIST
        if (x == EEXIST)
-               {*r = Mono_Posix_Error_EEXIST; return 0;}
+               {*r = Mono_Posix_Errno_EEXIST; return 0;}
 #endif /* ndef EEXIST */
 #ifdef EFAULT
        if (x == EFAULT)
-               {*r = Mono_Posix_Error_EFAULT; return 0;}
+               {*r = Mono_Posix_Errno_EFAULT; return 0;}
 #endif /* ndef EFAULT */
 #ifdef EFBIG
        if (x == EFBIG)
-               {*r = Mono_Posix_Error_EFBIG; return 0;}
+               {*r = Mono_Posix_Errno_EFBIG; return 0;}
 #endif /* ndef EFBIG */
+#ifdef EFTYPE
+       if (x == EFTYPE)
+               {*r = Mono_Posix_Errno_EFTYPE; return 0;}
+#endif /* ndef EFTYPE */
 #ifdef EHOSTDOWN
        if (x == EHOSTDOWN)
-               {*r = Mono_Posix_Error_EHOSTDOWN; return 0;}
+               {*r = Mono_Posix_Errno_EHOSTDOWN; return 0;}
 #endif /* ndef EHOSTDOWN */
 #ifdef EHOSTUNREACH
        if (x == EHOSTUNREACH)
-               {*r = Mono_Posix_Error_EHOSTUNREACH; return 0;}
+               {*r = Mono_Posix_Errno_EHOSTUNREACH; return 0;}
 #endif /* ndef EHOSTUNREACH */
 #ifdef EIDRM
        if (x == EIDRM)
-               {*r = Mono_Posix_Error_EIDRM; return 0;}
+               {*r = Mono_Posix_Errno_EIDRM; return 0;}
 #endif /* ndef EIDRM */
 #ifdef EILSEQ
        if (x == EILSEQ)
-               {*r = Mono_Posix_Error_EILSEQ; return 0;}
+               {*r = Mono_Posix_Errno_EILSEQ; return 0;}
 #endif /* ndef EILSEQ */
 #ifdef EINPROGRESS
        if (x == EINPROGRESS)
-               {*r = Mono_Posix_Error_EINPROGRESS; return 0;}
+               {*r = Mono_Posix_Errno_EINPROGRESS; return 0;}
 #endif /* ndef EINPROGRESS */
 #ifdef EINTR
        if (x == EINTR)
-               {*r = Mono_Posix_Error_EINTR; return 0;}
+               {*r = Mono_Posix_Errno_EINTR; return 0;}
 #endif /* ndef EINTR */
 #ifdef EINVAL
        if (x == EINVAL)
-               {*r = Mono_Posix_Error_EINVAL; return 0;}
+               {*r = Mono_Posix_Errno_EINVAL; return 0;}
 #endif /* ndef EINVAL */
 #ifdef EIO
        if (x == EIO)
-               {*r = Mono_Posix_Error_EIO; return 0;}
+               {*r = Mono_Posix_Errno_EIO; return 0;}
 #endif /* ndef EIO */
 #ifdef EISCONN
        if (x == EISCONN)
-               {*r = Mono_Posix_Error_EISCONN; return 0;}
+               {*r = Mono_Posix_Errno_EISCONN; return 0;}
 #endif /* ndef EISCONN */
 #ifdef EISDIR
        if (x == EISDIR)
-               {*r = Mono_Posix_Error_EISDIR; return 0;}
+               {*r = Mono_Posix_Errno_EISDIR; return 0;}
 #endif /* ndef EISDIR */
 #ifdef EISNAM
        if (x == EISNAM)
-               {*r = Mono_Posix_Error_EISNAM; return 0;}
+               {*r = Mono_Posix_Errno_EISNAM; return 0;}
 #endif /* ndef EISNAM */
+#ifdef EKEYEXPIRED
+       if (x == EKEYEXPIRED)
+               {*r = Mono_Posix_Errno_EKEYEXPIRED; return 0;}
+#endif /* ndef EKEYEXPIRED */
+#ifdef EKEYREJECTED
+       if (x == EKEYREJECTED)
+               {*r = Mono_Posix_Errno_EKEYREJECTED; return 0;}
+#endif /* ndef EKEYREJECTED */
+#ifdef EKEYREVOKED
+       if (x == EKEYREVOKED)
+               {*r = Mono_Posix_Errno_EKEYREVOKED; return 0;}
+#endif /* ndef EKEYREVOKED */
 #ifdef EL2HLT
        if (x == EL2HLT)
-               {*r = Mono_Posix_Error_EL2HLT; return 0;}
+               {*r = Mono_Posix_Errno_EL2HLT; return 0;}
 #endif /* ndef EL2HLT */
 #ifdef EL2NSYNC
        if (x == EL2NSYNC)
-               {*r = Mono_Posix_Error_EL2NSYNC; return 0;}
+               {*r = Mono_Posix_Errno_EL2NSYNC; return 0;}
 #endif /* ndef EL2NSYNC */
 #ifdef EL3HLT
        if (x == EL3HLT)
-               {*r = Mono_Posix_Error_EL3HLT; return 0;}
+               {*r = Mono_Posix_Errno_EL3HLT; return 0;}
 #endif /* ndef EL3HLT */
 #ifdef EL3RST
        if (x == EL3RST)
-               {*r = Mono_Posix_Error_EL3RST; return 0;}
+               {*r = Mono_Posix_Errno_EL3RST; return 0;}
 #endif /* ndef EL3RST */
 #ifdef ELIBACC
        if (x == ELIBACC)
-               {*r = Mono_Posix_Error_ELIBACC; return 0;}
+               {*r = Mono_Posix_Errno_ELIBACC; return 0;}
 #endif /* ndef ELIBACC */
 #ifdef ELIBBAD
        if (x == ELIBBAD)
-               {*r = Mono_Posix_Error_ELIBBAD; return 0;}
+               {*r = Mono_Posix_Errno_ELIBBAD; return 0;}
 #endif /* ndef ELIBBAD */
 #ifdef ELIBEXEC
        if (x == ELIBEXEC)
-               {*r = Mono_Posix_Error_ELIBEXEC; return 0;}
+               {*r = Mono_Posix_Errno_ELIBEXEC; return 0;}
 #endif /* ndef ELIBEXEC */
 #ifdef ELIBMAX
        if (x == ELIBMAX)
-               {*r = Mono_Posix_Error_ELIBMAX; return 0;}
+               {*r = Mono_Posix_Errno_ELIBMAX; return 0;}
 #endif /* ndef ELIBMAX */
 #ifdef ELIBSCN
        if (x == ELIBSCN)
-               {*r = Mono_Posix_Error_ELIBSCN; return 0;}
+               {*r = Mono_Posix_Errno_ELIBSCN; return 0;}
 #endif /* ndef ELIBSCN */
 #ifdef ELNRNG
        if (x == ELNRNG)
-               {*r = Mono_Posix_Error_ELNRNG; return 0;}
+               {*r = Mono_Posix_Errno_ELNRNG; return 0;}
 #endif /* ndef ELNRNG */
 #ifdef ELOOP
        if (x == ELOOP)
-               {*r = Mono_Posix_Error_ELOOP; return 0;}
+               {*r = Mono_Posix_Errno_ELOOP; return 0;}
 #endif /* ndef ELOOP */
 #ifdef EMEDIUMTYPE
        if (x == EMEDIUMTYPE)
-               {*r = Mono_Posix_Error_EMEDIUMTYPE; return 0;}
+               {*r = Mono_Posix_Errno_EMEDIUMTYPE; return 0;}
 #endif /* ndef EMEDIUMTYPE */
 #ifdef EMFILE
        if (x == EMFILE)
-               {*r = Mono_Posix_Error_EMFILE; return 0;}
+               {*r = Mono_Posix_Errno_EMFILE; return 0;}
 #endif /* ndef EMFILE */
 #ifdef EMLINK
        if (x == EMLINK)
-               {*r = Mono_Posix_Error_EMLINK; return 0;}
+               {*r = Mono_Posix_Errno_EMLINK; return 0;}
 #endif /* ndef EMLINK */
 #ifdef EMSGSIZE
        if (x == EMSGSIZE)
-               {*r = Mono_Posix_Error_EMSGSIZE; return 0;}
+               {*r = Mono_Posix_Errno_EMSGSIZE; return 0;}
 #endif /* ndef EMSGSIZE */
 #ifdef EMULTIHOP
        if (x == EMULTIHOP)
-               {*r = Mono_Posix_Error_EMULTIHOP; return 0;}
+               {*r = Mono_Posix_Errno_EMULTIHOP; return 0;}
 #endif /* ndef EMULTIHOP */
 #ifdef ENAMETOOLONG
        if (x == ENAMETOOLONG)
-               {*r = Mono_Posix_Error_ENAMETOOLONG; return 0;}
+               {*r = Mono_Posix_Errno_ENAMETOOLONG; return 0;}
 #endif /* ndef ENAMETOOLONG */
 #ifdef ENAVAIL
        if (x == ENAVAIL)
-               {*r = Mono_Posix_Error_ENAVAIL; return 0;}
+               {*r = Mono_Posix_Errno_ENAVAIL; return 0;}
 #endif /* ndef ENAVAIL */
+#ifdef ENEEDAUTH
+       if (x == ENEEDAUTH)
+               {*r = Mono_Posix_Errno_ENEEDAUTH; return 0;}
+#endif /* ndef ENEEDAUTH */
 #ifdef ENETDOWN
        if (x == ENETDOWN)
-               {*r = Mono_Posix_Error_ENETDOWN; return 0;}
+               {*r = Mono_Posix_Errno_ENETDOWN; return 0;}
 #endif /* ndef ENETDOWN */
 #ifdef ENETRESET
        if (x == ENETRESET)
-               {*r = Mono_Posix_Error_ENETRESET; return 0;}
+               {*r = Mono_Posix_Errno_ENETRESET; return 0;}
 #endif /* ndef ENETRESET */
 #ifdef ENETUNREACH
        if (x == ENETUNREACH)
-               {*r = Mono_Posix_Error_ENETUNREACH; return 0;}
+               {*r = Mono_Posix_Errno_ENETUNREACH; return 0;}
 #endif /* ndef ENETUNREACH */
 #ifdef ENFILE
        if (x == ENFILE)
-               {*r = Mono_Posix_Error_ENFILE; return 0;}
+               {*r = Mono_Posix_Errno_ENFILE; return 0;}
 #endif /* ndef ENFILE */
 #ifdef ENOANO
        if (x == ENOANO)
-               {*r = Mono_Posix_Error_ENOANO; return 0;}
+               {*r = Mono_Posix_Errno_ENOANO; return 0;}
 #endif /* ndef ENOANO */
+#ifdef ENOATTR
+       if (x == ENOATTR)
+               {*r = Mono_Posix_Errno_ENOATTR; return 0;}
+#endif /* ndef ENOATTR */
 #ifdef ENOBUFS
        if (x == ENOBUFS)
-               {*r = Mono_Posix_Error_ENOBUFS; return 0;}
+               {*r = Mono_Posix_Errno_ENOBUFS; return 0;}
 #endif /* ndef ENOBUFS */
 #ifdef ENOCSI
        if (x == ENOCSI)
-               {*r = Mono_Posix_Error_ENOCSI; return 0;}
+               {*r = Mono_Posix_Errno_ENOCSI; return 0;}
 #endif /* ndef ENOCSI */
 #ifdef ENODATA
        if (x == ENODATA)
-               {*r = Mono_Posix_Error_ENODATA; return 0;}
+               {*r = Mono_Posix_Errno_ENODATA; return 0;}
 #endif /* ndef ENODATA */
 #ifdef ENODEV
        if (x == ENODEV)
-               {*r = Mono_Posix_Error_ENODEV; return 0;}
+               {*r = Mono_Posix_Errno_ENODEV; return 0;}
 #endif /* ndef ENODEV */
 #ifdef ENOENT
        if (x == ENOENT)
-               {*r = Mono_Posix_Error_ENOENT; return 0;}
+               {*r = Mono_Posix_Errno_ENOENT; return 0;}
 #endif /* ndef ENOENT */
 #ifdef ENOEXEC
        if (x == ENOEXEC)
-               {*r = Mono_Posix_Error_ENOEXEC; return 0;}
+               {*r = Mono_Posix_Errno_ENOEXEC; return 0;}
 #endif /* ndef ENOEXEC */
+#ifdef ENOKEY
+       if (x == ENOKEY)
+               {*r = Mono_Posix_Errno_ENOKEY; return 0;}
+#endif /* ndef ENOKEY */
 #ifdef ENOLCK
        if (x == ENOLCK)
-               {*r = Mono_Posix_Error_ENOLCK; return 0;}
+               {*r = Mono_Posix_Errno_ENOLCK; return 0;}
 #endif /* ndef ENOLCK */
 #ifdef ENOLINK
        if (x == ENOLINK)
-               {*r = Mono_Posix_Error_ENOLINK; return 0;}
+               {*r = Mono_Posix_Errno_ENOLINK; return 0;}
 #endif /* ndef ENOLINK */
 #ifdef ENOMEDIUM
        if (x == ENOMEDIUM)
-               {*r = Mono_Posix_Error_ENOMEDIUM; return 0;}
+               {*r = Mono_Posix_Errno_ENOMEDIUM; return 0;}
 #endif /* ndef ENOMEDIUM */
 #ifdef ENOMEM
        if (x == ENOMEM)
-               {*r = Mono_Posix_Error_ENOMEM; return 0;}
+               {*r = Mono_Posix_Errno_ENOMEM; return 0;}
 #endif /* ndef ENOMEM */
 #ifdef ENOMSG
        if (x == ENOMSG)
-               {*r = Mono_Posix_Error_ENOMSG; return 0;}
+               {*r = Mono_Posix_Errno_ENOMSG; return 0;}
 #endif /* ndef ENOMSG */
 #ifdef ENONET
        if (x == ENONET)
-               {*r = Mono_Posix_Error_ENONET; return 0;}
+               {*r = Mono_Posix_Errno_ENONET; return 0;}
 #endif /* ndef ENONET */
 #ifdef ENOPKG
        if (x == ENOPKG)
-               {*r = Mono_Posix_Error_ENOPKG; return 0;}
+               {*r = Mono_Posix_Errno_ENOPKG; return 0;}
 #endif /* ndef ENOPKG */
+#ifdef ENOPOLICY
+       if (x == ENOPOLICY)
+               {*r = Mono_Posix_Errno_ENOPOLICY; return 0;}
+#endif /* ndef ENOPOLICY */
 #ifdef ENOPROTOOPT
        if (x == ENOPROTOOPT)
-               {*r = Mono_Posix_Error_ENOPROTOOPT; return 0;}
+               {*r = Mono_Posix_Errno_ENOPROTOOPT; return 0;}
 #endif /* ndef ENOPROTOOPT */
 #ifdef ENOSPC
        if (x == ENOSPC)
-               {*r = Mono_Posix_Error_ENOSPC; return 0;}
+               {*r = Mono_Posix_Errno_ENOSPC; return 0;}
 #endif /* ndef ENOSPC */
 #ifdef ENOSR
        if (x == ENOSR)
-               {*r = Mono_Posix_Error_ENOSR; return 0;}
+               {*r = Mono_Posix_Errno_ENOSR; return 0;}
 #endif /* ndef ENOSR */
 #ifdef ENOSTR
        if (x == ENOSTR)
-               {*r = Mono_Posix_Error_ENOSTR; return 0;}
+               {*r = Mono_Posix_Errno_ENOSTR; return 0;}
 #endif /* ndef ENOSTR */
 #ifdef ENOSYS
        if (x == ENOSYS)
-               {*r = Mono_Posix_Error_ENOSYS; return 0;}
+               {*r = Mono_Posix_Errno_ENOSYS; return 0;}
 #endif /* ndef ENOSYS */
 #ifdef ENOTBLK
        if (x == ENOTBLK)
-               {*r = Mono_Posix_Error_ENOTBLK; return 0;}
+               {*r = Mono_Posix_Errno_ENOTBLK; return 0;}
 #endif /* ndef ENOTBLK */
 #ifdef ENOTCONN
        if (x == ENOTCONN)
-               {*r = Mono_Posix_Error_ENOTCONN; return 0;}
+               {*r = Mono_Posix_Errno_ENOTCONN; return 0;}
 #endif /* ndef ENOTCONN */
 #ifdef ENOTDIR
        if (x == ENOTDIR)
-               {*r = Mono_Posix_Error_ENOTDIR; return 0;}
+               {*r = Mono_Posix_Errno_ENOTDIR; return 0;}
 #endif /* ndef ENOTDIR */
 #ifdef ENOTEMPTY
        if (x == ENOTEMPTY)
-               {*r = Mono_Posix_Error_ENOTEMPTY; return 0;}
+               {*r = Mono_Posix_Errno_ENOTEMPTY; return 0;}
 #endif /* ndef ENOTEMPTY */
 #ifdef ENOTNAM
        if (x == ENOTNAM)
-               {*r = Mono_Posix_Error_ENOTNAM; return 0;}
+               {*r = Mono_Posix_Errno_ENOTNAM; return 0;}
 #endif /* ndef ENOTNAM */
+#ifdef ENOTRECOVERABLE
+       if (x == ENOTRECOVERABLE)
+               {*r = Mono_Posix_Errno_ENOTRECOVERABLE; return 0;}
+#endif /* ndef ENOTRECOVERABLE */
 #ifdef ENOTSOCK
        if (x == ENOTSOCK)
-               {*r = Mono_Posix_Error_ENOTSOCK; return 0;}
+               {*r = Mono_Posix_Errno_ENOTSOCK; return 0;}
 #endif /* ndef ENOTSOCK */
 #ifdef ENOTTY
        if (x == ENOTTY)
-               {*r = Mono_Posix_Error_ENOTTY; return 0;}
+               {*r = Mono_Posix_Errno_ENOTTY; return 0;}
 #endif /* ndef ENOTTY */
 #ifdef ENOTUNIQ
        if (x == ENOTUNIQ)
-               {*r = Mono_Posix_Error_ENOTUNIQ; return 0;}
+               {*r = Mono_Posix_Errno_ENOTUNIQ; return 0;}
 #endif /* ndef ENOTUNIQ */
 #ifdef ENXIO
        if (x == ENXIO)
-               {*r = Mono_Posix_Error_ENXIO; return 0;}
+               {*r = Mono_Posix_Errno_ENXIO; return 0;}
 #endif /* ndef ENXIO */
 #ifdef EOPNOTSUPP
        if (x == EOPNOTSUPP)
-               {*r = Mono_Posix_Error_EOPNOTSUPP; return 0;}
+               {*r = Mono_Posix_Errno_EOPNOTSUPP; return 0;}
 #endif /* ndef EOPNOTSUPP */
 #ifdef EOVERFLOW
        if (x == EOVERFLOW)
-               {*r = Mono_Posix_Error_EOVERFLOW; return 0;}
+               {*r = Mono_Posix_Errno_EOVERFLOW; return 0;}
 #endif /* ndef EOVERFLOW */
+#ifdef EOWNERDEAD
+       if (x == EOWNERDEAD)
+               {*r = Mono_Posix_Errno_EOWNERDEAD; return 0;}
+#endif /* ndef EOWNERDEAD */
 #ifdef EPERM
        if (x == EPERM)
-               {*r = Mono_Posix_Error_EPERM; return 0;}
+               {*r = Mono_Posix_Errno_EPERM; return 0;}
 #endif /* ndef EPERM */
 #ifdef EPFNOSUPPORT
        if (x == EPFNOSUPPORT)
-               {*r = Mono_Posix_Error_EPFNOSUPPORT; return 0;}
+               {*r = Mono_Posix_Errno_EPFNOSUPPORT; return 0;}
 #endif /* ndef EPFNOSUPPORT */
 #ifdef EPIPE
        if (x == EPIPE)
-               {*r = Mono_Posix_Error_EPIPE; return 0;}
+               {*r = Mono_Posix_Errno_EPIPE; return 0;}
 #endif /* ndef EPIPE */
+#ifdef EPROCLIM
+       if (x == EPROCLIM)
+               {*r = Mono_Posix_Errno_EPROCLIM; return 0;}
+#endif /* ndef EPROCLIM */
+#ifdef EPROCUNAVAIL
+       if (x == EPROCUNAVAIL)
+               {*r = Mono_Posix_Errno_EPROCUNAVAIL; return 0;}
+#endif /* ndef EPROCUNAVAIL */
+#ifdef EPROGMISMATCH
+       if (x == EPROGMISMATCH)
+               {*r = Mono_Posix_Errno_EPROGMISMATCH; return 0;}
+#endif /* ndef EPROGMISMATCH */
+#ifdef EPROGUNAVAIL
+       if (x == EPROGUNAVAIL)
+               {*r = Mono_Posix_Errno_EPROGUNAVAIL; return 0;}
+#endif /* ndef EPROGUNAVAIL */
 #ifdef EPROTO
        if (x == EPROTO)
-               {*r = Mono_Posix_Error_EPROTO; return 0;}
+               {*r = Mono_Posix_Errno_EPROTO; return 0;}
 #endif /* ndef EPROTO */
 #ifdef EPROTONOSUPPORT
        if (x == EPROTONOSUPPORT)
-               {*r = Mono_Posix_Error_EPROTONOSUPPORT; return 0;}
+               {*r = Mono_Posix_Errno_EPROTONOSUPPORT; return 0;}
 #endif /* ndef EPROTONOSUPPORT */
 #ifdef EPROTOTYPE
        if (x == EPROTOTYPE)
-               {*r = Mono_Posix_Error_EPROTOTYPE; return 0;}
+               {*r = Mono_Posix_Errno_EPROTOTYPE; return 0;}
 #endif /* ndef EPROTOTYPE */
+#ifdef EPWROFF
+       if (x == EPWROFF)
+               {*r = Mono_Posix_Errno_EPWROFF; return 0;}
+#endif /* ndef EPWROFF */
 #ifdef ERANGE
        if (x == ERANGE)
-               {*r = Mono_Posix_Error_ERANGE; return 0;}
+               {*r = Mono_Posix_Errno_ERANGE; return 0;}
 #endif /* ndef ERANGE */
 #ifdef EREMCHG
        if (x == EREMCHG)
-               {*r = Mono_Posix_Error_EREMCHG; return 0;}
+               {*r = Mono_Posix_Errno_EREMCHG; return 0;}
 #endif /* ndef EREMCHG */
 #ifdef EREMOTE
        if (x == EREMOTE)
-               {*r = Mono_Posix_Error_EREMOTE; return 0;}
+               {*r = Mono_Posix_Errno_EREMOTE; return 0;}
 #endif /* ndef EREMOTE */
 #ifdef EREMOTEIO
        if (x == EREMOTEIO)
-               {*r = Mono_Posix_Error_EREMOTEIO; return 0;}
+               {*r = Mono_Posix_Errno_EREMOTEIO; return 0;}
 #endif /* ndef EREMOTEIO */
 #ifdef ERESTART
        if (x == ERESTART)
-               {*r = Mono_Posix_Error_ERESTART; return 0;}
+               {*r = Mono_Posix_Errno_ERESTART; return 0;}
 #endif /* ndef ERESTART */
 #ifdef EROFS
        if (x == EROFS)
-               {*r = Mono_Posix_Error_EROFS; return 0;}
+               {*r = Mono_Posix_Errno_EROFS; return 0;}
 #endif /* ndef EROFS */
+#ifdef ERPCMISMATCH
+       if (x == ERPCMISMATCH)
+               {*r = Mono_Posix_Errno_ERPCMISMATCH; return 0;}
+#endif /* ndef ERPCMISMATCH */
+#ifdef ESHLIBVERS
+       if (x == ESHLIBVERS)
+               {*r = Mono_Posix_Errno_ESHLIBVERS; return 0;}
+#endif /* ndef ESHLIBVERS */
 #ifdef ESHUTDOWN
        if (x == ESHUTDOWN)
-               {*r = Mono_Posix_Error_ESHUTDOWN; return 0;}
+               {*r = Mono_Posix_Errno_ESHUTDOWN; return 0;}
 #endif /* ndef ESHUTDOWN */
 #ifdef ESOCKTNOSUPPORT
        if (x == ESOCKTNOSUPPORT)
-               {*r = Mono_Posix_Error_ESOCKTNOSUPPORT; return 0;}
+               {*r = Mono_Posix_Errno_ESOCKTNOSUPPORT; return 0;}
 #endif /* ndef ESOCKTNOSUPPORT */
 #ifdef ESPIPE
        if (x == ESPIPE)
-               {*r = Mono_Posix_Error_ESPIPE; return 0;}
+               {*r = Mono_Posix_Errno_ESPIPE; return 0;}
 #endif /* ndef ESPIPE */
 #ifdef ESRCH
        if (x == ESRCH)
-               {*r = Mono_Posix_Error_ESRCH; return 0;}
+               {*r = Mono_Posix_Errno_ESRCH; return 0;}
 #endif /* ndef ESRCH */
 #ifdef ESRMNT
        if (x == ESRMNT)
-               {*r = Mono_Posix_Error_ESRMNT; return 0;}
+               {*r = Mono_Posix_Errno_ESRMNT; return 0;}
 #endif /* ndef ESRMNT */
 #ifdef ESTALE
        if (x == ESTALE)
-               {*r = Mono_Posix_Error_ESTALE; return 0;}
+               {*r = Mono_Posix_Errno_ESTALE; return 0;}
 #endif /* ndef ESTALE */
 #ifdef ESTRPIPE
        if (x == ESTRPIPE)
-               {*r = Mono_Posix_Error_ESTRPIPE; return 0;}
+               {*r = Mono_Posix_Errno_ESTRPIPE; return 0;}
 #endif /* ndef ESTRPIPE */
 #ifdef ETIME
        if (x == ETIME)
-               {*r = Mono_Posix_Error_ETIME; return 0;}
+               {*r = Mono_Posix_Errno_ETIME; return 0;}
 #endif /* ndef ETIME */
 #ifdef ETIMEDOUT
        if (x == ETIMEDOUT)
-               {*r = Mono_Posix_Error_ETIMEDOUT; return 0;}
+               {*r = Mono_Posix_Errno_ETIMEDOUT; return 0;}
 #endif /* ndef ETIMEDOUT */
 #ifdef ETOOMANYREFS
        if (x == ETOOMANYREFS)
-               {*r = Mono_Posix_Error_ETOOMANYREFS; return 0;}
+               {*r = Mono_Posix_Errno_ETOOMANYREFS; return 0;}
 #endif /* ndef ETOOMANYREFS */
 #ifdef ETXTBSY
        if (x == ETXTBSY)
-               {*r = Mono_Posix_Error_ETXTBSY; return 0;}
+               {*r = Mono_Posix_Errno_ETXTBSY; return 0;}
 #endif /* ndef ETXTBSY */
 #ifdef EUCLEAN
        if (x == EUCLEAN)
-               {*r = Mono_Posix_Error_EUCLEAN; return 0;}
+               {*r = Mono_Posix_Errno_EUCLEAN; return 0;}
 #endif /* ndef EUCLEAN */
 #ifdef EUNATCH
        if (x == EUNATCH)
-               {*r = Mono_Posix_Error_EUNATCH; return 0;}
+               {*r = Mono_Posix_Errno_EUNATCH; return 0;}
 #endif /* ndef EUNATCH */
 #ifdef EUSERS
        if (x == EUSERS)
-               {*r = Mono_Posix_Error_EUSERS; return 0;}
+               {*r = Mono_Posix_Errno_EUSERS; return 0;}
 #endif /* ndef EUSERS */
 #ifdef EWOULDBLOCK
        if (x == EWOULDBLOCK)
-               {*r = Mono_Posix_Error_EWOULDBLOCK; return 0;}
+               {*r = Mono_Posix_Errno_EWOULDBLOCK; return 0;}
 #endif /* ndef EWOULDBLOCK */
 #ifdef EXDEV
        if (x == EXDEV)
-               {*r = Mono_Posix_Error_EXDEV; return 0;}
+               {*r = Mono_Posix_Errno_EXDEV; return 0;}
 #endif /* ndef EXDEV */
 #ifdef EXFULL
        if (x == EXFULL)
-               {*r = Mono_Posix_Error_EXFULL; return 0;}
+               {*r = Mono_Posix_Errno_EXFULL; return 0;}
 #endif /* ndef EXFULL */
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_FromMmapProt (int x, int *r)
+int Mono_Posix_FromFcntlCommand (int x, int *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
-       if ((x & Mono_Posix_MmapProt_PROT_EXEC) == Mono_Posix_MmapProt_PROT_EXEC)
-#ifdef PROT_EXEC
-               *r |= PROT_EXEC;
-#else /* def PROT_EXEC */
+       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 PROT_EXEC */
-       if ((x & Mono_Posix_MmapProt_PROT_GROWSDOWN) == Mono_Posix_MmapProt_PROT_GROWSDOWN)
-#ifdef PROT_GROWSDOWN
-               *r |= PROT_GROWSDOWN;
-#else /* def PROT_GROWSDOWN */
+#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 PROT_GROWSDOWN */
-       if ((x & Mono_Posix_MmapProt_PROT_GROWSUP) == Mono_Posix_MmapProt_PROT_GROWSUP)
-#ifdef PROT_GROWSUP
-               *r |= PROT_GROWSUP;
-#else /* def PROT_GROWSUP */
+#endif /* ndef F_GETFD */
+       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 PROT_GROWSUP */
-       if ((x & Mono_Posix_MmapProt_PROT_NONE) == Mono_Posix_MmapProt_PROT_NONE)
-#ifdef PROT_NONE
-               *r |= PROT_NONE;
-#else /* def PROT_NONE */
+#endif /* ndef F_GETFL */
+       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 PROT_NONE */
-       if ((x & Mono_Posix_MmapProt_PROT_READ) == Mono_Posix_MmapProt_PROT_READ)
-#ifdef PROT_READ
-               *r |= PROT_READ;
-#else /* def PROT_READ */
+#endif /* ndef F_GETLEASE */
+       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 PROT_READ */
-       if ((x & Mono_Posix_MmapProt_PROT_WRITE) == Mono_Posix_MmapProt_PROT_WRITE)
-#ifdef PROT_WRITE
-               *r |= PROT_WRITE;
-#else /* def PROT_WRITE */
+#endif /* ndef F_GETLK */
+       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 PROT_WRITE */
-       return 0;
+#endif /* ndef F_GETOWN */
+       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_NOCACHE)
+#ifdef F_NOCACHE
+               {*r = F_NOCACHE; return 0;}
+#else /* def F_NOCACHE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef F_NOCACHE */
+       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 */
+       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_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_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_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_SETSIG)
+#ifdef F_SETSIG
+               {*r = F_SETSIG; return 0;}
+#else /* def F_SETSIG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef F_SETSIG */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToMmapProt (int x, int *r)
+int Mono_Posix_ToFcntlCommand (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
-#ifdef PROT_EXEC
-       if ((x & PROT_EXEC) == PROT_EXEC)
-               *r |= Mono_Posix_MmapProt_PROT_EXEC;
-#endif /* ndef PROT_EXEC */
-#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 */
-#ifdef PROT_NONE
-       if ((x & PROT_NONE) == PROT_NONE)
-               *r |= Mono_Posix_MmapProt_PROT_NONE;
-#endif /* ndef PROT_NONE */
-#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 */
-       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_GETFL
+       if (x == F_GETFL)
+               {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
+#endif /* ndef F_GETFL */
+#ifdef F_GETLEASE
+       if (x == F_GETLEASE)
+               {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
+#endif /* ndef F_GETLEASE */
+#ifdef F_GETLK
+       if (x == F_GETLK)
+               {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
+#endif /* ndef F_GETLK */
+#ifdef F_GETOWN
+       if (x == F_GETOWN)
+               {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
+#endif /* ndef F_GETOWN */
+#ifdef F_GETSIG
+       if (x == F_GETSIG)
+               {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
+#endif /* ndef F_GETSIG */
+#ifdef F_NOCACHE
+       if (x == F_NOCACHE)
+               {*r = Mono_Posix_FcntlCommand_F_NOCACHE; return 0;}
+#endif /* ndef F_NOCACHE */
+#ifdef F_NOTIFY
+       if (x == F_NOTIFY)
+               {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
+#endif /* ndef F_NOTIFY */
+#ifdef F_SETFD
+       if (x == F_SETFD)
+               {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
+#endif /* ndef F_SETFD */
+#ifdef F_SETFL
+       if (x == F_SETFL)
+               {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
+#endif /* ndef F_SETFL */
+#ifdef F_SETLEASE
+       if (x == F_SETLEASE)
+               {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
+#endif /* ndef F_SETLEASE */
+#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_SETSIG
+       if (x == F_SETSIG)
+               {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
+#endif /* ndef F_SETSIG */
+       errno = EINVAL; return -1;
 }
 
-int Mono_Posix_FromAccessModes (int x, int *r)
+int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
-       if ((x & Mono_Posix_AccessModes_F_OK) == Mono_Posix_AccessModes_F_OK)
-#ifdef F_OK
-               *r |= F_OK;
-#else /* def F_OK */
+       if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
+#ifdef ACCESSPERMS
+               *r |= ACCESSPERMS;
+#else /* def ACCESSPERMS */
+               {/* Ignoring Mono_Posix_FilePermissions_ACCESSPERMS, as it is constructed from other values */}
+#endif /* ndef ACCESSPERMS */
+       if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
+#ifdef ALLPERMS
+               *r |= ALLPERMS;
+#else /* def ALLPERMS */
+               {/* Ignoring Mono_Posix_FilePermissions_ALLPERMS, as it is constructed from other values */}
+#endif /* ndef ALLPERMS */
+       if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
+#ifdef DEFFILEMODE
+               *r |= DEFFILEMODE;
+#else /* def DEFFILEMODE */
+               {/* Ignoring Mono_Posix_FilePermissions_DEFFILEMODE, as it is constructed from other values */}
+#endif /* ndef DEFFILEMODE */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFBLK)
+#ifdef S_IFBLK
+               *r |= S_IFBLK;
+#else /* def S_IFBLK */
                {errno = EINVAL; return -1;}
-#endif /* ndef F_OK */
-       if ((x & Mono_Posix_AccessModes_R_OK) == Mono_Posix_AccessModes_R_OK)
-#ifdef R_OK
-               *r |= R_OK;
-#else /* def R_OK */
+#endif /* ndef S_IFBLK */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFCHR)
+#ifdef S_IFCHR
+               *r |= S_IFCHR;
+#else /* def S_IFCHR */
                {errno = EINVAL; return -1;}
-#endif /* ndef R_OK */
-       if ((x & Mono_Posix_AccessModes_W_OK) == Mono_Posix_AccessModes_W_OK)
-#ifdef W_OK
-               *r |= W_OK;
-#else /* def W_OK */
+#endif /* ndef S_IFCHR */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFDIR)
+#ifdef S_IFDIR
+               *r |= S_IFDIR;
+#else /* def S_IFDIR */
                {errno = EINVAL; return -1;}
-#endif /* ndef W_OK */
-       if ((x & Mono_Posix_AccessModes_X_OK) == Mono_Posix_AccessModes_X_OK)
-#ifdef X_OK
-               *r |= X_OK;
-#else /* def X_OK */
+#endif /* ndef S_IFDIR */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFIFO)
+#ifdef S_IFIFO
+               *r |= S_IFIFO;
+#else /* def S_IFIFO */
                {errno = EINVAL; return -1;}
-#endif /* ndef X_OK */
-       return 0;
-}
-
-int Mono_Posix_ToAccessModes (int x, int *r)
-{
-       *r = 0;
+#endif /* ndef S_IFIFO */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == 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_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
+#ifdef S_IFMT
+               *r |= S_IFMT;
+#else /* def S_IFMT */
+               {/* Ignoring Mono_Posix_FilePermissions_S_IFMT, as it is constructed from other values */}
+#endif /* ndef S_IFMT */
+       if ((x & Mono_Posix_FilePermissions_S_IFMT) == 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_IFMT) == Mono_Posix_FilePermissions_S_IFSOCK)
+#ifdef S_IFSOCK
+               *r |= S_IFSOCK;
+#else /* def S_IFSOCK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef S_IFSOCK */
+       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_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_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_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
+#ifdef S_IRWXG
+               *r |= S_IRWXG;
+#else /* def S_IRWXG */
+               {/* Ignoring Mono_Posix_FilePermissions_S_IRWXG, as it is constructed from other values */}
+#endif /* ndef S_IRWXG */
+       if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
+#ifdef S_IRWXO
+               *r |= S_IRWXO;
+#else /* def S_IRWXO */
+               {/* Ignoring Mono_Posix_FilePermissions_S_IRWXO, as it is constructed from other values */}
+#endif /* ndef S_IRWXO */
+       if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
+#ifdef S_IRWXU
+               *r |= S_IRWXU;
+#else /* def S_IRWXU */
+               {/* Ignoring Mono_Posix_FilePermissions_S_IRWXU, as it is constructed from other values */}
+#endif /* ndef S_IRWXU */
+       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_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_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_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_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_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_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_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_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 == 0)
                return 0;
-#ifdef F_OK
-       if ((x & F_OK) == F_OK)
-               *r |= Mono_Posix_AccessModes_F_OK;
-#endif /* ndef F_OK */
-#ifdef R_OK
-       if ((x & R_OK) == R_OK)
-               *r |= Mono_Posix_AccessModes_R_OK;
-#endif /* ndef R_OK */
-#ifdef W_OK
-       if ((x & W_OK) == W_OK)
-               *r |= Mono_Posix_AccessModes_W_OK;
-#endif /* ndef W_OK */
-#ifdef X_OK
-       if ((x & X_OK) == X_OK)
-               *r |= Mono_Posix_AccessModes_X_OK;
-#endif /* ndef X_OK */
        return 0;
 }
 
-int Mono_Posix_FromConfstrName (int x, int *r)
+int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
-       if (x == Mono_Posix_ConfstrName__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_ConfstrName__CS_GNU_LIBPTHREAD_VERSION)
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
-               {*r = _CS_GNU_LIBPTHREAD_VERSION; return 0;}
-#else /* def _CS_GNU_LIBPTHREAD_VERSION */
+#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_IFBLK
+       if ((x & S_IFMT) == S_IFBLK)
+               *r |= Mono_Posix_FilePermissions_S_IFBLK;
+#endif /* ndef S_IFBLK */
+#ifdef S_IFCHR
+       if ((x & S_IFMT) == S_IFCHR)
+               *r |= Mono_Posix_FilePermissions_S_IFCHR;
+#endif /* ndef S_IFCHR */
+#ifdef S_IFDIR
+       if ((x & S_IFMT) == S_IFDIR)
+               *r |= Mono_Posix_FilePermissions_S_IFDIR;
+#endif /* ndef S_IFDIR */
+#ifdef S_IFIFO
+       if ((x & S_IFMT) == S_IFIFO)
+               *r |= Mono_Posix_FilePermissions_S_IFIFO;
+#endif /* ndef S_IFIFO */
+#ifdef S_IFLNK
+       if ((x & S_IFMT) == S_IFLNK)
+               *r |= Mono_Posix_FilePermissions_S_IFLNK;
+#endif /* ndef S_IFLNK */
+#ifdef S_IFMT
+       if ((x & S_IFMT) == S_IFMT)
+               *r |= Mono_Posix_FilePermissions_S_IFMT;
+#endif /* ndef S_IFMT */
+#ifdef S_IFREG
+       if ((x & S_IFMT) == S_IFREG)
+               *r |= Mono_Posix_FilePermissions_S_IFREG;
+#endif /* ndef S_IFREG */
+#ifdef S_IFSOCK
+       if ((x & S_IFMT) == S_IFSOCK)
+               *r |= Mono_Posix_FilePermissions_S_IFSOCK;
+#endif /* ndef S_IFSOCK */
+#ifdef S_IRGRP
+       if ((x & S_IRGRP) == S_IRGRP)
+               *r |= Mono_Posix_FilePermissions_S_IRGRP;
+#endif /* ndef S_IRGRP */
+#ifdef S_IROTH
+       if ((x & S_IROTH) == S_IROTH)
+               *r |= Mono_Posix_FilePermissions_S_IROTH;
+#endif /* ndef S_IROTH */
+#ifdef S_IRUSR
+       if ((x & S_IRUSR) == S_IRUSR)
+               *r |= Mono_Posix_FilePermissions_S_IRUSR;
+#endif /* ndef S_IRUSR */
+#ifdef S_IRWXG
+       if ((x & S_IRWXG) == S_IRWXG)
+               *r |= Mono_Posix_FilePermissions_S_IRWXG;
+#endif /* ndef S_IRWXG */
+#ifdef S_IRWXO
+       if ((x & S_IRWXO) == S_IRWXO)
+               *r |= Mono_Posix_FilePermissions_S_IRWXO;
+#endif /* ndef S_IRWXO */
+#ifdef S_IRWXU
+       if ((x & S_IRWXU) == S_IRWXU)
+               *r |= Mono_Posix_FilePermissions_S_IRWXU;
+#endif /* ndef S_IRWXU */
+#ifdef S_ISGID
+       if ((x & S_ISGID) == S_ISGID)
+               *r |= Mono_Posix_FilePermissions_S_ISGID;
+#endif /* ndef S_ISGID */
+#ifdef S_ISUID
+       if ((x & S_ISUID) == S_ISUID)
+               *r |= Mono_Posix_FilePermissions_S_ISUID;
+#endif /* ndef S_ISUID */
+#ifdef S_ISVTX
+       if ((x & S_ISVTX) == S_ISVTX)
+               *r |= Mono_Posix_FilePermissions_S_ISVTX;
+#endif /* ndef S_ISVTX */
+#ifdef S_IWGRP
+       if ((x & S_IWGRP) == S_IWGRP)
+               *r |= Mono_Posix_FilePermissions_S_IWGRP;
+#endif /* ndef S_IWGRP */
+#ifdef S_IWOTH
+       if ((x & S_IWOTH) == S_IWOTH)
+               *r |= Mono_Posix_FilePermissions_S_IWOTH;
+#endif /* ndef S_IWOTH */
+#ifdef S_IWUSR
+       if ((x & S_IWUSR) == S_IWUSR)
+               *r |= Mono_Posix_FilePermissions_S_IWUSR;
+#endif /* ndef S_IWUSR */
+#ifdef S_IXGRP
+       if ((x & S_IXGRP) == S_IXGRP)
+               *r |= Mono_Posix_FilePermissions_S_IXGRP;
+#endif /* ndef S_IXGRP */
+#ifdef S_IXOTH
+       if ((x & S_IXOTH) == S_IXOTH)
+               *r |= Mono_Posix_FilePermissions_S_IXOTH;
+#endif /* ndef S_IXOTH */
+#ifdef S_IXUSR
+       if ((x & S_IXUSR) == S_IXUSR)
+               *r |= Mono_Posix_FilePermissions_S_IXUSR;
+#endif /* ndef S_IXUSR */
+       return 0;
+}
+
+#ifdef HAVE_STRUCT_FLOCK
+int
+Mono_Posix_FromFlock (struct Mono_Posix_Flock *from, struct flock *to)
+{
+       _cnm_return_val_if_overflow (off_t, from->l_start, -1);
+       _cnm_return_val_if_overflow (off_t, from->l_len, -1);
+       _cnm_return_val_if_overflow (pid_t, from->l_pid, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       if (Mono_Posix_FromLockType (from->l_type, &to->l_type) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_FromSeekFlags (from->l_whence, &to->l_whence) != 0) {
+               return -1;
+       }
+       to->l_start  = from->l_start;
+       to->l_len    = from->l_len;
+       to->l_pid    = from->l_pid;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_FLOCK */
+
+
+#ifdef HAVE_STRUCT_FLOCK
+int
+Mono_Posix_ToFlock (struct flock *from, struct Mono_Posix_Flock *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->l_start, -1);
+       _cnm_return_val_if_overflow (gint64, from->l_len, -1);
+       _cnm_return_val_if_overflow (int, from->l_pid, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       if (Mono_Posix_ToLockType (from->l_type, &to->l_type) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_ToSeekFlags (from->l_whence, &to->l_whence) != 0) {
+               return -1;
+       }
+       to->l_start  = from->l_start;
+       to->l_len    = from->l_len;
+       to->l_pid    = from->l_pid;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_FLOCK */
+
+
+#ifdef HAVE_STRUCT_IOVEC
+int
+Mono_Posix_FromIovec (struct Mono_Posix_Iovec *from, struct iovec *to)
+{
+       _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->iov_base = from->iov_base;
+       to->iov_len  = from->iov_len;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_IOVEC */
+
+
+#ifdef HAVE_STRUCT_IOVEC
+int
+Mono_Posix_ToIovec (struct iovec *from, struct Mono_Posix_Iovec *to)
+{
+       _cnm_return_val_if_overflow (guint64, from->iov_len, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->iov_base = from->iov_base;
+       to->iov_len  = from->iov_len;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_IOVEC */
+
+
+#ifdef HAVE_STRUCT_LINGER
+int
+Mono_Posix_FromLinger (struct Mono_Posix_Linger *from, struct linger *to)
+{
+       _cnm_return_val_if_overflow (int, from->l_onoff, -1);
+       _cnm_return_val_if_overflow (int, from->l_linger, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->l_onoff  = from->l_onoff;
+       to->l_linger = from->l_linger;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_LINGER */
+
+
+#ifdef HAVE_STRUCT_LINGER
+int
+Mono_Posix_ToLinger (struct linger *from, struct Mono_Posix_Linger *to)
+{
+       _cnm_return_val_if_overflow (int, from->l_onoff, -1);
+       _cnm_return_val_if_overflow (int, from->l_linger, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->l_onoff  = from->l_onoff;
+       to->l_linger = from->l_linger;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_LINGER */
+
+
+int Mono_Posix_FromLockType (short x, short *r)
+{
+       *r = 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 _CS_GNU_LIBPTHREAD_VERSION */
-       if (x == Mono_Posix_ConfstrName__CS_LFS64_CFLAGS)
-#ifdef _CS_LFS64_CFLAGS
-               {*r = _CS_LFS64_CFLAGS; return 0;}
-#else /* def _CS_LFS64_CFLAGS */
+#endif /* ndef F_RDLCK */
+       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 _CS_LFS64_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS)
-#ifdef _CS_LFS64_LDFLAGS
-               {*r = _CS_LFS64_LDFLAGS; return 0;}
-#else /* def _CS_LFS64_LDFLAGS */
+#endif /* ndef F_UNLCK */
+       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 _CS_LFS64_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__CS_LFS64_LIBS)
-#ifdef _CS_LFS64_LIBS
-               {*r = _CS_LFS64_LIBS; return 0;}
-#else /* def _CS_LFS64_LIBS */
+#endif /* ndef F_WRLCK */
+       if (x == 0)
+               return 0;
+       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_UNLCK
+       if (x == F_UNLCK)
+               {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
+#endif /* ndef F_UNLCK */
+#ifdef F_WRLCK
+       if (x == F_WRLCK)
+               {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
+#endif /* ndef F_WRLCK */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromLockfCommand (int x, int *r)
+{
+       *r = 0;
+       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 _CS_LFS64_LIBS */
-       if (x == Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS)
-#ifdef _CS_LFS64_LINTFLAGS
-               {*r = _CS_LFS64_LINTFLAGS; return 0;}
-#else /* def _CS_LFS64_LINTFLAGS */
+#endif /* ndef F_LOCK */
+       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 _CS_LFS64_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__CS_LFS_CFLAGS)
-#ifdef _CS_LFS_CFLAGS
-               {*r = _CS_LFS_CFLAGS; return 0;}
-#else /* def _CS_LFS_CFLAGS */
+#endif /* ndef F_TEST */
+       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 _CS_LFS_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__CS_LFS_LDFLAGS)
-#ifdef _CS_LFS_LDFLAGS
-               {*r = _CS_LFS_LDFLAGS; return 0;}
-#else /* def _CS_LFS_LDFLAGS */
+#endif /* ndef F_TLOCK */
+       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 _CS_LFS_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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 */
+#endif /* ndef F_ULOCK */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToLockfCommand (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef F_LOCK
+       if (x == F_LOCK)
+               {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
+#endif /* ndef F_LOCK */
+#ifdef F_TEST
+       if (x == F_TEST)
+               {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
+#endif /* ndef F_TEST */
+#ifdef F_TLOCK
+       if (x == F_TLOCK)
+               {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
+#endif /* ndef F_TLOCK */
+#ifdef F_ULOCK
+       if (x == F_ULOCK)
+               {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
+#endif /* ndef F_ULOCK */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromMessageFlags (int x, int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC) == Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC)
+#ifdef MSG_CMSG_CLOEXEC
+               *r |= MSG_CMSG_CLOEXEC;
+#else /* def MSG_CMSG_CLOEXEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_CMSG_CLOEXEC */
+       if ((x & Mono_Posix_MessageFlags_MSG_CONFIRM) == Mono_Posix_MessageFlags_MSG_CONFIRM)
+#ifdef MSG_CONFIRM
+               *r |= MSG_CONFIRM;
+#else /* def MSG_CONFIRM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_CONFIRM */
+       if ((x & Mono_Posix_MessageFlags_MSG_CTRUNC) == Mono_Posix_MessageFlags_MSG_CTRUNC)
+#ifdef MSG_CTRUNC
+               *r |= MSG_CTRUNC;
+#else /* def MSG_CTRUNC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_CTRUNC */
+       if ((x & Mono_Posix_MessageFlags_MSG_DONTROUTE) == Mono_Posix_MessageFlags_MSG_DONTROUTE)
+#ifdef MSG_DONTROUTE
+               *r |= MSG_DONTROUTE;
+#else /* def MSG_DONTROUTE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_DONTROUTE */
+       if ((x & Mono_Posix_MessageFlags_MSG_DONTWAIT) == Mono_Posix_MessageFlags_MSG_DONTWAIT)
+#ifdef MSG_DONTWAIT
+               *r |= MSG_DONTWAIT;
+#else /* def MSG_DONTWAIT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_DONTWAIT */
+       if ((x & Mono_Posix_MessageFlags_MSG_EOR) == Mono_Posix_MessageFlags_MSG_EOR)
+#ifdef MSG_EOR
+               *r |= MSG_EOR;
+#else /* def MSG_EOR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_EOR */
+       if ((x & Mono_Posix_MessageFlags_MSG_ERRQUEUE) == Mono_Posix_MessageFlags_MSG_ERRQUEUE)
+#ifdef MSG_ERRQUEUE
+               *r |= MSG_ERRQUEUE;
+#else /* def MSG_ERRQUEUE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_ERRQUEUE */
+       if ((x & Mono_Posix_MessageFlags_MSG_FASTOPEN) == Mono_Posix_MessageFlags_MSG_FASTOPEN)
+#ifdef MSG_FASTOPEN
+               *r |= MSG_FASTOPEN;
+#else /* def MSG_FASTOPEN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_FASTOPEN */
+       if ((x & Mono_Posix_MessageFlags_MSG_FIN) == Mono_Posix_MessageFlags_MSG_FIN)
+#ifdef MSG_FIN
+               *r |= MSG_FIN;
+#else /* def MSG_FIN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_FIN */
+       if ((x & Mono_Posix_MessageFlags_MSG_MORE) == Mono_Posix_MessageFlags_MSG_MORE)
+#ifdef MSG_MORE
+               *r |= MSG_MORE;
+#else /* def MSG_MORE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_MORE */
+       if ((x & Mono_Posix_MessageFlags_MSG_NOSIGNAL) == Mono_Posix_MessageFlags_MSG_NOSIGNAL)
+#ifdef MSG_NOSIGNAL
+               *r |= MSG_NOSIGNAL;
+#else /* def MSG_NOSIGNAL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_NOSIGNAL */
+       if ((x & Mono_Posix_MessageFlags_MSG_OOB) == Mono_Posix_MessageFlags_MSG_OOB)
+#ifdef MSG_OOB
+               *r |= MSG_OOB;
+#else /* def MSG_OOB */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_OOB */
+       if ((x & Mono_Posix_MessageFlags_MSG_PEEK) == Mono_Posix_MessageFlags_MSG_PEEK)
+#ifdef MSG_PEEK
+               *r |= MSG_PEEK;
+#else /* def MSG_PEEK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_PEEK */
+       if ((x & Mono_Posix_MessageFlags_MSG_PROXY) == Mono_Posix_MessageFlags_MSG_PROXY)
+#ifdef MSG_PROXY
+               *r |= MSG_PROXY;
+#else /* def MSG_PROXY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_PROXY */
+       if ((x & Mono_Posix_MessageFlags_MSG_RST) == Mono_Posix_MessageFlags_MSG_RST)
+#ifdef MSG_RST
+               *r |= MSG_RST;
+#else /* def MSG_RST */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_RST */
+       if ((x & Mono_Posix_MessageFlags_MSG_SYN) == Mono_Posix_MessageFlags_MSG_SYN)
+#ifdef MSG_SYN
+               *r |= MSG_SYN;
+#else /* def MSG_SYN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_SYN */
+       if ((x & Mono_Posix_MessageFlags_MSG_TRUNC) == Mono_Posix_MessageFlags_MSG_TRUNC)
+#ifdef MSG_TRUNC
+               *r |= MSG_TRUNC;
+#else /* def MSG_TRUNC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_TRUNC */
+       if ((x & Mono_Posix_MessageFlags_MSG_WAITALL) == Mono_Posix_MessageFlags_MSG_WAITALL)
+#ifdef MSG_WAITALL
+               *r |= MSG_WAITALL;
+#else /* def MSG_WAITALL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_WAITALL */
+       if ((x & Mono_Posix_MessageFlags_MSG_WAITFORONE) == Mono_Posix_MessageFlags_MSG_WAITFORONE)
+#ifdef MSG_WAITFORONE
+               *r |= MSG_WAITFORONE;
+#else /* def MSG_WAITFORONE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MSG_WAITFORONE */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToMessageFlags (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef MSG_CMSG_CLOEXEC
+       if ((x & MSG_CMSG_CLOEXEC) == MSG_CMSG_CLOEXEC)
+               *r |= Mono_Posix_MessageFlags_MSG_CMSG_CLOEXEC;
+#endif /* ndef MSG_CMSG_CLOEXEC */
+#ifdef MSG_CONFIRM
+       if ((x & MSG_CONFIRM) == MSG_CONFIRM)
+               *r |= Mono_Posix_MessageFlags_MSG_CONFIRM;
+#endif /* ndef MSG_CONFIRM */
+#ifdef MSG_CTRUNC
+       if ((x & MSG_CTRUNC) == MSG_CTRUNC)
+               *r |= Mono_Posix_MessageFlags_MSG_CTRUNC;
+#endif /* ndef MSG_CTRUNC */
+#ifdef MSG_DONTROUTE
+       if ((x & MSG_DONTROUTE) == MSG_DONTROUTE)
+               *r |= Mono_Posix_MessageFlags_MSG_DONTROUTE;
+#endif /* ndef MSG_DONTROUTE */
+#ifdef MSG_DONTWAIT
+       if ((x & MSG_DONTWAIT) == MSG_DONTWAIT)
+               *r |= Mono_Posix_MessageFlags_MSG_DONTWAIT;
+#endif /* ndef MSG_DONTWAIT */
+#ifdef MSG_EOR
+       if ((x & MSG_EOR) == MSG_EOR)
+               *r |= Mono_Posix_MessageFlags_MSG_EOR;
+#endif /* ndef MSG_EOR */
+#ifdef MSG_ERRQUEUE
+       if ((x & MSG_ERRQUEUE) == MSG_ERRQUEUE)
+               *r |= Mono_Posix_MessageFlags_MSG_ERRQUEUE;
+#endif /* ndef MSG_ERRQUEUE */
+#ifdef MSG_FASTOPEN
+       if ((x & MSG_FASTOPEN) == MSG_FASTOPEN)
+               *r |= Mono_Posix_MessageFlags_MSG_FASTOPEN;
+#endif /* ndef MSG_FASTOPEN */
+#ifdef MSG_FIN
+       if ((x & MSG_FIN) == MSG_FIN)
+               *r |= Mono_Posix_MessageFlags_MSG_FIN;
+#endif /* ndef MSG_FIN */
+#ifdef MSG_MORE
+       if ((x & MSG_MORE) == MSG_MORE)
+               *r |= Mono_Posix_MessageFlags_MSG_MORE;
+#endif /* ndef MSG_MORE */
+#ifdef MSG_NOSIGNAL
+       if ((x & MSG_NOSIGNAL) == MSG_NOSIGNAL)
+               *r |= Mono_Posix_MessageFlags_MSG_NOSIGNAL;
+#endif /* ndef MSG_NOSIGNAL */
+#ifdef MSG_OOB
+       if ((x & MSG_OOB) == MSG_OOB)
+               *r |= Mono_Posix_MessageFlags_MSG_OOB;
+#endif /* ndef MSG_OOB */
+#ifdef MSG_PEEK
+       if ((x & MSG_PEEK) == MSG_PEEK)
+               *r |= Mono_Posix_MessageFlags_MSG_PEEK;
+#endif /* ndef MSG_PEEK */
+#ifdef MSG_PROXY
+       if ((x & MSG_PROXY) == MSG_PROXY)
+               *r |= Mono_Posix_MessageFlags_MSG_PROXY;
+#endif /* ndef MSG_PROXY */
+#ifdef MSG_RST
+       if ((x & MSG_RST) == MSG_RST)
+               *r |= Mono_Posix_MessageFlags_MSG_RST;
+#endif /* ndef MSG_RST */
+#ifdef MSG_SYN
+       if ((x & MSG_SYN) == MSG_SYN)
+               *r |= Mono_Posix_MessageFlags_MSG_SYN;
+#endif /* ndef MSG_SYN */
+#ifdef MSG_TRUNC
+       if ((x & MSG_TRUNC) == MSG_TRUNC)
+               *r |= Mono_Posix_MessageFlags_MSG_TRUNC;
+#endif /* ndef MSG_TRUNC */
+#ifdef MSG_WAITALL
+       if ((x & MSG_WAITALL) == MSG_WAITALL)
+               *r |= Mono_Posix_MessageFlags_MSG_WAITALL;
+#endif /* ndef MSG_WAITALL */
+#ifdef MSG_WAITFORONE
+       if ((x & MSG_WAITFORONE) == MSG_WAITFORONE)
+               *r |= Mono_Posix_MessageFlags_MSG_WAITFORONE;
+#endif /* ndef MSG_WAITFORONE */
+       return 0;
+}
+
+int Mono_Posix_FromMlockallFlags (int x, int *r)
+{
+       *r = 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 _CS_POSIX_V6_ILP32_OFF32_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#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 _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MCL_FUTURE */
+       if (x == 0)
+               return 0;
+       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_FromMmapFlags (int x, int *r)
+{
+       *r = 0;
+       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 _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_ANON */
+       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 _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_ANONYMOUS */
+       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 _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#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 _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_EXECUTABLE */
+       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 _CS_POSIX_V6_LP64_OFF64_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_FILE */
+       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 _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_FIXED */
+       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 _CS_POSIX_V6_LP64_OFF64_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_GROWSDOWN */
+       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 _CS_POSIX_V6_LP64_OFF64_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_LOCKED */
+       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 _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_NONBLOCK */
+       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 _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#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 _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_POPULATE */
+       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 _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_PRIVATE */
+       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 _CS_V6_WIDTH_RESTRICTED_ENVS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_SHARED */
+       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 _CS_XBS5_ILP32_OFF32_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef MAP_TYPE */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToMmapFlags (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef MAP_ANON
+       if ((x & MAP_ANON) == MAP_ANON)
+               *r |= Mono_Posix_MmapFlags_MAP_ANON;
+#endif /* ndef MAP_ANON */
+#ifdef MAP_ANONYMOUS
+       if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
+               *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
+#endif /* ndef MAP_ANONYMOUS */
+#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_FILE
+       if ((x & MAP_FILE) == MAP_FILE)
+               *r |= Mono_Posix_MmapFlags_MAP_FILE;
+#endif /* ndef MAP_FILE */
+#ifdef MAP_FIXED
+       if ((x & MAP_FIXED) == MAP_FIXED)
+               *r |= Mono_Posix_MmapFlags_MAP_FIXED;
+#endif /* ndef MAP_FIXED */
+#ifdef MAP_GROWSDOWN
+       if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
+               *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
+#endif /* ndef MAP_GROWSDOWN */
+#ifdef MAP_LOCKED
+       if ((x & MAP_LOCKED) == MAP_LOCKED)
+               *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
+#endif /* ndef MAP_LOCKED */
+#ifdef MAP_NONBLOCK
+       if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
+               *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
+#endif /* ndef MAP_NONBLOCK */
+#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_PRIVATE
+       if ((x & MAP_PRIVATE) == MAP_PRIVATE)
+               *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
+#endif /* ndef MAP_PRIVATE */
+#ifdef MAP_SHARED
+       if ((x & MAP_SHARED) == MAP_SHARED)
+               *r |= Mono_Posix_MmapFlags_MAP_SHARED;
+#endif /* ndef MAP_SHARED */
+#ifdef MAP_TYPE
+       if ((x & MAP_TYPE) == MAP_TYPE)
+               *r |= Mono_Posix_MmapFlags_MAP_TYPE;
+#endif /* ndef MAP_TYPE */
+       return 0;
+}
+
+int Mono_Posix_FromMmapProts (int x, int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
+#ifdef PROT_EXEC
+               *r |= PROT_EXEC;
+#else /* def PROT_EXEC */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFF32_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_EXEC */
+       if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
+#ifdef PROT_GROWSDOWN
+               *r |= PROT_GROWSDOWN;
+#else /* def PROT_GROWSDOWN */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFF32_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_GROWSDOWN */
+       if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
+#ifdef PROT_GROWSUP
+               *r |= PROT_GROWSUP;
+#else /* def PROT_GROWSUP */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFF32_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_GROWSUP */
+       if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
+#ifdef PROT_NONE
+               *r |= PROT_NONE;
+#else /* def PROT_NONE */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFFBIG_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_NONE */
+       if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
+#ifdef PROT_READ
+               *r |= PROT_READ;
+#else /* def PROT_READ */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_READ */
+       if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
+#ifdef PROT_WRITE
+               *r |= PROT_WRITE;
+#else /* def PROT_WRITE */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_ILP32_OFFBIG_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef PROT_WRITE */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToMmapProts (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef PROT_EXEC
+       if ((x & PROT_EXEC) == PROT_EXEC)
+               *r |= Mono_Posix_MmapProts_PROT_EXEC;
+#endif /* ndef PROT_EXEC */
+#ifdef PROT_GROWSDOWN
+       if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
+               *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
+#endif /* ndef PROT_GROWSDOWN */
+#ifdef PROT_GROWSUP
+       if ((x & PROT_GROWSUP) == PROT_GROWSUP)
+               *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
+#endif /* ndef PROT_GROWSUP */
+#ifdef PROT_NONE
+       if ((x & PROT_NONE) == PROT_NONE)
+               *r |= Mono_Posix_MmapProts_PROT_NONE;
+#endif /* ndef PROT_NONE */
+#ifdef PROT_READ
+       if ((x & PROT_READ) == PROT_READ)
+               *r |= Mono_Posix_MmapProts_PROT_READ;
+#endif /* ndef PROT_READ */
+#ifdef PROT_WRITE
+       if ((x & PROT_WRITE) == PROT_WRITE)
+               *r |= Mono_Posix_MmapProts_PROT_WRITE;
+#endif /* ndef PROT_WRITE */
+       return 0;
+}
+
+int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
+{
+       *r = 0;
+       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 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_APPEND */
+       if ((x & Mono_Posix_MountFlags_ST_BIND) == Mono_Posix_MountFlags_ST_BIND)
+#ifdef ST_BIND
+               *r |= ST_BIND;
+#else /* def ST_BIND */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_LP64_OFF64_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_BIND */
+       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 _CS_XBS5_LP64_OFF64_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_IMMUTABLE */
+       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 _CS_XBS5_LP64_OFF64_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_MANDLOCK */
+       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 _CS_XBS5_LP64_OFF64_LINTFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_NOATIME */
+       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 _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_NODEV */
+       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 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_NODIRATIME */
+       if ((x & Mono_Posix_MountFlags_ST_NOEXEC) == Mono_Posix_MountFlags_ST_NOEXEC)
+#ifdef ST_NOEXEC
+               *r |= ST_NOEXEC;
+#else /* def ST_NOEXEC */
                {errno = EINVAL; return -1;}
-#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LIBS */
-       if (x == Mono_Posix_ConfstrName__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 */
+#endif /* ndef ST_NOEXEC */
+       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 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToConfstrName (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef _CS_GNU_LIBC_VERSION
-       if (x == _CS_GNU_LIBC_VERSION)
-               {*r = Mono_Posix_ConfstrName__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_ConfstrName__CS_GNU_LIBPTHREAD_VERSION; return 0;}
-#endif /* ndef _CS_GNU_LIBPTHREAD_VERSION */
-#ifdef _CS_LFS64_CFLAGS
-       if (x == _CS_LFS64_CFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS64_CFLAGS; return 0;}
-#endif /* ndef _CS_LFS64_CFLAGS */
-#ifdef _CS_LFS64_LDFLAGS
-       if (x == _CS_LFS64_LDFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS64_LDFLAGS; return 0;}
-#endif /* ndef _CS_LFS64_LDFLAGS */
-#ifdef _CS_LFS64_LIBS
-       if (x == _CS_LFS64_LIBS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS64_LIBS; return 0;}
-#endif /* ndef _CS_LFS64_LIBS */
-#ifdef _CS_LFS64_LINTFLAGS
-       if (x == _CS_LFS64_LINTFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS64_LINTFLAGS; return 0;}
-#endif /* ndef _CS_LFS64_LINTFLAGS */
-#ifdef _CS_LFS_CFLAGS
-       if (x == _CS_LFS_CFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS_CFLAGS; return 0;}
-#endif /* ndef _CS_LFS_CFLAGS */
-#ifdef _CS_LFS_LDFLAGS
-       if (x == _CS_LFS_LDFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS_LDFLAGS; return 0;}
-#endif /* ndef _CS_LFS_LDFLAGS */
-#ifdef _CS_LFS_LIBS
-       if (x == _CS_LFS_LIBS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS_LIBS; return 0;}
-#endif /* ndef _CS_LFS_LIBS */
-#ifdef _CS_LFS_LINTFLAGS
-       if (x == _CS_LFS_LINTFLAGS)
-               {*r = Mono_Posix_ConfstrName__CS_LFS_LINTFLAGS; return 0;}
-#endif /* ndef _CS_LFS_LINTFLAGS */
-#ifdef _CS_PATH
-       if (x == _CS_PATH)
-               {*r = Mono_Posix_ConfstrName__CS_PATH; return 0;}
-#endif /* ndef _CS_PATH */
-#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
-       if (x == _CS_POSIX_V6_ILP32_OFF32_CFLAGS)
-               {*r = Mono_Posix_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS; return 0;}
-#endif /* ndef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS */
-#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
-       if (x == _CS_V6_WIDTH_RESTRICTED_ENVS)
-               {*r = Mono_Posix_ConfstrName__CS_V6_WIDTH_RESTRICTED_ENVS; return 0;}
-#endif /* ndef _CS_V6_WIDTH_RESTRICTED_ENVS */
-#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
-       if (x == _CS_XBS5_ILP32_OFF32_CFLAGS)
-               {*r = Mono_Posix_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__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_ConfstrName__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS; return 0;}
-#endif /* ndef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
-       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_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_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 */
+#endif /* ndef ST_NOSUID */
+       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 DN_DELETE */
-       if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY)
-#ifdef DN_MODIFY
-               *r |= DN_MODIFY;
-#else /* def DN_MODIFY */
+#endif /* ndef ST_RDONLY */
+       if ((x & Mono_Posix_MountFlags_ST_REMOUNT) == Mono_Posix_MountFlags_ST_REMOUNT)
+#ifdef ST_REMOUNT
+               *r |= ST_REMOUNT;
+#else /* def ST_REMOUNT */
                {errno = EINVAL; return -1;}
-#endif /* ndef DN_MODIFY */
-       if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT)
-#ifdef DN_MULTISHOT
-               *r |= DN_MULTISHOT;
-#else /* def DN_MULTISHOT */
+#endif /* ndef ST_REMOUNT */
+       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 DN_MULTISHOT */
-       if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME)
-#ifdef DN_RENAME
-               *r |= DN_RENAME;
-#else /* def DN_RENAME */
+#endif /* ndef ST_SYNCHRONOUS */
+       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 DN_RENAME */
+#endif /* ndef ST_WRITE */
+       if (x == 0)
+               return 0;
        return 0;
 }
 
-int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r)
+int Mono_Posix_ToMountFlags (guint64 x, guint64 *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_ATTRIB
-       if ((x & DN_ATTRIB) == DN_ATTRIB)
-               *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
-#endif /* ndef DN_ATTRIB */
-#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_MODIFY
-       if ((x & DN_MODIFY) == DN_MODIFY)
-               *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
-#endif /* ndef DN_MODIFY */
-#ifdef DN_MULTISHOT
-       if ((x & DN_MULTISHOT) == DN_MULTISHOT)
-               *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
-#endif /* ndef DN_MULTISHOT */
-#ifdef DN_RENAME
-       if ((x & DN_RENAME) == DN_RENAME)
-               *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
-#endif /* ndef DN_RENAME */
+#ifdef ST_APPEND
+       if ((x & ST_APPEND) == ST_APPEND)
+               *r |= Mono_Posix_MountFlags_ST_APPEND;
+#endif /* ndef ST_APPEND */
+#ifdef ST_BIND
+       if ((x & ST_BIND) == ST_BIND)
+               *r |= Mono_Posix_MountFlags_ST_BIND;
+#endif /* ndef ST_BIND */
+#ifdef ST_IMMUTABLE
+       if ((x & ST_IMMUTABLE) == ST_IMMUTABLE)
+               *r |= Mono_Posix_MountFlags_ST_IMMUTABLE;
+#endif /* ndef ST_IMMUTABLE */
+#ifdef ST_MANDLOCK
+       if ((x & ST_MANDLOCK) == ST_MANDLOCK)
+               *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
+#endif /* ndef ST_MANDLOCK */
+#ifdef ST_NOATIME
+       if ((x & ST_NOATIME) == ST_NOATIME)
+               *r |= Mono_Posix_MountFlags_ST_NOATIME;
+#endif /* ndef ST_NOATIME */
+#ifdef ST_NODEV
+       if ((x & ST_NODEV) == ST_NODEV)
+               *r |= Mono_Posix_MountFlags_ST_NODEV;
+#endif /* ndef ST_NODEV */
+#ifdef ST_NODIRATIME
+       if ((x & ST_NODIRATIME) == ST_NODIRATIME)
+               *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
+#endif /* ndef ST_NODIRATIME */
+#ifdef ST_NOEXEC
+       if ((x & ST_NOEXEC) == ST_NOEXEC)
+               *r |= Mono_Posix_MountFlags_ST_NOEXEC;
+#endif /* ndef ST_NOEXEC */
+#ifdef ST_NOSUID
+       if ((x & ST_NOSUID) == ST_NOSUID)
+               *r |= Mono_Posix_MountFlags_ST_NOSUID;
+#endif /* ndef ST_NOSUID */
+#ifdef ST_RDONLY
+       if ((x & ST_RDONLY) == ST_RDONLY)
+               *r |= Mono_Posix_MountFlags_ST_RDONLY;
+#endif /* ndef ST_RDONLY */
+#ifdef ST_REMOUNT
+       if ((x & ST_REMOUNT) == ST_REMOUNT)
+               *r |= Mono_Posix_MountFlags_ST_REMOUNT;
+#endif /* ndef ST_REMOUNT */
+#ifdef ST_SYNCHRONOUS
+       if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
+               *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
+#endif /* ndef ST_SYNCHRONOUS */
+#ifdef ST_WRITE
+       if ((x & ST_WRITE) == ST_WRITE)
+               *r |= Mono_Posix_MountFlags_ST_WRITE;
+#endif /* ndef ST_WRITE */
        return 0;
 }
 
-int Mono_Posix_FromErrno (int x, int *r)
+int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
+{
+       *r = 0;
+#ifndef __NetBSD__
+       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 */
+#else /* def __NetBSD__ */
+       if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) != Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
+               *r = MAP_FIXED;
+#endif /* def __NetBSD__ */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
 {
        *r = 0;
+#ifndef __NetBSD__
        if (x == 0)
                return 0;
-       if (x == Mono_Posix_Errno_E2BIG)
-#ifdef E2BIG
-               {*r = E2BIG; return 0;}
-#else /* def E2BIG */
+#ifdef MREMAP_MAYMOVE
+       if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
+               *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
+#endif /* ndef MREMAP_MAYMOVE */
+#else /* def __NetBSD__ */
+       if ((x & MAP_FIXED) != MAP_FIXED)
+               *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
+#endif
+       return 0;
+}
+
+int Mono_Posix_FromMsyncFlags (int x, int *r)
+{
+       *r = 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 E2BIG */
-       if (x == Mono_Posix_Errno_EACCES)
-#ifdef EACCES
-               {*r = EACCES; return 0;}
-#else /* def EACCES */
+#endif /* ndef MS_ASYNC */
+       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 EACCES */
-       if (x == Mono_Posix_Errno_EADDRINUSE)
-#ifdef EADDRINUSE
-               {*r = EADDRINUSE; return 0;}
-#else /* def EADDRINUSE */
+#endif /* ndef MS_INVALIDATE */
+       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 EADDRINUSE */
-       if (x == Mono_Posix_Errno_EADDRNOTAVAIL)
-#ifdef EADDRNOTAVAIL
-               {*r = EADDRNOTAVAIL; return 0;}
-#else /* def EADDRNOTAVAIL */
+#endif /* ndef MS_SYNC */
+       if (x == 0)
+               return 0;
+       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_INVALIDATE
+       if ((x & MS_INVALIDATE) == MS_INVALIDATE)
+               *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
+#endif /* ndef MS_INVALIDATE */
+#ifdef MS_SYNC
+       if ((x & MS_SYNC) == MS_SYNC)
+               *r |= Mono_Posix_MsyncFlags_MS_SYNC;
+#endif /* ndef MS_SYNC */
+       return 0;
+}
+
+int Mono_Posix_FromOpenFlags (int x, int *r)
+{
+       *r = 0;
+       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 EADDRNOTAVAIL */
-       if (x == Mono_Posix_Errno_EADV)
-#ifdef EADV
-               {*r = EADV; return 0;}
-#else /* def EADV */
+#endif /* ndef O_APPEND */
+       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 EADV */
-       if (x == Mono_Posix_Errno_EAFNOSUPPORT)
-#ifdef EAFNOSUPPORT
-               {*r = EAFNOSUPPORT; return 0;}
-#else /* def EAFNOSUPPORT */
+#endif /* ndef O_ASYNC */
+       if ((x & Mono_Posix_OpenFlags_O_CLOEXEC) == Mono_Posix_OpenFlags_O_CLOEXEC)
+#ifdef O_CLOEXEC
+               *r |= O_CLOEXEC;
+#else /* def O_CLOEXEC */
                {errno = EINVAL; return -1;}
-#endif /* ndef EAFNOSUPPORT */
-       if (x == Mono_Posix_Errno_EAGAIN)
-#ifdef EAGAIN
-               {*r = EAGAIN; return 0;}
-#else /* def EAGAIN */
+#endif /* ndef O_CLOEXEC */
+       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 EAGAIN */
-       if (x == Mono_Posix_Errno_EALREADY)
-#ifdef EALREADY
-               {*r = EALREADY; return 0;}
-#else /* def EALREADY */
+#endif /* ndef O_CREAT */
+       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 EALREADY */
-       if (x == Mono_Posix_Errno_EBADE)
-#ifdef EBADE
-               {*r = EBADE; return 0;}
-#else /* def EBADE */
+#endif /* ndef O_DIRECT */
+       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 EBADE */
-       if (x == Mono_Posix_Errno_EBADF)
-#ifdef EBADF
-               {*r = EBADF; return 0;}
-#else /* def EBADF */
+#endif /* ndef O_DIRECTORY */
+       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 EBADF */
-       if (x == Mono_Posix_Errno_EBADFD)
-#ifdef EBADFD
-               {*r = EBADFD; return 0;}
-#else /* def EBADFD */
+#endif /* ndef O_EXCL */
+       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 EBADFD */
-       if (x == Mono_Posix_Errno_EBADMSG)
-#ifdef EBADMSG
-               {*r = EBADMSG; return 0;}
-#else /* def EBADMSG */
+#endif /* ndef O_LARGEFILE */
+       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 EBADMSG */
-       if (x == Mono_Posix_Errno_EBADR)
-#ifdef EBADR
-               {*r = EBADR; return 0;}
-#else /* def EBADR */
+#endif /* ndef O_NOCTTY */
+       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 EBADR */
-       if (x == Mono_Posix_Errno_EBADRQC)
-#ifdef EBADRQC
-               {*r = EBADRQC; return 0;}
-#else /* def EBADRQC */
+#endif /* ndef O_NOFOLLOW */
+       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 EBADRQC */
-       if (x == Mono_Posix_Errno_EBADSLT)
-#ifdef EBADSLT
-               {*r = EBADSLT; return 0;}
-#else /* def EBADSLT */
+#endif /* ndef O_NONBLOCK */
+       if ((x & Mono_Posix_OpenFlags_O_PATH) == Mono_Posix_OpenFlags_O_PATH)
+#ifdef O_PATH
+               *r |= O_PATH;
+#else /* def O_PATH */
                {errno = EINVAL; return -1;}
-#endif /* ndef EBADSLT */
-       if (x == Mono_Posix_Errno_EBFONT)
-#ifdef EBFONT
-               {*r = EBFONT; return 0;}
-#else /* def EBFONT */
+#endif /* ndef O_PATH */
+       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 EBFONT */
-       if (x == Mono_Posix_Errno_EBUSY)
-#ifdef EBUSY
-               {*r = EBUSY; return 0;}
-#else /* def EBUSY */
+#endif /* ndef O_RDONLY */
+       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 EBUSY */
-       if (x == Mono_Posix_Errno_ECHILD)
-#ifdef ECHILD
-               {*r = ECHILD; return 0;}
-#else /* def ECHILD */
+#endif /* ndef O_RDWR */
+       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 ECHILD */
-       if (x == Mono_Posix_Errno_ECHRNG)
-#ifdef ECHRNG
-               {*r = ECHRNG; return 0;}
-#else /* def ECHRNG */
+#endif /* ndef O_SYNC */
+       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 ECHRNG */
-       if (x == Mono_Posix_Errno_ECOMM)
-#ifdef ECOMM
-               {*r = ECOMM; return 0;}
-#else /* def ECOMM */
+#endif /* ndef O_TRUNC */
+       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 ECOMM */
-       if (x == Mono_Posix_Errno_ECONNABORTED)
-#ifdef ECONNABORTED
-               {*r = ECONNABORTED; return 0;}
-#else /* def ECONNABORTED */
+#endif /* ndef O_WRONLY */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToOpenFlags (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef O_APPEND
+       if ((x & O_APPEND) == O_APPEND)
+               *r |= Mono_Posix_OpenFlags_O_APPEND;
+#endif /* ndef O_APPEND */
+#ifdef O_ASYNC
+       if ((x & O_ASYNC) == O_ASYNC)
+               *r |= Mono_Posix_OpenFlags_O_ASYNC;
+#endif /* ndef O_ASYNC */
+#ifdef O_CLOEXEC
+       if ((x & O_CLOEXEC) == O_CLOEXEC)
+               *r |= Mono_Posix_OpenFlags_O_CLOEXEC;
+#endif /* ndef O_CLOEXEC */
+#ifdef O_CREAT
+       if ((x & O_CREAT) == O_CREAT)
+               *r |= Mono_Posix_OpenFlags_O_CREAT;
+#endif /* ndef O_CREAT */
+#ifdef O_DIRECT
+       if ((x & O_DIRECT) == O_DIRECT)
+               *r |= Mono_Posix_OpenFlags_O_DIRECT;
+#endif /* ndef O_DIRECT */
+#ifdef O_DIRECTORY
+       if ((x & O_DIRECTORY) == O_DIRECTORY)
+               *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
+#endif /* ndef O_DIRECTORY */
+#ifdef O_EXCL
+       if ((x & O_EXCL) == O_EXCL)
+               *r |= Mono_Posix_OpenFlags_O_EXCL;
+#endif /* ndef O_EXCL */
+#ifdef O_LARGEFILE
+       if ((x & O_LARGEFILE) == O_LARGEFILE)
+               *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
+#endif /* ndef O_LARGEFILE */
+#ifdef O_NOCTTY
+       if ((x & O_NOCTTY) == O_NOCTTY)
+               *r |= Mono_Posix_OpenFlags_O_NOCTTY;
+#endif /* ndef O_NOCTTY */
+#ifdef O_NOFOLLOW
+       if ((x & O_NOFOLLOW) == O_NOFOLLOW)
+               *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
+#endif /* ndef O_NOFOLLOW */
+#ifdef O_NONBLOCK
+       if ((x & O_NONBLOCK) == O_NONBLOCK)
+               *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
+#endif /* ndef O_NONBLOCK */
+#ifdef O_PATH
+       if ((x & O_PATH) == O_PATH)
+               *r |= Mono_Posix_OpenFlags_O_PATH;
+#endif /* ndef O_PATH */
+#ifdef O_RDONLY
+       if ((x & O_RDONLY) == O_RDONLY)
+               *r |= Mono_Posix_OpenFlags_O_RDONLY;
+#endif /* ndef O_RDONLY */
+#ifdef O_RDWR
+       if ((x & O_RDWR) == O_RDWR)
+               *r |= Mono_Posix_OpenFlags_O_RDWR;
+#endif /* ndef O_RDWR */
+#ifdef O_SYNC
+       if ((x & O_SYNC) == O_SYNC)
+               *r |= Mono_Posix_OpenFlags_O_SYNC;
+#endif /* ndef O_SYNC */
+#ifdef O_TRUNC
+       if ((x & O_TRUNC) == O_TRUNC)
+               *r |= Mono_Posix_OpenFlags_O_TRUNC;
+#endif /* ndef O_TRUNC */
+#ifdef O_WRONLY
+       if ((x & O_WRONLY) == O_WRONLY)
+               *r |= Mono_Posix_OpenFlags_O_WRONLY;
+#endif /* ndef O_WRONLY */
+       return 0;
+}
+
+int Mono_Posix_FromPathconfName (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_PathconfName__PC_2_SYMLINKS)
+#ifdef _PC_2_SYMLINKS
+               {*r = _PC_2_SYMLINKS; return 0;}
+#else /* def _PC_2_SYMLINKS */
                {errno = EINVAL; return -1;}
-#endif /* ndef ECONNABORTED */
-       if (x == Mono_Posix_Errno_ECONNREFUSED)
-#ifdef ECONNREFUSED
-               {*r = ECONNREFUSED; return 0;}
-#else /* def ECONNREFUSED */
+#endif /* ndef _PC_2_SYMLINKS */
+       if (x == Mono_Posix_PathconfName__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 ECONNREFUSED */
-       if (x == Mono_Posix_Errno_ECONNRESET)
-#ifdef ECONNRESET
-               {*r = ECONNRESET; return 0;}
-#else /* def ECONNRESET */
+#endif /* ndef _PC_ALLOC_SIZE_MIN */
+       if (x == Mono_Posix_PathconfName__PC_ASYNC_IO)
+#ifdef _PC_ASYNC_IO
+               {*r = _PC_ASYNC_IO; return 0;}
+#else /* def _PC_ASYNC_IO */
                {errno = EINVAL; return -1;}
-#endif /* ndef ECONNRESET */
-       if (x == Mono_Posix_Errno_EDEADLK)
-#ifdef EDEADLK
-               {*r = EDEADLK; return 0;}
-#else /* def EDEADLK */
+#endif /* ndef _PC_ASYNC_IO */
+       if (x == Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED)
+#ifdef _PC_CHOWN_RESTRICTED
+               {*r = _PC_CHOWN_RESTRICTED; return 0;}
+#else /* def _PC_CHOWN_RESTRICTED */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDEADLK */
-       if (x == Mono_Posix_Errno_EDEADLOCK)
-#ifdef EDEADLOCK
-               {*r = EDEADLOCK; return 0;}
-#else /* def EDEADLOCK */
+#endif /* ndef _PC_CHOWN_RESTRICTED */
+       if (x == Mono_Posix_PathconfName__PC_FILESIZEBITS)
+#ifdef _PC_FILESIZEBITS
+               {*r = _PC_FILESIZEBITS; return 0;}
+#else /* def _PC_FILESIZEBITS */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDEADLOCK */
-       if (x == Mono_Posix_Errno_EDESTADDRREQ)
-#ifdef EDESTADDRREQ
-               {*r = EDESTADDRREQ; return 0;}
-#else /* def EDESTADDRREQ */
+#endif /* ndef _PC_FILESIZEBITS */
+       if (x == Mono_Posix_PathconfName__PC_LINK_MAX)
+#ifdef _PC_LINK_MAX
+               {*r = _PC_LINK_MAX; return 0;}
+#else /* def _PC_LINK_MAX */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDESTADDRREQ */
-       if (x == Mono_Posix_Errno_EDOM)
-#ifdef EDOM
-               {*r = EDOM; return 0;}
-#else /* def EDOM */
+#endif /* ndef _PC_LINK_MAX */
+       if (x == Mono_Posix_PathconfName__PC_MAX_CANON)
+#ifdef _PC_MAX_CANON
+               {*r = _PC_MAX_CANON; return 0;}
+#else /* def _PC_MAX_CANON */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDOM */
-       if (x == Mono_Posix_Errno_EDOTDOT)
-#ifdef EDOTDOT
-               {*r = EDOTDOT; return 0;}
-#else /* def EDOTDOT */
+#endif /* ndef _PC_MAX_CANON */
+       if (x == Mono_Posix_PathconfName__PC_MAX_INPUT)
+#ifdef _PC_MAX_INPUT
+               {*r = _PC_MAX_INPUT; return 0;}
+#else /* def _PC_MAX_INPUT */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDOTDOT */
-       if (x == Mono_Posix_Errno_EDQUOT)
-#ifdef EDQUOT
-               {*r = EDQUOT; return 0;}
-#else /* def EDQUOT */
+#endif /* ndef _PC_MAX_INPUT */
+       if (x == Mono_Posix_PathconfName__PC_NAME_MAX)
+#ifdef _PC_NAME_MAX
+               {*r = _PC_NAME_MAX; return 0;}
+#else /* def _PC_NAME_MAX */
                {errno = EINVAL; return -1;}
-#endif /* ndef EDQUOT */
-       if (x == Mono_Posix_Errno_EEXIST)
-#ifdef EEXIST
-               {*r = EEXIST; return 0;}
-#else /* def EEXIST */
+#endif /* ndef _PC_NAME_MAX */
+       if (x == Mono_Posix_PathconfName__PC_NO_TRUNC)
+#ifdef _PC_NO_TRUNC
+               {*r = _PC_NO_TRUNC; return 0;}
+#else /* def _PC_NO_TRUNC */
                {errno = EINVAL; return -1;}
-#endif /* ndef EEXIST */
-       if (x == Mono_Posix_Errno_EFAULT)
-#ifdef EFAULT
-               {*r = EFAULT; return 0;}
-#else /* def EFAULT */
+#endif /* ndef _PC_NO_TRUNC */
+       if (x == Mono_Posix_PathconfName__PC_PATH_MAX)
+#ifdef _PC_PATH_MAX
+               {*r = _PC_PATH_MAX; return 0;}
+#else /* def _PC_PATH_MAX */
                {errno = EINVAL; return -1;}
-#endif /* ndef EFAULT */
-       if (x == Mono_Posix_Errno_EFBIG)
-#ifdef EFBIG
-               {*r = EFBIG; return 0;}
-#else /* def EFBIG */
+#endif /* ndef _PC_PATH_MAX */
+       if (x == Mono_Posix_PathconfName__PC_PIPE_BUF)
+#ifdef _PC_PIPE_BUF
+               {*r = _PC_PIPE_BUF; return 0;}
+#else /* def _PC_PIPE_BUF */
                {errno = EINVAL; return -1;}
-#endif /* ndef EFBIG */
-       if (x == Mono_Posix_Errno_EHOSTDOWN)
-#ifdef EHOSTDOWN
-               {*r = EHOSTDOWN; return 0;}
-#else /* def EHOSTDOWN */
+#endif /* ndef _PC_PIPE_BUF */
+       if (x == Mono_Posix_PathconfName__PC_PRIO_IO)
+#ifdef _PC_PRIO_IO
+               {*r = _PC_PRIO_IO; return 0;}
+#else /* def _PC_PRIO_IO */
                {errno = EINVAL; return -1;}
-#endif /* ndef EHOSTDOWN */
-       if (x == Mono_Posix_Errno_EHOSTUNREACH)
-#ifdef EHOSTUNREACH
-               {*r = EHOSTUNREACH; return 0;}
-#else /* def EHOSTUNREACH */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EHOSTUNREACH */
-       if (x == Mono_Posix_Errno_EIDRM)
-#ifdef EIDRM
-               {*r = EIDRM; return 0;}
-#else /* def EIDRM */
+#endif /* ndef _PC_PRIO_IO */
+       if (x == Mono_Posix_PathconfName__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 EIDRM */
-       if (x == Mono_Posix_Errno_EILSEQ)
-#ifdef EILSEQ
-               {*r = EILSEQ; return 0;}
-#else /* def EILSEQ */
+#endif /* ndef _PC_REC_INCR_XFER_SIZE */
+       if (x == Mono_Posix_PathconfName__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 EILSEQ */
-       if (x == Mono_Posix_Errno_EINPROGRESS)
-#ifdef EINPROGRESS
-               {*r = EINPROGRESS; return 0;}
-#else /* def EINPROGRESS */
+#endif /* ndef _PC_REC_MAX_XFER_SIZE */
+       if (x == Mono_Posix_PathconfName__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 EINPROGRESS */
-       if (x == Mono_Posix_Errno_EINTR)
-#ifdef EINTR
-               {*r = EINTR; return 0;}
-#else /* def EINTR */
+#endif /* ndef _PC_REC_MIN_XFER_SIZE */
+       if (x == Mono_Posix_PathconfName__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 EINTR */
-       if (x == Mono_Posix_Errno_EINVAL)
-#ifdef EINVAL
-               {*r = EINVAL; return 0;}
-#else /* def EINVAL */
+#endif /* ndef _PC_REC_XFER_ALIGN */
+       if (x == Mono_Posix_PathconfName__PC_SOCK_MAXBUF)
+#ifdef _PC_SOCK_MAXBUF
+               {*r = _PC_SOCK_MAXBUF; return 0;}
+#else /* def _PC_SOCK_MAXBUF */
                {errno = EINVAL; return -1;}
-#endif /* ndef EINVAL */
-       if (x == Mono_Posix_Errno_EIO)
-#ifdef EIO
-               {*r = EIO; return 0;}
-#else /* def EIO */
+#endif /* ndef _PC_SOCK_MAXBUF */
+       if (x == Mono_Posix_PathconfName__PC_SYMLINK_MAX)
+#ifdef _PC_SYMLINK_MAX
+               {*r = _PC_SYMLINK_MAX; return 0;}
+#else /* def _PC_SYMLINK_MAX */
                {errno = EINVAL; return -1;}
-#endif /* ndef EIO */
-       if (x == Mono_Posix_Errno_EISCONN)
-#ifdef EISCONN
-               {*r = EISCONN; return 0;}
-#else /* def EISCONN */
+#endif /* ndef _PC_SYMLINK_MAX */
+       if (x == Mono_Posix_PathconfName__PC_SYNC_IO)
+#ifdef _PC_SYNC_IO
+               {*r = _PC_SYNC_IO; return 0;}
+#else /* def _PC_SYNC_IO */
                {errno = EINVAL; return -1;}
-#endif /* ndef EISCONN */
-       if (x == Mono_Posix_Errno_EISDIR)
-#ifdef EISDIR
-               {*r = EISDIR; return 0;}
-#else /* def EISDIR */
+#endif /* ndef _PC_SYNC_IO */
+       if (x == Mono_Posix_PathconfName__PC_VDISABLE)
+#ifdef _PC_VDISABLE
+               {*r = _PC_VDISABLE; return 0;}
+#else /* def _PC_VDISABLE */
                {errno = EINVAL; return -1;}
-#endif /* ndef EISDIR */
-       if (x == Mono_Posix_Errno_EISNAM)
-#ifdef EISNAM
-               {*r = EISNAM; return 0;}
-#else /* def EISNAM */
+#endif /* ndef _PC_VDISABLE */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToPathconfName (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef _PC_2_SYMLINKS
+       if (x == _PC_2_SYMLINKS)
+               {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
+#endif /* ndef _PC_2_SYMLINKS */
+#ifdef _PC_ALLOC_SIZE_MIN
+       if (x == _PC_ALLOC_SIZE_MIN)
+               {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
+#endif /* ndef _PC_ALLOC_SIZE_MIN */
+#ifdef _PC_ASYNC_IO
+       if (x == _PC_ASYNC_IO)
+               {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
+#endif /* ndef _PC_ASYNC_IO */
+#ifdef _PC_CHOWN_RESTRICTED
+       if (x == _PC_CHOWN_RESTRICTED)
+               {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
+#endif /* ndef _PC_CHOWN_RESTRICTED */
+#ifdef _PC_FILESIZEBITS
+       if (x == _PC_FILESIZEBITS)
+               {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
+#endif /* ndef _PC_FILESIZEBITS */
+#ifdef _PC_LINK_MAX
+       if (x == _PC_LINK_MAX)
+               {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
+#endif /* ndef _PC_LINK_MAX */
+#ifdef _PC_MAX_CANON
+       if (x == _PC_MAX_CANON)
+               {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
+#endif /* ndef _PC_MAX_CANON */
+#ifdef _PC_MAX_INPUT
+       if (x == _PC_MAX_INPUT)
+               {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
+#endif /* ndef _PC_MAX_INPUT */
+#ifdef _PC_NAME_MAX
+       if (x == _PC_NAME_MAX)
+               {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
+#endif /* ndef _PC_NAME_MAX */
+#ifdef _PC_NO_TRUNC
+       if (x == _PC_NO_TRUNC)
+               {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
+#endif /* ndef _PC_NO_TRUNC */
+#ifdef _PC_PATH_MAX
+       if (x == _PC_PATH_MAX)
+               {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
+#endif /* ndef _PC_PATH_MAX */
+#ifdef _PC_PIPE_BUF
+       if (x == _PC_PIPE_BUF)
+               {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
+#endif /* ndef _PC_PIPE_BUF */
+#ifdef _PC_PRIO_IO
+       if (x == _PC_PRIO_IO)
+               {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
+#endif /* ndef _PC_PRIO_IO */
+#ifdef _PC_REC_INCR_XFER_SIZE
+       if (x == _PC_REC_INCR_XFER_SIZE)
+               {*r = Mono_Posix_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__PC_REC_XFER_ALIGN; return 0;}
+#endif /* ndef _PC_REC_XFER_ALIGN */
+#ifdef _PC_SOCK_MAXBUF
+       if (x == _PC_SOCK_MAXBUF)
+               {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
+#endif /* ndef _PC_SOCK_MAXBUF */
+#ifdef _PC_SYMLINK_MAX
+       if (x == _PC_SYMLINK_MAX)
+               {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
+#endif /* ndef _PC_SYMLINK_MAX */
+#ifdef _PC_SYNC_IO
+       if (x == _PC_SYNC_IO)
+               {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
+#endif /* ndef _PC_SYNC_IO */
+#ifdef _PC_VDISABLE
+       if (x == _PC_VDISABLE)
+               {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
+#endif /* ndef _PC_VDISABLE */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromPollEvents (short x, short *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_PollEvents_POLLERR) == Mono_Posix_PollEvents_POLLERR)
+#ifdef POLLERR
+               *r |= POLLERR;
+#else /* def POLLERR */
                {errno = EINVAL; return -1;}
-#endif /* ndef EISNAM */
-       if (x == Mono_Posix_Errno_EL2HLT)
-#ifdef EL2HLT
-               {*r = EL2HLT; return 0;}
-#else /* def EL2HLT */
+#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 EL2HLT */
-       if (x == Mono_Posix_Errno_EL2NSYNC)
-#ifdef EL2NSYNC
-               {*r = EL2NSYNC; return 0;}
-#else /* def EL2NSYNC */
+#endif /* ndef POLLHUP */
+       if ((x & Mono_Posix_PollEvents_POLLIN) == Mono_Posix_PollEvents_POLLIN)
+#ifdef POLLIN
+               *r |= POLLIN;
+#else /* def POLLIN */
                {errno = EINVAL; return -1;}
-#endif /* ndef EL2NSYNC */
-       if (x == Mono_Posix_Errno_EL3HLT)
-#ifdef EL3HLT
-               {*r = EL3HLT; return 0;}
-#else /* def EL3HLT */
+#endif /* ndef POLLIN */
+       if ((x & Mono_Posix_PollEvents_POLLNVAL) == Mono_Posix_PollEvents_POLLNVAL)
+#ifdef POLLNVAL
+               *r |= POLLNVAL;
+#else /* def POLLNVAL */
                {errno = EINVAL; return -1;}
-#endif /* ndef EL3HLT */
-       if (x == Mono_Posix_Errno_EL3RST)
-#ifdef EL3RST
-               {*r = EL3RST; return 0;}
-#else /* def EL3RST */
+#endif /* ndef POLLNVAL */
+       if ((x & Mono_Posix_PollEvents_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
+#ifdef POLLOUT
+               *r |= POLLOUT;
+#else /* def POLLOUT */
                {errno = EINVAL; return -1;}
-#endif /* ndef EL3RST */
-       if (x == Mono_Posix_Errno_ELIBACC)
-#ifdef ELIBACC
-               {*r = ELIBACC; return 0;}
-#else /* def ELIBACC */
+#endif /* ndef POLLOUT */
+       if ((x & Mono_Posix_PollEvents_POLLPRI) == Mono_Posix_PollEvents_POLLPRI)
+#ifdef POLLPRI
+               *r |= POLLPRI;
+#else /* def POLLPRI */
                {errno = EINVAL; return -1;}
-#endif /* ndef ELIBACC */
-       if (x == Mono_Posix_Errno_ELIBBAD)
-#ifdef ELIBBAD
-               {*r = ELIBBAD; return 0;}
-#else /* def ELIBBAD */
+#endif /* ndef POLLPRI */
+       if ((x & Mono_Posix_PollEvents_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
+#ifdef POLLRDBAND
+               *r |= POLLRDBAND;
+#else /* def POLLRDBAND */
                {errno = EINVAL; return -1;}
-#endif /* ndef ELIBBAD */
-       if (x == Mono_Posix_Errno_ELIBEXEC)
-#ifdef ELIBEXEC
-               {*r = ELIBEXEC; return 0;}
-#else /* def ELIBEXEC */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ELIBEXEC */
-       if (x == Mono_Posix_Errno_ELIBMAX)
-#ifdef ELIBMAX
-               {*r = ELIBMAX; return 0;}
-#else /* def ELIBMAX */
+#endif /* ndef POLLRDBAND */
+       if ((x & Mono_Posix_PollEvents_POLLRDNORM) == Mono_Posix_PollEvents_POLLRDNORM)
+#ifdef POLLRDNORM
+               *r |= POLLRDNORM;
+#else /* def POLLRDNORM */
                {errno = EINVAL; return -1;}
-#endif /* ndef ELIBMAX */
-       if (x == Mono_Posix_Errno_ELIBSCN)
-#ifdef ELIBSCN
-               {*r = ELIBSCN; return 0;}
-#else /* def ELIBSCN */
+#endif /* ndef POLLRDNORM */
+       if ((x & Mono_Posix_PollEvents_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
+#ifdef POLLWRBAND
+               *r |= POLLWRBAND;
+#else /* def POLLWRBAND */
                {errno = EINVAL; return -1;}
-#endif /* ndef ELIBSCN */
-       if (x == Mono_Posix_Errno_ELNRNG)
-#ifdef ELNRNG
-               {*r = ELNRNG; return 0;}
-#else /* def ELNRNG */
+#endif /* ndef POLLWRBAND */
+       if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
+#ifdef POLLWRNORM
+               *r |= POLLWRNORM;
+#else /* def POLLWRNORM */
                {errno = EINVAL; return -1;}
-#endif /* ndef ELNRNG */
-       if (x == Mono_Posix_Errno_ELOOP)
-#ifdef ELOOP
-               {*r = ELOOP; return 0;}
-#else /* def ELOOP */
+#endif /* ndef POLLWRNORM */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToPollEvents (short x, short *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#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 POLLIN
+       if ((x & POLLIN) == POLLIN)
+               *r |= Mono_Posix_PollEvents_POLLIN;
+#endif /* ndef POLLIN */
+#ifdef POLLNVAL
+       if ((x & POLLNVAL) == POLLNVAL)
+               *r |= Mono_Posix_PollEvents_POLLNVAL;
+#endif /* ndef POLLNVAL */
+#ifdef POLLOUT
+       if ((x & POLLOUT) == POLLOUT)
+               *r |= Mono_Posix_PollEvents_POLLOUT;
+#endif /* ndef POLLOUT */
+#ifdef POLLPRI
+       if ((x & POLLPRI) == POLLPRI)
+               *r |= Mono_Posix_PollEvents_POLLPRI;
+#endif /* ndef POLLPRI */
+#ifdef POLLRDBAND
+       if ((x & POLLRDBAND) == POLLRDBAND)
+               *r |= Mono_Posix_PollEvents_POLLRDBAND;
+#endif /* ndef POLLRDBAND */
+#ifdef POLLRDNORM
+       if ((x & POLLRDNORM) == POLLRDNORM)
+               *r |= Mono_Posix_PollEvents_POLLRDNORM;
+#endif /* ndef POLLRDNORM */
+#ifdef POLLWRBAND
+       if ((x & POLLWRBAND) == POLLWRBAND)
+               *r |= Mono_Posix_PollEvents_POLLWRBAND;
+#endif /* ndef POLLWRBAND */
+#ifdef POLLWRNORM
+       if ((x & POLLWRNORM) == POLLWRNORM)
+               *r |= Mono_Posix_PollEvents_POLLWRNORM;
+#endif /* ndef POLLWRNORM */
+       return 0;
+}
+
+#ifdef HAVE_STRUCT_POLLFD
+int
+Mono_Posix_FromPollfd (struct Mono_Posix_Pollfd *from, struct pollfd *to)
+{
+       _cnm_return_val_if_overflow (int, from->fd, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->fd      = from->fd;
+       if (Mono_Posix_FromPollEvents (from->events, &to->events) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_FromPollEvents (from->revents, &to->revents) != 0) {
+               return -1;
+       }
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_POLLFD */
+
+
+#ifdef HAVE_STRUCT_POLLFD
+int
+Mono_Posix_ToPollfd (struct pollfd *from, struct Mono_Posix_Pollfd *to)
+{
+       _cnm_return_val_if_overflow (int, from->fd, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->fd      = from->fd;
+       if (Mono_Posix_ToPollEvents (from->events, &to->events) != 0) {
+               return -1;
+       }
+       if (Mono_Posix_ToPollEvents (from->revents, &to->revents) != 0) {
+               return -1;
+       }
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_POLLFD */
+
+
+int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
+{
+       *r = 0;
+       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 ELOOP */
-       if (x == Mono_Posix_Errno_EMEDIUMTYPE)
-#ifdef EMEDIUMTYPE
-               {*r = EMEDIUMTYPE; return 0;}
-#else /* def EMEDIUMTYPE */
+#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 EMEDIUMTYPE */
-       if (x == Mono_Posix_Errno_EMFILE)
-#ifdef EMFILE
-               {*r = EMFILE; return 0;}
-#else /* def EMFILE */
+#endif /* ndef POSIX_FADV_NOREUSE */
+       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 EMFILE */
-       if (x == Mono_Posix_Errno_EMLINK)
-#ifdef EMLINK
-               {*r = EMLINK; return 0;}
-#else /* def EMLINK */
+#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 EMLINK */
-       if (x == Mono_Posix_Errno_EMSGSIZE)
-#ifdef EMSGSIZE
-               {*r = EMSGSIZE; return 0;}
-#else /* def EMSGSIZE */
+#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 EMSGSIZE */
-       if (x == Mono_Posix_Errno_EMULTIHOP)
-#ifdef EMULTIHOP
-               {*r = EMULTIHOP; return 0;}
-#else /* def EMULTIHOP */
+#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 EMULTIHOP */
-       if (x == Mono_Posix_Errno_ENAMETOOLONG)
-#ifdef ENAMETOOLONG
-               {*r = ENAMETOOLONG; return 0;}
-#else /* def ENAMETOOLONG */
+#endif /* ndef POSIX_FADV_WILLNEED */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#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 */
+#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 */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
+{
+       *r = 0;
+       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 ENAMETOOLONG */
-       if (x == Mono_Posix_Errno_ENAVAIL)
-#ifdef ENAVAIL
-               {*r = ENAVAIL; return 0;}
-#else /* def ENAVAIL */
+#endif /* ndef POSIX_MADV_DONTNEED */
+       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 ENAVAIL */
-       if (x == Mono_Posix_Errno_ENETDOWN)
-#ifdef ENETDOWN
-               {*r = ENETDOWN; return 0;}
-#else /* def ENETDOWN */
+#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 ENETDOWN */
-       if (x == Mono_Posix_Errno_ENETRESET)
-#ifdef ENETRESET
-               {*r = ENETRESET; return 0;}
-#else /* def ENETRESET */
+#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 ENETRESET */
-       if (x == Mono_Posix_Errno_ENETUNREACH)
-#ifdef ENETUNREACH
-               {*r = ENETUNREACH; return 0;}
-#else /* def ENETUNREACH */
+#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 ENETUNREACH */
-       if (x == Mono_Posix_Errno_ENFILE)
-#ifdef ENFILE
-               {*r = ENFILE; return 0;}
-#else /* def ENFILE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ENFILE */
-       if (x == Mono_Posix_Errno_ENOANO)
-#ifdef ENOANO
-               {*r = ENOANO; return 0;}
-#else /* def ENOANO */
+#endif /* ndef POSIX_MADV_WILLNEED */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef POSIX_MADV_DONTNEED
+       if (x == POSIX_MADV_DONTNEED)
+               {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
+#endif /* ndef POSIX_MADV_DONTNEED */
+#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 */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromSeekFlags (short x, short *r)
+{
+       *r = 0;
+       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 ENOANO */
-       if (x == Mono_Posix_Errno_ENOBUFS)
-#ifdef ENOBUFS
-               {*r = ENOBUFS; return 0;}
-#else /* def ENOBUFS */
+#endif /* ndef L_INCR */
+       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 ENOBUFS */
-       if (x == Mono_Posix_Errno_ENOCSI)
-#ifdef ENOCSI
-               {*r = ENOCSI; return 0;}
-#else /* def ENOCSI */
+#endif /* ndef L_SET */
+       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 ENOCSI */
-       if (x == Mono_Posix_Errno_ENODATA)
-#ifdef ENODATA
-               {*r = ENODATA; return 0;}
-#else /* def ENODATA */
+#endif /* ndef L_XTND */
+       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 ENODATA */
-       if (x == Mono_Posix_Errno_ENODEV)
-#ifdef ENODEV
-               {*r = ENODEV; return 0;}
-#else /* def ENODEV */
+#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 ENODEV */
-       if (x == Mono_Posix_Errno_ENOENT)
-#ifdef ENOENT
-               {*r = ENOENT; return 0;}
-#else /* def ENOENT */
+#endif /* ndef SEEK_END */
+       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 ENOENT */
-       if (x == Mono_Posix_Errno_ENOEXEC)
-#ifdef ENOEXEC
-               {*r = ENOEXEC; return 0;}
-#else /* def ENOEXEC */
+#endif /* ndef SEEK_SET */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToSeekFlags (short x, short *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef L_INCR
+       if (x == L_INCR)
+               {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
+#endif /* ndef L_INCR */
+#ifdef L_SET
+       if (x == L_SET)
+               {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
+#endif /* ndef L_SET */
+#ifdef L_XTND
+       if (x == L_XTND)
+               {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
+#endif /* ndef L_XTND */
+#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 SEEK_SET
+       if (x == SEEK_SET)
+               {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
+#endif /* ndef SEEK_SET */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromShutdownOption (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_ShutdownOption_SHUT_RD)
+#ifdef SHUT_RD
+               {*r = SHUT_RD; return 0;}
+#else /* def SHUT_RD */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SHUT_RD */
+       if (x == Mono_Posix_ShutdownOption_SHUT_RDWR)
+#ifdef SHUT_RDWR
+               {*r = SHUT_RDWR; return 0;}
+#else /* def SHUT_RDWR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SHUT_RDWR */
+       if (x == Mono_Posix_ShutdownOption_SHUT_WR)
+#ifdef SHUT_WR
+               {*r = SHUT_WR; return 0;}
+#else /* def SHUT_WR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SHUT_WR */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToShutdownOption (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef SHUT_RD
+       if (x == SHUT_RD)
+               {*r = Mono_Posix_ShutdownOption_SHUT_RD; return 0;}
+#endif /* ndef SHUT_RD */
+#ifdef SHUT_RDWR
+       if (x == SHUT_RDWR)
+               {*r = Mono_Posix_ShutdownOption_SHUT_RDWR; return 0;}
+#endif /* ndef SHUT_RDWR */
+#ifdef SHUT_WR
+       if (x == SHUT_WR)
+               {*r = Mono_Posix_ShutdownOption_SHUT_WR; return 0;}
+#endif /* ndef SHUT_WR */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromSignum (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_Signum_SIGABRT)
+#ifdef SIGABRT
+               {*r = SIGABRT; return 0;}
+#else /* def SIGABRT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOEXEC */
-       if (x == Mono_Posix_Errno_ENOLCK)
-#ifdef ENOLCK
-               {*r = ENOLCK; return 0;}
-#else /* def ENOLCK */
+#endif /* ndef SIGABRT */
+       if (x == Mono_Posix_Signum_SIGALRM)
+#ifdef SIGALRM
+               {*r = SIGALRM; return 0;}
+#else /* def SIGALRM */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOLCK */
-       if (x == Mono_Posix_Errno_ENOLINK)
-#ifdef ENOLINK
-               {*r = ENOLINK; return 0;}
-#else /* def ENOLINK */
+#endif /* ndef SIGALRM */
+       if (x == Mono_Posix_Signum_SIGBUS)
+#ifdef SIGBUS
+               {*r = SIGBUS; return 0;}
+#else /* def SIGBUS */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOLINK */
-       if (x == Mono_Posix_Errno_ENOMEDIUM)
-#ifdef ENOMEDIUM
-               {*r = ENOMEDIUM; return 0;}
-#else /* def ENOMEDIUM */
+#endif /* ndef SIGBUS */
+       if (x == Mono_Posix_Signum_SIGCHLD)
+#ifdef SIGCHLD
+               {*r = SIGCHLD; return 0;}
+#else /* def SIGCHLD */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOMEDIUM */
-       if (x == Mono_Posix_Errno_ENOMEM)
-#ifdef ENOMEM
-               {*r = ENOMEM; return 0;}
-#else /* def ENOMEM */
+#endif /* ndef SIGCHLD */
+       if (x == Mono_Posix_Signum_SIGCLD)
+#ifdef SIGCLD
+               {*r = SIGCLD; return 0;}
+#else /* def SIGCLD */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOMEM */
-       if (x == Mono_Posix_Errno_ENOMSG)
-#ifdef ENOMSG
-               {*r = ENOMSG; return 0;}
-#else /* def ENOMSG */
+#endif /* ndef SIGCLD */
+       if (x == Mono_Posix_Signum_SIGCONT)
+#ifdef SIGCONT
+               {*r = SIGCONT; return 0;}
+#else /* def SIGCONT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOMSG */
-       if (x == Mono_Posix_Errno_ENONET)
-#ifdef ENONET
-               {*r = ENONET; return 0;}
-#else /* def ENONET */
+#endif /* ndef SIGCONT */
+       if (x == Mono_Posix_Signum_SIGFPE)
+#ifdef SIGFPE
+               {*r = SIGFPE; return 0;}
+#else /* def SIGFPE */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENONET */
-       if (x == Mono_Posix_Errno_ENOPKG)
-#ifdef ENOPKG
-               {*r = ENOPKG; return 0;}
-#else /* def ENOPKG */
+#endif /* ndef SIGFPE */
+       if (x == Mono_Posix_Signum_SIGHUP)
+#ifdef SIGHUP
+               {*r = SIGHUP; return 0;}
+#else /* def SIGHUP */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOPKG */
-       if (x == Mono_Posix_Errno_ENOPROTOOPT)
-#ifdef ENOPROTOOPT
-               {*r = ENOPROTOOPT; return 0;}
-#else /* def ENOPROTOOPT */
+#endif /* ndef SIGHUP */
+       if (x == Mono_Posix_Signum_SIGILL)
+#ifdef SIGILL
+               {*r = SIGILL; return 0;}
+#else /* def SIGILL */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOPROTOOPT */
-       if (x == Mono_Posix_Errno_ENOSPC)
-#ifdef ENOSPC
-               {*r = ENOSPC; return 0;}
-#else /* def ENOSPC */
+#endif /* ndef SIGILL */
+       if (x == Mono_Posix_Signum_SIGINT)
+#ifdef SIGINT
+               {*r = SIGINT; return 0;}
+#else /* def SIGINT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOSPC */
-       if (x == Mono_Posix_Errno_ENOSR)
-#ifdef ENOSR
-               {*r = ENOSR; return 0;}
-#else /* def ENOSR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ENOSR */
-       if (x == Mono_Posix_Errno_ENOSTR)
-#ifdef ENOSTR
-               {*r = ENOSTR; return 0;}
-#else /* def ENOSTR */
+#endif /* ndef SIGINT */
+       if (x == Mono_Posix_Signum_SIGIO)
+#ifdef SIGIO
+               {*r = SIGIO; return 0;}
+#else /* def SIGIO */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOSTR */
-       if (x == Mono_Posix_Errno_ENOSYS)
-#ifdef ENOSYS
-               {*r = ENOSYS; return 0;}
-#else /* def ENOSYS */
+#endif /* ndef SIGIO */
+       if (x == Mono_Posix_Signum_SIGIOT)
+#ifdef SIGIOT
+               {*r = SIGIOT; return 0;}
+#else /* def SIGIOT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOSYS */
-       if (x == Mono_Posix_Errno_ENOTBLK)
-#ifdef ENOTBLK
-               {*r = ENOTBLK; return 0;}
-#else /* def ENOTBLK */
+#endif /* ndef SIGIOT */
+       if (x == Mono_Posix_Signum_SIGKILL)
+#ifdef SIGKILL
+               {*r = SIGKILL; return 0;}
+#else /* def SIGKILL */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTBLK */
-       if (x == Mono_Posix_Errno_ENOTCONN)
-#ifdef ENOTCONN
-               {*r = ENOTCONN; return 0;}
-#else /* def ENOTCONN */
+#endif /* ndef SIGKILL */
+       if (x == Mono_Posix_Signum_SIGPIPE)
+#ifdef SIGPIPE
+               {*r = SIGPIPE; return 0;}
+#else /* def SIGPIPE */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTCONN */
-       if (x == Mono_Posix_Errno_ENOTDIR)
-#ifdef ENOTDIR
-               {*r = ENOTDIR; return 0;}
-#else /* def ENOTDIR */
+#endif /* ndef SIGPIPE */
+       if (x == Mono_Posix_Signum_SIGPOLL)
+#ifdef SIGPOLL
+               {*r = SIGPOLL; return 0;}
+#else /* def SIGPOLL */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTDIR */
-       if (x == Mono_Posix_Errno_ENOTEMPTY)
-#ifdef ENOTEMPTY
-               {*r = ENOTEMPTY; return 0;}
-#else /* def ENOTEMPTY */
+#endif /* ndef SIGPOLL */
+       if (x == Mono_Posix_Signum_SIGPROF)
+#ifdef SIGPROF
+               {*r = SIGPROF; return 0;}
+#else /* def SIGPROF */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTEMPTY */
-       if (x == Mono_Posix_Errno_ENOTNAM)
-#ifdef ENOTNAM
-               {*r = ENOTNAM; return 0;}
-#else /* def ENOTNAM */
+#endif /* ndef SIGPROF */
+       if (x == Mono_Posix_Signum_SIGPWR)
+#ifdef SIGPWR
+               {*r = SIGPWR; return 0;}
+#else /* def SIGPWR */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTNAM */
-       if (x == Mono_Posix_Errno_ENOTSOCK)
-#ifdef ENOTSOCK
-               {*r = ENOTSOCK; return 0;}
-#else /* def ENOTSOCK */
+#endif /* ndef SIGPWR */
+       if (x == Mono_Posix_Signum_SIGQUIT)
+#ifdef SIGQUIT
+               {*r = SIGQUIT; return 0;}
+#else /* def SIGQUIT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTSOCK */
-       if (x == Mono_Posix_Errno_ENOTTY)
-#ifdef ENOTTY
-               {*r = ENOTTY; return 0;}
-#else /* def ENOTTY */
+#endif /* ndef SIGQUIT */
+       if (x == Mono_Posix_Signum_SIGSEGV)
+#ifdef SIGSEGV
+               {*r = SIGSEGV; return 0;}
+#else /* def SIGSEGV */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTTY */
-       if (x == Mono_Posix_Errno_ENOTUNIQ)
-#ifdef ENOTUNIQ
-               {*r = ENOTUNIQ; return 0;}
-#else /* def ENOTUNIQ */
+#endif /* ndef SIGSEGV */
+       if (x == Mono_Posix_Signum_SIGSTKFLT)
+#ifdef SIGSTKFLT
+               {*r = SIGSTKFLT; return 0;}
+#else /* def SIGSTKFLT */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENOTUNIQ */
-       if (x == Mono_Posix_Errno_ENXIO)
-#ifdef ENXIO
-               {*r = ENXIO; return 0;}
-#else /* def ENXIO */
+#endif /* ndef SIGSTKFLT */
+       if (x == Mono_Posix_Signum_SIGSTOP)
+#ifdef SIGSTOP
+               {*r = SIGSTOP; return 0;}
+#else /* def SIGSTOP */
                {errno = EINVAL; return -1;}
-#endif /* ndef ENXIO */
-       if (x == Mono_Posix_Errno_EOPNOTSUPP)
-#ifdef EOPNOTSUPP
-               {*r = EOPNOTSUPP; return 0;}
-#else /* def EOPNOTSUPP */
+#endif /* ndef SIGSTOP */
+       if (x == Mono_Posix_Signum_SIGSYS)
+#ifdef SIGSYS
+               {*r = SIGSYS; return 0;}
+#else /* def SIGSYS */
                {errno = EINVAL; return -1;}
-#endif /* ndef EOPNOTSUPP */
-       if (x == Mono_Posix_Errno_EOVERFLOW)
-#ifdef EOVERFLOW
-               {*r = EOVERFLOW; return 0;}
-#else /* def EOVERFLOW */
+#endif /* ndef SIGSYS */
+       if (x == Mono_Posix_Signum_SIGTERM)
+#ifdef SIGTERM
+               {*r = SIGTERM; return 0;}
+#else /* def SIGTERM */
                {errno = EINVAL; return -1;}
-#endif /* ndef EOVERFLOW */
-       if (x == Mono_Posix_Errno_EPERM)
-#ifdef EPERM
-               {*r = EPERM; return 0;}
-#else /* def EPERM */
+#endif /* ndef SIGTERM */
+       if (x == Mono_Posix_Signum_SIGTRAP)
+#ifdef SIGTRAP
+               {*r = SIGTRAP; return 0;}
+#else /* def SIGTRAP */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPERM */
-       if (x == Mono_Posix_Errno_EPFNOSUPPORT)
-#ifdef EPFNOSUPPORT
-               {*r = EPFNOSUPPORT; return 0;}
-#else /* def EPFNOSUPPORT */
+#endif /* ndef SIGTRAP */
+       if (x == Mono_Posix_Signum_SIGTSTP)
+#ifdef SIGTSTP
+               {*r = SIGTSTP; return 0;}
+#else /* def SIGTSTP */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPFNOSUPPORT */
-       if (x == Mono_Posix_Errno_EPIPE)
-#ifdef EPIPE
-               {*r = EPIPE; return 0;}
-#else /* def EPIPE */
+#endif /* ndef SIGTSTP */
+       if (x == Mono_Posix_Signum_SIGTTIN)
+#ifdef SIGTTIN
+               {*r = SIGTTIN; return 0;}
+#else /* def SIGTTIN */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPIPE */
-       if (x == Mono_Posix_Errno_EPROTO)
-#ifdef EPROTO
-               {*r = EPROTO; return 0;}
-#else /* def EPROTO */
+#endif /* ndef SIGTTIN */
+       if (x == Mono_Posix_Signum_SIGTTOU)
+#ifdef SIGTTOU
+               {*r = SIGTTOU; return 0;}
+#else /* def SIGTTOU */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPROTO */
-       if (x == Mono_Posix_Errno_EPROTONOSUPPORT)
-#ifdef EPROTONOSUPPORT
-               {*r = EPROTONOSUPPORT; return 0;}
-#else /* def EPROTONOSUPPORT */
+#endif /* ndef SIGTTOU */
+       if (x == Mono_Posix_Signum_SIGUNUSED)
+#ifdef SIGUNUSED
+               {*r = SIGUNUSED; return 0;}
+#else /* def SIGUNUSED */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPROTONOSUPPORT */
-       if (x == Mono_Posix_Errno_EPROTOTYPE)
-#ifdef EPROTOTYPE
-               {*r = EPROTOTYPE; return 0;}
-#else /* def EPROTOTYPE */
+#endif /* ndef SIGUNUSED */
+       if (x == Mono_Posix_Signum_SIGURG)
+#ifdef SIGURG
+               {*r = SIGURG; return 0;}
+#else /* def SIGURG */
                {errno = EINVAL; return -1;}
-#endif /* ndef EPROTOTYPE */
-       if (x == Mono_Posix_Errno_ERANGE)
-#ifdef ERANGE
-               {*r = ERANGE; return 0;}
-#else /* def ERANGE */
+#endif /* ndef SIGURG */
+       if (x == Mono_Posix_Signum_SIGUSR1)
+#ifdef SIGUSR1
+               {*r = SIGUSR1; return 0;}
+#else /* def SIGUSR1 */
                {errno = EINVAL; return -1;}
-#endif /* ndef ERANGE */
-       if (x == Mono_Posix_Errno_EREMCHG)
-#ifdef EREMCHG
-               {*r = EREMCHG; return 0;}
-#else /* def EREMCHG */
+#endif /* ndef SIGUSR1 */
+       if (x == Mono_Posix_Signum_SIGUSR2)
+#ifdef SIGUSR2
+               {*r = SIGUSR2; return 0;}
+#else /* def SIGUSR2 */
                {errno = EINVAL; return -1;}
-#endif /* ndef EREMCHG */
-       if (x == Mono_Posix_Errno_EREMOTE)
-#ifdef EREMOTE
-               {*r = EREMOTE; return 0;}
-#else /* def EREMOTE */
+#endif /* ndef SIGUSR2 */
+       if (x == Mono_Posix_Signum_SIGVTALRM)
+#ifdef SIGVTALRM
+               {*r = SIGVTALRM; return 0;}
+#else /* def SIGVTALRM */
                {errno = EINVAL; return -1;}
-#endif /* ndef EREMOTE */
-       if (x == Mono_Posix_Errno_EREMOTEIO)
-#ifdef EREMOTEIO
-               {*r = EREMOTEIO; return 0;}
-#else /* def EREMOTEIO */
+#endif /* ndef SIGVTALRM */
+       if (x == Mono_Posix_Signum_SIGWINCH)
+#ifdef SIGWINCH
+               {*r = SIGWINCH; return 0;}
+#else /* def SIGWINCH */
                {errno = EINVAL; return -1;}
-#endif /* ndef EREMOTEIO */
-       if (x == Mono_Posix_Errno_ERESTART)
-#ifdef ERESTART
-               {*r = ERESTART; return 0;}
-#else /* def ERESTART */
+#endif /* ndef SIGWINCH */
+       if (x == Mono_Posix_Signum_SIGXCPU)
+#ifdef SIGXCPU
+               {*r = SIGXCPU; return 0;}
+#else /* def SIGXCPU */
                {errno = EINVAL; return -1;}
-#endif /* ndef ERESTART */
-       if (x == Mono_Posix_Errno_EROFS)
-#ifdef EROFS
-               {*r = EROFS; return 0;}
-#else /* def EROFS */
+#endif /* ndef SIGXCPU */
+       if (x == Mono_Posix_Signum_SIGXFSZ)
+#ifdef SIGXFSZ
+               {*r = SIGXFSZ; return 0;}
+#else /* def SIGXFSZ */
                {errno = EINVAL; return -1;}
-#endif /* ndef EROFS */
-       if (x == Mono_Posix_Errno_ESHUTDOWN)
-#ifdef ESHUTDOWN
-               {*r = ESHUTDOWN; return 0;}
-#else /* def ESHUTDOWN */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESHUTDOWN */
-       if (x == Mono_Posix_Errno_ESOCKTNOSUPPORT)
-#ifdef ESOCKTNOSUPPORT
-               {*r = ESOCKTNOSUPPORT; return 0;}
-#else /* def ESOCKTNOSUPPORT */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESOCKTNOSUPPORT */
-       if (x == Mono_Posix_Errno_ESPIPE)
-#ifdef ESPIPE
-               {*r = ESPIPE; return 0;}
-#else /* def ESPIPE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESPIPE */
-       if (x == Mono_Posix_Errno_ESRCH)
-#ifdef ESRCH
-               {*r = ESRCH; return 0;}
-#else /* def ESRCH */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESRCH */
-       if (x == Mono_Posix_Errno_ESRMNT)
-#ifdef ESRMNT
-               {*r = ESRMNT; return 0;}
-#else /* def ESRMNT */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESRMNT */
-       if (x == Mono_Posix_Errno_ESTALE)
-#ifdef ESTALE
-               {*r = ESTALE; return 0;}
-#else /* def ESTALE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESTALE */
-       if (x == Mono_Posix_Errno_ESTRPIPE)
-#ifdef ESTRPIPE
-               {*r = ESTRPIPE; return 0;}
-#else /* def ESTRPIPE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ESTRPIPE */
-       if (x == Mono_Posix_Errno_ETIME)
-#ifdef ETIME
-               {*r = ETIME; return 0;}
-#else /* def ETIME */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ETIME */
-       if (x == Mono_Posix_Errno_ETIMEDOUT)
-#ifdef ETIMEDOUT
-               {*r = ETIMEDOUT; return 0;}
-#else /* def ETIMEDOUT */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ETIMEDOUT */
-       if (x == Mono_Posix_Errno_ETOOMANYREFS)
-#ifdef ETOOMANYREFS
-               {*r = ETOOMANYREFS; return 0;}
-#else /* def ETOOMANYREFS */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ETOOMANYREFS */
-       if (x == Mono_Posix_Errno_ETXTBSY)
-#ifdef ETXTBSY
-               {*r = ETXTBSY; return 0;}
-#else /* def ETXTBSY */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ETXTBSY */
-       if (x == Mono_Posix_Errno_EUCLEAN)
-#ifdef EUCLEAN
-               {*r = EUCLEAN; return 0;}
-#else /* def EUCLEAN */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EUCLEAN */
-       if (x == Mono_Posix_Errno_EUNATCH)
-#ifdef EUNATCH
-               {*r = EUNATCH; return 0;}
-#else /* def EUNATCH */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EUNATCH */
-       if (x == Mono_Posix_Errno_EUSERS)
-#ifdef EUSERS
-               {*r = EUSERS; return 0;}
-#else /* def EUSERS */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EUSERS */
-       if (x == Mono_Posix_Errno_EWOULDBLOCK)
-#ifdef EWOULDBLOCK
-               {*r = EWOULDBLOCK; return 0;}
-#else /* def EWOULDBLOCK */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EWOULDBLOCK */
-       if (x == Mono_Posix_Errno_EXDEV)
-#ifdef EXDEV
-               {*r = EXDEV; return 0;}
-#else /* def EXDEV */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EXDEV */
-       if (x == Mono_Posix_Errno_EXFULL)
-#ifdef EXFULL
-               {*r = EXFULL; return 0;}
-#else /* def EXFULL */
-               {errno = EINVAL; return -1;}
-#endif /* ndef EXFULL */
+#endif /* ndef SIGXFSZ */
+       if (x == 0)
+               return 0;
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToErrno (int x, int *r)
+int Mono_Posix_ToSignum (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
-#ifdef E2BIG
-       if (x == E2BIG)
-               {*r = Mono_Posix_Errno_E2BIG; return 0;}
-#endif /* ndef E2BIG */
-#ifdef EACCES
-       if (x == EACCES)
-               {*r = Mono_Posix_Errno_EACCES; return 0;}
-#endif /* ndef EACCES */
-#ifdef EADDRINUSE
-       if (x == EADDRINUSE)
-               {*r = Mono_Posix_Errno_EADDRINUSE; return 0;}
-#endif /* ndef EADDRINUSE */
-#ifdef EADDRNOTAVAIL
-       if (x == EADDRNOTAVAIL)
-               {*r = Mono_Posix_Errno_EADDRNOTAVAIL; return 0;}
-#endif /* ndef EADDRNOTAVAIL */
-#ifdef EADV
-       if (x == EADV)
-               {*r = Mono_Posix_Errno_EADV; return 0;}
-#endif /* ndef EADV */
-#ifdef EAFNOSUPPORT
-       if (x == EAFNOSUPPORT)
-               {*r = Mono_Posix_Errno_EAFNOSUPPORT; return 0;}
-#endif /* ndef EAFNOSUPPORT */
-#ifdef EAGAIN
-       if (x == EAGAIN)
-               {*r = Mono_Posix_Errno_EAGAIN; return 0;}
-#endif /* ndef EAGAIN */
-#ifdef EALREADY
-       if (x == EALREADY)
-               {*r = Mono_Posix_Errno_EALREADY; return 0;}
-#endif /* ndef EALREADY */
-#ifdef EBADE
-       if (x == EBADE)
-               {*r = Mono_Posix_Errno_EBADE; return 0;}
-#endif /* ndef EBADE */
-#ifdef EBADF
-       if (x == EBADF)
-               {*r = Mono_Posix_Errno_EBADF; return 0;}
-#endif /* ndef EBADF */
-#ifdef EBADFD
-       if (x == EBADFD)
-               {*r = Mono_Posix_Errno_EBADFD; return 0;}
-#endif /* ndef EBADFD */
-#ifdef EBADMSG
-       if (x == EBADMSG)
-               {*r = Mono_Posix_Errno_EBADMSG; return 0;}
-#endif /* ndef EBADMSG */
-#ifdef EBADR
-       if (x == EBADR)
-               {*r = Mono_Posix_Errno_EBADR; return 0;}
-#endif /* ndef EBADR */
-#ifdef EBADRQC
-       if (x == EBADRQC)
-               {*r = Mono_Posix_Errno_EBADRQC; return 0;}
-#endif /* ndef EBADRQC */
-#ifdef EBADSLT
-       if (x == EBADSLT)
-               {*r = Mono_Posix_Errno_EBADSLT; return 0;}
-#endif /* ndef EBADSLT */
-#ifdef EBFONT
-       if (x == EBFONT)
-               {*r = Mono_Posix_Errno_EBFONT; return 0;}
-#endif /* ndef EBFONT */
-#ifdef EBUSY
-       if (x == EBUSY)
-               {*r = Mono_Posix_Errno_EBUSY; return 0;}
-#endif /* ndef EBUSY */
-#ifdef ECHILD
-       if (x == ECHILD)
-               {*r = Mono_Posix_Errno_ECHILD; return 0;}
-#endif /* ndef ECHILD */
-#ifdef ECHRNG
-       if (x == ECHRNG)
-               {*r = Mono_Posix_Errno_ECHRNG; return 0;}
-#endif /* ndef ECHRNG */
-#ifdef ECOMM
-       if (x == ECOMM)
-               {*r = Mono_Posix_Errno_ECOMM; return 0;}
-#endif /* ndef ECOMM */
-#ifdef ECONNABORTED
-       if (x == ECONNABORTED)
-               {*r = Mono_Posix_Errno_ECONNABORTED; return 0;}
-#endif /* ndef ECONNABORTED */
-#ifdef ECONNREFUSED
-       if (x == ECONNREFUSED)
-               {*r = Mono_Posix_Errno_ECONNREFUSED; return 0;}
-#endif /* ndef ECONNREFUSED */
-#ifdef ECONNRESET
-       if (x == ECONNRESET)
-               {*r = Mono_Posix_Errno_ECONNRESET; return 0;}
-#endif /* ndef ECONNRESET */
-#ifdef EDEADLK
-       if (x == EDEADLK)
-               {*r = Mono_Posix_Errno_EDEADLK; return 0;}
-#endif /* ndef EDEADLK */
-#ifdef EDEADLOCK
-       if (x == EDEADLOCK)
-               {*r = Mono_Posix_Errno_EDEADLOCK; return 0;}
-#endif /* ndef EDEADLOCK */
-#ifdef EDESTADDRREQ
-       if (x == EDESTADDRREQ)
-               {*r = Mono_Posix_Errno_EDESTADDRREQ; return 0;}
-#endif /* ndef EDESTADDRREQ */
-#ifdef EDOM
-       if (x == EDOM)
-               {*r = Mono_Posix_Errno_EDOM; return 0;}
-#endif /* ndef EDOM */
-#ifdef EDOTDOT
-       if (x == EDOTDOT)
-               {*r = Mono_Posix_Errno_EDOTDOT; return 0;}
-#endif /* ndef EDOTDOT */
-#ifdef EDQUOT
-       if (x == EDQUOT)
-               {*r = Mono_Posix_Errno_EDQUOT; return 0;}
-#endif /* ndef EDQUOT */
-#ifdef EEXIST
-       if (x == EEXIST)
-               {*r = Mono_Posix_Errno_EEXIST; return 0;}
-#endif /* ndef EEXIST */
-#ifdef EFAULT
-       if (x == EFAULT)
-               {*r = Mono_Posix_Errno_EFAULT; return 0;}
-#endif /* ndef EFAULT */
-#ifdef EFBIG
-       if (x == EFBIG)
-               {*r = Mono_Posix_Errno_EFBIG; return 0;}
-#endif /* ndef EFBIG */
-#ifdef EHOSTDOWN
-       if (x == EHOSTDOWN)
-               {*r = Mono_Posix_Errno_EHOSTDOWN; return 0;}
-#endif /* ndef EHOSTDOWN */
-#ifdef EHOSTUNREACH
-       if (x == EHOSTUNREACH)
-               {*r = Mono_Posix_Errno_EHOSTUNREACH; return 0;}
-#endif /* ndef EHOSTUNREACH */
-#ifdef EIDRM
-       if (x == EIDRM)
-               {*r = Mono_Posix_Errno_EIDRM; return 0;}
-#endif /* ndef EIDRM */
-#ifdef EILSEQ
-       if (x == EILSEQ)
-               {*r = Mono_Posix_Errno_EILSEQ; return 0;}
-#endif /* ndef EILSEQ */
-#ifdef EINPROGRESS
-       if (x == EINPROGRESS)
-               {*r = Mono_Posix_Errno_EINPROGRESS; return 0;}
-#endif /* ndef EINPROGRESS */
-#ifdef EINTR
-       if (x == EINTR)
-               {*r = Mono_Posix_Errno_EINTR; return 0;}
-#endif /* ndef EINTR */
-#ifdef EINVAL
-       if (x == EINVAL)
-               {*r = Mono_Posix_Errno_EINVAL; return 0;}
-#endif /* ndef EINVAL */
-#ifdef EIO
-       if (x == EIO)
-               {*r = Mono_Posix_Errno_EIO; return 0;}
-#endif /* ndef EIO */
-#ifdef EISCONN
-       if (x == EISCONN)
-               {*r = Mono_Posix_Errno_EISCONN; return 0;}
-#endif /* ndef EISCONN */
-#ifdef EISDIR
-       if (x == EISDIR)
-               {*r = Mono_Posix_Errno_EISDIR; return 0;}
-#endif /* ndef EISDIR */
-#ifdef EISNAM
-       if (x == EISNAM)
-               {*r = Mono_Posix_Errno_EISNAM; return 0;}
-#endif /* ndef EISNAM */
-#ifdef EL2HLT
-       if (x == EL2HLT)
-               {*r = Mono_Posix_Errno_EL2HLT; return 0;}
-#endif /* ndef EL2HLT */
-#ifdef EL2NSYNC
-       if (x == EL2NSYNC)
-               {*r = Mono_Posix_Errno_EL2NSYNC; return 0;}
-#endif /* ndef EL2NSYNC */
-#ifdef EL3HLT
-       if (x == EL3HLT)
-               {*r = Mono_Posix_Errno_EL3HLT; return 0;}
-#endif /* ndef EL3HLT */
-#ifdef EL3RST
-       if (x == EL3RST)
-               {*r = Mono_Posix_Errno_EL3RST; return 0;}
-#endif /* ndef EL3RST */
-#ifdef ELIBACC
-       if (x == ELIBACC)
-               {*r = Mono_Posix_Errno_ELIBACC; return 0;}
-#endif /* ndef ELIBACC */
-#ifdef ELIBBAD
-       if (x == ELIBBAD)
-               {*r = Mono_Posix_Errno_ELIBBAD; return 0;}
-#endif /* ndef ELIBBAD */
-#ifdef ELIBEXEC
-       if (x == ELIBEXEC)
-               {*r = Mono_Posix_Errno_ELIBEXEC; return 0;}
-#endif /* ndef ELIBEXEC */
-#ifdef ELIBMAX
-       if (x == ELIBMAX)
-               {*r = Mono_Posix_Errno_ELIBMAX; return 0;}
-#endif /* ndef ELIBMAX */
-#ifdef ELIBSCN
-       if (x == ELIBSCN)
-               {*r = Mono_Posix_Errno_ELIBSCN; return 0;}
-#endif /* ndef ELIBSCN */
-#ifdef ELNRNG
-       if (x == ELNRNG)
-               {*r = Mono_Posix_Errno_ELNRNG; return 0;}
-#endif /* ndef ELNRNG */
-#ifdef ELOOP
-       if (x == ELOOP)
-               {*r = Mono_Posix_Errno_ELOOP; return 0;}
-#endif /* ndef ELOOP */
-#ifdef EMEDIUMTYPE
-       if (x == EMEDIUMTYPE)
-               {*r = Mono_Posix_Errno_EMEDIUMTYPE; return 0;}
-#endif /* ndef EMEDIUMTYPE */
-#ifdef EMFILE
-       if (x == EMFILE)
-               {*r = Mono_Posix_Errno_EMFILE; return 0;}
-#endif /* ndef EMFILE */
-#ifdef EMLINK
-       if (x == EMLINK)
-               {*r = Mono_Posix_Errno_EMLINK; return 0;}
-#endif /* ndef EMLINK */
-#ifdef EMSGSIZE
-       if (x == EMSGSIZE)
-               {*r = Mono_Posix_Errno_EMSGSIZE; return 0;}
-#endif /* ndef EMSGSIZE */
-#ifdef EMULTIHOP
-       if (x == EMULTIHOP)
-               {*r = Mono_Posix_Errno_EMULTIHOP; return 0;}
-#endif /* ndef EMULTIHOP */
-#ifdef ENAMETOOLONG
-       if (x == ENAMETOOLONG)
-               {*r = Mono_Posix_Errno_ENAMETOOLONG; return 0;}
-#endif /* ndef ENAMETOOLONG */
-#ifdef ENAVAIL
-       if (x == ENAVAIL)
-               {*r = Mono_Posix_Errno_ENAVAIL; return 0;}
-#endif /* ndef ENAVAIL */
-#ifdef ENETDOWN
-       if (x == ENETDOWN)
-               {*r = Mono_Posix_Errno_ENETDOWN; return 0;}
-#endif /* ndef ENETDOWN */
-#ifdef ENETRESET
-       if (x == ENETRESET)
-               {*r = Mono_Posix_Errno_ENETRESET; return 0;}
-#endif /* ndef ENETRESET */
-#ifdef ENETUNREACH
-       if (x == ENETUNREACH)
-               {*r = Mono_Posix_Errno_ENETUNREACH; return 0;}
-#endif /* ndef ENETUNREACH */
-#ifdef ENFILE
-       if (x == ENFILE)
-               {*r = Mono_Posix_Errno_ENFILE; return 0;}
-#endif /* ndef ENFILE */
-#ifdef ENOANO
-       if (x == ENOANO)
-               {*r = Mono_Posix_Errno_ENOANO; return 0;}
-#endif /* ndef ENOANO */
-#ifdef ENOBUFS
-       if (x == ENOBUFS)
-               {*r = Mono_Posix_Errno_ENOBUFS; return 0;}
-#endif /* ndef ENOBUFS */
-#ifdef ENOCSI
-       if (x == ENOCSI)
-               {*r = Mono_Posix_Errno_ENOCSI; return 0;}
-#endif /* ndef ENOCSI */
-#ifdef ENODATA
-       if (x == ENODATA)
-               {*r = Mono_Posix_Errno_ENODATA; return 0;}
-#endif /* ndef ENODATA */
-#ifdef ENODEV
-       if (x == ENODEV)
-               {*r = Mono_Posix_Errno_ENODEV; return 0;}
-#endif /* ndef ENODEV */
-#ifdef ENOENT
-       if (x == ENOENT)
-               {*r = Mono_Posix_Errno_ENOENT; return 0;}
-#endif /* ndef ENOENT */
-#ifdef ENOEXEC
-       if (x == ENOEXEC)
-               {*r = Mono_Posix_Errno_ENOEXEC; return 0;}
-#endif /* ndef ENOEXEC */
-#ifdef ENOLCK
-       if (x == ENOLCK)
-               {*r = Mono_Posix_Errno_ENOLCK; return 0;}
-#endif /* ndef ENOLCK */
-#ifdef ENOLINK
-       if (x == ENOLINK)
-               {*r = Mono_Posix_Errno_ENOLINK; return 0;}
-#endif /* ndef ENOLINK */
-#ifdef ENOMEDIUM
-       if (x == ENOMEDIUM)
-               {*r = Mono_Posix_Errno_ENOMEDIUM; return 0;}
-#endif /* ndef ENOMEDIUM */
-#ifdef ENOMEM
-       if (x == ENOMEM)
-               {*r = Mono_Posix_Errno_ENOMEM; return 0;}
-#endif /* ndef ENOMEM */
-#ifdef ENOMSG
-       if (x == ENOMSG)
-               {*r = Mono_Posix_Errno_ENOMSG; return 0;}
-#endif /* ndef ENOMSG */
-#ifdef ENONET
-       if (x == ENONET)
-               {*r = Mono_Posix_Errno_ENONET; return 0;}
-#endif /* ndef ENONET */
-#ifdef ENOPKG
-       if (x == ENOPKG)
-               {*r = Mono_Posix_Errno_ENOPKG; return 0;}
-#endif /* ndef ENOPKG */
-#ifdef ENOPROTOOPT
-       if (x == ENOPROTOOPT)
-               {*r = Mono_Posix_Errno_ENOPROTOOPT; return 0;}
-#endif /* ndef ENOPROTOOPT */
-#ifdef ENOSPC
-       if (x == ENOSPC)
-               {*r = Mono_Posix_Errno_ENOSPC; return 0;}
-#endif /* ndef ENOSPC */
-#ifdef ENOSR
-       if (x == ENOSR)
-               {*r = Mono_Posix_Errno_ENOSR; return 0;}
-#endif /* ndef ENOSR */
-#ifdef ENOSTR
-       if (x == ENOSTR)
-               {*r = Mono_Posix_Errno_ENOSTR; return 0;}
-#endif /* ndef ENOSTR */
-#ifdef ENOSYS
-       if (x == ENOSYS)
-               {*r = Mono_Posix_Errno_ENOSYS; return 0;}
-#endif /* ndef ENOSYS */
-#ifdef ENOTBLK
-       if (x == ENOTBLK)
-               {*r = Mono_Posix_Errno_ENOTBLK; return 0;}
-#endif /* ndef ENOTBLK */
-#ifdef ENOTCONN
-       if (x == ENOTCONN)
-               {*r = Mono_Posix_Errno_ENOTCONN; return 0;}
-#endif /* ndef ENOTCONN */
-#ifdef ENOTDIR
-       if (x == ENOTDIR)
-               {*r = Mono_Posix_Errno_ENOTDIR; return 0;}
-#endif /* ndef ENOTDIR */
-#ifdef ENOTEMPTY
-       if (x == ENOTEMPTY)
-               {*r = Mono_Posix_Errno_ENOTEMPTY; return 0;}
-#endif /* ndef ENOTEMPTY */
-#ifdef ENOTNAM
-       if (x == ENOTNAM)
-               {*r = Mono_Posix_Errno_ENOTNAM; return 0;}
-#endif /* ndef ENOTNAM */
-#ifdef ENOTSOCK
-       if (x == ENOTSOCK)
-               {*r = Mono_Posix_Errno_ENOTSOCK; return 0;}
-#endif /* ndef ENOTSOCK */
-#ifdef ENOTTY
-       if (x == ENOTTY)
-               {*r = Mono_Posix_Errno_ENOTTY; return 0;}
-#endif /* ndef ENOTTY */
-#ifdef ENOTUNIQ
-       if (x == ENOTUNIQ)
-               {*r = Mono_Posix_Errno_ENOTUNIQ; return 0;}
-#endif /* ndef ENOTUNIQ */
-#ifdef ENXIO
-       if (x == ENXIO)
-               {*r = Mono_Posix_Errno_ENXIO; return 0;}
-#endif /* ndef ENXIO */
-#ifdef EOPNOTSUPP
-       if (x == EOPNOTSUPP)
-               {*r = Mono_Posix_Errno_EOPNOTSUPP; return 0;}
-#endif /* ndef EOPNOTSUPP */
-#ifdef EOVERFLOW
-       if (x == EOVERFLOW)
-               {*r = Mono_Posix_Errno_EOVERFLOW; return 0;}
-#endif /* ndef EOVERFLOW */
-#ifdef EPERM
-       if (x == EPERM)
-               {*r = Mono_Posix_Errno_EPERM; return 0;}
-#endif /* ndef EPERM */
-#ifdef EPFNOSUPPORT
-       if (x == EPFNOSUPPORT)
-               {*r = Mono_Posix_Errno_EPFNOSUPPORT; return 0;}
-#endif /* ndef EPFNOSUPPORT */
-#ifdef EPIPE
-       if (x == EPIPE)
-               {*r = Mono_Posix_Errno_EPIPE; return 0;}
-#endif /* ndef EPIPE */
-#ifdef EPROTO
-       if (x == EPROTO)
-               {*r = Mono_Posix_Errno_EPROTO; return 0;}
-#endif /* ndef EPROTO */
-#ifdef EPROTONOSUPPORT
-       if (x == EPROTONOSUPPORT)
-               {*r = Mono_Posix_Errno_EPROTONOSUPPORT; return 0;}
-#endif /* ndef EPROTONOSUPPORT */
-#ifdef EPROTOTYPE
-       if (x == EPROTOTYPE)
-               {*r = Mono_Posix_Errno_EPROTOTYPE; return 0;}
-#endif /* ndef EPROTOTYPE */
-#ifdef ERANGE
-       if (x == ERANGE)
-               {*r = Mono_Posix_Errno_ERANGE; return 0;}
-#endif /* ndef ERANGE */
-#ifdef EREMCHG
-       if (x == EREMCHG)
-               {*r = Mono_Posix_Errno_EREMCHG; return 0;}
-#endif /* ndef EREMCHG */
-#ifdef EREMOTE
-       if (x == EREMOTE)
-               {*r = Mono_Posix_Errno_EREMOTE; return 0;}
-#endif /* ndef EREMOTE */
-#ifdef EREMOTEIO
-       if (x == EREMOTEIO)
-               {*r = Mono_Posix_Errno_EREMOTEIO; return 0;}
-#endif /* ndef EREMOTEIO */
-#ifdef ERESTART
-       if (x == ERESTART)
-               {*r = Mono_Posix_Errno_ERESTART; return 0;}
-#endif /* ndef ERESTART */
-#ifdef EROFS
-       if (x == EROFS)
-               {*r = Mono_Posix_Errno_EROFS; return 0;}
-#endif /* ndef EROFS */
-#ifdef ESHUTDOWN
-       if (x == ESHUTDOWN)
-               {*r = Mono_Posix_Errno_ESHUTDOWN; return 0;}
-#endif /* ndef ESHUTDOWN */
-#ifdef ESOCKTNOSUPPORT
-       if (x == ESOCKTNOSUPPORT)
-               {*r = Mono_Posix_Errno_ESOCKTNOSUPPORT; return 0;}
-#endif /* ndef ESOCKTNOSUPPORT */
-#ifdef ESPIPE
-       if (x == ESPIPE)
-               {*r = Mono_Posix_Errno_ESPIPE; return 0;}
-#endif /* ndef ESPIPE */
-#ifdef ESRCH
-       if (x == ESRCH)
-               {*r = Mono_Posix_Errno_ESRCH; return 0;}
-#endif /* ndef ESRCH */
-#ifdef ESRMNT
-       if (x == ESRMNT)
-               {*r = Mono_Posix_Errno_ESRMNT; return 0;}
-#endif /* ndef ESRMNT */
-#ifdef ESTALE
-       if (x == ESTALE)
-               {*r = Mono_Posix_Errno_ESTALE; return 0;}
-#endif /* ndef ESTALE */
-#ifdef ESTRPIPE
-       if (x == ESTRPIPE)
-               {*r = Mono_Posix_Errno_ESTRPIPE; return 0;}
-#endif /* ndef ESTRPIPE */
-#ifdef ETIME
-       if (x == ETIME)
-               {*r = Mono_Posix_Errno_ETIME; return 0;}
-#endif /* ndef ETIME */
-#ifdef ETIMEDOUT
-       if (x == ETIMEDOUT)
-               {*r = Mono_Posix_Errno_ETIMEDOUT; return 0;}
-#endif /* ndef ETIMEDOUT */
-#ifdef ETOOMANYREFS
-       if (x == ETOOMANYREFS)
-               {*r = Mono_Posix_Errno_ETOOMANYREFS; return 0;}
-#endif /* ndef ETOOMANYREFS */
-#ifdef ETXTBSY
-       if (x == ETXTBSY)
-               {*r = Mono_Posix_Errno_ETXTBSY; return 0;}
-#endif /* ndef ETXTBSY */
-#ifdef EUCLEAN
-       if (x == EUCLEAN)
-               {*r = Mono_Posix_Errno_EUCLEAN; return 0;}
-#endif /* ndef EUCLEAN */
-#ifdef EUNATCH
-       if (x == EUNATCH)
-               {*r = Mono_Posix_Errno_EUNATCH; return 0;}
-#endif /* ndef EUNATCH */
-#ifdef EUSERS
-       if (x == EUSERS)
-               {*r = Mono_Posix_Errno_EUSERS; return 0;}
-#endif /* ndef EUSERS */
-#ifdef EWOULDBLOCK
-       if (x == EWOULDBLOCK)
-               {*r = Mono_Posix_Errno_EWOULDBLOCK; return 0;}
-#endif /* ndef EWOULDBLOCK */
-#ifdef EXDEV
-       if (x == EXDEV)
-               {*r = Mono_Posix_Errno_EXDEV; return 0;}
-#endif /* ndef EXDEV */
-#ifdef EXFULL
-       if (x == EXFULL)
-               {*r = Mono_Posix_Errno_EXFULL; return 0;}
-#endif /* ndef EXFULL */
-       errno = EINVAL; return -1;
-}
-
-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_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_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_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_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_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_NOTIFY)
-#ifdef F_NOTIFY
-               {*r = F_NOTIFY; return 0;}
-#else /* def F_NOTIFY */
-               {errno = EINVAL; return -1;}
-#endif /* ndef F_NOTIFY */
-       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_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_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_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_SETSIG)
-#ifdef F_SETSIG
-               {*r = F_SETSIG; return 0;}
-#else /* def F_SETSIG */
-               {errno = EINVAL; return -1;}
-#endif /* ndef F_SETSIG */
-       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_GETFL
-       if (x == F_GETFL)
-               {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
-#endif /* ndef F_GETFL */
-#ifdef F_GETLEASE
-       if (x == F_GETLEASE)
-               {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
-#endif /* ndef F_GETLEASE */
-#ifdef F_GETLK
-       if (x == F_GETLK)
-               {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
-#endif /* ndef F_GETLK */
-#ifdef F_GETOWN
-       if (x == F_GETOWN)
-               {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
-#endif /* ndef F_GETOWN */
-#ifdef F_GETSIG
-       if (x == F_GETSIG)
-               {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
-#endif /* ndef F_GETSIG */
-#ifdef F_NOTIFY
-       if (x == F_NOTIFY)
-               {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
-#endif /* ndef F_NOTIFY */
-#ifdef F_SETFD
-       if (x == F_SETFD)
-               {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
-#endif /* ndef F_SETFD */
-#ifdef F_SETFL
-       if (x == F_SETFL)
-               {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
-#endif /* ndef F_SETFL */
-#ifdef F_SETLEASE
-       if (x == F_SETLEASE)
-               {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
-#endif /* ndef F_SETLEASE */
-#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_SETSIG
-       if (x == F_SETSIG)
-               {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
-#endif /* ndef F_SETSIG */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_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_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_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_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_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_IFSOCK) == Mono_Posix_FilePermissions_S_IFSOCK)
-#ifdef S_IFSOCK
-               *r |= S_IFSOCK;
-#else /* def S_IFSOCK */
-               {errno = EINVAL; return -1;}
-#endif /* ndef S_IFSOCK */
-       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_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_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_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_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_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_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_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_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_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_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_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_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_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_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
-#ifdef S_IXUSR
-               *r |= S_IXUSR;
-#else /* def S_IXUSR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef S_IXUSR */
-       return 0;
-}
-
-int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#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_IFBLK
-       if ((x & S_IFBLK) == S_IFBLK)
-               *r |= Mono_Posix_FilePermissions_S_IFBLK;
-#endif /* ndef S_IFBLK */
-#ifdef S_IFCHR
-       if ((x & S_IFCHR) == S_IFCHR)
-               *r |= Mono_Posix_FilePermissions_S_IFCHR;
-#endif /* ndef S_IFCHR */
-#ifdef S_IFDIR
-       if ((x & S_IFDIR) == S_IFDIR)
-               *r |= Mono_Posix_FilePermissions_S_IFDIR;
-#endif /* ndef S_IFDIR */
-#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_IFMT
-       if ((x & S_IFMT) == S_IFMT)
-               *r |= Mono_Posix_FilePermissions_S_IFMT;
-#endif /* ndef S_IFMT */
-#ifdef S_IFREG
-       if ((x & S_IFREG) == S_IFREG)
-               *r |= Mono_Posix_FilePermissions_S_IFREG;
-#endif /* ndef S_IFREG */
-#ifdef S_IFSOCK
-       if ((x & S_IFSOCK) == S_IFSOCK)
-               *r |= Mono_Posix_FilePermissions_S_IFSOCK;
-#endif /* ndef S_IFSOCK */
-#ifdef S_IRGRP
-       if ((x & S_IRGRP) == S_IRGRP)
-               *r |= Mono_Posix_FilePermissions_S_IRGRP;
-#endif /* ndef S_IRGRP */
-#ifdef S_IROTH
-       if ((x & S_IROTH) == S_IROTH)
-               *r |= Mono_Posix_FilePermissions_S_IROTH;
-#endif /* ndef S_IROTH */
-#ifdef S_IRUSR
-       if ((x & S_IRUSR) == S_IRUSR)
-               *r |= Mono_Posix_FilePermissions_S_IRUSR;
-#endif /* ndef S_IRUSR */
-#ifdef S_IRWXG
-       if ((x & S_IRWXG) == S_IRWXG)
-               *r |= Mono_Posix_FilePermissions_S_IRWXG;
-#endif /* ndef S_IRWXG */
-#ifdef S_IRWXO
-       if ((x & S_IRWXO) == S_IRWXO)
-               *r |= Mono_Posix_FilePermissions_S_IRWXO;
-#endif /* ndef S_IRWXO */
-#ifdef S_IRWXU
-       if ((x & S_IRWXU) == S_IRWXU)
-               *r |= Mono_Posix_FilePermissions_S_IRWXU;
-#endif /* ndef S_IRWXU */
-#ifdef S_ISGID
-       if ((x & S_ISGID) == S_ISGID)
-               *r |= Mono_Posix_FilePermissions_S_ISGID;
-#endif /* ndef S_ISGID */
-#ifdef S_ISUID
-       if ((x & S_ISUID) == S_ISUID)
-               *r |= Mono_Posix_FilePermissions_S_ISUID;
-#endif /* ndef S_ISUID */
-#ifdef S_ISVTX
-       if ((x & S_ISVTX) == S_ISVTX)
-               *r |= Mono_Posix_FilePermissions_S_ISVTX;
-#endif /* ndef S_ISVTX */
-#ifdef S_IWGRP
-       if ((x & S_IWGRP) == S_IWGRP)
-               *r |= Mono_Posix_FilePermissions_S_IWGRP;
-#endif /* ndef S_IWGRP */
-#ifdef S_IWOTH
-       if ((x & S_IWOTH) == S_IWOTH)
-               *r |= Mono_Posix_FilePermissions_S_IWOTH;
-#endif /* ndef S_IWOTH */
-#ifdef S_IWUSR
-       if ((x & S_IWUSR) == S_IWUSR)
-               *r |= Mono_Posix_FilePermissions_S_IWUSR;
-#endif /* ndef S_IWUSR */
-#ifdef S_IXGRP
-       if ((x & S_IXGRP) == S_IXGRP)
-               *r |= Mono_Posix_FilePermissions_S_IXGRP;
-#endif /* ndef S_IXGRP */
-#ifdef S_IXOTH
-       if ((x & S_IXOTH) == S_IXOTH)
-               *r |= Mono_Posix_FilePermissions_S_IXOTH;
-#endif /* ndef S_IXOTH */
-#ifdef S_IXUSR
-       if ((x & S_IXUSR) == S_IXUSR)
-               *r |= Mono_Posix_FilePermissions_S_IXUSR;
-#endif /* ndef S_IXUSR */
-       return 0;
-}
-
-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_UNLCK)
-#ifdef F_UNLCK
-               {*r = F_UNLCK; return 0;}
-#else /* def F_UNLCK */
-               {errno = EINVAL; return -1;}
-#endif /* ndef F_UNLCK */
-       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 */
-       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_UNLCK
-       if (x == F_UNLCK)
-               {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
-#endif /* ndef F_UNLCK */
-#ifdef F_WRLCK
-       if (x == F_WRLCK)
-               {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
-#endif /* ndef F_WRLCK */
-       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_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_TEST)
-#ifdef F_TEST
-               {*r = F_TEST; return 0;}
-#else /* def F_TEST */
-               {errno = EINVAL; return -1;}
-#endif /* ndef F_TEST */
-       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_ULOCK)
-#ifdef F_ULOCK
-               {*r = F_ULOCK; return 0;}
-#else /* def F_ULOCK */
-               {errno = EINVAL; return -1;}
-#endif /* ndef F_ULOCK */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToLockfCommand (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef F_LOCK
-       if (x == F_LOCK)
-               {*r = Mono_Posix_LockfCommand_F_LOCK; return 0;}
-#endif /* ndef F_LOCK */
-#ifdef F_TEST
-       if (x == F_TEST)
-               {*r = Mono_Posix_LockfCommand_F_TEST; return 0;}
-#endif /* ndef F_TEST */
-#ifdef F_TLOCK
-       if (x == F_TLOCK)
-               {*r = Mono_Posix_LockfCommand_F_TLOCK; return 0;}
-#endif /* ndef F_TLOCK */
-#ifdef F_ULOCK
-       if (x == F_ULOCK)
-               {*r = Mono_Posix_LockfCommand_F_ULOCK; return 0;}
-#endif /* ndef F_ULOCK */
-       errno = EINVAL; return -1;
-}
-
-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_FromMmapFlags (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_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_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_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_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_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_NONBLOCK) == Mono_Posix_MmapFlags_MAP_NONBLOCK)
-#ifdef MAP_NONBLOCK
-               *r |= MAP_NONBLOCK;
-#else /* def MAP_NONBLOCK */
-               {errno = EINVAL; return -1;}
-#endif /* ndef MAP_NONBLOCK */
-       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_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_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_TYPE) == Mono_Posix_MmapFlags_MAP_TYPE)
-#ifdef MAP_TYPE
-               *r |= MAP_TYPE;
-#else /* def MAP_TYPE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef MAP_TYPE */
-       return 0;
-}
-
-int Mono_Posix_ToMmapFlags (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef MAP_ANON
-       if ((x & MAP_ANON) == MAP_ANON)
-               *r |= Mono_Posix_MmapFlags_MAP_ANON;
-#endif /* ndef MAP_ANON */
-#ifdef MAP_ANONYMOUS
-       if ((x & MAP_ANONYMOUS) == MAP_ANONYMOUS)
-               *r |= Mono_Posix_MmapFlags_MAP_ANONYMOUS;
-#endif /* ndef MAP_ANONYMOUS */
-#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_FILE
-       if ((x & MAP_FILE) == MAP_FILE)
-               *r |= Mono_Posix_MmapFlags_MAP_FILE;
-#endif /* ndef MAP_FILE */
-#ifdef MAP_FIXED
-       if ((x & MAP_FIXED) == MAP_FIXED)
-               *r |= Mono_Posix_MmapFlags_MAP_FIXED;
-#endif /* ndef MAP_FIXED */
-#ifdef MAP_GROWSDOWN
-       if ((x & MAP_GROWSDOWN) == MAP_GROWSDOWN)
-               *r |= Mono_Posix_MmapFlags_MAP_GROWSDOWN;
-#endif /* ndef MAP_GROWSDOWN */
-#ifdef MAP_LOCKED
-       if ((x & MAP_LOCKED) == MAP_LOCKED)
-               *r |= Mono_Posix_MmapFlags_MAP_LOCKED;
-#endif /* ndef MAP_LOCKED */
-#ifdef MAP_NONBLOCK
-       if ((x & MAP_NONBLOCK) == MAP_NONBLOCK)
-               *r |= Mono_Posix_MmapFlags_MAP_NONBLOCK;
-#endif /* ndef MAP_NONBLOCK */
-#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_PRIVATE
-       if ((x & MAP_PRIVATE) == MAP_PRIVATE)
-               *r |= Mono_Posix_MmapFlags_MAP_PRIVATE;
-#endif /* ndef MAP_PRIVATE */
-#ifdef MAP_SHARED
-       if ((x & MAP_SHARED) == MAP_SHARED)
-               *r |= Mono_Posix_MmapFlags_MAP_SHARED;
-#endif /* ndef MAP_SHARED */
-#ifdef MAP_TYPE
-       if ((x & MAP_TYPE) == MAP_TYPE)
-               *r |= Mono_Posix_MmapFlags_MAP_TYPE;
-#endif /* ndef MAP_TYPE */
-       return 0;
-}
-
-int Mono_Posix_FromMmapProts (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       if ((x & Mono_Posix_MmapProts_PROT_EXEC) == Mono_Posix_MmapProts_PROT_EXEC)
-#ifdef PROT_EXEC
-               *r |= PROT_EXEC;
-#else /* def PROT_EXEC */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_EXEC */
-       if ((x & Mono_Posix_MmapProts_PROT_GROWSDOWN) == Mono_Posix_MmapProts_PROT_GROWSDOWN)
-#ifdef PROT_GROWSDOWN
-               *r |= PROT_GROWSDOWN;
-#else /* def PROT_GROWSDOWN */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_GROWSDOWN */
-       if ((x & Mono_Posix_MmapProts_PROT_GROWSUP) == Mono_Posix_MmapProts_PROT_GROWSUP)
-#ifdef PROT_GROWSUP
-               *r |= PROT_GROWSUP;
-#else /* def PROT_GROWSUP */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_GROWSUP */
-       if ((x & Mono_Posix_MmapProts_PROT_NONE) == Mono_Posix_MmapProts_PROT_NONE)
-#ifdef PROT_NONE
-               *r |= PROT_NONE;
-#else /* def PROT_NONE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_NONE */
-       if ((x & Mono_Posix_MmapProts_PROT_READ) == Mono_Posix_MmapProts_PROT_READ)
-#ifdef PROT_READ
-               *r |= PROT_READ;
-#else /* def PROT_READ */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_READ */
-       if ((x & Mono_Posix_MmapProts_PROT_WRITE) == Mono_Posix_MmapProts_PROT_WRITE)
-#ifdef PROT_WRITE
-               *r |= PROT_WRITE;
-#else /* def PROT_WRITE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef PROT_WRITE */
-       return 0;
-}
-
-int Mono_Posix_ToMmapProts (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef PROT_EXEC
-       if ((x & PROT_EXEC) == PROT_EXEC)
-               *r |= Mono_Posix_MmapProts_PROT_EXEC;
-#endif /* ndef PROT_EXEC */
-#ifdef PROT_GROWSDOWN
-       if ((x & PROT_GROWSDOWN) == PROT_GROWSDOWN)
-               *r |= Mono_Posix_MmapProts_PROT_GROWSDOWN;
-#endif /* ndef PROT_GROWSDOWN */
-#ifdef PROT_GROWSUP
-       if ((x & PROT_GROWSUP) == PROT_GROWSUP)
-               *r |= Mono_Posix_MmapProts_PROT_GROWSUP;
-#endif /* ndef PROT_GROWSUP */
-#ifdef PROT_NONE
-       if ((x & PROT_NONE) == PROT_NONE)
-               *r |= Mono_Posix_MmapProts_PROT_NONE;
-#endif /* ndef PROT_NONE */
-#ifdef PROT_READ
-       if ((x & PROT_READ) == PROT_READ)
-               *r |= Mono_Posix_MmapProts_PROT_READ;
-#endif /* ndef PROT_READ */
-#ifdef PROT_WRITE
-       if ((x & PROT_WRITE) == PROT_WRITE)
-               *r |= Mono_Posix_MmapProts_PROT_WRITE;
-#endif /* ndef PROT_WRITE */
-       return 0;
-}
-
-int Mono_Posix_FromMountFlags (guint64 x, guint64 *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_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_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_NODIRATIME) == Mono_Posix_MountFlags_ST_NODIRATIME)
-#ifdef ST_NODIRATIME
-               *r |= ST_NODIRATIME;
-#else /* def ST_NODIRATIME */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ST_NODIRATIME */
-       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_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_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_WRITE) == Mono_Posix_MountFlags_ST_WRITE)
-#ifdef ST_WRITE
-               *r |= ST_WRITE;
-#else /* def ST_WRITE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef ST_WRITE */
-       return 0;
-}
-
-int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#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_MANDLOCK
-       if ((x & ST_MANDLOCK) == ST_MANDLOCK)
-               *r |= Mono_Posix_MountFlags_ST_MANDLOCK;
-#endif /* ndef ST_MANDLOCK */
-#ifdef ST_NOATIME
-       if ((x & ST_NOATIME) == ST_NOATIME)
-               *r |= Mono_Posix_MountFlags_ST_NOATIME;
-#endif /* ndef ST_NOATIME */
-#ifdef ST_NODEV
-       if ((x & ST_NODEV) == ST_NODEV)
-               *r |= Mono_Posix_MountFlags_ST_NODEV;
-#endif /* ndef ST_NODEV */
-#ifdef ST_NODIRATIME
-       if ((x & ST_NODIRATIME) == ST_NODIRATIME)
-               *r |= Mono_Posix_MountFlags_ST_NODIRATIME;
-#endif /* ndef ST_NODIRATIME */
-#ifdef ST_NOSUID
-       if ((x & ST_NOSUID) == ST_NOSUID)
-               *r |= Mono_Posix_MountFlags_ST_NOSUID;
-#endif /* ndef ST_NOSUID */
-#ifdef ST_RDONLY
-       if ((x & ST_RDONLY) == ST_RDONLY)
-               *r |= Mono_Posix_MountFlags_ST_RDONLY;
-#endif /* ndef ST_RDONLY */
-#ifdef ST_SYNCHRONOUS
-       if ((x & ST_SYNCHRONOUS) == ST_SYNCHRONOUS)
-               *r |= Mono_Posix_MountFlags_ST_SYNCHRONOUS;
-#endif /* ndef ST_SYNCHRONOUS */
-#ifdef ST_WRITE
-       if ((x & ST_WRITE) == ST_WRITE)
-               *r |= Mono_Posix_MountFlags_ST_WRITE;
-#endif /* ndef ST_WRITE */
-       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;
-}
-
-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_INVALIDATE) == Mono_Posix_MsyncFlags_MS_INVALIDATE)
-#ifdef MS_INVALIDATE
-               *r |= MS_INVALIDATE;
-#else /* def MS_INVALIDATE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef MS_INVALIDATE */
-       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 */
-       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_INVALIDATE
-       if ((x & MS_INVALIDATE) == MS_INVALIDATE)
-               *r |= Mono_Posix_MsyncFlags_MS_INVALIDATE;
-#endif /* ndef MS_INVALIDATE */
-#ifdef MS_SYNC
-       if ((x & MS_SYNC) == MS_SYNC)
-               *r |= Mono_Posix_MsyncFlags_MS_SYNC;
-#endif /* ndef MS_SYNC */
-       return 0;
-}
-
-int Mono_Posix_FromOpenFlags (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_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_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_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_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_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
-#ifdef O_LARGEFILE
-               *r |= O_LARGEFILE;
-#else /* def O_LARGEFILE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef O_LARGEFILE */
-       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_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_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_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_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_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_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_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
-#ifdef O_WRONLY
-               *r |= O_WRONLY;
-#else /* def O_WRONLY */
-               {errno = EINVAL; return -1;}
-#endif /* ndef O_WRONLY */
-       return 0;
-}
-
-int Mono_Posix_ToOpenFlags (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef O_APPEND
-       if ((x & O_APPEND) == O_APPEND)
-               *r |= Mono_Posix_OpenFlags_O_APPEND;
-#endif /* ndef O_APPEND */
-#ifdef O_ASYNC
-       if ((x & O_ASYNC) == O_ASYNC)
-               *r |= Mono_Posix_OpenFlags_O_ASYNC;
-#endif /* ndef O_ASYNC */
-#ifdef O_CREAT
-       if ((x & O_CREAT) == O_CREAT)
-               *r |= Mono_Posix_OpenFlags_O_CREAT;
-#endif /* ndef O_CREAT */
-#ifdef O_DIRECT
-       if ((x & O_DIRECT) == O_DIRECT)
-               *r |= Mono_Posix_OpenFlags_O_DIRECT;
-#endif /* ndef O_DIRECT */
-#ifdef O_DIRECTORY
-       if ((x & O_DIRECTORY) == O_DIRECTORY)
-               *r |= Mono_Posix_OpenFlags_O_DIRECTORY;
-#endif /* ndef O_DIRECTORY */
-#ifdef O_EXCL
-       if ((x & O_EXCL) == O_EXCL)
-               *r |= Mono_Posix_OpenFlags_O_EXCL;
-#endif /* ndef O_EXCL */
-#ifdef O_LARGEFILE
-       if ((x & O_LARGEFILE) == O_LARGEFILE)
-               *r |= Mono_Posix_OpenFlags_O_LARGEFILE;
-#endif /* ndef O_LARGEFILE */
-#ifdef O_NOCTTY
-       if ((x & O_NOCTTY) == O_NOCTTY)
-               *r |= Mono_Posix_OpenFlags_O_NOCTTY;
-#endif /* ndef O_NOCTTY */
-#ifdef O_NOFOLLOW
-       if ((x & O_NOFOLLOW) == O_NOFOLLOW)
-               *r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
-#endif /* ndef O_NOFOLLOW */
-#ifdef O_NONBLOCK
-       if ((x & O_NONBLOCK) == O_NONBLOCK)
-               *r |= Mono_Posix_OpenFlags_O_NONBLOCK;
-#endif /* ndef O_NONBLOCK */
-#ifdef O_RDONLY
-       if ((x & O_RDONLY) == O_RDONLY)
-               *r |= Mono_Posix_OpenFlags_O_RDONLY;
-#endif /* ndef O_RDONLY */
-#ifdef O_RDWR
-       if ((x & O_RDWR) == O_RDWR)
-               *r |= Mono_Posix_OpenFlags_O_RDWR;
-#endif /* ndef O_RDWR */
-#ifdef O_SYNC
-       if ((x & O_SYNC) == O_SYNC)
-               *r |= Mono_Posix_OpenFlags_O_SYNC;
-#endif /* ndef O_SYNC */
-#ifdef O_TRUNC
-       if ((x & O_TRUNC) == O_TRUNC)
-               *r |= Mono_Posix_OpenFlags_O_TRUNC;
-#endif /* ndef O_TRUNC */
-#ifdef O_WRONLY
-       if ((x & O_WRONLY) == O_WRONLY)
-               *r |= Mono_Posix_OpenFlags_O_WRONLY;
-#endif /* ndef O_WRONLY */
-       return 0;
-}
-
-int Mono_Posix_FromPathconfName (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       if (x == Mono_Posix_PathconfName__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 */
-       if (x == Mono_Posix_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__PC_VDISABLE)
-#ifdef _PC_VDISABLE
-               {*r = _PC_VDISABLE; return 0;}
-#else /* def _PC_VDISABLE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef _PC_VDISABLE */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPathconfName (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef _PC_2_SYMLINKS
-       if (x == _PC_2_SYMLINKS)
-               {*r = Mono_Posix_PathconfName__PC_2_SYMLINKS; return 0;}
-#endif /* ndef _PC_2_SYMLINKS */
-#ifdef _PC_ALLOC_SIZE_MIN
-       if (x == _PC_ALLOC_SIZE_MIN)
-               {*r = Mono_Posix_PathconfName__PC_ALLOC_SIZE_MIN; return 0;}
-#endif /* ndef _PC_ALLOC_SIZE_MIN */
-#ifdef _PC_ASYNC_IO
-       if (x == _PC_ASYNC_IO)
-               {*r = Mono_Posix_PathconfName__PC_ASYNC_IO; return 0;}
-#endif /* ndef _PC_ASYNC_IO */
-#ifdef _PC_CHOWN_RESTRICTED
-       if (x == _PC_CHOWN_RESTRICTED)
-               {*r = Mono_Posix_PathconfName__PC_CHOWN_RESTRICTED; return 0;}
-#endif /* ndef _PC_CHOWN_RESTRICTED */
-#ifdef _PC_FILESIZEBITS
-       if (x == _PC_FILESIZEBITS)
-               {*r = Mono_Posix_PathconfName__PC_FILESIZEBITS; return 0;}
-#endif /* ndef _PC_FILESIZEBITS */
-#ifdef _PC_LINK_MAX
-       if (x == _PC_LINK_MAX)
-               {*r = Mono_Posix_PathconfName__PC_LINK_MAX; return 0;}
-#endif /* ndef _PC_LINK_MAX */
-#ifdef _PC_MAX_CANON
-       if (x == _PC_MAX_CANON)
-               {*r = Mono_Posix_PathconfName__PC_MAX_CANON; return 0;}
-#endif /* ndef _PC_MAX_CANON */
-#ifdef _PC_MAX_INPUT
-       if (x == _PC_MAX_INPUT)
-               {*r = Mono_Posix_PathconfName__PC_MAX_INPUT; return 0;}
-#endif /* ndef _PC_MAX_INPUT */
-#ifdef _PC_NAME_MAX
-       if (x == _PC_NAME_MAX)
-               {*r = Mono_Posix_PathconfName__PC_NAME_MAX; return 0;}
-#endif /* ndef _PC_NAME_MAX */
-#ifdef _PC_NO_TRUNC
-       if (x == _PC_NO_TRUNC)
-               {*r = Mono_Posix_PathconfName__PC_NO_TRUNC; return 0;}
-#endif /* ndef _PC_NO_TRUNC */
-#ifdef _PC_PATH_MAX
-       if (x == _PC_PATH_MAX)
-               {*r = Mono_Posix_PathconfName__PC_PATH_MAX; return 0;}
-#endif /* ndef _PC_PATH_MAX */
-#ifdef _PC_PIPE_BUF
-       if (x == _PC_PIPE_BUF)
-               {*r = Mono_Posix_PathconfName__PC_PIPE_BUF; return 0;}
-#endif /* ndef _PC_PIPE_BUF */
-#ifdef _PC_PRIO_IO
-       if (x == _PC_PRIO_IO)
-               {*r = Mono_Posix_PathconfName__PC_PRIO_IO; return 0;}
-#endif /* ndef _PC_PRIO_IO */
-#ifdef _PC_REC_INCR_XFER_SIZE
-       if (x == _PC_REC_INCR_XFER_SIZE)
-               {*r = Mono_Posix_PathconfName__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_PathconfName__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_PathconfName__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_PathconfName__PC_REC_XFER_ALIGN; return 0;}
-#endif /* ndef _PC_REC_XFER_ALIGN */
-#ifdef _PC_SOCK_MAXBUF
-       if (x == _PC_SOCK_MAXBUF)
-               {*r = Mono_Posix_PathconfName__PC_SOCK_MAXBUF; return 0;}
-#endif /* ndef _PC_SOCK_MAXBUF */
-#ifdef _PC_SYMLINK_MAX
-       if (x == _PC_SYMLINK_MAX)
-               {*r = Mono_Posix_PathconfName__PC_SYMLINK_MAX; return 0;}
-#endif /* ndef _PC_SYMLINK_MAX */
-#ifdef _PC_SYNC_IO
-       if (x == _PC_SYNC_IO)
-               {*r = Mono_Posix_PathconfName__PC_SYNC_IO; return 0;}
-#endif /* ndef _PC_SYNC_IO */
-#ifdef _PC_VDISABLE
-       if (x == _PC_VDISABLE)
-               {*r = Mono_Posix_PathconfName__PC_VDISABLE; return 0;}
-#endif /* ndef _PC_VDISABLE */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromPollEvents (short x, short *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_POLLIN) == Mono_Posix_PollEvents_POLLIN)
-#ifdef POLLIN
-               *r |= POLLIN;
-#else /* def POLLIN */
-               {errno = EINVAL; return -1;}
-#endif /* ndef POLLIN */
-       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_POLLOUT) == Mono_Posix_PollEvents_POLLOUT)
-#ifdef POLLOUT
-               *r |= POLLOUT;
-#else /* def POLLOUT */
-               {errno = EINVAL; return -1;}
-#endif /* ndef POLLOUT */
-       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_POLLRDBAND) == Mono_Posix_PollEvents_POLLRDBAND)
-#ifdef POLLRDBAND
-               *r |= POLLRDBAND;
-#else /* def POLLRDBAND */
-               {errno = EINVAL; return -1;}
-#endif /* ndef POLLRDBAND */
-       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_POLLWRBAND) == Mono_Posix_PollEvents_POLLWRBAND)
-#ifdef POLLWRBAND
-               *r |= POLLWRBAND;
-#else /* def POLLWRBAND */
-               {errno = EINVAL; return -1;}
-#endif /* ndef POLLWRBAND */
-       if ((x & Mono_Posix_PollEvents_POLLWRNORM) == Mono_Posix_PollEvents_POLLWRNORM)
-#ifdef POLLWRNORM
-               *r |= POLLWRNORM;
-#else /* def POLLWRNORM */
-               {errno = EINVAL; return -1;}
-#endif /* ndef POLLWRNORM */
-       return 0;
-}
-
-int Mono_Posix_ToPollEvents (short x, short *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#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 POLLIN
-       if ((x & POLLIN) == POLLIN)
-               *r |= Mono_Posix_PollEvents_POLLIN;
-#endif /* ndef POLLIN */
-#ifdef POLLNVAL
-       if ((x & POLLNVAL) == POLLNVAL)
-               *r |= Mono_Posix_PollEvents_POLLNVAL;
-#endif /* ndef POLLNVAL */
-#ifdef POLLOUT
-       if ((x & POLLOUT) == POLLOUT)
-               *r |= Mono_Posix_PollEvents_POLLOUT;
-#endif /* ndef POLLOUT */
-#ifdef POLLPRI
-       if ((x & POLLPRI) == POLLPRI)
-               *r |= Mono_Posix_PollEvents_POLLPRI;
-#endif /* ndef POLLPRI */
-#ifdef POLLRDBAND
-       if ((x & POLLRDBAND) == POLLRDBAND)
-               *r |= Mono_Posix_PollEvents_POLLRDBAND;
-#endif /* ndef POLLRDBAND */
-#ifdef POLLRDNORM
-       if ((x & POLLRDNORM) == POLLRDNORM)
-               *r |= Mono_Posix_PollEvents_POLLRDNORM;
-#endif /* ndef POLLRDNORM */
-#ifdef POLLWRBAND
-       if ((x & POLLWRBAND) == POLLWRBAND)
-               *r |= Mono_Posix_PollEvents_POLLWRBAND;
-#endif /* ndef POLLWRBAND */
-#ifdef POLLWRNORM
-       if ((x & POLLWRNORM) == POLLWRNORM)
-               *r |= Mono_Posix_PollEvents_POLLWRNORM;
-#endif /* ndef POLLWRNORM */
-       return 0;
-}
-
-int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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 */
-       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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#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 */
-#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 */
-       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_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 */
-       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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef POSIX_MADV_DONTNEED
-       if (x == POSIX_MADV_DONTNEED)
-               {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
-#endif /* ndef POSIX_MADV_DONTNEED */
-#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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSeekFlags (short x, short *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_XTND)
-#ifdef L_XTND
-               {*r = L_XTND; return 0;}
-#else /* def L_XTND */
-               {errno = EINVAL; return -1;}
-#endif /* ndef L_XTND */
-       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_SEEK_SET)
-#ifdef SEEK_SET
-               {*r = SEEK_SET; return 0;}
-#else /* def SEEK_SET */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_SET */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSeekFlags (short x, short *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef L_INCR
-       if (x == L_INCR)
-               {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
-#endif /* ndef L_INCR */
-#ifdef L_SET
-       if (x == L_SET)
-               {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
-#endif /* ndef L_SET */
-#ifdef L_XTND
-       if (x == L_XTND)
-               {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
-#endif /* ndef L_XTND */
-#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 SEEK_SET
-       if (x == SEEK_SET)
-               {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
-#endif /* ndef SEEK_SET */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSignum (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_SIGALRM)
-#ifdef SIGALRM
-               {*r = SIGALRM; return 0;}
-#else /* def SIGALRM */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGALRM */
-       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_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_SIGFPE)
-#ifdef SIGFPE
-               {*r = SIGFPE; return 0;}
-#else /* def SIGFPE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGFPE */
-       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_SIGILL)
-#ifdef SIGILL
-               {*r = SIGILL; return 0;}
-#else /* def SIGILL */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGILL */
-       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_SIGIO)
-#ifdef SIGIO
-               {*r = SIGIO; return 0;}
-#else /* def SIGIO */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGIO */
-       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_SIGKILL)
-#ifdef SIGKILL
-               {*r = SIGKILL; return 0;}
-#else /* def SIGKILL */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGKILL */
-       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_SIGPOLL)
-#ifdef SIGPOLL
-               {*r = SIGPOLL; return 0;}
-#else /* def SIGPOLL */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGPOLL */
-       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_SIGPWR)
-#ifdef SIGPWR
-               {*r = SIGPWR; return 0;}
-#else /* def SIGPWR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGPWR */
-       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_SIGSEGV)
-#ifdef SIGSEGV
-               {*r = SIGSEGV; return 0;}
-#else /* def SIGSEGV */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGSEGV */
-       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_SIGSTOP)
-#ifdef SIGSTOP
-               {*r = SIGSTOP; return 0;}
-#else /* def SIGSTOP */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGSTOP */
-       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_SIGTERM)
-#ifdef SIGTERM
-               {*r = SIGTERM; return 0;}
-#else /* def SIGTERM */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGTERM */
-       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_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_SIGUNUSED)
-#ifdef SIGUNUSED
-               {*r = SIGUNUSED; return 0;}
-#else /* def SIGUNUSED */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGUNUSED */
-       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_SIGUSR1)
-#ifdef SIGUSR1
-               {*r = SIGUSR1; return 0;}
-#else /* def SIGUSR1 */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGUSR1 */
-       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_SIGVTALRM)
-#ifdef SIGVTALRM
-               {*r = SIGVTALRM; return 0;}
-#else /* def SIGVTALRM */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SIGVTALRM */
-       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_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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSignum (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef SIGABRT
-       if (x == SIGABRT)
-               {*r = Mono_Posix_Signum_SIGABRT; return 0;}
-#endif /* ndef SIGABRT */
-#ifdef SIGALRM
-       if (x == SIGALRM)
-               {*r = Mono_Posix_Signum_SIGALRM; return 0;}
-#endif /* ndef SIGALRM */
-#ifdef SIGBUS
-       if (x == SIGBUS)
-               {*r = Mono_Posix_Signum_SIGBUS; return 0;}
-#endif /* ndef SIGBUS */
-#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 SIGFPE
-       if (x == SIGFPE)
-               {*r = Mono_Posix_Signum_SIGFPE; return 0;}
-#endif /* ndef SIGFPE */
-#ifdef SIGHUP
-       if (x == SIGHUP)
-               {*r = Mono_Posix_Signum_SIGHUP; return 0;}
-#endif /* ndef SIGHUP */
-#ifdef SIGILL
-       if (x == SIGILL)
-               {*r = Mono_Posix_Signum_SIGILL; return 0;}
-#endif /* ndef SIGILL */
-#ifdef SIGINT
-       if (x == SIGINT)
-               {*r = Mono_Posix_Signum_SIGINT; return 0;}
-#endif /* ndef SIGINT */
-#ifdef SIGIO
-       if (x == SIGIO)
-               {*r = Mono_Posix_Signum_SIGIO; return 0;}
-#endif /* ndef SIGIO */
-#ifdef SIGIOT
-       if (x == SIGIOT)
-               {*r = Mono_Posix_Signum_SIGIOT; return 0;}
-#endif /* ndef SIGIOT */
-#ifdef SIGKILL
-       if (x == SIGKILL)
-               {*r = Mono_Posix_Signum_SIGKILL; return 0;}
-#endif /* ndef SIGKILL */
-#ifdef SIGPIPE
-       if (x == SIGPIPE)
-               {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
-#endif /* ndef SIGPIPE */
-#ifdef SIGPOLL
-       if (x == SIGPOLL)
-               {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
-#endif /* ndef SIGPOLL */
-#ifdef SIGPROF
-       if (x == SIGPROF)
-               {*r = Mono_Posix_Signum_SIGPROF; return 0;}
-#endif /* ndef SIGPROF */
-#ifdef SIGPWR
-       if (x == SIGPWR)
-               {*r = Mono_Posix_Signum_SIGPWR; return 0;}
-#endif /* ndef SIGPWR */
-#ifdef SIGQUIT
-       if (x == SIGQUIT)
-               {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
-#endif /* ndef SIGQUIT */
-#ifdef SIGSEGV
-       if (x == SIGSEGV)
-               {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
-#endif /* ndef SIGSEGV */
-#ifdef SIGSTKFLT
-       if (x == SIGSTKFLT)
-               {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
-#endif /* ndef SIGSTKFLT */
-#ifdef SIGSTOP
-       if (x == SIGSTOP)
-               {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
-#endif /* ndef SIGSTOP */
-#ifdef SIGSYS
-       if (x == SIGSYS)
-               {*r = Mono_Posix_Signum_SIGSYS; return 0;}
-#endif /* ndef SIGSYS */
-#ifdef SIGTERM
-       if (x == SIGTERM)
-               {*r = Mono_Posix_Signum_SIGTERM; return 0;}
-#endif /* ndef SIGTERM */
-#ifdef SIGTRAP
-       if (x == SIGTRAP)
-               {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
-#endif /* ndef SIGTRAP */
-#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 SIGUNUSED
-       if (x == SIGUNUSED)
-               {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
-#endif /* ndef SIGUNUSED */
-#ifdef SIGURG
-       if (x == SIGURG)
-               {*r = Mono_Posix_Signum_SIGURG; return 0;}
-#endif /* ndef SIGURG */
-#ifdef SIGUSR1
-       if (x == SIGUSR1)
-               {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
-#endif /* ndef SIGUSR1 */
-#ifdef SIGUSR2
-       if (x == SIGUSR2)
-               {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
-#endif /* ndef SIGUSR2 */
-#ifdef SIGVTALRM
-       if (x == SIGVTALRM)
-               {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
-#endif /* ndef SIGVTALRM */
-#ifdef SIGWINCH
-       if (x == SIGWINCH)
-               {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
-#endif /* ndef SIGWINCH */
-#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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSysconfName (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       if (x == Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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 */
-       if (x == Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSysconfName (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef _SC_2_CHAR_TERM
-       if (x == _SC_2_CHAR_TERM)
-               {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
-#endif /* ndef _SC_2_CHAR_TERM */
-#ifdef _SC_2_C_BIND
-       if (x == _SC_2_C_BIND)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_2_C_DEV; return 0;}
-#endif /* ndef _SC_2_C_DEV */
-#ifdef _SC_2_C_VERSION
-       if (x == _SC_2_C_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
-#endif /* ndef _SC_2_C_VERSION */
-#ifdef _SC_2_FORT_DEV
-       if (x == _SC_2_FORT_DEV)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_2_FORT_RUN; return 0;}
-#endif /* ndef _SC_2_FORT_RUN */
-#ifdef _SC_2_LOCALEDEF
-       if (x == _SC_2_LOCALEDEF)
-               {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
-#endif /* ndef _SC_2_LOCALEDEF */
-#ifdef _SC_2_PBS
-       if (x == _SC_2_PBS)
-               {*r = Mono_Posix_SysconfName__SC_2_PBS; return 0;}
-#endif /* ndef _SC_2_PBS */
-#ifdef _SC_2_PBS_ACCOUNTING
-       if (x == _SC_2_PBS_ACCOUNTING)
-               {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
-#endif /* ndef _SC_2_PBS_ACCOUNTING */
-#ifdef _SC_2_PBS_CHECKPOINT
-       if (x == _SC_2_PBS_CHECKPOINT)
-               {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
-#endif /* ndef _SC_2_PBS_CHECKPOINT */
-#ifdef _SC_2_PBS_LOCATE
-       if (x == _SC_2_PBS_LOCATE)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__SC_2_PBS_TRACK; return 0;}
-#endif /* ndef _SC_2_PBS_TRACK */
-#ifdef _SC_2_SW_DEV
-       if (x == _SC_2_SW_DEV)
-               {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
-#endif /* ndef _SC_2_SW_DEV */
-#ifdef _SC_2_UPE
-       if (x == _SC_2_UPE)
-               {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
-#endif /* ndef _SC_2_UPE */
-#ifdef _SC_2_VERSION
-       if (x == _SC_2_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
-#endif /* ndef _SC_2_VERSION */
-#ifdef _SC_ADVISORY_INFO
-       if (x == _SC_ADVISORY_INFO)
-               {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
-#endif /* ndef _SC_ADVISORY_INFO */
-#ifdef _SC_AIO_LISTIO_MAX
-       if (x == _SC_AIO_LISTIO_MAX)
-               {*r = Mono_Posix_SysconfName__SC_AIO_LISTIO_MAX; return 0;}
-#endif /* ndef _SC_AIO_LISTIO_MAX */
-#ifdef _SC_AIO_MAX
-       if (x == _SC_AIO_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
-#endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
-#ifdef _SC_ARG_MAX
-       if (x == _SC_ARG_MAX)
-               {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
-#endif /* ndef _SC_ARG_MAX */
-#ifdef _SC_ASYNCHRONOUS_IO
-       if (x == _SC_ASYNCHRONOUS_IO)
-               {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
-#endif /* ndef _SC_ASYNCHRONOUS_IO */
-#ifdef _SC_ATEXIT_MAX
-       if (x == _SC_ATEXIT_MAX)
-               {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
-#endif /* ndef _SC_ATEXIT_MAX */
-#ifdef _SC_AVPHYS_PAGES
-       if (x == _SC_AVPHYS_PAGES)
-               {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
-#endif /* ndef _SC_AVPHYS_PAGES */
-#ifdef _SC_BARRIERS
-       if (x == _SC_BARRIERS)
-               {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
-#endif /* ndef _SC_BARRIERS */
-#ifdef _SC_BASE
-       if (x == _SC_BASE)
-               {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
-#endif /* ndef _SC_BASE */
-#ifdef _SC_BC_BASE_MAX
-       if (x == _SC_BC_BASE_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__SC_BC_STRING_MAX; return 0;}
-#endif /* ndef _SC_BC_STRING_MAX */
-#ifdef _SC_CHARCLASS_NAME_MAX
-       if (x == _SC_CHARCLASS_NAME_MAX)
-               {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
-#endif /* ndef _SC_CHARCLASS_NAME_MAX */
-#ifdef _SC_CHAR_BIT
-       if (x == _SC_CHAR_BIT)
-               {*r = Mono_Posix_SysconfName__SC_CHAR_BIT; return 0;}
-#endif /* ndef _SC_CHAR_BIT */
-#ifdef _SC_CHAR_MAX
-       if (x == _SC_CHAR_MAX)
-               {*r = Mono_Posix_SysconfName__SC_CHAR_MAX; return 0;}
-#endif /* ndef _SC_CHAR_MAX */
-#ifdef _SC_CHAR_MIN
-       if (x == _SC_CHAR_MIN)
-               {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
-#endif /* ndef _SC_CHAR_MIN */
-#ifdef _SC_CHILD_MAX
-       if (x == _SC_CHILD_MAX)
-               {*r = Mono_Posix_SysconfName__SC_CHILD_MAX; return 0;}
-#endif /* ndef _SC_CHILD_MAX */
-#ifdef _SC_CLK_TCK
-       if (x == _SC_CLK_TCK)
-               {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
-#endif /* ndef _SC_CLK_TCK */
-#ifdef _SC_CLOCK_SELECTION
-       if (x == _SC_CLOCK_SELECTION)
-               {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
-#endif /* ndef _SC_CLOCK_SELECTION */
-#ifdef _SC_COLL_WEIGHTS_MAX
-       if (x == _SC_COLL_WEIGHTS_MAX)
-               {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
-#endif /* ndef _SC_COLL_WEIGHTS_MAX */
-#ifdef _SC_CPUTIME
-       if (x == _SC_CPUTIME)
-               {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
-#endif /* ndef _SC_CPUTIME */
-#ifdef _SC_C_LANG_SUPPORT
-       if (x == _SC_C_LANG_SUPPORT)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
-#endif /* ndef _SC_C_LANG_SUPPORT_R */
-#ifdef _SC_DELAYTIMER_MAX
-       if (x == _SC_DELAYTIMER_MAX)
-               {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
-#endif /* ndef _SC_DELAYTIMER_MAX */
-#ifdef _SC_DEVICE_IO
-       if (x == _SC_DEVICE_IO)
-               {*r = Mono_Posix_SysconfName__SC_DEVICE_IO; return 0;}
-#endif /* ndef _SC_DEVICE_IO */
-#ifdef _SC_DEVICE_SPECIFIC
-       if (x == _SC_DEVICE_SPECIFIC)
-               {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC; return 0;}
-#endif /* ndef _SC_DEVICE_SPECIFIC */
-#ifdef _SC_DEVICE_SPECIFIC_R
-       if (x == _SC_DEVICE_SPECIFIC_R)
-               {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
-#endif /* ndef _SC_DEVICE_SPECIFIC_R */
-#ifdef _SC_EQUIV_CLASS_MAX
-       if (x == _SC_EQUIV_CLASS_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_EXPR_NEST_MAX; return 0;}
-#endif /* ndef _SC_EXPR_NEST_MAX */
-#ifdef _SC_FD_MGMT
-       if (x == _SC_FD_MGMT)
-               {*r = Mono_Posix_SysconfName__SC_FD_MGMT; return 0;}
-#endif /* ndef _SC_FD_MGMT */
-#ifdef _SC_FIFO
-       if (x == _SC_FIFO)
-               {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
-#endif /* ndef _SC_FIFO */
-#ifdef _SC_FILE_ATTRIBUTES
-       if (x == _SC_FILE_ATTRIBUTES)
-               {*r = Mono_Posix_SysconfName__SC_FILE_ATTRIBUTES; return 0;}
-#endif /* ndef _SC_FILE_ATTRIBUTES */
-#ifdef _SC_FILE_LOCKING
-       if (x == _SC_FILE_LOCKING)
-               {*r = Mono_Posix_SysconfName__SC_FILE_LOCKING; return 0;}
-#endif /* ndef _SC_FILE_LOCKING */
-#ifdef _SC_FILE_SYSTEM
-       if (x == _SC_FILE_SYSTEM)
-               {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
-#endif /* ndef _SC_FILE_SYSTEM */
-#ifdef _SC_FSYNC
-       if (x == _SC_FSYNC)
-               {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
-#endif /* ndef _SC_FSYNC */
-#ifdef _SC_GETGR_R_SIZE_MAX
-       if (x == _SC_GETGR_R_SIZE_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
-#endif /* ndef _SC_GETPW_R_SIZE_MAX */
-#ifdef _SC_HOST_NAME_MAX
-       if (x == _SC_HOST_NAME_MAX)
-               {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
-#endif /* ndef _SC_HOST_NAME_MAX */
-#ifdef _SC_INT_MAX
-       if (x == _SC_INT_MAX)
-               {*r = Mono_Posix_SysconfName__SC_INT_MAX; return 0;}
-#endif /* ndef _SC_INT_MAX */
-#ifdef _SC_INT_MIN
-       if (x == _SC_INT_MIN)
-               {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
-#endif /* ndef _SC_INT_MIN */
-#ifdef _SC_IOV_MAX
-       if (x == _SC_IOV_MAX)
-               {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
-#endif /* ndef _SC_IOV_MAX */
-#ifdef _SC_JOB_CONTROL
-       if (x == _SC_JOB_CONTROL)
-               {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
-#endif /* ndef _SC_JOB_CONTROL */
-#ifdef _SC_LEVEL1_DCACHE_ASSOC
-       if (x == _SC_LEVEL1_DCACHE_ASSOC)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
-#endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
-#ifdef _SC_LEVEL1_DCACHE_SIZE
-       if (x == _SC_LEVEL1_DCACHE_SIZE)
-               {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
-#endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
-#ifdef _SC_LEVEL1_ICACHE_ASSOC
-       if (x == _SC_LEVEL1_ICACHE_ASSOC)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
-#endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
-#ifdef _SC_LEVEL1_ICACHE_SIZE
-       if (x == _SC_LEVEL1_ICACHE_SIZE)
-               {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
-#endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
-#ifdef _SC_LEVEL2_CACHE_ASSOC
-       if (x == _SC_LEVEL2_CACHE_ASSOC)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
-#endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
-#ifdef _SC_LEVEL2_CACHE_SIZE
-       if (x == _SC_LEVEL2_CACHE_SIZE)
-               {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
-#endif /* ndef _SC_LEVEL2_CACHE_SIZE */
-#ifdef _SC_LEVEL3_CACHE_ASSOC
-       if (x == _SC_LEVEL3_CACHE_ASSOC)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
-#endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
-#ifdef _SC_LEVEL3_CACHE_SIZE
-       if (x == _SC_LEVEL3_CACHE_SIZE)
-               {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
-#endif /* ndef _SC_LEVEL3_CACHE_SIZE */
-#ifdef _SC_LEVEL4_CACHE_ASSOC
-       if (x == _SC_LEVEL4_CACHE_ASSOC)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
-#endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
-#ifdef _SC_LEVEL4_CACHE_SIZE
-       if (x == _SC_LEVEL4_CACHE_SIZE)
-               {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
-#endif /* ndef _SC_LEVEL4_CACHE_SIZE */
-#ifdef _SC_LINE_MAX
-       if (x == _SC_LINE_MAX)
-               {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
-#endif /* ndef _SC_LINE_MAX */
-#ifdef _SC_LOGIN_NAME_MAX
-       if (x == _SC_LOGIN_NAME_MAX)
-               {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
-#endif /* ndef _SC_LOGIN_NAME_MAX */
-#ifdef _SC_LONG_BIT
-       if (x == _SC_LONG_BIT)
-               {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
-#endif /* ndef _SC_LONG_BIT */
-#ifdef _SC_MAPPED_FILES
-       if (x == _SC_MAPPED_FILES)
-               {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
-#endif /* ndef _SC_MAPPED_FILES */
-#ifdef _SC_MB_LEN_MAX
-       if (x == _SC_MB_LEN_MAX)
-               {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
-#endif /* ndef _SC_MB_LEN_MAX */
-#ifdef _SC_MEMLOCK
-       if (x == _SC_MEMLOCK)
-               {*r = Mono_Posix_SysconfName__SC_MEMLOCK; return 0;}
-#endif /* ndef _SC_MEMLOCK */
-#ifdef _SC_MEMLOCK_RANGE
-       if (x == _SC_MEMLOCK_RANGE)
-               {*r = Mono_Posix_SysconfName__SC_MEMLOCK_RANGE; return 0;}
-#endif /* ndef _SC_MEMLOCK_RANGE */
-#ifdef _SC_MEMORY_PROTECTION
-       if (x == _SC_MEMORY_PROTECTION)
-               {*r = Mono_Posix_SysconfName__SC_MEMORY_PROTECTION; return 0;}
-#endif /* ndef _SC_MEMORY_PROTECTION */
-#ifdef _SC_MESSAGE_PASSING
-       if (x == _SC_MESSAGE_PASSING)
-               {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
-#endif /* ndef _SC_MESSAGE_PASSING */
-#ifdef _SC_MONOTONIC_CLOCK
-       if (x == _SC_MONOTONIC_CLOCK)
-               {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
-#endif /* ndef _SC_MONOTONIC_CLOCK */
-#ifdef _SC_MQ_OPEN_MAX
-       if (x == _SC_MQ_OPEN_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_MQ_PRIO_MAX; return 0;}
-#endif /* ndef _SC_MQ_PRIO_MAX */
-#ifdef _SC_MULTI_PROCESS
-       if (x == _SC_MULTI_PROCESS)
-               {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
-#endif /* ndef _SC_MULTI_PROCESS */
-#ifdef _SC_NETWORKING
-       if (x == _SC_NETWORKING)
-               {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
-#endif /* ndef _SC_NETWORKING */
-#ifdef _SC_NGROUPS_MAX
-       if (x == _SC_NGROUPS_MAX)
-               {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
-#endif /* ndef _SC_NGROUPS_MAX */
-#ifdef _SC_NL_ARGMAX
-       if (x == _SC_NL_ARGMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_ARGMAX; return 0;}
-#endif /* ndef _SC_NL_ARGMAX */
-#ifdef _SC_NL_LANGMAX
-       if (x == _SC_NL_LANGMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_LANGMAX; return 0;}
-#endif /* ndef _SC_NL_LANGMAX */
-#ifdef _SC_NL_MSGMAX
-       if (x == _SC_NL_MSGMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_MSGMAX; return 0;}
-#endif /* ndef _SC_NL_MSGMAX */
-#ifdef _SC_NL_NMAX
-       if (x == _SC_NL_NMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_NMAX; return 0;}
-#endif /* ndef _SC_NL_NMAX */
-#ifdef _SC_NL_SETMAX
-       if (x == _SC_NL_SETMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_SETMAX; return 0;}
-#endif /* ndef _SC_NL_SETMAX */
-#ifdef _SC_NL_TEXTMAX
-       if (x == _SC_NL_TEXTMAX)
-               {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
-#endif /* ndef _SC_NL_TEXTMAX */
-#ifdef _SC_NPROCESSORS_CONF
-       if (x == _SC_NPROCESSORS_CONF)
-               {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_CONF; return 0;}
-#endif /* ndef _SC_NPROCESSORS_CONF */
-#ifdef _SC_NPROCESSORS_ONLN
-       if (x == _SC_NPROCESSORS_ONLN)
-               {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
-#endif /* ndef _SC_NPROCESSORS_ONLN */
-#ifdef _SC_NZERO
-       if (x == _SC_NZERO)
-               {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
-#endif /* ndef _SC_NZERO */
-#ifdef _SC_OPEN_MAX
-       if (x == _SC_OPEN_MAX)
-               {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
-#endif /* ndef _SC_OPEN_MAX */
-#ifdef _SC_PAGESIZE
-       if (x == _SC_PAGESIZE)
-               {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
-#endif /* ndef _SC_PAGESIZE */
-#ifdef _SC_PASS_MAX
-       if (x == _SC_PASS_MAX)
-               {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
-#endif /* ndef _SC_PASS_MAX */
-#ifdef _SC_PHYS_PAGES
-       if (x == _SC_PHYS_PAGES)
-               {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
-#endif /* ndef _SC_PHYS_PAGES */
-#ifdef _SC_PII
-       if (x == _SC_PII)
-               {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
-#endif /* ndef _SC_PII */
-#ifdef _SC_PII_INTERNET
-       if (x == _SC_PII_INTERNET)
-               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
-#endif /* ndef _SC_PII_INTERNET */
-#ifdef _SC_PII_INTERNET_DGRAM
-       if (x == _SC_PII_INTERNET_DGRAM)
-               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
-#endif /* ndef _SC_PII_INTERNET_DGRAM */
-#ifdef _SC_PII_INTERNET_STREAM
-       if (x == _SC_PII_INTERNET_STREAM)
-               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
-#endif /* ndef _SC_PII_INTERNET_STREAM */
-#ifdef _SC_PII_OSI
-       if (x == _SC_PII_OSI)
-               {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
-#endif /* ndef _SC_PII_OSI */
-#ifdef _SC_PII_OSI_CLTS
-       if (x == _SC_PII_OSI_CLTS)
-               {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
-#endif /* ndef _SC_PII_OSI_CLTS */
-#ifdef _SC_PII_OSI_COTS
-       if (x == _SC_PII_OSI_COTS)
-               {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
-#endif /* ndef _SC_PII_OSI_COTS */
-#ifdef _SC_PII_OSI_M
-       if (x == _SC_PII_OSI_M)
-               {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
-#endif /* ndef _SC_PII_OSI_M */
-#ifdef _SC_PII_SOCKET
-       if (x == _SC_PII_SOCKET)
-               {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
-#endif /* ndef _SC_PII_SOCKET */
-#ifdef _SC_PII_XTI
-       if (x == _SC_PII_XTI)
-               {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
-#endif /* ndef _SC_PII_XTI */
-#ifdef _SC_PIPE
-       if (x == _SC_PIPE)
-               {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
-#endif /* ndef _SC_PIPE */
-#ifdef _SC_POLL
-       if (x == _SC_POLL)
-               {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
-#endif /* ndef _SC_POLL */
-#ifdef _SC_PRIORITIZED_IO
-       if (x == _SC_PRIORITIZED_IO)
-               {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
-#endif /* ndef _SC_PRIORITIZED_IO */
-#ifdef _SC_PRIORITY_SCHEDULING
-       if (x == _SC_PRIORITY_SCHEDULING)
-               {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
-#endif /* ndef _SC_PRIORITY_SCHEDULING */
-#ifdef _SC_READER_WRITER_LOCKS
-       if (x == _SC_READER_WRITER_LOCKS)
-               {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
-#endif /* ndef _SC_READER_WRITER_LOCKS */
-#ifdef _SC_REALTIME_SIGNALS
-       if (x == _SC_REALTIME_SIGNALS)
-               {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
-#endif /* ndef _SC_REALTIME_SIGNALS */
-#ifdef _SC_REGEXP
-       if (x == _SC_REGEXP)
-               {*r = Mono_Posix_SysconfName__SC_REGEXP; return 0;}
-#endif /* ndef _SC_REGEXP */
-#ifdef _SC_REGEX_VERSION
-       if (x == _SC_REGEX_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
-#endif /* ndef _SC_REGEX_VERSION */
-#ifdef _SC_RE_DUP_MAX
-       if (x == _SC_RE_DUP_MAX)
-               {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
-#endif /* ndef _SC_RE_DUP_MAX */
-#ifdef _SC_RTSIG_MAX
-       if (x == _SC_RTSIG_MAX)
-               {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
-#endif /* ndef _SC_RTSIG_MAX */
-#ifdef _SC_SAVED_IDS
-       if (x == _SC_SAVED_IDS)
-               {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
-#endif /* ndef _SC_SAVED_IDS */
-#ifdef _SC_SCHAR_MAX
-       if (x == _SC_SCHAR_MAX)
-               {*r = Mono_Posix_SysconfName__SC_SCHAR_MAX; return 0;}
-#endif /* ndef _SC_SCHAR_MAX */
-#ifdef _SC_SCHAR_MIN
-       if (x == _SC_SCHAR_MIN)
-               {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
-#endif /* ndef _SC_SCHAR_MIN */
-#ifdef _SC_SELECT
-       if (x == _SC_SELECT)
-               {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
-#endif /* ndef _SC_SELECT */
-#ifdef _SC_SEMAPHORES
-       if (x == _SC_SEMAPHORES)
-               {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
-#endif /* ndef _SC_SEMAPHORES */
-#ifdef _SC_SEM_NSEMS_MAX
-       if (x == _SC_SEM_NSEMS_MAX)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_SEM_VALUE_MAX; return 0;}
-#endif /* ndef _SC_SEM_VALUE_MAX */
-#ifdef _SC_SHARED_MEMORY_OBJECTS
-       if (x == _SC_SHARED_MEMORY_OBJECTS)
-               {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
-#endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
-#ifdef _SC_SHELL
-       if (x == _SC_SHELL)
-               {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
-#endif /* ndef _SC_SHELL */
-#ifdef _SC_SHRT_MAX
-       if (x == _SC_SHRT_MAX)
-               {*r = Mono_Posix_SysconfName__SC_SHRT_MAX; return 0;}
-#endif /* ndef _SC_SHRT_MAX */
-#ifdef _SC_SHRT_MIN
-       if (x == _SC_SHRT_MIN)
-               {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
-#endif /* ndef _SC_SHRT_MIN */
-#ifdef _SC_SIGNALS
-       if (x == _SC_SIGNALS)
-               {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
-#endif /* ndef _SC_SIGNALS */
-#ifdef _SC_SIGQUEUE_MAX
-       if (x == _SC_SIGQUEUE_MAX)
-               {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
-#endif /* ndef _SC_SIGQUEUE_MAX */
-#ifdef _SC_SINGLE_PROCESS
-       if (x == _SC_SINGLE_PROCESS)
-               {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
-#endif /* ndef _SC_SINGLE_PROCESS */
-#ifdef _SC_SPAWN
-       if (x == _SC_SPAWN)
-               {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
-#endif /* ndef _SC_SPAWN */
-#ifdef _SC_SPIN_LOCKS
-       if (x == _SC_SPIN_LOCKS)
-               {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
-#endif /* ndef _SC_SPIN_LOCKS */
-#ifdef _SC_SPORADIC_SERVER
-       if (x == _SC_SPORADIC_SERVER)
-               {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
-#endif /* ndef _SC_SPORADIC_SERVER */
-#ifdef _SC_SSIZE_MAX
-       if (x == _SC_SSIZE_MAX)
-               {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
-#endif /* ndef _SC_SSIZE_MAX */
-#ifdef _SC_STREAMS
-       if (x == _SC_STREAMS)
-               {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
-#endif /* ndef _SC_STREAMS */
-#ifdef _SC_STREAM_MAX
-       if (x == _SC_STREAM_MAX)
-               {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
-#endif /* ndef _SC_STREAM_MAX */
-#ifdef _SC_SYMLOOP_MAX
-       if (x == _SC_SYMLOOP_MAX)
-               {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
-#endif /* ndef _SC_SYMLOOP_MAX */
-#ifdef _SC_SYNCHRONIZED_IO
-       if (x == _SC_SYNCHRONIZED_IO)
-               {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
-#endif /* ndef _SC_SYNCHRONIZED_IO */
-#ifdef _SC_SYSTEM_DATABASE
-       if (x == _SC_SYSTEM_DATABASE)
-               {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE; return 0;}
-#endif /* ndef _SC_SYSTEM_DATABASE */
-#ifdef _SC_SYSTEM_DATABASE_R
-       if (x == _SC_SYSTEM_DATABASE_R)
-               {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
-#endif /* ndef _SC_SYSTEM_DATABASE_R */
-#ifdef _SC_THREADS
-       if (x == _SC_THREADS)
-               {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
-#endif /* ndef _SC_THREADS */
-#ifdef _SC_THREAD_ATTR_STACKADDR
-       if (x == _SC_THREAD_ATTR_STACKADDR)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
-#endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
-#ifdef _SC_THREAD_CPUTIME
-       if (x == _SC_THREAD_CPUTIME)
-               {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
-#endif /* ndef _SC_THREAD_CPUTIME */
-#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
-       if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
-#endif /* ndef _SC_THREAD_KEYS_MAX */
-#ifdef _SC_THREAD_PRIORITY_SCHEDULING
-       if (x == _SC_THREAD_PRIORITY_SCHEDULING)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
-#endif /* ndef _SC_THREAD_PROCESS_SHARED */
-#ifdef _SC_THREAD_SAFE_FUNCTIONS
-       if (x == _SC_THREAD_SAFE_FUNCTIONS)
-               {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
-#endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
-#ifdef _SC_THREAD_SPORADIC_SERVER
-       if (x == _SC_THREAD_SPORADIC_SERVER)
-               {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
-#endif /* ndef _SC_THREAD_SPORADIC_SERVER */
-#ifdef _SC_THREAD_STACK_MIN
-       if (x == _SC_THREAD_STACK_MIN)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
-#endif /* ndef _SC_THREAD_THREADS_MAX */
-#ifdef _SC_TIMEOUTS
-       if (x == _SC_TIMEOUTS)
-               {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
-#endif /* ndef _SC_TIMEOUTS */
-#ifdef _SC_TIMERS
-       if (x == _SC_TIMERS)
-               {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
-#endif /* ndef _SC_TIMERS */
-#ifdef _SC_TIMER_MAX
-       if (x == _SC_TIMER_MAX)
-               {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
-#endif /* ndef _SC_TIMER_MAX */
-#ifdef _SC_TRACE
-       if (x == _SC_TRACE)
-               {*r = Mono_Posix_SysconfName__SC_TRACE; return 0;}
-#endif /* ndef _SC_TRACE */
-#ifdef _SC_TRACE_EVENT_FILTER
-       if (x == _SC_TRACE_EVENT_FILTER)
-               {*r = Mono_Posix_SysconfName__SC_TRACE_EVENT_FILTER; return 0;}
-#endif /* ndef _SC_TRACE_EVENT_FILTER */
-#ifdef _SC_TRACE_INHERIT
-       if (x == _SC_TRACE_INHERIT)
-               {*r = Mono_Posix_SysconfName__SC_TRACE_INHERIT; return 0;}
-#endif /* ndef _SC_TRACE_INHERIT */
-#ifdef _SC_TRACE_LOG
-       if (x == _SC_TRACE_LOG)
-               {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
-#endif /* ndef _SC_TRACE_LOG */
-#ifdef _SC_TTY_NAME_MAX
-       if (x == _SC_TTY_NAME_MAX)
-               {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
-#endif /* ndef _SC_TTY_NAME_MAX */
-#ifdef _SC_TYPED_MEMORY_OBJECTS
-       if (x == _SC_TYPED_MEMORY_OBJECTS)
-               {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
-#endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
-#ifdef _SC_TZNAME_MAX
-       if (x == _SC_TZNAME_MAX)
-               {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
-#endif /* ndef _SC_TZNAME_MAX */
-#ifdef _SC_T_IOV_MAX
-       if (x == _SC_T_IOV_MAX)
-               {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
-#endif /* ndef _SC_T_IOV_MAX */
-#ifdef _SC_UCHAR_MAX
-       if (x == _SC_UCHAR_MAX)
-               {*r = Mono_Posix_SysconfName__SC_UCHAR_MAX; return 0;}
-#endif /* ndef _SC_UCHAR_MAX */
-#ifdef _SC_UINT_MAX
-       if (x == _SC_UINT_MAX)
-               {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
-#endif /* ndef _SC_UINT_MAX */
-#ifdef _SC_UIO_MAXIOV
-       if (x == _SC_UIO_MAXIOV)
-               {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
-#endif /* ndef _SC_UIO_MAXIOV */
-#ifdef _SC_ULONG_MAX
-       if (x == _SC_ULONG_MAX)
-               {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
-#endif /* ndef _SC_ULONG_MAX */
-#ifdef _SC_USER_GROUPS
-       if (x == _SC_USER_GROUPS)
-               {*r = Mono_Posix_SysconfName__SC_USER_GROUPS; return 0;}
-#endif /* ndef _SC_USER_GROUPS */
-#ifdef _SC_USER_GROUPS_R
-       if (x == _SC_USER_GROUPS_R)
-               {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
-#endif /* ndef _SC_USER_GROUPS_R */
-#ifdef _SC_USHRT_MAX
-       if (x == _SC_USHRT_MAX)
-               {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
-#endif /* ndef _SC_USHRT_MAX */
-#ifdef _SC_V6_ILP32_OFF32
-       if (x == _SC_V6_ILP32_OFF32)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
-#endif /* ndef _SC_V6_LPBIG_OFFBIG */
-#ifdef _SC_VERSION
-       if (x == _SC_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
-#endif /* ndef _SC_VERSION */
-#ifdef _SC_WORD_BIT
-       if (x == _SC_WORD_BIT)
-               {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
-#endif /* ndef _SC_WORD_BIT */
-#ifdef _SC_XBS5_ILP32_OFF32
-       if (x == _SC_XBS5_ILP32_OFF32)
-               {*r = Mono_Posix_SysconfName__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_SysconfName__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_SysconfName__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_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
-#endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
-#ifdef _SC_XOPEN_CRYPT
-       if (x == _SC_XOPEN_CRYPT)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_CRYPT; return 0;}
-#endif /* ndef _SC_XOPEN_CRYPT */
-#ifdef _SC_XOPEN_ENH_I18N
-       if (x == _SC_XOPEN_ENH_I18N)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
-#endif /* ndef _SC_XOPEN_ENH_I18N */
-#ifdef _SC_XOPEN_LEGACY
-       if (x == _SC_XOPEN_LEGACY)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_LEGACY; return 0;}
-#endif /* ndef _SC_XOPEN_LEGACY */
-#ifdef _SC_XOPEN_REALTIME
-       if (x == _SC_XOPEN_REALTIME)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME; return 0;}
-#endif /* ndef _SC_XOPEN_REALTIME */
-#ifdef _SC_XOPEN_REALTIME_THREADS
-       if (x == _SC_XOPEN_REALTIME_THREADS)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
-#endif /* ndef _SC_XOPEN_REALTIME_THREADS */
-#ifdef _SC_XOPEN_SHM
-       if (x == _SC_XOPEN_SHM)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
-#endif /* ndef _SC_XOPEN_SHM */
-#ifdef _SC_XOPEN_UNIX
-       if (x == _SC_XOPEN_UNIX)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
-#endif /* ndef _SC_XOPEN_UNIX */
-#ifdef _SC_XOPEN_VERSION
-       if (x == _SC_XOPEN_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_VERSION; return 0;}
-#endif /* ndef _SC_XOPEN_VERSION */
-#ifdef _SC_XOPEN_XCU_VERSION
-       if (x == _SC_XOPEN_XCU_VERSION)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
-#endif /* ndef _SC_XOPEN_XCU_VERSION */
-#ifdef _SC_XOPEN_XPG2
-       if (x == _SC_XOPEN_XPG2)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG2; return 0;}
-#endif /* ndef _SC_XOPEN_XPG2 */
-#ifdef _SC_XOPEN_XPG3
-       if (x == _SC_XOPEN_XPG3)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG3; return 0;}
-#endif /* ndef _SC_XOPEN_XPG3 */
-#ifdef _SC_XOPEN_XPG4
-       if (x == _SC_XOPEN_XPG4)
-               {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
-#endif /* ndef _SC_XOPEN_XPG4 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSyslogFacility (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-       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_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_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_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_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_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_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 */
-       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_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_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_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_USER)
-#ifdef LOG_USER
-               {*r = LOG_USER; return 0;}
-#else /* def LOG_USER */
-               {errno = EINVAL; return -1;}
-#endif /* ndef LOG_USER */
-       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 */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSyslogFacility (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef LOG_AUTH
-       if (x == LOG_AUTH)
-               {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
-#endif /* ndef LOG_AUTH */
-#ifdef LOG_AUTHPRIV
-       if (x == LOG_AUTHPRIV)
-               {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
-#endif /* ndef LOG_AUTHPRIV */
-#ifdef LOG_CRON
-       if (x == LOG_CRON)
-               {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
-#endif /* ndef LOG_CRON */
-#ifdef LOG_DAEMON
-       if (x == LOG_DAEMON)
-               {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
-#endif /* ndef LOG_DAEMON */
-#ifdef LOG_FTP
-       if (x == LOG_FTP)
-               {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
-#endif /* ndef LOG_FTP */
-#ifdef LOG_KERN
-       if (x == LOG_KERN)
-               {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
-#endif /* ndef LOG_KERN */
-#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 */
-#ifdef LOG_LPR
-       if (x == LOG_LPR)
-               {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
-#endif /* ndef LOG_LPR */
-#ifdef LOG_MAIL
-       if (x == LOG_MAIL)
-               {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
-#endif /* ndef LOG_MAIL */
-#ifdef LOG_NEWS
-       if (x == LOG_NEWS)
-               {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
-#endif /* ndef LOG_NEWS */
-#ifdef LOG_SYSLOG
-       if (x == LOG_SYSLOG)
-               {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
-#endif /* ndef LOG_SYSLOG */
-#ifdef LOG_USER
-       if (x == LOG_USER)
-               {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
-#endif /* ndef LOG_USER */
-#ifdef LOG_UUCP
-       if (x == LOG_UUCP)
-               {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
-#endif /* ndef LOG_UUCP */
-       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_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_DEBUG)
-#ifdef LOG_DEBUG
-               {*r = LOG_DEBUG; return 0;}
-#else /* def LOG_DEBUG */
-               {errno = EINVAL; return -1;}
-#endif /* ndef LOG_DEBUG */
-       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_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_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_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_WARNING)
-#ifdef LOG_WARNING
-               {*r = LOG_WARNING; return 0;}
-#else /* def LOG_WARNING */
-               {errno = EINVAL; return -1;}
-#endif /* ndef LOG_WARNING */
-       errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSyslogLevel (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#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_DEBUG
-       if (x == LOG_DEBUG)
-               {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
-#endif /* ndef LOG_DEBUG */
-#ifdef LOG_EMERG
-       if (x == LOG_EMERG)
-               {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
-#endif /* ndef LOG_EMERG */
-#ifdef LOG_ERR
-       if (x == LOG_ERR)
-               {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
-#endif /* ndef LOG_ERR */
-#ifdef LOG_INFO
-       if (x == LOG_INFO)
-               {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
-#endif /* ndef LOG_INFO */
-#ifdef LOG_NOTICE
-       if (x == LOG_NOTICE)
-               {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
-#endif /* ndef LOG_NOTICE */
-#ifdef LOG_WARNING
-       if (x == LOG_WARNING)
-               {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
-#endif /* ndef LOG_WARNING */
-       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_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_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_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_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
-#ifdef LOG_PERROR
-               *r |= LOG_PERROR;
-#else /* def LOG_PERROR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef LOG_PERROR */
-       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 */
-       return 0;
-}
-
-int Mono_Posix_ToSyslogOptions (int x, int *r)
-{
-       *r = 0;
-       if (x == 0)
-               return 0;
-#ifdef LOG_CONS
-       if ((x & LOG_CONS) == LOG_CONS)
-               *r |= Mono_Posix_SyslogOptions_LOG_CONS;
-#endif /* ndef LOG_CONS */
-#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_ODELAY
-       if ((x & LOG_ODELAY) == LOG_ODELAY)
-               *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
-#endif /* ndef LOG_ODELAY */
-#ifdef LOG_PERROR
-       if ((x & LOG_PERROR) == LOG_PERROR)
-               *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
-#endif /* ndef LOG_PERROR */
-#ifdef LOG_PID
-       if ((x & LOG_PID) == LOG_PID)
-               *r |= Mono_Posix_SyslogOptions_LOG_PID;
-#endif /* ndef LOG_PID */
-       return 0;
+#ifdef SIGABRT
+       if (x == SIGABRT)
+               {*r = Mono_Posix_Signum_SIGABRT; return 0;}
+#endif /* ndef SIGABRT */
+#ifdef SIGALRM
+       if (x == SIGALRM)
+               {*r = Mono_Posix_Signum_SIGALRM; return 0;}
+#endif /* ndef SIGALRM */
+#ifdef SIGBUS
+       if (x == SIGBUS)
+               {*r = Mono_Posix_Signum_SIGBUS; return 0;}
+#endif /* ndef SIGBUS */
+#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 SIGFPE
+       if (x == SIGFPE)
+               {*r = Mono_Posix_Signum_SIGFPE; return 0;}
+#endif /* ndef SIGFPE */
+#ifdef SIGHUP
+       if (x == SIGHUP)
+               {*r = Mono_Posix_Signum_SIGHUP; return 0;}
+#endif /* ndef SIGHUP */
+#ifdef SIGILL
+       if (x == SIGILL)
+               {*r = Mono_Posix_Signum_SIGILL; return 0;}
+#endif /* ndef SIGILL */
+#ifdef SIGINT
+       if (x == SIGINT)
+               {*r = Mono_Posix_Signum_SIGINT; return 0;}
+#endif /* ndef SIGINT */
+#ifdef SIGIO
+       if (x == SIGIO)
+               {*r = Mono_Posix_Signum_SIGIO; return 0;}
+#endif /* ndef SIGIO */
+#ifdef SIGIOT
+       if (x == SIGIOT)
+               {*r = Mono_Posix_Signum_SIGIOT; return 0;}
+#endif /* ndef SIGIOT */
+#ifdef SIGKILL
+       if (x == SIGKILL)
+               {*r = Mono_Posix_Signum_SIGKILL; return 0;}
+#endif /* ndef SIGKILL */
+#ifdef SIGPIPE
+       if (x == SIGPIPE)
+               {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
+#endif /* ndef SIGPIPE */
+#ifdef SIGPOLL
+       if (x == SIGPOLL)
+               {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
+#endif /* ndef SIGPOLL */
+#ifdef SIGPROF
+       if (x == SIGPROF)
+               {*r = Mono_Posix_Signum_SIGPROF; return 0;}
+#endif /* ndef SIGPROF */
+#ifdef SIGPWR
+       if (x == SIGPWR)
+               {*r = Mono_Posix_Signum_SIGPWR; return 0;}
+#endif /* ndef SIGPWR */
+#ifdef SIGQUIT
+       if (x == SIGQUIT)
+               {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
+#endif /* ndef SIGQUIT */
+#ifdef SIGSEGV
+       if (x == SIGSEGV)
+               {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
+#endif /* ndef SIGSEGV */
+#ifdef SIGSTKFLT
+       if (x == SIGSTKFLT)
+               {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
+#endif /* ndef SIGSTKFLT */
+#ifdef SIGSTOP
+       if (x == SIGSTOP)
+               {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
+#endif /* ndef SIGSTOP */
+#ifdef SIGSYS
+       if (x == SIGSYS)
+               {*r = Mono_Posix_Signum_SIGSYS; return 0;}
+#endif /* ndef SIGSYS */
+#ifdef SIGTERM
+       if (x == SIGTERM)
+               {*r = Mono_Posix_Signum_SIGTERM; return 0;}
+#endif /* ndef SIGTERM */
+#ifdef SIGTRAP
+       if (x == SIGTRAP)
+               {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
+#endif /* ndef SIGTRAP */
+#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 SIGUNUSED
+       if (x == SIGUNUSED)
+               {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
+#endif /* ndef SIGUNUSED */
+#ifdef SIGURG
+       if (x == SIGURG)
+               {*r = Mono_Posix_Signum_SIGURG; return 0;}
+#endif /* ndef SIGURG */
+#ifdef SIGUSR1
+       if (x == SIGUSR1)
+               {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
+#endif /* ndef SIGUSR1 */
+#ifdef SIGUSR2
+       if (x == SIGUSR2)
+               {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
+#endif /* ndef SIGUSR2 */
+#ifdef SIGVTALRM
+       if (x == SIGVTALRM)
+               {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
+#endif /* ndef SIGVTALRM */
+#ifdef SIGWINCH
+       if (x == SIGWINCH)
+               {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
+#endif /* ndef SIGWINCH */
+#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 */
+       errno = EINVAL; return -1;
 }
 
-int Mono_Posix_FromWaitOptions (int x, int *r)
+#ifdef HAVE_STRUCT_SOCKADDR_IN
+int
+Mono_Posix_FromSockaddrIn (struct Mono_Posix_SockaddrIn *from, struct sockaddr_in *to)
 {
-       *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 */
+       _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->sin_port = from->sin_port;
+       if (Mono_Posix_FromInAddr (&from->sin_addr, &to->sin_addr) != 0) {
+               return -1;
+       }
+
        return 0;
 }
+#endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
 
-int Mono_Posix_ToWaitOptions (int x, int *r)
+
+#ifdef HAVE_STRUCT_SOCKADDR_IN
+int
+Mono_Posix_ToSockaddrIn (struct sockaddr_in *from, struct Mono_Posix_SockaddrIn *to)
 {
-       *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 */
+       _cnm_return_val_if_overflow (unsigned short, from->sin_port, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->sin_port = from->sin_port;
+       if (Mono_Posix_ToInAddr (&from->sin_addr, &to->sin_addr) != 0) {
+               return -1;
+       }
+
        return 0;
 }
+#endif /* ndef HAVE_STRUCT_SOCKADDR_IN */
 
-int Mono_Posix_FromXattrFlags (int x, int *r)
+
+#if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
+int
+Mono_Posix_FromSockaddrIn6 (struct Mono_Posix_SockaddrIn6 *from, struct sockaddr_in6 *to)
 {
-       *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 */
+       _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
+       _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
+       _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->sin6_port     = from->sin6_port;
+       to->sin6_flowinfo = from->sin6_flowinfo;
+       if (Mono_Posix_FromIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
+               return -1;
+       }
+       to->sin6_scope_id = from->sin6_scope_id;
+
        return 0;
 }
+#endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
 
-int Mono_Posix_ToXattrFlags (int x, int *r)
+
+#if defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(HOST_WIN32)
+int
+Mono_Posix_ToSockaddrIn6 (struct sockaddr_in6 *from, struct Mono_Posix_SockaddrIn6 *to)
 {
-       *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 */
+       _cnm_return_val_if_overflow (unsigned short, from->sin6_port, -1);
+       _cnm_return_val_if_overflow (unsigned int, from->sin6_flowinfo, -1);
+       _cnm_return_val_if_overflow (unsigned int, from->sin6_scope_id, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->sin6_port     = from->sin6_port;
+       to->sin6_flowinfo = from->sin6_flowinfo;
+       if (Mono_Posix_ToIn6Addr (&from->sin6_addr, &to->sin6_addr) != 0) {
+               return -1;
+       }
+       to->sin6_scope_id = from->sin6_scope_id;
+
        return 0;
 }
+#endif /* ndef HAVE_STRUCT_SOCKADDR_IN6 */
 
-int Mono_Posix_FromPathConf (int x, int *r)
+
+int Mono_Posix_FromSockaddrType (int x, int *r)
 {
        *r = 0;
+       if (x == Mono_Posix_SockaddrType_Invalid)
+#ifdef Invalid
+               {*r = Invalid; return 0;}
+#else /* def Invalid */
+               {errno = EINVAL; return -1;}
+#endif /* ndef Invalid */
+       if (x == Mono_Posix_SockaddrType_MustBeWrapped)
+#ifdef MustBeWrapped
+               {*r = MustBeWrapped; return 0;}
+#else /* def MustBeWrapped */
+               {errno = EINVAL; return -1;}
+#endif /* ndef MustBeWrapped */
+       if (x == Mono_Posix_SockaddrType_Sockaddr)
+#ifdef Sockaddr
+               {*r = Sockaddr; return 0;}
+#else /* def Sockaddr */
+               {errno = EINVAL; return -1;}
+#endif /* ndef Sockaddr */
+       if (x == Mono_Posix_SockaddrType_SockaddrIn)
+#ifdef SockaddrIn
+               {*r = SockaddrIn; return 0;}
+#else /* def SockaddrIn */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SockaddrIn */
+       if (x == Mono_Posix_SockaddrType_SockaddrIn6)
+#ifdef SockaddrIn6
+               {*r = SockaddrIn6; return 0;}
+#else /* def SockaddrIn6 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SockaddrIn6 */
+       if (x == Mono_Posix_SockaddrType_SockaddrStorage)
+#ifdef SockaddrStorage
+               {*r = SockaddrStorage; return 0;}
+#else /* def SockaddrStorage */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SockaddrStorage */
+       if (x == Mono_Posix_SockaddrType_SockaddrUn)
+#ifdef SockaddrUn
+               {*r = SockaddrUn; return 0;}
+#else /* def SockaddrUn */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SockaddrUn */
        if (x == 0)
                return 0;
-       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 */
-       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_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_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_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_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_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_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_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_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_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_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_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_VDISABLE)
-#ifdef _PC_VDISABLE
-               {*r = _PC_VDISABLE; return 0;}
-#else /* def _PC_VDISABLE */
-               {errno = EINVAL; return -1;}
-#endif /* ndef _PC_VDISABLE */
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToPathConf (int x, int *r)
+int Mono_Posix_ToSockaddrType (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
-#ifdef _PC_2_SYMLINKS
-       if (x == _PC_2_SYMLINKS)
-               {*r = Mono_Posix_PathConf__PC_2_SYMLINKS; return 0;}
-#endif /* ndef _PC_2_SYMLINKS */
-#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_ASYNC_IO
-       if (x == _PC_ASYNC_IO)
-               {*r = Mono_Posix_PathConf__PC_ASYNC_IO; return 0;}
-#endif /* ndef _PC_ASYNC_IO */
-#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_FILESIZEBITS
-       if (x == _PC_FILESIZEBITS)
-               {*r = Mono_Posix_PathConf__PC_FILESIZEBITS; return 0;}
-#endif /* ndef _PC_FILESIZEBITS */
-#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_NO_TRUNC
-       if (x == _PC_NO_TRUNC)
-               {*r = Mono_Posix_PathConf__PC_NO_TRUNC; return 0;}
-#endif /* ndef _PC_NO_TRUNC */
-#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_PRIO_IO
-       if (x == _PC_PRIO_IO)
-               {*r = Mono_Posix_PathConf__PC_PRIO_IO; return 0;}
-#endif /* ndef _PC_PRIO_IO */
-#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_SOCK_MAXBUF
-       if (x == _PC_SOCK_MAXBUF)
-               {*r = Mono_Posix_PathConf__PC_SOCK_MAXBUF; return 0;}
-#endif /* ndef _PC_SOCK_MAXBUF */
-#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_SYNC_IO
-       if (x == _PC_SYNC_IO)
-               {*r = Mono_Posix_PathConf__PC_SYNC_IO; return 0;}
-#endif /* ndef _PC_SYNC_IO */
-#ifdef _PC_VDISABLE
-       if (x == _PC_VDISABLE)
-               {*r = Mono_Posix_PathConf__PC_VDISABLE; return 0;}
-#endif /* ndef _PC_VDISABLE */
+#ifdef Invalid
+       if (x == Invalid)
+               {*r = Mono_Posix_SockaddrType_Invalid; return 0;}
+#endif /* ndef Invalid */
+#ifdef MustBeWrapped
+       if (x == MustBeWrapped)
+               {*r = Mono_Posix_SockaddrType_MustBeWrapped; return 0;}
+#endif /* ndef MustBeWrapped */
+#ifdef Sockaddr
+       if (x == Sockaddr)
+               {*r = Mono_Posix_SockaddrType_Sockaddr; return 0;}
+#endif /* ndef Sockaddr */
+#ifdef SockaddrIn
+       if (x == SockaddrIn)
+               {*r = Mono_Posix_SockaddrType_SockaddrIn; return 0;}
+#endif /* ndef SockaddrIn */
+#ifdef SockaddrIn6
+       if (x == SockaddrIn6)
+               {*r = Mono_Posix_SockaddrType_SockaddrIn6; return 0;}
+#endif /* ndef SockaddrIn6 */
+#ifdef SockaddrStorage
+       if (x == SockaddrStorage)
+               {*r = Mono_Posix_SockaddrType_SockaddrStorage; return 0;}
+#endif /* ndef SockaddrStorage */
+#ifdef SockaddrUn
+       if (x == SockaddrUn)
+               {*r = Mono_Posix_SockaddrType_SockaddrUn; return 0;}
+#endif /* ndef SockaddrUn */
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_FromSysConf (int x, int *r)
+int Mono_Posix_FromSysconfName (int x, int *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
-       if (x == Mono_Posix_SysConf__SC_2_CHAR_TERM)
+       if (x == Mono_Posix_SysconfName__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_BIND)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_C_VERSION)
+       if (x == Mono_Posix_SysconfName__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_FORT_DEV)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_LOCALEDEF)
+       if (x == Mono_Posix_SysconfName__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_2_PBS)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CHECKPOINT)
+       if (x == Mono_Posix_SysconfName__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_2_PBS_LOCATE)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_2_SW_DEV)
+       if (x == Mono_Posix_SysconfName__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_UPE)
+       if (x == Mono_Posix_SysconfName__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_2_VERSION)
+       if (x == Mono_Posix_SysconfName__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_ADVISORY_INFO)
+       if (x == Mono_Posix_SysconfName__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_AIO_LISTIO_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_ARG_MAX)
+       if (x == Mono_Posix_SysconfName__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_ASYNCHRONOUS_IO)
+       if (x == Mono_Posix_SysconfName__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_ATEXIT_MAX)
+       if (x == Mono_Posix_SysconfName__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_AVPHYS_PAGES)
+       if (x == Mono_Posix_SysconfName__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_BARRIERS)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_BC_BASE_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CHARCLASS_NAME_MAX)
+       if (x == Mono_Posix_SysconfName__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_CHAR_BIT)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CHILD_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CLOCK_SELECTION)
+       if (x == Mono_Posix_SysconfName__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_COLL_WEIGHTS_MAX)
+       if (x == Mono_Posix_SysconfName__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_CPUTIME)
+       if (x == Mono_Posix_SysconfName__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_C_LANG_SUPPORT)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_DELAYTIMER_MAX)
+       if (x == Mono_Posix_SysconfName__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_DEVICE_IO)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_EQUIV_CLASS_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_FD_MGMT)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_FILE_ATTRIBUTES)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_FSYNC)
+       if (x == Mono_Posix_SysconfName__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_GETGR_R_SIZE_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_HOST_NAME_MAX)
+       if (x == Mono_Posix_SysconfName__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_INT_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_IOV_MAX)
+       if (x == Mono_Posix_SysconfName__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_JOB_CONTROL)
+       if (x == Mono_Posix_SysconfName__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_LEVEL1_DCACHE_ASSOC)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_LEVEL1_DCACHE_SIZE)
+       if (x == Mono_Posix_SysconfName__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_ICACHE_ASSOC)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_ICACHE_SIZE)
+       if (x == Mono_Posix_SysconfName__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_LEVEL2_CACHE_ASSOC)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_LEVEL2_CACHE_SIZE)
+       if (x == Mono_Posix_SysconfName__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_LEVEL3_CACHE_ASSOC)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_LEVEL3_CACHE_SIZE)
+       if (x == Mono_Posix_SysconfName__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_LEVEL4_CACHE_ASSOC)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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 */
-       if (x == Mono_Posix_SysConf__SC_LEVEL4_CACHE_SIZE)
+       if (x == Mono_Posix_SysconfName__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_LINE_MAX)
+       if (x == Mono_Posix_SysconfName__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_LOGIN_NAME_MAX)
+       if (x == Mono_Posix_SysconfName__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_LONG_BIT)
+       if (x == Mono_Posix_SysconfName__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_MAPPED_FILES)
+       if (x == Mono_Posix_SysconfName__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_MB_LEN_MAX)
+       if (x == Mono_Posix_SysconfName__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_MEMLOCK)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_MONOTONIC_CLOCK)
+       if (x == Mono_Posix_SysconfName__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_MQ_OPEN_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_MULTI_PROCESS)
+       if (x == Mono_Posix_SysconfName__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_NETWORKING)
+       if (x == Mono_Posix_SysconfName__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_NGROUPS_MAX)
+       if (x == Mono_Posix_SysconfName__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_NL_ARGMAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_NPROCESSORS_CONF)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_NZERO)
+       if (x == Mono_Posix_SysconfName__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_OPEN_MAX)
+       if (x == Mono_Posix_SysconfName__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_PAGESIZE)
+       if (x == Mono_Posix_SysconfName__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_PASS_MAX)
+       if (x == Mono_Posix_SysconfName__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_PHYS_PAGES)
+       if (x == Mono_Posix_SysconfName__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_PII)
+       if (x == Mono_Posix_SysconfName__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_INTERNET)
+       if (x == Mono_Posix_SysconfName__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_INTERNET_DGRAM)
+       if (x == Mono_Posix_SysconfName__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_INTERNET_STREAM)
+       if (x == Mono_Posix_SysconfName__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_OSI)
+       if (x == Mono_Posix_SysconfName__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_PII_OSI_CLTS)
+       if (x == Mono_Posix_SysconfName__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_COTS)
+       if (x == Mono_Posix_SysconfName__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_M)
+       if (x == Mono_Posix_SysconfName__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_PII_SOCKET)
+       if (x == Mono_Posix_SysconfName__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_XTI)
+       if (x == Mono_Posix_SysconfName__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_PIPE)
+       if (x == Mono_Posix_SysconfName__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_POLL)
+       if (x == Mono_Posix_SysconfName__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_PRIORITIZED_IO)
+       if (x == Mono_Posix_SysconfName__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_PRIORITY_SCHEDULING)
+       if (x == Mono_Posix_SysconfName__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_READER_WRITER_LOCKS)
+       if (x == Mono_Posix_SysconfName__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_REALTIME_SIGNALS)
+       if (x == Mono_Posix_SysconfName__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_REGEXP)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_RE_DUP_MAX)
+       if (x == Mono_Posix_SysconfName__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_RTSIG_MAX)
+       if (x == Mono_Posix_SysconfName__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_SAVED_IDS)
+       if (x == Mono_Posix_SysconfName__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_SCHAR_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_SELECT)
+       if (x == Mono_Posix_SysconfName__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_SEMAPHORES)
+       if (x == Mono_Posix_SysconfName__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_SEM_NSEMS_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_SHARED_MEMORY_OBJECTS)
+       if (x == Mono_Posix_SysconfName__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_SHELL)
+       if (x == Mono_Posix_SysconfName__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_SHRT_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_SIGNALS)
+       if (x == Mono_Posix_SysconfName__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_SIGQUEUE_MAX)
+       if (x == Mono_Posix_SysconfName__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_SINGLE_PROCESS)
+       if (x == Mono_Posix_SysconfName__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_SPAWN)
+       if (x == Mono_Posix_SysconfName__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_SPIN_LOCKS)
+       if (x == Mono_Posix_SysconfName__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_SPORADIC_SERVER)
+       if (x == Mono_Posix_SysconfName__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_SSIZE_MAX)
+       if (x == Mono_Posix_SysconfName__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_STREAMS)
+       if (x == Mono_Posix_SysconfName__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_STREAM_MAX)
+       if (x == Mono_Posix_SysconfName__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_SYMLOOP_MAX)
+       if (x == Mono_Posix_SysconfName__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_SYNCHRONIZED_IO)
+       if (x == Mono_Posix_SysconfName__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_SYSTEM_DATABASE)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_THREADS)
+       if (x == Mono_Posix_SysconfName__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_ATTR_STACKADDR)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CPUTIME)
+       if (x == Mono_Posix_SysconfName__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_THREAD_DESTRUCTOR_ITERATIONS)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_PRIORITY_SCHEDULING)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_THREAD_SAFE_FUNCTIONS)
+       if (x == Mono_Posix_SysconfName__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_THREAD_SPORADIC_SERVER)
+       if (x == Mono_Posix_SysconfName__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_THREAD_STACK_MIN)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_TIMEOUTS)
+       if (x == Mono_Posix_SysconfName__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_TIMERS)
+       if (x == Mono_Posix_SysconfName__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_TIMER_MAX)
+       if (x == Mono_Posix_SysconfName__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_TRACE)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_TTY_NAME_MAX)
+       if (x == Mono_Posix_SysconfName__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_TYPED_MEMORY_OBJECTS)
+       if (x == Mono_Posix_SysconfName__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_TZNAME_MAX)
+       if (x == Mono_Posix_SysconfName__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_T_IOV_MAX)
+       if (x == Mono_Posix_SysconfName__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_UCHAR_MAX)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_UIO_MAXIOV)
+       if (x == Mono_Posix_SysconfName__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_ULONG_MAX)
+       if (x == Mono_Posix_SysconfName__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_USER_GROUPS)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_USHRT_MAX)
+       if (x == Mono_Posix_SysconfName__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_V6_ILP32_OFF32)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_VERSION)
+       if (x == Mono_Posix_SysconfName__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_WORD_BIT)
+       if (x == Mono_Posix_SysconfName__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_XBS5_ILP32_OFF32)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_CRYPT)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_LEGACY)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_XOPEN_SHM)
+       if (x == Mono_Posix_SysconfName__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_XOPEN_UNIX)
+       if (x == Mono_Posix_SysconfName__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_VERSION)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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_XPG2)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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)
+       if (x == Mono_Posix_SysconfName__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 == 0)
+               return 0;
        errno = EINVAL; return -1;
 }
 
-int Mono_Posix_ToSysConf (int x, int *r)
+int Mono_Posix_ToSysconfName (int x, int *r)
 {
        *r = 0;
        if (x == 0)
                return 0;
 #ifdef _SC_2_CHAR_TERM
        if (x == _SC_2_CHAR_TERM)
-               {*r = Mono_Posix_SysConf__SC_2_CHAR_TERM; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_CHAR_TERM; return 0;}
 #endif /* ndef _SC_2_CHAR_TERM */
 #ifdef _SC_2_C_BIND
        if (x == _SC_2_C_BIND)
-               {*r = Mono_Posix_SysConf__SC_2_C_BIND; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_2_C_DEV; return 0;}
 #endif /* ndef _SC_2_C_DEV */
 #ifdef _SC_2_C_VERSION
        if (x == _SC_2_C_VERSION)
-               {*r = Mono_Posix_SysConf__SC_2_C_VERSION; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_C_VERSION; return 0;}
 #endif /* ndef _SC_2_C_VERSION */
 #ifdef _SC_2_FORT_DEV
        if (x == _SC_2_FORT_DEV)
-               {*r = Mono_Posix_SysConf__SC_2_FORT_DEV; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_2_FORT_RUN; return 0;}
 #endif /* ndef _SC_2_FORT_RUN */
 #ifdef _SC_2_LOCALEDEF
        if (x == _SC_2_LOCALEDEF)
-               {*r = Mono_Posix_SysConf__SC_2_LOCALEDEF; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_LOCALEDEF; return 0;}
 #endif /* ndef _SC_2_LOCALEDEF */
 #ifdef _SC_2_PBS
        if (x == _SC_2_PBS)
-               {*r = Mono_Posix_SysConf__SC_2_PBS; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_2_PBS_ACCOUNTING; return 0;}
 #endif /* ndef _SC_2_PBS_ACCOUNTING */
 #ifdef _SC_2_PBS_CHECKPOINT
        if (x == _SC_2_PBS_CHECKPOINT)
-               {*r = Mono_Posix_SysConf__SC_2_PBS_CHECKPOINT; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_PBS_CHECKPOINT; return 0;}
 #endif /* ndef _SC_2_PBS_CHECKPOINT */
 #ifdef _SC_2_PBS_LOCATE
        if (x == _SC_2_PBS_LOCATE)
-               {*r = Mono_Posix_SysConf__SC_2_PBS_LOCATE; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_2_PBS_TRACK; return 0;}
 #endif /* ndef _SC_2_PBS_TRACK */
 #ifdef _SC_2_SW_DEV
        if (x == _SC_2_SW_DEV)
-               {*r = Mono_Posix_SysConf__SC_2_SW_DEV; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_SW_DEV; return 0;}
 #endif /* ndef _SC_2_SW_DEV */
 #ifdef _SC_2_UPE
        if (x == _SC_2_UPE)
-               {*r = Mono_Posix_SysConf__SC_2_UPE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_UPE; return 0;}
 #endif /* ndef _SC_2_UPE */
 #ifdef _SC_2_VERSION
        if (x == _SC_2_VERSION)
-               {*r = Mono_Posix_SysConf__SC_2_VERSION; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_2_VERSION; return 0;}
 #endif /* ndef _SC_2_VERSION */
 #ifdef _SC_ADVISORY_INFO
        if (x == _SC_ADVISORY_INFO)
-               {*r = Mono_Posix_SysConf__SC_ADVISORY_INFO; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_ADVISORY_INFO; return 0;}
 #endif /* ndef _SC_ADVISORY_INFO */
 #ifdef _SC_AIO_LISTIO_MAX
        if (x == _SC_AIO_LISTIO_MAX)
-               {*r = Mono_Posix_SysConf__SC_AIO_LISTIO_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_AIO_PRIO_DELTA_MAX; return 0;}
 #endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
 #ifdef _SC_ARG_MAX
        if (x == _SC_ARG_MAX)
-               {*r = Mono_Posix_SysConf__SC_ARG_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_ARG_MAX; return 0;}
 #endif /* ndef _SC_ARG_MAX */
 #ifdef _SC_ASYNCHRONOUS_IO
        if (x == _SC_ASYNCHRONOUS_IO)
-               {*r = Mono_Posix_SysConf__SC_ASYNCHRONOUS_IO; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_ASYNCHRONOUS_IO; return 0;}
 #endif /* ndef _SC_ASYNCHRONOUS_IO */
 #ifdef _SC_ATEXIT_MAX
        if (x == _SC_ATEXIT_MAX)
-               {*r = Mono_Posix_SysConf__SC_ATEXIT_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_ATEXIT_MAX; return 0;}
 #endif /* ndef _SC_ATEXIT_MAX */
 #ifdef _SC_AVPHYS_PAGES
        if (x == _SC_AVPHYS_PAGES)
-               {*r = Mono_Posix_SysConf__SC_AVPHYS_PAGES; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_AVPHYS_PAGES; return 0;}
 #endif /* ndef _SC_AVPHYS_PAGES */
 #ifdef _SC_BARRIERS
        if (x == _SC_BARRIERS)
-               {*r = Mono_Posix_SysConf__SC_BARRIERS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_BARRIERS; return 0;}
 #endif /* ndef _SC_BARRIERS */
 #ifdef _SC_BASE
        if (x == _SC_BASE)
-               {*r = Mono_Posix_SysConf__SC_BASE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_BASE; return 0;}
 #endif /* ndef _SC_BASE */
 #ifdef _SC_BC_BASE_MAX
        if (x == _SC_BC_BASE_MAX)
-               {*r = Mono_Posix_SysConf__SC_BC_BASE_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_BC_STRING_MAX; return 0;}
 #endif /* ndef _SC_BC_STRING_MAX */
 #ifdef _SC_CHARCLASS_NAME_MAX
        if (x == _SC_CHARCLASS_NAME_MAX)
-               {*r = Mono_Posix_SysConf__SC_CHARCLASS_NAME_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_CHARCLASS_NAME_MAX; return 0;}
 #endif /* ndef _SC_CHARCLASS_NAME_MAX */
 #ifdef _SC_CHAR_BIT
        if (x == _SC_CHAR_BIT)
-               {*r = Mono_Posix_SysConf__SC_CHAR_BIT; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_CHAR_MIN; return 0;}
 #endif /* ndef _SC_CHAR_MIN */
 #ifdef _SC_CHILD_MAX
        if (x == _SC_CHILD_MAX)
-               {*r = Mono_Posix_SysConf__SC_CHILD_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_CLK_TCK; return 0;}
 #endif /* ndef _SC_CLK_TCK */
 #ifdef _SC_CLOCK_SELECTION
        if (x == _SC_CLOCK_SELECTION)
-               {*r = Mono_Posix_SysConf__SC_CLOCK_SELECTION; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_CLOCK_SELECTION; return 0;}
 #endif /* ndef _SC_CLOCK_SELECTION */
 #ifdef _SC_COLL_WEIGHTS_MAX
        if (x == _SC_COLL_WEIGHTS_MAX)
-               {*r = Mono_Posix_SysConf__SC_COLL_WEIGHTS_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_COLL_WEIGHTS_MAX; return 0;}
 #endif /* ndef _SC_COLL_WEIGHTS_MAX */
 #ifdef _SC_CPUTIME
        if (x == _SC_CPUTIME)
-               {*r = Mono_Posix_SysConf__SC_CPUTIME; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_CPUTIME; return 0;}
 #endif /* ndef _SC_CPUTIME */
 #ifdef _SC_C_LANG_SUPPORT
        if (x == _SC_C_LANG_SUPPORT)
-               {*r = Mono_Posix_SysConf__SC_C_LANG_SUPPORT; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_C_LANG_SUPPORT_R; return 0;}
 #endif /* ndef _SC_C_LANG_SUPPORT_R */
 #ifdef _SC_DELAYTIMER_MAX
        if (x == _SC_DELAYTIMER_MAX)
-               {*r = Mono_Posix_SysConf__SC_DELAYTIMER_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_DELAYTIMER_MAX; return 0;}
 #endif /* ndef _SC_DELAYTIMER_MAX */
 #ifdef _SC_DEVICE_IO
        if (x == _SC_DEVICE_IO)
-               {*r = Mono_Posix_SysConf__SC_DEVICE_IO; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_DEVICE_SPECIFIC_R; return 0;}
 #endif /* ndef _SC_DEVICE_SPECIFIC_R */
 #ifdef _SC_EQUIV_CLASS_MAX
        if (x == _SC_EQUIV_CLASS_MAX)
-               {*r = Mono_Posix_SysConf__SC_EQUIV_CLASS_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_EXPR_NEST_MAX; return 0;}
 #endif /* ndef _SC_EXPR_NEST_MAX */
 #ifdef _SC_FD_MGMT
        if (x == _SC_FD_MGMT)
-               {*r = Mono_Posix_SysConf__SC_FD_MGMT; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_FIFO; return 0;}
 #endif /* ndef _SC_FIFO */
 #ifdef _SC_FILE_ATTRIBUTES
        if (x == _SC_FILE_ATTRIBUTES)
-               {*r = Mono_Posix_SysConf__SC_FILE_ATTRIBUTES; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_FILE_SYSTEM; return 0;}
 #endif /* ndef _SC_FILE_SYSTEM */
 #ifdef _SC_FSYNC
        if (x == _SC_FSYNC)
-               {*r = Mono_Posix_SysConf__SC_FSYNC; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_FSYNC; return 0;}
 #endif /* ndef _SC_FSYNC */
 #ifdef _SC_GETGR_R_SIZE_MAX
        if (x == _SC_GETGR_R_SIZE_MAX)
-               {*r = Mono_Posix_SysConf__SC_GETGR_R_SIZE_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_GETPW_R_SIZE_MAX; return 0;}
 #endif /* ndef _SC_GETPW_R_SIZE_MAX */
 #ifdef _SC_HOST_NAME_MAX
        if (x == _SC_HOST_NAME_MAX)
-               {*r = Mono_Posix_SysConf__SC_HOST_NAME_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_HOST_NAME_MAX; return 0;}
 #endif /* ndef _SC_HOST_NAME_MAX */
 #ifdef _SC_INT_MAX
        if (x == _SC_INT_MAX)
-               {*r = Mono_Posix_SysConf__SC_INT_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_INT_MIN; return 0;}
 #endif /* ndef _SC_INT_MIN */
 #ifdef _SC_IOV_MAX
        if (x == _SC_IOV_MAX)
-               {*r = Mono_Posix_SysConf__SC_IOV_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_IOV_MAX; return 0;}
 #endif /* ndef _SC_IOV_MAX */
 #ifdef _SC_JOB_CONTROL
        if (x == _SC_JOB_CONTROL)
-               {*r = Mono_Posix_SysConf__SC_JOB_CONTROL; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_JOB_CONTROL; return 0;}
 #endif /* ndef _SC_JOB_CONTROL */
 #ifdef _SC_LEVEL1_DCACHE_ASSOC
        if (x == _SC_LEVEL1_DCACHE_ASSOC)
-               {*r = Mono_Posix_SysConf__SC_LEVEL1_DCACHE_ASSOC; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_LINESIZE; return 0;}
 #endif /* ndef _SC_LEVEL1_DCACHE_LINESIZE */
 #ifdef _SC_LEVEL1_DCACHE_SIZE
        if (x == _SC_LEVEL1_DCACHE_SIZE)
-               {*r = Mono_Posix_SysConf__SC_LEVEL1_DCACHE_SIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL1_DCACHE_SIZE; return 0;}
 #endif /* ndef _SC_LEVEL1_DCACHE_SIZE */
 #ifdef _SC_LEVEL1_ICACHE_ASSOC
        if (x == _SC_LEVEL1_ICACHE_ASSOC)
-               {*r = Mono_Posix_SysConf__SC_LEVEL1_ICACHE_ASSOC; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_LINESIZE; return 0;}
 #endif /* ndef _SC_LEVEL1_ICACHE_LINESIZE */
 #ifdef _SC_LEVEL1_ICACHE_SIZE
        if (x == _SC_LEVEL1_ICACHE_SIZE)
-               {*r = Mono_Posix_SysConf__SC_LEVEL1_ICACHE_SIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL1_ICACHE_SIZE; return 0;}
 #endif /* ndef _SC_LEVEL1_ICACHE_SIZE */
 #ifdef _SC_LEVEL2_CACHE_ASSOC
        if (x == _SC_LEVEL2_CACHE_ASSOC)
-               {*r = Mono_Posix_SysConf__SC_LEVEL2_CACHE_ASSOC; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_LINESIZE; return 0;}
 #endif /* ndef _SC_LEVEL2_CACHE_LINESIZE */
 #ifdef _SC_LEVEL2_CACHE_SIZE
        if (x == _SC_LEVEL2_CACHE_SIZE)
-               {*r = Mono_Posix_SysConf__SC_LEVEL2_CACHE_SIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL2_CACHE_SIZE; return 0;}
 #endif /* ndef _SC_LEVEL2_CACHE_SIZE */
 #ifdef _SC_LEVEL3_CACHE_ASSOC
        if (x == _SC_LEVEL3_CACHE_ASSOC)
-               {*r = Mono_Posix_SysConf__SC_LEVEL3_CACHE_ASSOC; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_LINESIZE; return 0;}
 #endif /* ndef _SC_LEVEL3_CACHE_LINESIZE */
 #ifdef _SC_LEVEL3_CACHE_SIZE
        if (x == _SC_LEVEL3_CACHE_SIZE)
-               {*r = Mono_Posix_SysConf__SC_LEVEL3_CACHE_SIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL3_CACHE_SIZE; return 0;}
 #endif /* ndef _SC_LEVEL3_CACHE_SIZE */
 #ifdef _SC_LEVEL4_CACHE_ASSOC
        if (x == _SC_LEVEL4_CACHE_ASSOC)
-               {*r = Mono_Posix_SysConf__SC_LEVEL4_CACHE_ASSOC; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_LINESIZE; return 0;}
 #endif /* ndef _SC_LEVEL4_CACHE_LINESIZE */
 #ifdef _SC_LEVEL4_CACHE_SIZE
        if (x == _SC_LEVEL4_CACHE_SIZE)
-               {*r = Mono_Posix_SysConf__SC_LEVEL4_CACHE_SIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LEVEL4_CACHE_SIZE; return 0;}
 #endif /* ndef _SC_LEVEL4_CACHE_SIZE */
 #ifdef _SC_LINE_MAX
        if (x == _SC_LINE_MAX)
-               {*r = Mono_Posix_SysConf__SC_LINE_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LINE_MAX; return 0;}
 #endif /* ndef _SC_LINE_MAX */
 #ifdef _SC_LOGIN_NAME_MAX
        if (x == _SC_LOGIN_NAME_MAX)
-               {*r = Mono_Posix_SysConf__SC_LOGIN_NAME_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LOGIN_NAME_MAX; return 0;}
 #endif /* ndef _SC_LOGIN_NAME_MAX */
 #ifdef _SC_LONG_BIT
        if (x == _SC_LONG_BIT)
-               {*r = Mono_Posix_SysConf__SC_LONG_BIT; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_LONG_BIT; return 0;}
 #endif /* ndef _SC_LONG_BIT */
 #ifdef _SC_MAPPED_FILES
        if (x == _SC_MAPPED_FILES)
-               {*r = Mono_Posix_SysConf__SC_MAPPED_FILES; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_MAPPED_FILES; return 0;}
 #endif /* ndef _SC_MAPPED_FILES */
 #ifdef _SC_MB_LEN_MAX
        if (x == _SC_MB_LEN_MAX)
-               {*r = Mono_Posix_SysConf__SC_MB_LEN_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_MB_LEN_MAX; return 0;}
 #endif /* ndef _SC_MB_LEN_MAX */
 #ifdef _SC_MEMLOCK
        if (x == _SC_MEMLOCK)
-               {*r = Mono_Posix_SysConf__SC_MEMLOCK; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_MESSAGE_PASSING; return 0;}
 #endif /* ndef _SC_MESSAGE_PASSING */
 #ifdef _SC_MONOTONIC_CLOCK
        if (x == _SC_MONOTONIC_CLOCK)
-               {*r = Mono_Posix_SysConf__SC_MONOTONIC_CLOCK; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_MONOTONIC_CLOCK; return 0;}
 #endif /* ndef _SC_MONOTONIC_CLOCK */
 #ifdef _SC_MQ_OPEN_MAX
        if (x == _SC_MQ_OPEN_MAX)
-               {*r = Mono_Posix_SysConf__SC_MQ_OPEN_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_MQ_PRIO_MAX; return 0;}
 #endif /* ndef _SC_MQ_PRIO_MAX */
 #ifdef _SC_MULTI_PROCESS
        if (x == _SC_MULTI_PROCESS)
-               {*r = Mono_Posix_SysConf__SC_MULTI_PROCESS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_MULTI_PROCESS; return 0;}
 #endif /* ndef _SC_MULTI_PROCESS */
 #ifdef _SC_NETWORKING
        if (x == _SC_NETWORKING)
-               {*r = Mono_Posix_SysConf__SC_NETWORKING; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_NETWORKING; return 0;}
 #endif /* ndef _SC_NETWORKING */
 #ifdef _SC_NGROUPS_MAX
        if (x == _SC_NGROUPS_MAX)
-               {*r = Mono_Posix_SysConf__SC_NGROUPS_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_NGROUPS_MAX; return 0;}
 #endif /* ndef _SC_NGROUPS_MAX */
 #ifdef _SC_NL_ARGMAX
        if (x == _SC_NL_ARGMAX)
-               {*r = Mono_Posix_SysConf__SC_NL_ARGMAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_NL_TEXTMAX; return 0;}
 #endif /* ndef _SC_NL_TEXTMAX */
 #ifdef _SC_NPROCESSORS_CONF
        if (x == _SC_NPROCESSORS_CONF)
-               {*r = Mono_Posix_SysConf__SC_NPROCESSORS_CONF; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_NPROCESSORS_ONLN; return 0;}
 #endif /* ndef _SC_NPROCESSORS_ONLN */
 #ifdef _SC_NZERO
        if (x == _SC_NZERO)
-               {*r = Mono_Posix_SysConf__SC_NZERO; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_NZERO; return 0;}
 #endif /* ndef _SC_NZERO */
 #ifdef _SC_OPEN_MAX
        if (x == _SC_OPEN_MAX)
-               {*r = Mono_Posix_SysConf__SC_OPEN_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_OPEN_MAX; return 0;}
 #endif /* ndef _SC_OPEN_MAX */
 #ifdef _SC_PAGESIZE
        if (x == _SC_PAGESIZE)
-               {*r = Mono_Posix_SysConf__SC_PAGESIZE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PAGESIZE; return 0;}
 #endif /* ndef _SC_PAGESIZE */
 #ifdef _SC_PASS_MAX
        if (x == _SC_PASS_MAX)
-               {*r = Mono_Posix_SysConf__SC_PASS_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PASS_MAX; return 0;}
 #endif /* ndef _SC_PASS_MAX */
 #ifdef _SC_PHYS_PAGES
        if (x == _SC_PHYS_PAGES)
-               {*r = Mono_Posix_SysConf__SC_PHYS_PAGES; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PHYS_PAGES; return 0;}
 #endif /* ndef _SC_PHYS_PAGES */
 #ifdef _SC_PII
        if (x == _SC_PII)
-               {*r = Mono_Posix_SysConf__SC_PII; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII; return 0;}
 #endif /* ndef _SC_PII */
 #ifdef _SC_PII_INTERNET
        if (x == _SC_PII_INTERNET)
-               {*r = Mono_Posix_SysConf__SC_PII_INTERNET; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET; return 0;}
 #endif /* ndef _SC_PII_INTERNET */
 #ifdef _SC_PII_INTERNET_DGRAM
        if (x == _SC_PII_INTERNET_DGRAM)
-               {*r = Mono_Posix_SysConf__SC_PII_INTERNET_DGRAM; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_DGRAM; return 0;}
 #endif /* ndef _SC_PII_INTERNET_DGRAM */
 #ifdef _SC_PII_INTERNET_STREAM
        if (x == _SC_PII_INTERNET_STREAM)
-               {*r = Mono_Posix_SysConf__SC_PII_INTERNET_STREAM; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_INTERNET_STREAM; return 0;}
 #endif /* ndef _SC_PII_INTERNET_STREAM */
 #ifdef _SC_PII_OSI
        if (x == _SC_PII_OSI)
-               {*r = Mono_Posix_SysConf__SC_PII_OSI; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_OSI; return 0;}
 #endif /* ndef _SC_PII_OSI */
 #ifdef _SC_PII_OSI_CLTS
        if (x == _SC_PII_OSI_CLTS)
-               {*r = Mono_Posix_SysConf__SC_PII_OSI_CLTS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_OSI_CLTS; return 0;}
 #endif /* ndef _SC_PII_OSI_CLTS */
 #ifdef _SC_PII_OSI_COTS
        if (x == _SC_PII_OSI_COTS)
-               {*r = Mono_Posix_SysConf__SC_PII_OSI_COTS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_OSI_COTS; return 0;}
 #endif /* ndef _SC_PII_OSI_COTS */
 #ifdef _SC_PII_OSI_M
        if (x == _SC_PII_OSI_M)
-               {*r = Mono_Posix_SysConf__SC_PII_OSI_M; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_OSI_M; return 0;}
 #endif /* ndef _SC_PII_OSI_M */
 #ifdef _SC_PII_SOCKET
        if (x == _SC_PII_SOCKET)
-               {*r = Mono_Posix_SysConf__SC_PII_SOCKET; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_SOCKET; return 0;}
 #endif /* ndef _SC_PII_SOCKET */
 #ifdef _SC_PII_XTI
        if (x == _SC_PII_XTI)
-               {*r = Mono_Posix_SysConf__SC_PII_XTI; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PII_XTI; return 0;}
 #endif /* ndef _SC_PII_XTI */
 #ifdef _SC_PIPE
        if (x == _SC_PIPE)
-               {*r = Mono_Posix_SysConf__SC_PIPE; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PIPE; return 0;}
 #endif /* ndef _SC_PIPE */
 #ifdef _SC_POLL
        if (x == _SC_POLL)
-               {*r = Mono_Posix_SysConf__SC_POLL; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_POLL; return 0;}
 #endif /* ndef _SC_POLL */
 #ifdef _SC_PRIORITIZED_IO
        if (x == _SC_PRIORITIZED_IO)
-               {*r = Mono_Posix_SysConf__SC_PRIORITIZED_IO; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PRIORITIZED_IO; return 0;}
 #endif /* ndef _SC_PRIORITIZED_IO */
 #ifdef _SC_PRIORITY_SCHEDULING
        if (x == _SC_PRIORITY_SCHEDULING)
-               {*r = Mono_Posix_SysConf__SC_PRIORITY_SCHEDULING; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_PRIORITY_SCHEDULING; return 0;}
 #endif /* ndef _SC_PRIORITY_SCHEDULING */
 #ifdef _SC_READER_WRITER_LOCKS
        if (x == _SC_READER_WRITER_LOCKS)
-               {*r = Mono_Posix_SysConf__SC_READER_WRITER_LOCKS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_READER_WRITER_LOCKS; return 0;}
 #endif /* ndef _SC_READER_WRITER_LOCKS */
 #ifdef _SC_REALTIME_SIGNALS
        if (x == _SC_REALTIME_SIGNALS)
-               {*r = Mono_Posix_SysConf__SC_REALTIME_SIGNALS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_REALTIME_SIGNALS; return 0;}
 #endif /* ndef _SC_REALTIME_SIGNALS */
 #ifdef _SC_REGEXP
        if (x == _SC_REGEXP)
-               {*r = Mono_Posix_SysConf__SC_REGEXP; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_REGEX_VERSION; return 0;}
 #endif /* ndef _SC_REGEX_VERSION */
 #ifdef _SC_RE_DUP_MAX
        if (x == _SC_RE_DUP_MAX)
-               {*r = Mono_Posix_SysConf__SC_RE_DUP_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_RE_DUP_MAX; return 0;}
 #endif /* ndef _SC_RE_DUP_MAX */
 #ifdef _SC_RTSIG_MAX
        if (x == _SC_RTSIG_MAX)
-               {*r = Mono_Posix_SysConf__SC_RTSIG_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_RTSIG_MAX; return 0;}
 #endif /* ndef _SC_RTSIG_MAX */
 #ifdef _SC_SAVED_IDS
        if (x == _SC_SAVED_IDS)
-               {*r = Mono_Posix_SysConf__SC_SAVED_IDS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SAVED_IDS; return 0;}
 #endif /* ndef _SC_SAVED_IDS */
 #ifdef _SC_SCHAR_MAX
        if (x == _SC_SCHAR_MAX)
-               {*r = Mono_Posix_SysConf__SC_SCHAR_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_SCHAR_MIN; return 0;}
 #endif /* ndef _SC_SCHAR_MIN */
 #ifdef _SC_SELECT
        if (x == _SC_SELECT)
-               {*r = Mono_Posix_SysConf__SC_SELECT; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SELECT; return 0;}
 #endif /* ndef _SC_SELECT */
 #ifdef _SC_SEMAPHORES
        if (x == _SC_SEMAPHORES)
-               {*r = Mono_Posix_SysConf__SC_SEMAPHORES; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SEMAPHORES; return 0;}
 #endif /* ndef _SC_SEMAPHORES */
 #ifdef _SC_SEM_NSEMS_MAX
        if (x == _SC_SEM_NSEMS_MAX)
-               {*r = Mono_Posix_SysConf__SC_SEM_NSEMS_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_SEM_VALUE_MAX; return 0;}
 #endif /* ndef _SC_SEM_VALUE_MAX */
 #ifdef _SC_SHARED_MEMORY_OBJECTS
        if (x == _SC_SHARED_MEMORY_OBJECTS)
-               {*r = Mono_Posix_SysConf__SC_SHARED_MEMORY_OBJECTS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SHARED_MEMORY_OBJECTS; return 0;}
 #endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
 #ifdef _SC_SHELL
        if (x == _SC_SHELL)
-               {*r = Mono_Posix_SysConf__SC_SHELL; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SHELL; return 0;}
 #endif /* ndef _SC_SHELL */
 #ifdef _SC_SHRT_MAX
        if (x == _SC_SHRT_MAX)
-               {*r = Mono_Posix_SysConf__SC_SHRT_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_SHRT_MIN; return 0;}
 #endif /* ndef _SC_SHRT_MIN */
 #ifdef _SC_SIGNALS
        if (x == _SC_SIGNALS)
-               {*r = Mono_Posix_SysConf__SC_SIGNALS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SIGNALS; return 0;}
 #endif /* ndef _SC_SIGNALS */
 #ifdef _SC_SIGQUEUE_MAX
        if (x == _SC_SIGQUEUE_MAX)
-               {*r = Mono_Posix_SysConf__SC_SIGQUEUE_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SIGQUEUE_MAX; return 0;}
 #endif /* ndef _SC_SIGQUEUE_MAX */
 #ifdef _SC_SINGLE_PROCESS
        if (x == _SC_SINGLE_PROCESS)
-               {*r = Mono_Posix_SysConf__SC_SINGLE_PROCESS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SINGLE_PROCESS; return 0;}
 #endif /* ndef _SC_SINGLE_PROCESS */
 #ifdef _SC_SPAWN
        if (x == _SC_SPAWN)
-               {*r = Mono_Posix_SysConf__SC_SPAWN; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SPAWN; return 0;}
 #endif /* ndef _SC_SPAWN */
 #ifdef _SC_SPIN_LOCKS
        if (x == _SC_SPIN_LOCKS)
-               {*r = Mono_Posix_SysConf__SC_SPIN_LOCKS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SPIN_LOCKS; return 0;}
 #endif /* ndef _SC_SPIN_LOCKS */
 #ifdef _SC_SPORADIC_SERVER
        if (x == _SC_SPORADIC_SERVER)
-               {*r = Mono_Posix_SysConf__SC_SPORADIC_SERVER; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SPORADIC_SERVER; return 0;}
 #endif /* ndef _SC_SPORADIC_SERVER */
 #ifdef _SC_SSIZE_MAX
        if (x == _SC_SSIZE_MAX)
-               {*r = Mono_Posix_SysConf__SC_SSIZE_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SSIZE_MAX; return 0;}
 #endif /* ndef _SC_SSIZE_MAX */
 #ifdef _SC_STREAMS
        if (x == _SC_STREAMS)
-               {*r = Mono_Posix_SysConf__SC_STREAMS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_STREAMS; return 0;}
 #endif /* ndef _SC_STREAMS */
 #ifdef _SC_STREAM_MAX
        if (x == _SC_STREAM_MAX)
-               {*r = Mono_Posix_SysConf__SC_STREAM_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_STREAM_MAX; return 0;}
 #endif /* ndef _SC_STREAM_MAX */
 #ifdef _SC_SYMLOOP_MAX
        if (x == _SC_SYMLOOP_MAX)
-               {*r = Mono_Posix_SysConf__SC_SYMLOOP_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SYMLOOP_MAX; return 0;}
 #endif /* ndef _SC_SYMLOOP_MAX */
 #ifdef _SC_SYNCHRONIZED_IO
        if (x == _SC_SYNCHRONIZED_IO)
-               {*r = Mono_Posix_SysConf__SC_SYNCHRONIZED_IO; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_SYNCHRONIZED_IO; return 0;}
 #endif /* ndef _SC_SYNCHRONIZED_IO */
 #ifdef _SC_SYSTEM_DATABASE
        if (x == _SC_SYSTEM_DATABASE)
-               {*r = Mono_Posix_SysConf__SC_SYSTEM_DATABASE; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_SYSTEM_DATABASE_R; return 0;}
 #endif /* ndef _SC_SYSTEM_DATABASE_R */
 #ifdef _SC_THREADS
        if (x == _SC_THREADS)
-               {*r = Mono_Posix_SysConf__SC_THREADS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_THREADS; return 0;}
 #endif /* ndef _SC_THREADS */
 #ifdef _SC_THREAD_ATTR_STACKADDR
        if (x == _SC_THREAD_ATTR_STACKADDR)
-               {*r = Mono_Posix_SysConf__SC_THREAD_ATTR_STACKADDR; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_ATTR_STACKSIZE; return 0;}
 #endif /* ndef _SC_THREAD_ATTR_STACKSIZE */
 #ifdef _SC_THREAD_CPUTIME
        if (x == _SC_THREAD_CPUTIME)
-               {*r = Mono_Posix_SysConf__SC_THREAD_CPUTIME; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_CPUTIME; return 0;}
 #endif /* ndef _SC_THREAD_CPUTIME */
 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
        if (x == _SC_THREAD_DESTRUCTOR_ITERATIONS)
-               {*r = Mono_Posix_SysConf__SC_THREAD_DESTRUCTOR_ITERATIONS; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_KEYS_MAX; return 0;}
 #endif /* ndef _SC_THREAD_KEYS_MAX */
 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
        if (x == _SC_THREAD_PRIORITY_SCHEDULING)
-               {*r = Mono_Posix_SysConf__SC_THREAD_PRIORITY_SCHEDULING; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_PROCESS_SHARED; return 0;}
 #endif /* ndef _SC_THREAD_PROCESS_SHARED */
 #ifdef _SC_THREAD_SAFE_FUNCTIONS
        if (x == _SC_THREAD_SAFE_FUNCTIONS)
-               {*r = Mono_Posix_SysConf__SC_THREAD_SAFE_FUNCTIONS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_SAFE_FUNCTIONS; return 0;}
 #endif /* ndef _SC_THREAD_SAFE_FUNCTIONS */
 #ifdef _SC_THREAD_SPORADIC_SERVER
        if (x == _SC_THREAD_SPORADIC_SERVER)
-               {*r = Mono_Posix_SysConf__SC_THREAD_SPORADIC_SERVER; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_SPORADIC_SERVER; return 0;}
 #endif /* ndef _SC_THREAD_SPORADIC_SERVER */
 #ifdef _SC_THREAD_STACK_MIN
        if (x == _SC_THREAD_STACK_MIN)
-               {*r = Mono_Posix_SysConf__SC_THREAD_STACK_MIN; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_THREAD_THREADS_MAX; return 0;}
 #endif /* ndef _SC_THREAD_THREADS_MAX */
 #ifdef _SC_TIMEOUTS
        if (x == _SC_TIMEOUTS)
-               {*r = Mono_Posix_SysConf__SC_TIMEOUTS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TIMEOUTS; return 0;}
 #endif /* ndef _SC_TIMEOUTS */
 #ifdef _SC_TIMERS
        if (x == _SC_TIMERS)
-               {*r = Mono_Posix_SysConf__SC_TIMERS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TIMERS; return 0;}
 #endif /* ndef _SC_TIMERS */
 #ifdef _SC_TIMER_MAX
        if (x == _SC_TIMER_MAX)
-               {*r = Mono_Posix_SysConf__SC_TIMER_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TIMER_MAX; return 0;}
 #endif /* ndef _SC_TIMER_MAX */
 #ifdef _SC_TRACE
        if (x == _SC_TRACE)
-               {*r = Mono_Posix_SysConf__SC_TRACE; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_TRACE_LOG; return 0;}
 #endif /* ndef _SC_TRACE_LOG */
 #ifdef _SC_TTY_NAME_MAX
        if (x == _SC_TTY_NAME_MAX)
-               {*r = Mono_Posix_SysConf__SC_TTY_NAME_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TTY_NAME_MAX; return 0;}
 #endif /* ndef _SC_TTY_NAME_MAX */
 #ifdef _SC_TYPED_MEMORY_OBJECTS
        if (x == _SC_TYPED_MEMORY_OBJECTS)
-               {*r = Mono_Posix_SysConf__SC_TYPED_MEMORY_OBJECTS; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TYPED_MEMORY_OBJECTS; return 0;}
 #endif /* ndef _SC_TYPED_MEMORY_OBJECTS */
 #ifdef _SC_TZNAME_MAX
        if (x == _SC_TZNAME_MAX)
-               {*r = Mono_Posix_SysConf__SC_TZNAME_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_TZNAME_MAX; return 0;}
 #endif /* ndef _SC_TZNAME_MAX */
 #ifdef _SC_T_IOV_MAX
        if (x == _SC_T_IOV_MAX)
-               {*r = Mono_Posix_SysConf__SC_T_IOV_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_T_IOV_MAX; return 0;}
 #endif /* ndef _SC_T_IOV_MAX */
 #ifdef _SC_UCHAR_MAX
        if (x == _SC_UCHAR_MAX)
-               {*r = Mono_Posix_SysConf__SC_UCHAR_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_UINT_MAX; return 0;}
 #endif /* ndef _SC_UINT_MAX */
 #ifdef _SC_UIO_MAXIOV
        if (x == _SC_UIO_MAXIOV)
-               {*r = Mono_Posix_SysConf__SC_UIO_MAXIOV; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_UIO_MAXIOV; return 0;}
 #endif /* ndef _SC_UIO_MAXIOV */
 #ifdef _SC_ULONG_MAX
        if (x == _SC_ULONG_MAX)
-               {*r = Mono_Posix_SysConf__SC_ULONG_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_ULONG_MAX; return 0;}
 #endif /* ndef _SC_ULONG_MAX */
 #ifdef _SC_USER_GROUPS
        if (x == _SC_USER_GROUPS)
-               {*r = Mono_Posix_SysConf__SC_USER_GROUPS; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_USER_GROUPS_R; return 0;}
 #endif /* ndef _SC_USER_GROUPS_R */
 #ifdef _SC_USHRT_MAX
        if (x == _SC_USHRT_MAX)
-               {*r = Mono_Posix_SysConf__SC_USHRT_MAX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_USHRT_MAX; return 0;}
 #endif /* ndef _SC_USHRT_MAX */
 #ifdef _SC_V6_ILP32_OFF32
        if (x == _SC_V6_ILP32_OFF32)
-               {*r = Mono_Posix_SysConf__SC_V6_ILP32_OFF32; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_V6_LPBIG_OFFBIG; return 0;}
 #endif /* ndef _SC_V6_LPBIG_OFFBIG */
 #ifdef _SC_VERSION
        if (x == _SC_VERSION)
-               {*r = Mono_Posix_SysConf__SC_VERSION; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_VERSION; return 0;}
 #endif /* ndef _SC_VERSION */
 #ifdef _SC_WORD_BIT
        if (x == _SC_WORD_BIT)
-               {*r = Mono_Posix_SysConf__SC_WORD_BIT; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_WORD_BIT; return 0;}
 #endif /* ndef _SC_WORD_BIT */
 #ifdef _SC_XBS5_ILP32_OFF32
        if (x == _SC_XBS5_ILP32_OFF32)
-               {*r = Mono_Posix_SysConf__SC_XBS5_ILP32_OFF32; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_XBS5_LPBIG_OFFBIG; return 0;}
 #endif /* ndef _SC_XBS5_LPBIG_OFFBIG */
 #ifdef _SC_XOPEN_CRYPT
        if (x == _SC_XOPEN_CRYPT)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_CRYPT; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_ENH_I18N; return 0;}
 #endif /* ndef _SC_XOPEN_ENH_I18N */
 #ifdef _SC_XOPEN_LEGACY
        if (x == _SC_XOPEN_LEGACY)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_LEGACY; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_REALTIME_THREADS; return 0;}
 #endif /* ndef _SC_XOPEN_REALTIME_THREADS */
 #ifdef _SC_XOPEN_SHM
        if (x == _SC_XOPEN_SHM)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_SHM; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_SHM; return 0;}
 #endif /* ndef _SC_XOPEN_SHM */
 #ifdef _SC_XOPEN_UNIX
        if (x == _SC_XOPEN_UNIX)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_UNIX; return 0;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_UNIX; return 0;}
 #endif /* ndef _SC_XOPEN_UNIX */
 #ifdef _SC_XOPEN_VERSION
        if (x == _SC_XOPEN_VERSION)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_VERSION; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_XCU_VERSION; return 0;}
 #endif /* ndef _SC_XOPEN_XCU_VERSION */
 #ifdef _SC_XOPEN_XPG2
        if (x == _SC_XOPEN_XPG2)
-               {*r = Mono_Posix_SysConf__SC_XOPEN_XPG2; return 0;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__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;}
+               {*r = Mono_Posix_SysconfName__SC_XOPEN_XPG4; return 0;}
 #endif /* ndef _SC_XOPEN_XPG4 */
        errno = EINVAL; return -1;
 }
 
+int Mono_Posix_FromSyslogFacility (int x, int *r)
+{
+       *r = 0;
+       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_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_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_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_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_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_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 */
+       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_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_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_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_USER)
+#ifdef LOG_USER
+               {*r = LOG_USER; return 0;}
+#else /* def LOG_USER */
+               {errno = EINVAL; return -1;}
+#endif /* ndef LOG_USER */
+       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 == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToSyslogFacility (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef LOG_AUTH
+       if (x == LOG_AUTH)
+               {*r = Mono_Posix_SyslogFacility_LOG_AUTH; return 0;}
+#endif /* ndef LOG_AUTH */
+#ifdef LOG_AUTHPRIV
+       if (x == LOG_AUTHPRIV)
+               {*r = Mono_Posix_SyslogFacility_LOG_AUTHPRIV; return 0;}
+#endif /* ndef LOG_AUTHPRIV */
+#ifdef LOG_CRON
+       if (x == LOG_CRON)
+               {*r = Mono_Posix_SyslogFacility_LOG_CRON; return 0;}
+#endif /* ndef LOG_CRON */
+#ifdef LOG_DAEMON
+       if (x == LOG_DAEMON)
+               {*r = Mono_Posix_SyslogFacility_LOG_DAEMON; return 0;}
+#endif /* ndef LOG_DAEMON */
+#ifdef LOG_FTP
+       if (x == LOG_FTP)
+               {*r = Mono_Posix_SyslogFacility_LOG_FTP; return 0;}
+#endif /* ndef LOG_FTP */
+#ifdef LOG_KERN
+       if (x == LOG_KERN)
+               {*r = Mono_Posix_SyslogFacility_LOG_KERN; return 0;}
+#endif /* ndef LOG_KERN */
+#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 */
+#ifdef LOG_LPR
+       if (x == LOG_LPR)
+               {*r = Mono_Posix_SyslogFacility_LOG_LPR; return 0;}
+#endif /* ndef LOG_LPR */
+#ifdef LOG_MAIL
+       if (x == LOG_MAIL)
+               {*r = Mono_Posix_SyslogFacility_LOG_MAIL; return 0;}
+#endif /* ndef LOG_MAIL */
+#ifdef LOG_NEWS
+       if (x == LOG_NEWS)
+               {*r = Mono_Posix_SyslogFacility_LOG_NEWS; return 0;}
+#endif /* ndef LOG_NEWS */
+#ifdef LOG_SYSLOG
+       if (x == LOG_SYSLOG)
+               {*r = Mono_Posix_SyslogFacility_LOG_SYSLOG; return 0;}
+#endif /* ndef LOG_SYSLOG */
+#ifdef LOG_USER
+       if (x == LOG_USER)
+               {*r = Mono_Posix_SyslogFacility_LOG_USER; return 0;}
+#endif /* ndef LOG_USER */
+#ifdef LOG_UUCP
+       if (x == LOG_UUCP)
+               {*r = Mono_Posix_SyslogFacility_LOG_UUCP; return 0;}
+#endif /* ndef LOG_UUCP */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromSyslogLevel (int x, int *r)
+{
+       *r = 0;
+       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_DEBUG)
+#ifdef LOG_DEBUG
+               {*r = LOG_DEBUG; return 0;}
+#else /* def LOG_DEBUG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef LOG_DEBUG */
+       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_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_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_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_WARNING)
+#ifdef LOG_WARNING
+               {*r = LOG_WARNING; return 0;}
+#else /* def LOG_WARNING */
+               {errno = EINVAL; return -1;}
+#endif /* ndef LOG_WARNING */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToSyslogLevel (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#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_DEBUG
+       if (x == LOG_DEBUG)
+               {*r = Mono_Posix_SyslogLevel_LOG_DEBUG; return 0;}
+#endif /* ndef LOG_DEBUG */
+#ifdef LOG_EMERG
+       if (x == LOG_EMERG)
+               {*r = Mono_Posix_SyslogLevel_LOG_EMERG; return 0;}
+#endif /* ndef LOG_EMERG */
+#ifdef LOG_ERR
+       if (x == LOG_ERR)
+               {*r = Mono_Posix_SyslogLevel_LOG_ERR; return 0;}
+#endif /* ndef LOG_ERR */
+#ifdef LOG_INFO
+       if (x == LOG_INFO)
+               {*r = Mono_Posix_SyslogLevel_LOG_INFO; return 0;}
+#endif /* ndef LOG_INFO */
+#ifdef LOG_NOTICE
+       if (x == LOG_NOTICE)
+               {*r = Mono_Posix_SyslogLevel_LOG_NOTICE; return 0;}
+#endif /* ndef LOG_NOTICE */
+#ifdef LOG_WARNING
+       if (x == LOG_WARNING)
+               {*r = Mono_Posix_SyslogLevel_LOG_WARNING; return 0;}
+#endif /* ndef LOG_WARNING */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromSyslogOptions (int x, int *r)
+{
+       *r = 0;
+       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_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_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_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
+#ifdef LOG_PERROR
+               *r |= LOG_PERROR;
+#else /* def LOG_PERROR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef LOG_PERROR */
+       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 == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToSyslogOptions (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef LOG_CONS
+       if ((x & LOG_CONS) == LOG_CONS)
+               *r |= Mono_Posix_SyslogOptions_LOG_CONS;
+#endif /* ndef LOG_CONS */
+#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_ODELAY
+       if ((x & LOG_ODELAY) == LOG_ODELAY)
+               *r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
+#endif /* ndef LOG_ODELAY */
+#ifdef LOG_PERROR
+       if ((x & LOG_PERROR) == LOG_PERROR)
+               *r |= Mono_Posix_SyslogOptions_LOG_PERROR;
+#endif /* ndef LOG_PERROR */
+#ifdef LOG_PID
+       if ((x & LOG_PID) == LOG_PID)
+               *r |= Mono_Posix_SyslogOptions_LOG_PID;
+#endif /* ndef LOG_PID */
+       return 0;
+}
+
+#ifdef HAVE_STRUCT_TIMESPEC
+int
+Mono_Posix_FromTimespec (struct Mono_Posix_Timespec *from, struct timespec *to)
+{
+       _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
+       _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tv_sec  = from->tv_sec;
+       to->tv_nsec = from->tv_nsec;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMESPEC */
+
+
+#ifdef HAVE_STRUCT_TIMESPEC
+int
+Mono_Posix_ToTimespec (struct timespec *from, struct Mono_Posix_Timespec *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
+       _cnm_return_val_if_overflow (gint64, from->tv_nsec, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tv_sec  = from->tv_sec;
+       to->tv_nsec = from->tv_nsec;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMESPEC */
+
+
+#ifdef HAVE_STRUCT_TIMEVAL
+int
+Mono_Posix_FromTimeval (struct Mono_Posix_Timeval *from, struct timeval *to)
+{
+       _cnm_return_val_if_overflow (time_t, from->tv_sec, -1);
+       _cnm_return_val_if_overflow (suseconds_t, from->tv_usec, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tv_sec  = from->tv_sec;
+       to->tv_usec = from->tv_usec;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMEVAL */
+
+
+#ifdef HAVE_STRUCT_TIMEVAL
+int
+Mono_Posix_ToTimeval (struct timeval *from, struct Mono_Posix_Timeval *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->tv_sec, -1);
+       _cnm_return_val_if_overflow (gint64, from->tv_usec, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tv_sec  = from->tv_sec;
+       to->tv_usec = from->tv_usec;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMEVAL */
+
+
+#ifdef HAVE_STRUCT_TIMEZONE
+int
+Mono_Posix_FromTimezone (struct Mono_Posix_Timezone *from, struct timezone *to)
+{
+       _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
+       _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tz_minuteswest = from->tz_minuteswest;
+       to->tz_dsttime     = from->tz_dsttime;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMEZONE */
+
+
+#ifdef HAVE_STRUCT_TIMEZONE
+int
+Mono_Posix_ToTimezone (struct timezone *from, struct Mono_Posix_Timezone *to)
+{
+       _cnm_return_val_if_overflow (int, from->tz_minuteswest, -1);
+       _cnm_return_val_if_overflow (int, from->tz_dsttime, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->tz_minuteswest = from->tz_minuteswest;
+       to->tz_dsttime     = from->tz_dsttime;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_TIMEZONE */
+
+
+int Mono_Posix_FromUnixAddressFamily (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_UnixAddressFamily_AF_ALG)
+#ifdef AF_ALG
+               {*r = AF_ALG; return 0;}
+#else /* def AF_ALG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ALG */
+       if (x == Mono_Posix_UnixAddressFamily_AF_APPLETALK)
+#ifdef AF_APPLETALK
+               {*r = AF_APPLETALK; return 0;}
+#else /* def AF_APPLETALK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_APPLETALK */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ASH)
+#ifdef AF_ASH
+               {*r = AF_ASH; return 0;}
+#else /* def AF_ASH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ASH */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ATMPVC)
+#ifdef AF_ATMPVC
+               {*r = AF_ATMPVC; return 0;}
+#else /* def AF_ATMPVC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ATMPVC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ATMSVC)
+#ifdef AF_ATMSVC
+               {*r = AF_ATMSVC; return 0;}
+#else /* def AF_ATMSVC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ATMSVC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_AX25)
+#ifdef AF_AX25
+               {*r = AF_AX25; return 0;}
+#else /* def AF_AX25 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_AX25 */
+       if (x == Mono_Posix_UnixAddressFamily_AF_BLUETOOTH)
+#ifdef AF_BLUETOOTH
+               {*r = AF_BLUETOOTH; return 0;}
+#else /* def AF_BLUETOOTH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_BLUETOOTH */
+       if (x == Mono_Posix_UnixAddressFamily_AF_BRIDGE)
+#ifdef AF_BRIDGE
+               {*r = AF_BRIDGE; return 0;}
+#else /* def AF_BRIDGE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_BRIDGE */
+       if (x == Mono_Posix_UnixAddressFamily_AF_CAIF)
+#ifdef AF_CAIF
+               {*r = AF_CAIF; return 0;}
+#else /* def AF_CAIF */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_CAIF */
+       if (x == Mono_Posix_UnixAddressFamily_AF_CAN)
+#ifdef AF_CAN
+               {*r = AF_CAN; return 0;}
+#else /* def AF_CAN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_CAN */
+       if (x == Mono_Posix_UnixAddressFamily_AF_DECnet)
+#ifdef AF_DECnet
+               {*r = AF_DECnet; return 0;}
+#else /* def AF_DECnet */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_DECnet */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ECONET)
+#ifdef AF_ECONET
+               {*r = AF_ECONET; return 0;}
+#else /* def AF_ECONET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ECONET */
+       if (x == Mono_Posix_UnixAddressFamily_AF_IEEE802154)
+#ifdef AF_IEEE802154
+               {*r = AF_IEEE802154; return 0;}
+#else /* def AF_IEEE802154 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_IEEE802154 */
+       if (x == Mono_Posix_UnixAddressFamily_AF_INET)
+#ifdef AF_INET
+               {*r = AF_INET; return 0;}
+#else /* def AF_INET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_INET */
+       if (x == Mono_Posix_UnixAddressFamily_AF_INET6)
+#ifdef AF_INET6
+               {*r = AF_INET6; return 0;}
+#else /* def AF_INET6 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_INET6 */
+       if (x == Mono_Posix_UnixAddressFamily_AF_IPX)
+#ifdef AF_IPX
+               {*r = AF_IPX; return 0;}
+#else /* def AF_IPX */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_IPX */
+       if (x == Mono_Posix_UnixAddressFamily_AF_IRDA)
+#ifdef AF_IRDA
+               {*r = AF_IRDA; return 0;}
+#else /* def AF_IRDA */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_IRDA */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ISDN)
+#ifdef AF_ISDN
+               {*r = AF_ISDN; return 0;}
+#else /* def AF_ISDN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ISDN */
+       if (x == Mono_Posix_UnixAddressFamily_AF_IUCV)
+#ifdef AF_IUCV
+               {*r = AF_IUCV; return 0;}
+#else /* def AF_IUCV */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_IUCV */
+       if (x == Mono_Posix_UnixAddressFamily_AF_KEY)
+#ifdef AF_KEY
+               {*r = AF_KEY; return 0;}
+#else /* def AF_KEY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_KEY */
+       if (x == Mono_Posix_UnixAddressFamily_AF_LLC)
+#ifdef AF_LLC
+               {*r = AF_LLC; return 0;}
+#else /* def AF_LLC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_LLC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_NETBEUI)
+#ifdef AF_NETBEUI
+               {*r = AF_NETBEUI; return 0;}
+#else /* def AF_NETBEUI */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_NETBEUI */
+       if (x == Mono_Posix_UnixAddressFamily_AF_NETLINK)
+#ifdef AF_NETLINK
+               {*r = AF_NETLINK; return 0;}
+#else /* def AF_NETLINK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_NETLINK */
+       if (x == Mono_Posix_UnixAddressFamily_AF_NETROM)
+#ifdef AF_NETROM
+               {*r = AF_NETROM; return 0;}
+#else /* def AF_NETROM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_NETROM */
+       if (x == Mono_Posix_UnixAddressFamily_AF_NFC)
+#ifdef AF_NFC
+               {*r = AF_NFC; return 0;}
+#else /* def AF_NFC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_NFC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_PACKET)
+#ifdef AF_PACKET
+               {*r = AF_PACKET; return 0;}
+#else /* def AF_PACKET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_PACKET */
+       if (x == Mono_Posix_UnixAddressFamily_AF_PHONET)
+#ifdef AF_PHONET
+               {*r = AF_PHONET; return 0;}
+#else /* def AF_PHONET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_PHONET */
+       if (x == Mono_Posix_UnixAddressFamily_AF_PPPOX)
+#ifdef AF_PPPOX
+               {*r = AF_PPPOX; return 0;}
+#else /* def AF_PPPOX */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_PPPOX */
+       if (x == Mono_Posix_UnixAddressFamily_AF_RDS)
+#ifdef AF_RDS
+               {*r = AF_RDS; return 0;}
+#else /* def AF_RDS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_RDS */
+       if (x == Mono_Posix_UnixAddressFamily_AF_ROSE)
+#ifdef AF_ROSE
+               {*r = AF_ROSE; return 0;}
+#else /* def AF_ROSE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_ROSE */
+       if (x == Mono_Posix_UnixAddressFamily_AF_RXRPC)
+#ifdef AF_RXRPC
+               {*r = AF_RXRPC; return 0;}
+#else /* def AF_RXRPC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_RXRPC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_SECURITY)
+#ifdef AF_SECURITY
+               {*r = AF_SECURITY; return 0;}
+#else /* def AF_SECURITY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_SECURITY */
+       if (x == Mono_Posix_UnixAddressFamily_AF_SNA)
+#ifdef AF_SNA
+               {*r = AF_SNA; return 0;}
+#else /* def AF_SNA */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_SNA */
+       if (x == Mono_Posix_UnixAddressFamily_AF_TIPC)
+#ifdef AF_TIPC
+               {*r = AF_TIPC; return 0;}
+#else /* def AF_TIPC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_TIPC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_UNIX)
+#ifdef AF_UNIX
+               {*r = AF_UNIX; return 0;}
+#else /* def AF_UNIX */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_UNIX */
+       if (x == Mono_Posix_UnixAddressFamily_AF_UNSPEC)
+#ifdef AF_UNSPEC
+               {*r = AF_UNSPEC; return 0;}
+#else /* def AF_UNSPEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_UNSPEC */
+       if (x == Mono_Posix_UnixAddressFamily_AF_VSOCK)
+#ifdef AF_VSOCK
+               {*r = AF_VSOCK; return 0;}
+#else /* def AF_VSOCK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_VSOCK */
+       if (x == Mono_Posix_UnixAddressFamily_AF_WANPIPE)
+#ifdef AF_WANPIPE
+               {*r = AF_WANPIPE; return 0;}
+#else /* def AF_WANPIPE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_WANPIPE */
+       if (x == Mono_Posix_UnixAddressFamily_AF_X25)
+#ifdef AF_X25
+               {*r = AF_X25; return 0;}
+#else /* def AF_X25 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef AF_X25 */
+       if (x == Mono_Posix_UnixAddressFamily_Unknown)
+#ifdef Unknown
+               {*r = Unknown; return 0;}
+#else /* def Unknown */
+               {errno = EINVAL; return -1;}
+#endif /* ndef Unknown */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToUnixAddressFamily (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef AF_ALG
+       if (x == AF_ALG)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ALG; return 0;}
+#endif /* ndef AF_ALG */
+#ifdef AF_APPLETALK
+       if (x == AF_APPLETALK)
+               {*r = Mono_Posix_UnixAddressFamily_AF_APPLETALK; return 0;}
+#endif /* ndef AF_APPLETALK */
+#ifdef AF_ASH
+       if (x == AF_ASH)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ASH; return 0;}
+#endif /* ndef AF_ASH */
+#ifdef AF_ATMPVC
+       if (x == AF_ATMPVC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ATMPVC; return 0;}
+#endif /* ndef AF_ATMPVC */
+#ifdef AF_ATMSVC
+       if (x == AF_ATMSVC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ATMSVC; return 0;}
+#endif /* ndef AF_ATMSVC */
+#ifdef AF_AX25
+       if (x == AF_AX25)
+               {*r = Mono_Posix_UnixAddressFamily_AF_AX25; return 0;}
+#endif /* ndef AF_AX25 */
+#ifdef AF_BLUETOOTH
+       if (x == AF_BLUETOOTH)
+               {*r = Mono_Posix_UnixAddressFamily_AF_BLUETOOTH; return 0;}
+#endif /* ndef AF_BLUETOOTH */
+#ifdef AF_BRIDGE
+       if (x == AF_BRIDGE)
+               {*r = Mono_Posix_UnixAddressFamily_AF_BRIDGE; return 0;}
+#endif /* ndef AF_BRIDGE */
+#ifdef AF_CAIF
+       if (x == AF_CAIF)
+               {*r = Mono_Posix_UnixAddressFamily_AF_CAIF; return 0;}
+#endif /* ndef AF_CAIF */
+#ifdef AF_CAN
+       if (x == AF_CAN)
+               {*r = Mono_Posix_UnixAddressFamily_AF_CAN; return 0;}
+#endif /* ndef AF_CAN */
+#ifdef AF_DECnet
+       if (x == AF_DECnet)
+               {*r = Mono_Posix_UnixAddressFamily_AF_DECnet; return 0;}
+#endif /* ndef AF_DECnet */
+#ifdef AF_ECONET
+       if (x == AF_ECONET)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ECONET; return 0;}
+#endif /* ndef AF_ECONET */
+#ifdef AF_IEEE802154
+       if (x == AF_IEEE802154)
+               {*r = Mono_Posix_UnixAddressFamily_AF_IEEE802154; return 0;}
+#endif /* ndef AF_IEEE802154 */
+#ifdef AF_INET
+       if (x == AF_INET)
+               {*r = Mono_Posix_UnixAddressFamily_AF_INET; return 0;}
+#endif /* ndef AF_INET */
+#ifdef AF_INET6
+       if (x == AF_INET6)
+               {*r = Mono_Posix_UnixAddressFamily_AF_INET6; return 0;}
+#endif /* ndef AF_INET6 */
+#ifdef AF_IPX
+       if (x == AF_IPX)
+               {*r = Mono_Posix_UnixAddressFamily_AF_IPX; return 0;}
+#endif /* ndef AF_IPX */
+#ifdef AF_IRDA
+       if (x == AF_IRDA)
+               {*r = Mono_Posix_UnixAddressFamily_AF_IRDA; return 0;}
+#endif /* ndef AF_IRDA */
+#ifdef AF_ISDN
+       if (x == AF_ISDN)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ISDN; return 0;}
+#endif /* ndef AF_ISDN */
+#ifdef AF_IUCV
+       if (x == AF_IUCV)
+               {*r = Mono_Posix_UnixAddressFamily_AF_IUCV; return 0;}
+#endif /* ndef AF_IUCV */
+#ifdef AF_KEY
+       if (x == AF_KEY)
+               {*r = Mono_Posix_UnixAddressFamily_AF_KEY; return 0;}
+#endif /* ndef AF_KEY */
+#ifdef AF_LLC
+       if (x == AF_LLC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_LLC; return 0;}
+#endif /* ndef AF_LLC */
+#ifdef AF_NETBEUI
+       if (x == AF_NETBEUI)
+               {*r = Mono_Posix_UnixAddressFamily_AF_NETBEUI; return 0;}
+#endif /* ndef AF_NETBEUI */
+#ifdef AF_NETLINK
+       if (x == AF_NETLINK)
+               {*r = Mono_Posix_UnixAddressFamily_AF_NETLINK; return 0;}
+#endif /* ndef AF_NETLINK */
+#ifdef AF_NETROM
+       if (x == AF_NETROM)
+               {*r = Mono_Posix_UnixAddressFamily_AF_NETROM; return 0;}
+#endif /* ndef AF_NETROM */
+#ifdef AF_NFC
+       if (x == AF_NFC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_NFC; return 0;}
+#endif /* ndef AF_NFC */
+#ifdef AF_PACKET
+       if (x == AF_PACKET)
+               {*r = Mono_Posix_UnixAddressFamily_AF_PACKET; return 0;}
+#endif /* ndef AF_PACKET */
+#ifdef AF_PHONET
+       if (x == AF_PHONET)
+               {*r = Mono_Posix_UnixAddressFamily_AF_PHONET; return 0;}
+#endif /* ndef AF_PHONET */
+#ifdef AF_PPPOX
+       if (x == AF_PPPOX)
+               {*r = Mono_Posix_UnixAddressFamily_AF_PPPOX; return 0;}
+#endif /* ndef AF_PPPOX */
+#ifdef AF_RDS
+       if (x == AF_RDS)
+               {*r = Mono_Posix_UnixAddressFamily_AF_RDS; return 0;}
+#endif /* ndef AF_RDS */
+#ifdef AF_ROSE
+       if (x == AF_ROSE)
+               {*r = Mono_Posix_UnixAddressFamily_AF_ROSE; return 0;}
+#endif /* ndef AF_ROSE */
+#ifdef AF_RXRPC
+       if (x == AF_RXRPC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_RXRPC; return 0;}
+#endif /* ndef AF_RXRPC */
+#ifdef AF_SECURITY
+       if (x == AF_SECURITY)
+               {*r = Mono_Posix_UnixAddressFamily_AF_SECURITY; return 0;}
+#endif /* ndef AF_SECURITY */
+#ifdef AF_SNA
+       if (x == AF_SNA)
+               {*r = Mono_Posix_UnixAddressFamily_AF_SNA; return 0;}
+#endif /* ndef AF_SNA */
+#ifdef AF_TIPC
+       if (x == AF_TIPC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_TIPC; return 0;}
+#endif /* ndef AF_TIPC */
+#ifdef AF_UNIX
+       if (x == AF_UNIX)
+               {*r = Mono_Posix_UnixAddressFamily_AF_UNIX; return 0;}
+#endif /* ndef AF_UNIX */
+#ifdef AF_UNSPEC
+       if (x == AF_UNSPEC)
+               {*r = Mono_Posix_UnixAddressFamily_AF_UNSPEC; return 0;}
+#endif /* ndef AF_UNSPEC */
+#ifdef AF_VSOCK
+       if (x == AF_VSOCK)
+               {*r = Mono_Posix_UnixAddressFamily_AF_VSOCK; return 0;}
+#endif /* ndef AF_VSOCK */
+#ifdef AF_WANPIPE
+       if (x == AF_WANPIPE)
+               {*r = Mono_Posix_UnixAddressFamily_AF_WANPIPE; return 0;}
+#endif /* ndef AF_WANPIPE */
+#ifdef AF_X25
+       if (x == AF_X25)
+               {*r = Mono_Posix_UnixAddressFamily_AF_X25; return 0;}
+#endif /* ndef AF_X25 */
+#ifdef Unknown
+       if (x == Unknown)
+               {*r = Mono_Posix_UnixAddressFamily_Unknown; return 0;}
+#endif /* ndef Unknown */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromUnixSocketControlMessage (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS)
+#ifdef SCM_CREDENTIALS
+               {*r = SCM_CREDENTIALS; return 0;}
+#else /* def SCM_CREDENTIALS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SCM_CREDENTIALS */
+       if (x == Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS)
+#ifdef SCM_RIGHTS
+               {*r = SCM_RIGHTS; return 0;}
+#else /* def SCM_RIGHTS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SCM_RIGHTS */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToUnixSocketControlMessage (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef SCM_CREDENTIALS
+       if (x == SCM_CREDENTIALS)
+               {*r = Mono_Posix_UnixSocketControlMessage_SCM_CREDENTIALS; return 0;}
+#endif /* ndef SCM_CREDENTIALS */
+#ifdef SCM_RIGHTS
+       if (x == SCM_RIGHTS)
+               {*r = Mono_Posix_UnixSocketControlMessage_SCM_RIGHTS; return 0;}
+#endif /* ndef SCM_RIGHTS */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromUnixSocketFlags (int x, int *r)
+{
+       *r = 0;
+       if ((x & Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC) == Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC)
+#ifdef SOCK_CLOEXEC
+               *r |= SOCK_CLOEXEC;
+#else /* def SOCK_CLOEXEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_CLOEXEC */
+       if ((x & Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK) == Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK)
+#ifdef SOCK_NONBLOCK
+               *r |= SOCK_NONBLOCK;
+#else /* def SOCK_NONBLOCK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_NONBLOCK */
+       if (x == 0)
+               return 0;
+       return 0;
+}
+
+int Mono_Posix_ToUnixSocketFlags (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef SOCK_CLOEXEC
+       if ((x & SOCK_CLOEXEC) == SOCK_CLOEXEC)
+               *r |= Mono_Posix_UnixSocketFlags_SOCK_CLOEXEC;
+#endif /* ndef SOCK_CLOEXEC */
+#ifdef SOCK_NONBLOCK
+       if ((x & SOCK_NONBLOCK) == SOCK_NONBLOCK)
+               *r |= Mono_Posix_UnixSocketFlags_SOCK_NONBLOCK;
+#endif /* ndef SOCK_NONBLOCK */
+       return 0;
+}
+
+int Mono_Posix_FromUnixSocketOptionName (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN)
+#ifdef SO_ACCEPTCONN
+               {*r = SO_ACCEPTCONN; return 0;}
+#else /* def SO_ACCEPTCONN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_ACCEPTCONN */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER)
+#ifdef SO_ATTACH_FILTER
+               {*r = SO_ATTACH_FILTER; return 0;}
+#else /* def SO_ATTACH_FILTER */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_ATTACH_FILTER */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE)
+#ifdef SO_BINDTODEVICE
+               {*r = SO_BINDTODEVICE; return 0;}
+#else /* def SO_BINDTODEVICE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_BINDTODEVICE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_BROADCAST)
+#ifdef SO_BROADCAST
+               {*r = SO_BROADCAST; return 0;}
+#else /* def SO_BROADCAST */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_BROADCAST */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT)
+#ifdef SO_BSDCOMPAT
+               {*r = SO_BSDCOMPAT; return 0;}
+#else /* def SO_BSDCOMPAT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_BSDCOMPAT */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL)
+#ifdef SO_BUSY_POLL
+               {*r = SO_BUSY_POLL; return 0;}
+#else /* def SO_BUSY_POLL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_BUSY_POLL */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_DEBUG)
+#ifdef SO_DEBUG
+               {*r = SO_DEBUG; return 0;}
+#else /* def SO_DEBUG */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_DEBUG */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER)
+#ifdef SO_DETACH_FILTER
+               {*r = SO_DETACH_FILTER; return 0;}
+#else /* def SO_DETACH_FILTER */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_DETACH_FILTER */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_DOMAIN)
+#ifdef SO_DOMAIN
+               {*r = SO_DOMAIN; return 0;}
+#else /* def SO_DOMAIN */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_DOMAIN */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_DONTROUTE)
+#ifdef SO_DONTROUTE
+               {*r = SO_DONTROUTE; return 0;}
+#else /* def SO_DONTROUTE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_DONTROUTE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_ERROR)
+#ifdef SO_ERROR
+               {*r = SO_ERROR; return 0;}
+#else /* def SO_ERROR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_ERROR */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE)
+#ifdef SO_KEEPALIVE
+               {*r = SO_KEEPALIVE; return 0;}
+#else /* def SO_KEEPALIVE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_KEEPALIVE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_LINGER)
+#ifdef SO_LINGER
+               {*r = SO_LINGER; return 0;}
+#else /* def SO_LINGER */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_LINGER */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER)
+#ifdef SO_LOCK_FILTER
+               {*r = SO_LOCK_FILTER; return 0;}
+#else /* def SO_LOCK_FILTER */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_LOCK_FILTER */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_MARK)
+#ifdef SO_MARK
+               {*r = SO_MARK; return 0;}
+#else /* def SO_MARK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_MARK */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE)
+#ifdef SO_MAX_PACING_RATE
+               {*r = SO_MAX_PACING_RATE; return 0;}
+#else /* def SO_MAX_PACING_RATE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_MAX_PACING_RATE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_NOFCS)
+#ifdef SO_NOFCS
+               {*r = SO_NOFCS; return 0;}
+#else /* def SO_NOFCS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_NOFCS */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_NO_CHECK)
+#ifdef SO_NO_CHECK
+               {*r = SO_NO_CHECK; return 0;}
+#else /* def SO_NO_CHECK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_NO_CHECK */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_OOBINLINE)
+#ifdef SO_OOBINLINE
+               {*r = SO_OOBINLINE; return 0;}
+#else /* def SO_OOBINLINE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_OOBINLINE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PASSCRED)
+#ifdef SO_PASSCRED
+               {*r = SO_PASSCRED; return 0;}
+#else /* def SO_PASSCRED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PASSCRED */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PASSSEC)
+#ifdef SO_PASSSEC
+               {*r = SO_PASSSEC; return 0;}
+#else /* def SO_PASSSEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PASSSEC */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF)
+#ifdef SO_PEEK_OFF
+               {*r = SO_PEEK_OFF; return 0;}
+#else /* def SO_PEEK_OFF */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PEEK_OFF */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PEERCRED)
+#ifdef SO_PEERCRED
+               {*r = SO_PEERCRED; return 0;}
+#else /* def SO_PEERCRED */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PEERCRED */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PEERNAME)
+#ifdef SO_PEERNAME
+               {*r = SO_PEERNAME; return 0;}
+#else /* def SO_PEERNAME */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PEERNAME */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PEERSEC)
+#ifdef SO_PEERSEC
+               {*r = SO_PEERSEC; return 0;}
+#else /* def SO_PEERSEC */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PEERSEC */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PRIORITY)
+#ifdef SO_PRIORITY
+               {*r = SO_PRIORITY; return 0;}
+#else /* def SO_PRIORITY */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PRIORITY */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_PROTOCOL)
+#ifdef SO_PROTOCOL
+               {*r = SO_PROTOCOL; return 0;}
+#else /* def SO_PROTOCOL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_PROTOCOL */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUF)
+#ifdef SO_RCVBUF
+               {*r = SO_RCVBUF; return 0;}
+#else /* def SO_RCVBUF */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_RCVBUF */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE)
+#ifdef SO_RCVBUFFORCE
+               {*r = SO_RCVBUFFORCE; return 0;}
+#else /* def SO_RCVBUFFORCE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_RCVBUFFORCE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT)
+#ifdef SO_RCVLOWAT
+               {*r = SO_RCVLOWAT; return 0;}
+#else /* def SO_RCVLOWAT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_RCVLOWAT */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO)
+#ifdef SO_RCVTIMEO
+               {*r = SO_RCVTIMEO; return 0;}
+#else /* def SO_RCVTIMEO */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_RCVTIMEO */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEADDR)
+#ifdef SO_REUSEADDR
+               {*r = SO_REUSEADDR; return 0;}
+#else /* def SO_REUSEADDR */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_REUSEADDR */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_REUSEPORT)
+#ifdef SO_REUSEPORT
+               {*r = SO_REUSEPORT; return 0;}
+#else /* def SO_REUSEPORT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_REUSEPORT */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL)
+#ifdef SO_RXQ_OVFL
+               {*r = SO_RXQ_OVFL; return 0;}
+#else /* def SO_RXQ_OVFL */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_RXQ_OVFL */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION)
+#ifdef SO_SECURITY_AUTHENTICATION
+               {*r = SO_SECURITY_AUTHENTICATION; return 0;}
+#else /* def SO_SECURITY_AUTHENTICATION */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SECURITY_AUTHENTICATION */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK)
+#ifdef SO_SECURITY_ENCRYPTION_NETWORK
+               {*r = SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
+#else /* def SO_SECURITY_ENCRYPTION_NETWORK */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT)
+#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
+               {*r = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
+#else /* def SO_SECURITY_ENCRYPTION_TRANSPORT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE)
+#ifdef SO_SELECT_ERR_QUEUE
+               {*r = SO_SELECT_ERR_QUEUE; return 0;}
+#else /* def SO_SELECT_ERR_QUEUE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SELECT_ERR_QUEUE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUF)
+#ifdef SO_SNDBUF
+               {*r = SO_SNDBUF; return 0;}
+#else /* def SO_SNDBUF */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SNDBUF */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE)
+#ifdef SO_SNDBUFFORCE
+               {*r = SO_SNDBUFFORCE; return 0;}
+#else /* def SO_SNDBUFFORCE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SNDBUFFORCE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT)
+#ifdef SO_SNDLOWAT
+               {*r = SO_SNDLOWAT; return 0;}
+#else /* def SO_SNDLOWAT */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SNDLOWAT */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO)
+#ifdef SO_SNDTIMEO
+               {*r = SO_SNDTIMEO; return 0;}
+#else /* def SO_SNDTIMEO */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_SNDTIMEO */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP)
+#ifdef SO_TIMESTAMP
+               {*r = SO_TIMESTAMP; return 0;}
+#else /* def SO_TIMESTAMP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_TIMESTAMP */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING)
+#ifdef SO_TIMESTAMPING
+               {*r = SO_TIMESTAMPING; return 0;}
+#else /* def SO_TIMESTAMPING */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_TIMESTAMPING */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS)
+#ifdef SO_TIMESTAMPNS
+               {*r = SO_TIMESTAMPNS; return 0;}
+#else /* def SO_TIMESTAMPNS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_TIMESTAMPNS */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_TYPE)
+#ifdef SO_TYPE
+               {*r = SO_TYPE; return 0;}
+#else /* def SO_TYPE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_TYPE */
+       if (x == Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS)
+#ifdef SO_WIFI_STATUS
+               {*r = SO_WIFI_STATUS; return 0;}
+#else /* def SO_WIFI_STATUS */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SO_WIFI_STATUS */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToUnixSocketOptionName (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef SO_ACCEPTCONN
+       if (x == SO_ACCEPTCONN)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_ACCEPTCONN; return 0;}
+#endif /* ndef SO_ACCEPTCONN */
+#ifdef SO_ATTACH_FILTER
+       if (x == SO_ATTACH_FILTER)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_ATTACH_FILTER; return 0;}
+#endif /* ndef SO_ATTACH_FILTER */
+#ifdef SO_BINDTODEVICE
+       if (x == SO_BINDTODEVICE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_BINDTODEVICE; return 0;}
+#endif /* ndef SO_BINDTODEVICE */
+#ifdef SO_BROADCAST
+       if (x == SO_BROADCAST)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_BROADCAST; return 0;}
+#endif /* ndef SO_BROADCAST */
+#ifdef SO_BSDCOMPAT
+       if (x == SO_BSDCOMPAT)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_BSDCOMPAT; return 0;}
+#endif /* ndef SO_BSDCOMPAT */
+#ifdef SO_BUSY_POLL
+       if (x == SO_BUSY_POLL)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_BUSY_POLL; return 0;}
+#endif /* ndef SO_BUSY_POLL */
+#ifdef SO_DEBUG
+       if (x == SO_DEBUG)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_DEBUG; return 0;}
+#endif /* ndef SO_DEBUG */
+#ifdef SO_DETACH_FILTER
+       if (x == SO_DETACH_FILTER)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_DETACH_FILTER; return 0;}
+#endif /* ndef SO_DETACH_FILTER */
+#ifdef SO_DOMAIN
+       if (x == SO_DOMAIN)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_DOMAIN; return 0;}
+#endif /* ndef SO_DOMAIN */
+#ifdef SO_DONTROUTE
+       if (x == SO_DONTROUTE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_DONTROUTE; return 0;}
+#endif /* ndef SO_DONTROUTE */
+#ifdef SO_ERROR
+       if (x == SO_ERROR)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_ERROR; return 0;}
+#endif /* ndef SO_ERROR */
+#ifdef SO_KEEPALIVE
+       if (x == SO_KEEPALIVE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_KEEPALIVE; return 0;}
+#endif /* ndef SO_KEEPALIVE */
+#ifdef SO_LINGER
+       if (x == SO_LINGER)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_LINGER; return 0;}
+#endif /* ndef SO_LINGER */
+#ifdef SO_LOCK_FILTER
+       if (x == SO_LOCK_FILTER)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_LOCK_FILTER; return 0;}
+#endif /* ndef SO_LOCK_FILTER */
+#ifdef SO_MARK
+       if (x == SO_MARK)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_MARK; return 0;}
+#endif /* ndef SO_MARK */
+#ifdef SO_MAX_PACING_RATE
+       if (x == SO_MAX_PACING_RATE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_MAX_PACING_RATE; return 0;}
+#endif /* ndef SO_MAX_PACING_RATE */
+#ifdef SO_NOFCS
+       if (x == SO_NOFCS)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_NOFCS; return 0;}
+#endif /* ndef SO_NOFCS */
+#ifdef SO_NO_CHECK
+       if (x == SO_NO_CHECK)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_NO_CHECK; return 0;}
+#endif /* ndef SO_NO_CHECK */
+#ifdef SO_OOBINLINE
+       if (x == SO_OOBINLINE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_OOBINLINE; return 0;}
+#endif /* ndef SO_OOBINLINE */
+#ifdef SO_PASSCRED
+       if (x == SO_PASSCRED)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PASSCRED; return 0;}
+#endif /* ndef SO_PASSCRED */
+#ifdef SO_PASSSEC
+       if (x == SO_PASSSEC)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PASSSEC; return 0;}
+#endif /* ndef SO_PASSSEC */
+#ifdef SO_PEEK_OFF
+       if (x == SO_PEEK_OFF)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PEEK_OFF; return 0;}
+#endif /* ndef SO_PEEK_OFF */
+#ifdef SO_PEERCRED
+       if (x == SO_PEERCRED)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PEERCRED; return 0;}
+#endif /* ndef SO_PEERCRED */
+#ifdef SO_PEERNAME
+       if (x == SO_PEERNAME)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PEERNAME; return 0;}
+#endif /* ndef SO_PEERNAME */
+#ifdef SO_PEERSEC
+       if (x == SO_PEERSEC)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PEERSEC; return 0;}
+#endif /* ndef SO_PEERSEC */
+#ifdef SO_PRIORITY
+       if (x == SO_PRIORITY)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PRIORITY; return 0;}
+#endif /* ndef SO_PRIORITY */
+#ifdef SO_PROTOCOL
+       if (x == SO_PROTOCOL)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_PROTOCOL; return 0;}
+#endif /* ndef SO_PROTOCOL */
+#ifdef SO_RCVBUF
+       if (x == SO_RCVBUF)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUF; return 0;}
+#endif /* ndef SO_RCVBUF */
+#ifdef SO_RCVBUFFORCE
+       if (x == SO_RCVBUFFORCE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_RCVBUFFORCE; return 0;}
+#endif /* ndef SO_RCVBUFFORCE */
+#ifdef SO_RCVLOWAT
+       if (x == SO_RCVLOWAT)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_RCVLOWAT; return 0;}
+#endif /* ndef SO_RCVLOWAT */
+#ifdef SO_RCVTIMEO
+       if (x == SO_RCVTIMEO)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_RCVTIMEO; return 0;}
+#endif /* ndef SO_RCVTIMEO */
+#ifdef SO_REUSEADDR
+       if (x == SO_REUSEADDR)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEADDR; return 0;}
+#endif /* ndef SO_REUSEADDR */
+#ifdef SO_REUSEPORT
+       if (x == SO_REUSEPORT)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_REUSEPORT; return 0;}
+#endif /* ndef SO_REUSEPORT */
+#ifdef SO_RXQ_OVFL
+       if (x == SO_RXQ_OVFL)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_RXQ_OVFL; return 0;}
+#endif /* ndef SO_RXQ_OVFL */
+#ifdef SO_SECURITY_AUTHENTICATION
+       if (x == SO_SECURITY_AUTHENTICATION)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_AUTHENTICATION; return 0;}
+#endif /* ndef SO_SECURITY_AUTHENTICATION */
+#ifdef SO_SECURITY_ENCRYPTION_NETWORK
+       if (x == SO_SECURITY_ENCRYPTION_NETWORK)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_NETWORK; return 0;}
+#endif /* ndef SO_SECURITY_ENCRYPTION_NETWORK */
+#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
+       if (x == SO_SECURITY_ENCRYPTION_TRANSPORT)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SECURITY_ENCRYPTION_TRANSPORT; return 0;}
+#endif /* ndef SO_SECURITY_ENCRYPTION_TRANSPORT */
+#ifdef SO_SELECT_ERR_QUEUE
+       if (x == SO_SELECT_ERR_QUEUE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SELECT_ERR_QUEUE; return 0;}
+#endif /* ndef SO_SELECT_ERR_QUEUE */
+#ifdef SO_SNDBUF
+       if (x == SO_SNDBUF)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUF; return 0;}
+#endif /* ndef SO_SNDBUF */
+#ifdef SO_SNDBUFFORCE
+       if (x == SO_SNDBUFFORCE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SNDBUFFORCE; return 0;}
+#endif /* ndef SO_SNDBUFFORCE */
+#ifdef SO_SNDLOWAT
+       if (x == SO_SNDLOWAT)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SNDLOWAT; return 0;}
+#endif /* ndef SO_SNDLOWAT */
+#ifdef SO_SNDTIMEO
+       if (x == SO_SNDTIMEO)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_SNDTIMEO; return 0;}
+#endif /* ndef SO_SNDTIMEO */
+#ifdef SO_TIMESTAMP
+       if (x == SO_TIMESTAMP)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMP; return 0;}
+#endif /* ndef SO_TIMESTAMP */
+#ifdef SO_TIMESTAMPING
+       if (x == SO_TIMESTAMPING)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPING; return 0;}
+#endif /* ndef SO_TIMESTAMPING */
+#ifdef SO_TIMESTAMPNS
+       if (x == SO_TIMESTAMPNS)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_TIMESTAMPNS; return 0;}
+#endif /* ndef SO_TIMESTAMPNS */
+#ifdef SO_TYPE
+       if (x == SO_TYPE)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_TYPE; return 0;}
+#endif /* ndef SO_TYPE */
+#ifdef SO_WIFI_STATUS
+       if (x == SO_WIFI_STATUS)
+               {*r = Mono_Posix_UnixSocketOptionName_SO_WIFI_STATUS; return 0;}
+#endif /* ndef SO_WIFI_STATUS */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromUnixSocketProtocol (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_AH)
+#ifdef IPPROTO_AH
+               {*r = IPPROTO_AH; return 0;}
+#else /* def IPPROTO_AH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_AH */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH)
+#ifdef IPPROTO_BEETPH
+               {*r = IPPROTO_BEETPH; return 0;}
+#else /* def IPPROTO_BEETPH */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_BEETPH */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_COMP)
+#ifdef IPPROTO_COMP
+               {*r = IPPROTO_COMP; return 0;}
+#else /* def IPPROTO_COMP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_COMP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP)
+#ifdef IPPROTO_DCCP
+               {*r = IPPROTO_DCCP; return 0;}
+#else /* def IPPROTO_DCCP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_DCCP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_EGP)
+#ifdef IPPROTO_EGP
+               {*r = IPPROTO_EGP; return 0;}
+#else /* def IPPROTO_EGP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_EGP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP)
+#ifdef IPPROTO_ENCAP
+               {*r = IPPROTO_ENCAP; return 0;}
+#else /* def IPPROTO_ENCAP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_ENCAP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ESP)
+#ifdef IPPROTO_ESP
+               {*r = IPPROTO_ESP; return 0;}
+#else /* def IPPROTO_ESP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_ESP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_GRE)
+#ifdef IPPROTO_GRE
+               {*r = IPPROTO_GRE; return 0;}
+#else /* def IPPROTO_GRE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_GRE */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP)
+#ifdef IPPROTO_ICMP
+               {*r = IPPROTO_ICMP; return 0;}
+#else /* def IPPROTO_ICMP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_ICMP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IDP)
+#ifdef IPPROTO_IDP
+               {*r = IPPROTO_IDP; return 0;}
+#else /* def IPPROTO_IDP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_IDP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP)
+#ifdef IPPROTO_IGMP
+               {*r = IPPROTO_IGMP; return 0;}
+#else /* def IPPROTO_IGMP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_IGMP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IP)
+#ifdef IPPROTO_IP
+               {*r = IPPROTO_IP; return 0;}
+#else /* def IPPROTO_IP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_IP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP)
+#ifdef IPPROTO_IPIP
+               {*r = IPPROTO_IPIP; return 0;}
+#else /* def IPPROTO_IPIP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_IPIP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6)
+#ifdef IPPROTO_IPV6
+               {*r = IPPROTO_IPV6; return 0;}
+#else /* def IPPROTO_IPV6 */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_IPV6 */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_MTP)
+#ifdef IPPROTO_MTP
+               {*r = IPPROTO_MTP; return 0;}
+#else /* def IPPROTO_MTP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_MTP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PIM)
+#ifdef IPPROTO_PIM
+               {*r = IPPROTO_PIM; return 0;}
+#else /* def IPPROTO_PIM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_PIM */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_PUP)
+#ifdef IPPROTO_PUP
+               {*r = IPPROTO_PUP; return 0;}
+#else /* def IPPROTO_PUP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_PUP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RAW)
+#ifdef IPPROTO_RAW
+               {*r = IPPROTO_RAW; return 0;}
+#else /* def IPPROTO_RAW */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_RAW */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP)
+#ifdef IPPROTO_RSVP
+               {*r = IPPROTO_RSVP; return 0;}
+#else /* def IPPROTO_RSVP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_RSVP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP)
+#ifdef IPPROTO_SCTP
+               {*r = IPPROTO_SCTP; return 0;}
+#else /* def IPPROTO_SCTP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_SCTP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TCP)
+#ifdef IPPROTO_TCP
+               {*r = IPPROTO_TCP; return 0;}
+#else /* def IPPROTO_TCP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_TCP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_TP)
+#ifdef IPPROTO_TP
+               {*r = IPPROTO_TP; return 0;}
+#else /* def IPPROTO_TP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_TP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDP)
+#ifdef IPPROTO_UDP
+               {*r = IPPROTO_UDP; return 0;}
+#else /* def IPPROTO_UDP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_UDP */
+       if (x == Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE)
+#ifdef IPPROTO_UDPLITE
+               {*r = IPPROTO_UDPLITE; return 0;}
+#else /* def IPPROTO_UDPLITE */
+               {errno = EINVAL; return -1;}
+#endif /* ndef IPPROTO_UDPLITE */
+       if (x == Mono_Posix_UnixSocketProtocol_SOL_SOCKET)
+#ifdef SOL_SOCKET
+               {*r = SOL_SOCKET; return 0;}
+#else /* def SOL_SOCKET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOL_SOCKET */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToUnixSocketProtocol (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef IPPROTO_AH
+       if (x == IPPROTO_AH)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_AH; return 0;}
+#endif /* ndef IPPROTO_AH */
+#ifdef IPPROTO_BEETPH
+       if (x == IPPROTO_BEETPH)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_BEETPH; return 0;}
+#endif /* ndef IPPROTO_BEETPH */
+#ifdef IPPROTO_COMP
+       if (x == IPPROTO_COMP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_COMP; return 0;}
+#endif /* ndef IPPROTO_COMP */
+#ifdef IPPROTO_DCCP
+       if (x == IPPROTO_DCCP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_DCCP; return 0;}
+#endif /* ndef IPPROTO_DCCP */
+#ifdef IPPROTO_EGP
+       if (x == IPPROTO_EGP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_EGP; return 0;}
+#endif /* ndef IPPROTO_EGP */
+#ifdef IPPROTO_ENCAP
+       if (x == IPPROTO_ENCAP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ENCAP; return 0;}
+#endif /* ndef IPPROTO_ENCAP */
+#ifdef IPPROTO_ESP
+       if (x == IPPROTO_ESP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ESP; return 0;}
+#endif /* ndef IPPROTO_ESP */
+#ifdef IPPROTO_GRE
+       if (x == IPPROTO_GRE)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_GRE; return 0;}
+#endif /* ndef IPPROTO_GRE */
+#ifdef IPPROTO_ICMP
+       if (x == IPPROTO_ICMP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_ICMP; return 0;}
+#endif /* ndef IPPROTO_ICMP */
+#ifdef IPPROTO_IDP
+       if (x == IPPROTO_IDP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IDP; return 0;}
+#endif /* ndef IPPROTO_IDP */
+#ifdef IPPROTO_IGMP
+       if (x == IPPROTO_IGMP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IGMP; return 0;}
+#endif /* ndef IPPROTO_IGMP */
+#ifdef IPPROTO_IP
+       if (x == IPPROTO_IP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IP; return 0;}
+#endif /* ndef IPPROTO_IP */
+#ifdef IPPROTO_IPIP
+       if (x == IPPROTO_IPIP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPIP; return 0;}
+#endif /* ndef IPPROTO_IPIP */
+#ifdef IPPROTO_IPV6
+       if (x == IPPROTO_IPV6)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_IPV6; return 0;}
+#endif /* ndef IPPROTO_IPV6 */
+#ifdef IPPROTO_MTP
+       if (x == IPPROTO_MTP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_MTP; return 0;}
+#endif /* ndef IPPROTO_MTP */
+#ifdef IPPROTO_PIM
+       if (x == IPPROTO_PIM)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PIM; return 0;}
+#endif /* ndef IPPROTO_PIM */
+#ifdef IPPROTO_PUP
+       if (x == IPPROTO_PUP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_PUP; return 0;}
+#endif /* ndef IPPROTO_PUP */
+#ifdef IPPROTO_RAW
+       if (x == IPPROTO_RAW)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RAW; return 0;}
+#endif /* ndef IPPROTO_RAW */
+#ifdef IPPROTO_RSVP
+       if (x == IPPROTO_RSVP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_RSVP; return 0;}
+#endif /* ndef IPPROTO_RSVP */
+#ifdef IPPROTO_SCTP
+       if (x == IPPROTO_SCTP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_SCTP; return 0;}
+#endif /* ndef IPPROTO_SCTP */
+#ifdef IPPROTO_TCP
+       if (x == IPPROTO_TCP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TCP; return 0;}
+#endif /* ndef IPPROTO_TCP */
+#ifdef IPPROTO_TP
+       if (x == IPPROTO_TP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_TP; return 0;}
+#endif /* ndef IPPROTO_TP */
+#ifdef IPPROTO_UDP
+       if (x == IPPROTO_UDP)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDP; return 0;}
+#endif /* ndef IPPROTO_UDP */
+#ifdef IPPROTO_UDPLITE
+       if (x == IPPROTO_UDPLITE)
+               {*r = Mono_Posix_UnixSocketProtocol_IPPROTO_UDPLITE; return 0;}
+#endif /* ndef IPPROTO_UDPLITE */
+#ifdef SOL_SOCKET
+       if (x == SOL_SOCKET)
+               {*r = Mono_Posix_UnixSocketProtocol_SOL_SOCKET; return 0;}
+#endif /* ndef SOL_SOCKET */
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_FromUnixSocketType (int x, int *r)
+{
+       *r = 0;
+       if (x == Mono_Posix_UnixSocketType_SOCK_DCCP)
+#ifdef SOCK_DCCP
+               {*r = SOCK_DCCP; return 0;}
+#else /* def SOCK_DCCP */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_DCCP */
+       if (x == Mono_Posix_UnixSocketType_SOCK_DGRAM)
+#ifdef SOCK_DGRAM
+               {*r = SOCK_DGRAM; return 0;}
+#else /* def SOCK_DGRAM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_DGRAM */
+       if (x == Mono_Posix_UnixSocketType_SOCK_PACKET)
+#ifdef SOCK_PACKET
+               {*r = SOCK_PACKET; return 0;}
+#else /* def SOCK_PACKET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_PACKET */
+       if (x == Mono_Posix_UnixSocketType_SOCK_RAW)
+#ifdef SOCK_RAW
+               {*r = SOCK_RAW; return 0;}
+#else /* def SOCK_RAW */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_RAW */
+       if (x == Mono_Posix_UnixSocketType_SOCK_RDM)
+#ifdef SOCK_RDM
+               {*r = SOCK_RDM; return 0;}
+#else /* def SOCK_RDM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_RDM */
+       if (x == Mono_Posix_UnixSocketType_SOCK_SEQPACKET)
+#ifdef SOCK_SEQPACKET
+               {*r = SOCK_SEQPACKET; return 0;}
+#else /* def SOCK_SEQPACKET */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_SEQPACKET */
+       if (x == Mono_Posix_UnixSocketType_SOCK_STREAM)
+#ifdef SOCK_STREAM
+               {*r = SOCK_STREAM; return 0;}
+#else /* def SOCK_STREAM */
+               {errno = EINVAL; return -1;}
+#endif /* ndef SOCK_STREAM */
+       if (x == 0)
+               return 0;
+       errno = EINVAL; return -1;
+}
+
+int Mono_Posix_ToUnixSocketType (int x, int *r)
+{
+       *r = 0;
+       if (x == 0)
+               return 0;
+#ifdef SOCK_DCCP
+       if (x == SOCK_DCCP)
+               {*r = Mono_Posix_UnixSocketType_SOCK_DCCP; return 0;}
+#endif /* ndef SOCK_DCCP */
+#ifdef SOCK_DGRAM
+       if (x == SOCK_DGRAM)
+               {*r = Mono_Posix_UnixSocketType_SOCK_DGRAM; return 0;}
+#endif /* ndef SOCK_DGRAM */
+#ifdef SOCK_PACKET
+       if (x == SOCK_PACKET)
+               {*r = Mono_Posix_UnixSocketType_SOCK_PACKET; return 0;}
+#endif /* ndef SOCK_PACKET */
+#ifdef SOCK_RAW
+       if (x == SOCK_RAW)
+               {*r = Mono_Posix_UnixSocketType_SOCK_RAW; return 0;}
+#endif /* ndef SOCK_RAW */
+#ifdef SOCK_RDM
+       if (x == SOCK_RDM)
+               {*r = Mono_Posix_UnixSocketType_SOCK_RDM; return 0;}
+#endif /* ndef SOCK_RDM */
+#ifdef SOCK_SEQPACKET
+       if (x == SOCK_SEQPACKET)
+               {*r = Mono_Posix_UnixSocketType_SOCK_SEQPACKET; return 0;}
+#endif /* ndef SOCK_SEQPACKET */
+#ifdef SOCK_STREAM
+       if (x == SOCK_STREAM)
+               {*r = Mono_Posix_UnixSocketType_SOCK_STREAM; return 0;}
+#endif /* ndef SOCK_STREAM */
+       errno = EINVAL; return -1;
+}
+
+#ifdef HAVE_STRUCT_UTIMBUF
+int
+Mono_Posix_FromUtimbuf (struct Mono_Posix_Utimbuf *from, struct utimbuf *to)
+{
+       _cnm_return_val_if_overflow (time_t, from->actime, -1);
+       _cnm_return_val_if_overflow (time_t, from->modtime, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->actime  = from->actime;
+       to->modtime = from->modtime;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_UTIMBUF */
+
+
+#ifdef HAVE_STRUCT_UTIMBUF
+int
+Mono_Posix_ToUtimbuf (struct utimbuf *from, struct Mono_Posix_Utimbuf *to)
+{
+       _cnm_return_val_if_overflow (gint64, from->actime, -1);
+       _cnm_return_val_if_overflow (gint64, from->modtime, -1);
+
+       memset (to, 0, sizeof(*to));
+
+       to->actime  = from->actime;
+       to->modtime = from->modtime;
+
+       return 0;
+}
+#endif /* ndef HAVE_STRUCT_UTIMBUF */
+
+
+int Mono_Posix_FromWaitOptions (int x, int *r)
+{
+       *r = 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 */
+       if (x == 0)
+               return 0;
+       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_FromXattrFlags (int x, int *r)
+{
+       *r = 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 */
+       if (x == 0)
+               return 0;
+       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;
+}