- if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
-#ifdef S_ISUID
- *r |= S_ISUID;
-#else /* def S_ISUID */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_ISUID */
- if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
-#ifdef S_ISGID
- *r |= S_ISGID;
-#else /* def S_ISGID */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_ISGID */
- if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
-#ifdef S_ISVTX
- *r |= S_ISVTX;
-#else /* def S_ISVTX */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_ISVTX */
- if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
-#ifdef S_IRUSR
- *r |= S_IRUSR;
-#else /* def S_IRUSR */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IRUSR */
- if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
-#ifdef S_IWUSR
- *r |= S_IWUSR;
-#else /* def S_IWUSR */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IWUSR */
- if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
-#ifdef S_IXUSR
- *r |= S_IXUSR;
-#else /* def S_IXUSR */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IXUSR */
- if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
-#ifdef S_IRGRP
- *r |= S_IRGRP;
-#else /* def S_IRGRP */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IRGRP */
- if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
-#ifdef S_IWGRP
- *r |= S_IWGRP;
-#else /* def S_IWGRP */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IWGRP */
- if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
-#ifdef S_IXGRP
- *r |= S_IXGRP;
-#else /* def S_IXGRP */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IXGRP */
- if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
-#ifdef S_IROTH
- *r |= S_IROTH;
-#else /* def S_IROTH */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IROTH */
- if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
-#ifdef S_IWOTH
- *r |= S_IWOTH;
-#else /* def S_IWOTH */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IWOTH */
- if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
-#ifdef S_IXOTH
- *r |= S_IXOTH;
-#else /* def S_IXOTH */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IXOTH */
- if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
-#ifdef S_IRWXG
- *r |= S_IRWXG;
-#else /* def S_IRWXG */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IRWXG */
- if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
-#ifdef S_IRWXU
- *r |= S_IRWXU;
-#else /* def S_IRWXU */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IRWXU */
- if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
-#ifdef S_IRWXO
- *r |= S_IRWXO;
-#else /* def S_IRWXO */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IRWXO */
- if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
-#ifdef ACCESSPERMS
- *r |= ACCESSPERMS;
-#else /* def ACCESSPERMS */
- {errno = EINVAL; return -1;}
-#endif /* ndef ACCESSPERMS */
- if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
-#ifdef ALLPERMS
- *r |= ALLPERMS;
-#else /* def ALLPERMS */
- {errno = EINVAL; return -1;}
-#endif /* ndef ALLPERMS */
- if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
-#ifdef DEFFILEMODE
- *r |= DEFFILEMODE;
-#else /* def DEFFILEMODE */
- {errno = EINVAL; return -1;}
-#endif /* ndef DEFFILEMODE */
- if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
-#ifdef S_IFMT
- *r |= S_IFMT;
-#else /* def S_IFMT */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFMT */
- if ((x & Mono_Posix_FilePermissions_S_IFDIR) == Mono_Posix_FilePermissions_S_IFDIR)
-#ifdef S_IFDIR
- *r |= S_IFDIR;
-#else /* def S_IFDIR */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFDIR */
- if ((x & Mono_Posix_FilePermissions_S_IFCHR) == Mono_Posix_FilePermissions_S_IFCHR)
-#ifdef S_IFCHR
- *r |= S_IFCHR;
-#else /* def S_IFCHR */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFCHR */
- if ((x & Mono_Posix_FilePermissions_S_IFBLK) == Mono_Posix_FilePermissions_S_IFBLK)
-#ifdef S_IFBLK
- *r |= S_IFBLK;
-#else /* def S_IFBLK */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFBLK */
- if ((x & Mono_Posix_FilePermissions_S_IFREG) == Mono_Posix_FilePermissions_S_IFREG)
-#ifdef S_IFREG
- *r |= S_IFREG;
-#else /* def S_IFREG */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFREG */
- if ((x & Mono_Posix_FilePermissions_S_IFIFO) == Mono_Posix_FilePermissions_S_IFIFO)
-#ifdef S_IFIFO
- *r |= S_IFIFO;
-#else /* def S_IFIFO */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFIFO */
- if ((x & Mono_Posix_FilePermissions_S_IFLNK) == Mono_Posix_FilePermissions_S_IFLNK)
-#ifdef S_IFLNK
- *r |= S_IFLNK;
-#else /* def S_IFLNK */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFLNK */
- if ((x & Mono_Posix_FilePermissions_S_IFSOCK) == Mono_Posix_FilePermissions_S_IFSOCK)
-#ifdef S_IFSOCK
- *r |= S_IFSOCK;
-#else /* def S_IFSOCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef S_IFSOCK */
- return 0;
-}
-
-int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef S_ISUID
- if ((x & S_ISUID) == S_ISUID)
- *r |= Mono_Posix_FilePermissions_S_ISUID;
-#endif /* ndef S_ISUID */
-#ifdef S_ISGID
- if ((x & S_ISGID) == S_ISGID)
- *r |= Mono_Posix_FilePermissions_S_ISGID;
-#endif /* ndef S_ISGID */
-#ifdef S_ISVTX
- if ((x & S_ISVTX) == S_ISVTX)
- *r |= Mono_Posix_FilePermissions_S_ISVTX;
-#endif /* ndef S_ISVTX */
-#ifdef S_IRUSR
- if ((x & S_IRUSR) == S_IRUSR)
- *r |= Mono_Posix_FilePermissions_S_IRUSR;
-#endif /* ndef S_IRUSR */
-#ifdef S_IWUSR
- if ((x & S_IWUSR) == S_IWUSR)
- *r |= Mono_Posix_FilePermissions_S_IWUSR;
-#endif /* ndef S_IWUSR */
-#ifdef S_IXUSR
- if ((x & S_IXUSR) == S_IXUSR)
- *r |= Mono_Posix_FilePermissions_S_IXUSR;
-#endif /* ndef S_IXUSR */
-#ifdef S_IRGRP
- if ((x & S_IRGRP) == S_IRGRP)
- *r |= Mono_Posix_FilePermissions_S_IRGRP;
-#endif /* ndef S_IRGRP */
-#ifdef S_IWGRP
- if ((x & S_IWGRP) == S_IWGRP)
- *r |= Mono_Posix_FilePermissions_S_IWGRP;
-#endif /* ndef S_IWGRP */
-#ifdef S_IXGRP
- if ((x & S_IXGRP) == S_IXGRP)
- *r |= Mono_Posix_FilePermissions_S_IXGRP;
-#endif /* ndef S_IXGRP */
-#ifdef S_IROTH
- if ((x & S_IROTH) == S_IROTH)
- *r |= Mono_Posix_FilePermissions_S_IROTH;
-#endif /* ndef S_IROTH */
-#ifdef S_IWOTH
- if ((x & S_IWOTH) == S_IWOTH)
- *r |= Mono_Posix_FilePermissions_S_IWOTH;
-#endif /* ndef S_IWOTH */
-#ifdef S_IXOTH
- if ((x & S_IXOTH) == S_IXOTH)
- *r |= Mono_Posix_FilePermissions_S_IXOTH;
-#endif /* ndef S_IXOTH */
-#ifdef S_IRWXG
- if ((x & S_IRWXG) == S_IRWXG)
- *r |= Mono_Posix_FilePermissions_S_IRWXG;
-#endif /* ndef S_IRWXG */
-#ifdef S_IRWXU
- if ((x & S_IRWXU) == S_IRWXU)
- *r |= Mono_Posix_FilePermissions_S_IRWXU;
-#endif /* ndef S_IRWXU */
-#ifdef S_IRWXO
- if ((x & S_IRWXO) == S_IRWXO)
- *r |= Mono_Posix_FilePermissions_S_IRWXO;
-#endif /* ndef S_IRWXO */
-#ifdef ACCESSPERMS
- if ((x & ACCESSPERMS) == ACCESSPERMS)
- *r |= Mono_Posix_FilePermissions_ACCESSPERMS;
-#endif /* ndef ACCESSPERMS */
-#ifdef ALLPERMS
- if ((x & ALLPERMS) == ALLPERMS)
- *r |= Mono_Posix_FilePermissions_ALLPERMS;
-#endif /* ndef ALLPERMS */
-#ifdef DEFFILEMODE
- if ((x & DEFFILEMODE) == DEFFILEMODE)
- *r |= Mono_Posix_FilePermissions_DEFFILEMODE;
-#endif /* ndef DEFFILEMODE */
-#ifdef S_IFMT
- if ((x & S_IFMT) == S_IFMT)
- *r |= Mono_Posix_FilePermissions_S_IFMT;
-#endif /* ndef S_IFMT */
-#ifdef S_IFDIR
- if ((x & S_IFDIR) == S_IFDIR)
- *r |= Mono_Posix_FilePermissions_S_IFDIR;
-#endif /* ndef S_IFDIR */
-#ifdef S_IFCHR
- if ((x & S_IFCHR) == S_IFCHR)
- *r |= Mono_Posix_FilePermissions_S_IFCHR;
-#endif /* ndef S_IFCHR */
-#ifdef S_IFBLK
- if ((x & S_IFBLK) == S_IFBLK)
- *r |= Mono_Posix_FilePermissions_S_IFBLK;
-#endif /* ndef S_IFBLK */
-#ifdef S_IFREG
- if ((x & S_IFREG) == S_IFREG)
- *r |= Mono_Posix_FilePermissions_S_IFREG;
-#endif /* ndef S_IFREG */
-#ifdef S_IFIFO
- if ((x & S_IFIFO) == S_IFIFO)
- *r |= Mono_Posix_FilePermissions_S_IFIFO;
-#endif /* ndef S_IFIFO */
-#ifdef S_IFLNK
- if ((x & S_IFLNK) == S_IFLNK)
- *r |= Mono_Posix_FilePermissions_S_IFLNK;
-#endif /* ndef S_IFLNK */
-#ifdef S_IFSOCK
- if ((x & S_IFSOCK) == S_IFSOCK)
- *r |= Mono_Posix_FilePermissions_S_IFSOCK;
-#endif /* ndef S_IFSOCK */
- return 0;
-}
-
-int Mono_Posix_FromFcntlCommand (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_FcntlCommand_F_DUPFD)
-#ifdef F_DUPFD
- {*r = F_DUPFD; return 0;}
-#else /* def F_DUPFD */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_DUPFD */
- if (x == Mono_Posix_FcntlCommand_F_GETFD)
-#ifdef F_GETFD
- {*r = F_GETFD; return 0;}
-#else /* def F_GETFD */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETFD */
- if (x == Mono_Posix_FcntlCommand_F_SETFD)
-#ifdef F_SETFD
- {*r = F_SETFD; return 0;}
-#else /* def F_SETFD */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETFD */
- if (x == Mono_Posix_FcntlCommand_F_GETFL)
-#ifdef F_GETFL
- {*r = F_GETFL; return 0;}
-#else /* def F_GETFL */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETFL */
- if (x == Mono_Posix_FcntlCommand_F_SETFL)
-#ifdef F_SETFL
- {*r = F_SETFL; return 0;}
-#else /* def F_SETFL */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETFL */
- if (x == Mono_Posix_FcntlCommand_F_GETLK)
-#ifdef F_GETLK
- {*r = F_GETLK; return 0;}
-#else /* def F_GETLK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETLK */
- if (x == Mono_Posix_FcntlCommand_F_SETLK)
-#ifdef F_SETLK
- {*r = F_SETLK; return 0;}
-#else /* def F_SETLK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETLK */
- if (x == Mono_Posix_FcntlCommand_F_SETLKW)
-#ifdef F_SETLKW
- {*r = F_SETLKW; return 0;}
-#else /* def F_SETLKW */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETLKW */
- if (x == Mono_Posix_FcntlCommand_F_SETOWN)
-#ifdef F_SETOWN
- {*r = F_SETOWN; return 0;}
-#else /* def F_SETOWN */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETOWN */
- if (x == Mono_Posix_FcntlCommand_F_GETOWN)
-#ifdef F_GETOWN
- {*r = F_GETOWN; return 0;}
-#else /* def F_GETOWN */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETOWN */
- if (x == Mono_Posix_FcntlCommand_F_SETSIG)
-#ifdef F_SETSIG
- {*r = F_SETSIG; return 0;}
-#else /* def F_SETSIG */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETSIG */
- if (x == Mono_Posix_FcntlCommand_F_GETSIG)
-#ifdef F_GETSIG
- {*r = F_GETSIG; return 0;}
-#else /* def F_GETSIG */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETSIG */
- if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
-#ifdef F_SETLEASE
- {*r = F_SETLEASE; return 0;}
-#else /* def F_SETLEASE */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_SETLEASE */
- if (x == Mono_Posix_FcntlCommand_F_GETLEASE)
-#ifdef F_GETLEASE
- {*r = F_GETLEASE; return 0;}
-#else /* def F_GETLEASE */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_GETLEASE */
- if (x == Mono_Posix_FcntlCommand_F_NOTIFY)
-#ifdef F_NOTIFY
- {*r = F_NOTIFY; return 0;}
-#else /* def F_NOTIFY */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_NOTIFY */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToFcntlCommand (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef F_DUPFD
- if (x == F_DUPFD)
- {*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
-#endif /* ndef F_DUPFD */
-#ifdef F_GETFD
- if (x == F_GETFD)
- {*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
-#endif /* ndef F_GETFD */
-#ifdef F_SETFD
- if (x == F_SETFD)
- {*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
-#endif /* ndef F_SETFD */
-#ifdef F_GETFL
- if (x == F_GETFL)
- {*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
-#endif /* ndef F_GETFL */
-#ifdef F_SETFL
- if (x == F_SETFL)
- {*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
-#endif /* ndef F_SETFL */
-#ifdef F_GETLK
- if (x == F_GETLK)
- {*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
-#endif /* ndef F_GETLK */
-#ifdef F_SETLK
- if (x == F_SETLK)
- {*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
-#endif /* ndef F_SETLK */
-#ifdef F_SETLKW
- if (x == F_SETLKW)
- {*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
-#endif /* ndef F_SETLKW */
-#ifdef F_SETOWN
- if (x == F_SETOWN)
- {*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
-#endif /* ndef F_SETOWN */
-#ifdef F_GETOWN
- if (x == F_GETOWN)
- {*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
-#endif /* ndef F_GETOWN */
-#ifdef F_SETSIG
- if (x == F_SETSIG)
- {*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
-#endif /* ndef F_SETSIG */
-#ifdef F_GETSIG
- if (x == F_GETSIG)
- {*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
-#endif /* ndef F_GETSIG */
-#ifdef F_SETLEASE
- if (x == F_SETLEASE)
- {*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
-#endif /* ndef F_SETLEASE */
-#ifdef F_GETLEASE
- if (x == F_GETLEASE)
- {*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
-#endif /* ndef F_GETLEASE */
-#ifdef F_NOTIFY
- if (x == F_NOTIFY)
- {*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
-#endif /* ndef F_NOTIFY */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromLockType (short x, short *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_LockType_F_RDLCK)
-#ifdef F_RDLCK
- {*r = F_RDLCK; return 0;}
-#else /* def F_RDLCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_RDLCK */
- if (x == Mono_Posix_LockType_F_WRLCK)
-#ifdef F_WRLCK
- {*r = F_WRLCK; return 0;}
-#else /* def F_WRLCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_WRLCK */
- if (x == Mono_Posix_LockType_F_UNLCK)
-#ifdef F_UNLCK
- {*r = F_UNLCK; return 0;}
-#else /* def F_UNLCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_UNLCK */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToLockType (short x, short *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef F_RDLCK
- if (x == F_RDLCK)
- {*r = Mono_Posix_LockType_F_RDLCK; return 0;}
-#endif /* ndef F_RDLCK */
-#ifdef F_WRLCK
- if (x == F_WRLCK)
- {*r = Mono_Posix_LockType_F_WRLCK; return 0;}
-#endif /* ndef F_WRLCK */
-#ifdef F_UNLCK
- if (x == F_UNLCK)
- {*r = Mono_Posix_LockType_F_UNLCK; return 0;}
-#endif /* ndef F_UNLCK */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSeekFlags (short x, short *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_SeekFlags_SEEK_SET)
-#ifdef SEEK_SET
- {*r = SEEK_SET; return 0;}
-#else /* def SEEK_SET */
- {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_SET */
- if (x == Mono_Posix_SeekFlags_SEEK_CUR)
-#ifdef SEEK_CUR
- {*r = SEEK_CUR; return 0;}
-#else /* def SEEK_CUR */
- {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_CUR */
- if (x == Mono_Posix_SeekFlags_SEEK_END)
-#ifdef SEEK_END
- {*r = SEEK_END; return 0;}
-#else /* def SEEK_END */
- {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_END */
- if (x == Mono_Posix_SeekFlags_L_SET)
-#ifdef L_SET
- {*r = L_SET; return 0;}
-#else /* def L_SET */
- {errno = EINVAL; return -1;}
-#endif /* ndef L_SET */
- if (x == Mono_Posix_SeekFlags_L_INCR)
-#ifdef L_INCR
- {*r = L_INCR; return 0;}
-#else /* def L_INCR */
- {errno = EINVAL; return -1;}
-#endif /* ndef L_INCR */
- if (x == Mono_Posix_SeekFlags_L_XTND)
-#ifdef L_XTND
- {*r = L_XTND; return 0;}
-#else /* def L_XTND */
- {errno = EINVAL; return -1;}
-#endif /* ndef L_XTND */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSeekFlags (short x, short *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef SEEK_SET
- if (x == SEEK_SET)
- {*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
-#endif /* ndef SEEK_SET */
-#ifdef SEEK_CUR
- if (x == SEEK_CUR)
- {*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
-#endif /* ndef SEEK_CUR */
-#ifdef SEEK_END
- if (x == SEEK_END)
- {*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
-#endif /* ndef SEEK_END */
-#ifdef L_SET
- if (x == L_SET)
- {*r = Mono_Posix_SeekFlags_L_SET; return 0;}
-#endif /* ndef L_SET */
-#ifdef L_INCR
- if (x == L_INCR)
- {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
-#endif /* ndef L_INCR */
-#ifdef L_XTND
- if (x == L_XTND)
- {*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
-#endif /* ndef L_XTND */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) == Mono_Posix_DirectoryNotifyFlags_DN_ACCESS)
-#ifdef DN_ACCESS
- *r |= DN_ACCESS;
-#else /* def DN_ACCESS */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_ACCESS */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY)
-#ifdef DN_MODIFY
- *r |= DN_MODIFY;
-#else /* def DN_MODIFY */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_MODIFY */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_CREATE) == Mono_Posix_DirectoryNotifyFlags_DN_CREATE)
-#ifdef DN_CREATE
- *r |= DN_CREATE;
-#else /* def DN_CREATE */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_CREATE */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_DELETE) == Mono_Posix_DirectoryNotifyFlags_DN_DELETE)
-#ifdef DN_DELETE
- *r |= DN_DELETE;
-#else /* def DN_DELETE */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_DELETE */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME)
-#ifdef DN_RENAME
- *r |= DN_RENAME;
-#else /* def DN_RENAME */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_RENAME */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) == Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB)
-#ifdef DN_ATTRIB
- *r |= DN_ATTRIB;
-#else /* def DN_ATTRIB */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_ATTRIB */
- if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT)
-#ifdef DN_MULTISHOT
- *r |= DN_MULTISHOT;
-#else /* def DN_MULTISHOT */
- {errno = EINVAL; return -1;}
-#endif /* ndef DN_MULTISHOT */
- return 0;
-}
-
-int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef DN_ACCESS
- if ((x & DN_ACCESS) == DN_ACCESS)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_ACCESS;
-#endif /* ndef DN_ACCESS */
-#ifdef DN_MODIFY
- if ((x & DN_MODIFY) == DN_MODIFY)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
-#endif /* ndef DN_MODIFY */
-#ifdef DN_CREATE
- if ((x & DN_CREATE) == DN_CREATE)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_CREATE;
-#endif /* ndef DN_CREATE */
-#ifdef DN_DELETE
- if ((x & DN_DELETE) == DN_DELETE)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_DELETE;
-#endif /* ndef DN_DELETE */
-#ifdef DN_RENAME
- if ((x & DN_RENAME) == DN_RENAME)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
-#endif /* ndef DN_RENAME */
-#ifdef DN_ATTRIB
- if ((x & DN_ATTRIB) == DN_ATTRIB)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
-#endif /* ndef DN_ATTRIB */
-#ifdef DN_MULTISHOT
- if ((x & DN_MULTISHOT) == DN_MULTISHOT)
- *r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
-#endif /* ndef DN_MULTISHOT */
- return 0;
-}
-
-int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
-#ifdef POSIX_FADV_NORMAL
- {*r = POSIX_FADV_NORMAL; return 0;}
-#else /* def POSIX_FADV_NORMAL */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_NORMAL */
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
-#ifdef POSIX_FADV_RANDOM
- {*r = POSIX_FADV_RANDOM; return 0;}
-#else /* def POSIX_FADV_RANDOM */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_RANDOM */
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
-#ifdef POSIX_FADV_SEQUENTIAL
- {*r = POSIX_FADV_SEQUENTIAL; return 0;}
-#else /* def POSIX_FADV_SEQUENTIAL */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_SEQUENTIAL */
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
-#ifdef POSIX_FADV_WILLNEED
- {*r = POSIX_FADV_WILLNEED; return 0;}
-#else /* def POSIX_FADV_WILLNEED */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_WILLNEED */
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
-#ifdef POSIX_FADV_DONTNEED
- {*r = POSIX_FADV_DONTNEED; return 0;}
-#else /* def POSIX_FADV_DONTNEED */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_DONTNEED */
- if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
-#ifdef POSIX_FADV_NOREUSE
- {*r = POSIX_FADV_NOREUSE; return 0;}
-#else /* def POSIX_FADV_NOREUSE */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_FADV_NOREUSE */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef POSIX_FADV_NORMAL
- if (x == POSIX_FADV_NORMAL)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
-#endif /* ndef POSIX_FADV_NORMAL */
-#ifdef POSIX_FADV_RANDOM
- if (x == POSIX_FADV_RANDOM)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
-#endif /* ndef POSIX_FADV_RANDOM */
-#ifdef POSIX_FADV_SEQUENTIAL
- if (x == POSIX_FADV_SEQUENTIAL)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
-#endif /* ndef POSIX_FADV_SEQUENTIAL */
-#ifdef POSIX_FADV_WILLNEED
- if (x == POSIX_FADV_WILLNEED)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
-#endif /* ndef POSIX_FADV_WILLNEED */
-#ifdef POSIX_FADV_DONTNEED
- if (x == POSIX_FADV_DONTNEED)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
-#endif /* ndef POSIX_FADV_DONTNEED */
-#ifdef POSIX_FADV_NOREUSE
- if (x == POSIX_FADV_NOREUSE)
- {*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
-#endif /* ndef POSIX_FADV_NOREUSE */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
-#ifdef POSIX_MADV_NORMAL
- {*r = POSIX_MADV_NORMAL; return 0;}
-#else /* def POSIX_MADV_NORMAL */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_MADV_NORMAL */
- if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
-#ifdef POSIX_MADV_RANDOM
- {*r = POSIX_MADV_RANDOM; return 0;}
-#else /* def POSIX_MADV_RANDOM */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_MADV_RANDOM */
- if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
-#ifdef POSIX_MADV_SEQUENTIAL
- {*r = POSIX_MADV_SEQUENTIAL; return 0;}
-#else /* def POSIX_MADV_SEQUENTIAL */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_MADV_SEQUENTIAL */
- if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
-#ifdef POSIX_MADV_WILLNEED
- {*r = POSIX_MADV_WILLNEED; return 0;}
-#else /* def POSIX_MADV_WILLNEED */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_MADV_WILLNEED */
- if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
-#ifdef POSIX_MADV_DONTNEED
- {*r = POSIX_MADV_DONTNEED; return 0;}
-#else /* def POSIX_MADV_DONTNEED */
- {errno = EINVAL; return -1;}
-#endif /* ndef POSIX_MADV_DONTNEED */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef POSIX_MADV_NORMAL
- if (x == POSIX_MADV_NORMAL)
- {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
-#endif /* ndef POSIX_MADV_NORMAL */
-#ifdef POSIX_MADV_RANDOM
- if (x == POSIX_MADV_RANDOM)
- {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
-#endif /* ndef POSIX_MADV_RANDOM */
-#ifdef POSIX_MADV_SEQUENTIAL
- if (x == POSIX_MADV_SEQUENTIAL)
- {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
-#endif /* ndef POSIX_MADV_SEQUENTIAL */
-#ifdef POSIX_MADV_WILLNEED
- if (x == POSIX_MADV_WILLNEED)
- {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
-#endif /* ndef POSIX_MADV_WILLNEED */
-#ifdef POSIX_MADV_DONTNEED
- if (x == POSIX_MADV_DONTNEED)
- {*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
-#endif /* ndef POSIX_MADV_DONTNEED */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSignum (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_Signum_SIGHUP)
-#ifdef SIGHUP
- {*r = SIGHUP; return 0;}
-#else /* def SIGHUP */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGHUP */
- if (x == Mono_Posix_Signum_SIGINT)
-#ifdef SIGINT
- {*r = SIGINT; return 0;}
-#else /* def SIGINT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGINT */
- if (x == Mono_Posix_Signum_SIGQUIT)
-#ifdef SIGQUIT
- {*r = SIGQUIT; return 0;}
-#else /* def SIGQUIT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGQUIT */
- if (x == Mono_Posix_Signum_SIGILL)
-#ifdef SIGILL
- {*r = SIGILL; return 0;}
-#else /* def SIGILL */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGILL */
- if (x == Mono_Posix_Signum_SIGTRAP)
-#ifdef SIGTRAP
- {*r = SIGTRAP; return 0;}
-#else /* def SIGTRAP */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGTRAP */
- if (x == Mono_Posix_Signum_SIGABRT)
-#ifdef SIGABRT
- {*r = SIGABRT; return 0;}
-#else /* def SIGABRT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGABRT */
- if (x == Mono_Posix_Signum_SIGIOT)
-#ifdef SIGIOT
- {*r = SIGIOT; return 0;}
-#else /* def SIGIOT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGIOT */
- if (x == Mono_Posix_Signum_SIGBUS)
-#ifdef SIGBUS
- {*r = SIGBUS; return 0;}
-#else /* def SIGBUS */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGBUS */
- if (x == Mono_Posix_Signum_SIGFPE)
-#ifdef SIGFPE
- {*r = SIGFPE; return 0;}
-#else /* def SIGFPE */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGFPE */
- if (x == Mono_Posix_Signum_SIGKILL)
-#ifdef SIGKILL
- {*r = SIGKILL; return 0;}
-#else /* def SIGKILL */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGKILL */
- if (x == Mono_Posix_Signum_SIGUSR1)
-#ifdef SIGUSR1
- {*r = SIGUSR1; return 0;}
-#else /* def SIGUSR1 */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGUSR1 */
- if (x == Mono_Posix_Signum_SIGSEGV)
-#ifdef SIGSEGV
- {*r = SIGSEGV; return 0;}
-#else /* def SIGSEGV */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGSEGV */
- if (x == Mono_Posix_Signum_SIGUSR2)
-#ifdef SIGUSR2
- {*r = SIGUSR2; return 0;}
-#else /* def SIGUSR2 */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGUSR2 */
- if (x == Mono_Posix_Signum_SIGPIPE)
-#ifdef SIGPIPE
- {*r = SIGPIPE; return 0;}
-#else /* def SIGPIPE */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGPIPE */
- if (x == Mono_Posix_Signum_SIGALRM)
-#ifdef SIGALRM
- {*r = SIGALRM; return 0;}
-#else /* def SIGALRM */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGALRM */
- if (x == Mono_Posix_Signum_SIGTERM)
-#ifdef SIGTERM
- {*r = SIGTERM; return 0;}
-#else /* def SIGTERM */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGTERM */
- if (x == Mono_Posix_Signum_SIGSTKFLT)
-#ifdef SIGSTKFLT
- {*r = SIGSTKFLT; return 0;}
-#else /* def SIGSTKFLT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGSTKFLT */
- if (x == Mono_Posix_Signum_SIGCHLD)
-#ifdef SIGCHLD
- {*r = SIGCHLD; return 0;}
-#else /* def SIGCHLD */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGCHLD */
- if (x == Mono_Posix_Signum_SIGCLD)
-#ifdef SIGCLD
- {*r = SIGCLD; return 0;}
-#else /* def SIGCLD */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGCLD */
- if (x == Mono_Posix_Signum_SIGCONT)
-#ifdef SIGCONT
- {*r = SIGCONT; return 0;}
-#else /* def SIGCONT */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGCONT */
- if (x == Mono_Posix_Signum_SIGSTOP)
-#ifdef SIGSTOP
- {*r = SIGSTOP; return 0;}
-#else /* def SIGSTOP */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGSTOP */
- if (x == Mono_Posix_Signum_SIGTSTP)
-#ifdef SIGTSTP
- {*r = SIGTSTP; return 0;}
-#else /* def SIGTSTP */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGTSTP */
- if (x == Mono_Posix_Signum_SIGTTIN)
-#ifdef SIGTTIN
- {*r = SIGTTIN; return 0;}
-#else /* def SIGTTIN */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGTTIN */
- if (x == Mono_Posix_Signum_SIGTTOU)
-#ifdef SIGTTOU
- {*r = SIGTTOU; return 0;}
-#else /* def SIGTTOU */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGTTOU */
- if (x == Mono_Posix_Signum_SIGURG)
-#ifdef SIGURG
- {*r = SIGURG; return 0;}
-#else /* def SIGURG */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGURG */
- if (x == Mono_Posix_Signum_SIGXCPU)
-#ifdef SIGXCPU
- {*r = SIGXCPU; return 0;}
-#else /* def SIGXCPU */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGXCPU */
- if (x == Mono_Posix_Signum_SIGXFSZ)
-#ifdef SIGXFSZ
- {*r = SIGXFSZ; return 0;}
-#else /* def SIGXFSZ */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGXFSZ */
- if (x == Mono_Posix_Signum_SIGVTALRM)
-#ifdef SIGVTALRM
- {*r = SIGVTALRM; return 0;}
-#else /* def SIGVTALRM */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGVTALRM */
- if (x == Mono_Posix_Signum_SIGPROF)
-#ifdef SIGPROF
- {*r = SIGPROF; return 0;}
-#else /* def SIGPROF */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGPROF */
- if (x == Mono_Posix_Signum_SIGWINCH)
-#ifdef SIGWINCH
- {*r = SIGWINCH; return 0;}
-#else /* def SIGWINCH */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGWINCH */
- if (x == Mono_Posix_Signum_SIGIO)
-#ifdef SIGIO
- {*r = SIGIO; return 0;}
-#else /* def SIGIO */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGIO */
- if (x == Mono_Posix_Signum_SIGPOLL)
-#ifdef SIGPOLL
- {*r = SIGPOLL; return 0;}
-#else /* def SIGPOLL */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGPOLL */
- if (x == Mono_Posix_Signum_SIGPWR)
-#ifdef SIGPWR
- {*r = SIGPWR; return 0;}
-#else /* def SIGPWR */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGPWR */
- if (x == Mono_Posix_Signum_SIGSYS)
-#ifdef SIGSYS
- {*r = SIGSYS; return 0;}
-#else /* def SIGSYS */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGSYS */
- if (x == Mono_Posix_Signum_SIGUNUSED)
-#ifdef SIGUNUSED
- {*r = SIGUNUSED; return 0;}
-#else /* def SIGUNUSED */
- {errno = EINVAL; return -1;}
-#endif /* ndef SIGUNUSED */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToSignum (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef SIGHUP
- if (x == SIGHUP)
- {*r = Mono_Posix_Signum_SIGHUP; return 0;}
-#endif /* ndef SIGHUP */
-#ifdef SIGINT
- if (x == SIGINT)
- {*r = Mono_Posix_Signum_SIGINT; return 0;}
-#endif /* ndef SIGINT */
-#ifdef SIGQUIT
- if (x == SIGQUIT)
- {*r = Mono_Posix_Signum_SIGQUIT; return 0;}
-#endif /* ndef SIGQUIT */
-#ifdef SIGILL
- if (x == SIGILL)
- {*r = Mono_Posix_Signum_SIGILL; return 0;}
-#endif /* ndef SIGILL */
-#ifdef SIGTRAP
- if (x == SIGTRAP)
- {*r = Mono_Posix_Signum_SIGTRAP; return 0;}
-#endif /* ndef SIGTRAP */
-#ifdef SIGABRT
- if (x == SIGABRT)
- {*r = Mono_Posix_Signum_SIGABRT; return 0;}
-#endif /* ndef SIGABRT */
-#ifdef SIGIOT
- if (x == SIGIOT)
- {*r = Mono_Posix_Signum_SIGIOT; return 0;}
-#endif /* ndef SIGIOT */
-#ifdef SIGBUS
- if (x == SIGBUS)
- {*r = Mono_Posix_Signum_SIGBUS; return 0;}
-#endif /* ndef SIGBUS */
-#ifdef SIGFPE
- if (x == SIGFPE)
- {*r = Mono_Posix_Signum_SIGFPE; return 0;}
-#endif /* ndef SIGFPE */
-#ifdef SIGKILL
- if (x == SIGKILL)
- {*r = Mono_Posix_Signum_SIGKILL; return 0;}
-#endif /* ndef SIGKILL */
-#ifdef SIGUSR1
- if (x == SIGUSR1)
- {*r = Mono_Posix_Signum_SIGUSR1; return 0;}
-#endif /* ndef SIGUSR1 */
-#ifdef SIGSEGV
- if (x == SIGSEGV)
- {*r = Mono_Posix_Signum_SIGSEGV; return 0;}
-#endif /* ndef SIGSEGV */
-#ifdef SIGUSR2
- if (x == SIGUSR2)
- {*r = Mono_Posix_Signum_SIGUSR2; return 0;}
-#endif /* ndef SIGUSR2 */
-#ifdef SIGPIPE
- if (x == SIGPIPE)
- {*r = Mono_Posix_Signum_SIGPIPE; return 0;}
-#endif /* ndef SIGPIPE */
-#ifdef SIGALRM
- if (x == SIGALRM)
- {*r = Mono_Posix_Signum_SIGALRM; return 0;}
-#endif /* ndef SIGALRM */
-#ifdef SIGTERM
- if (x == SIGTERM)
- {*r = Mono_Posix_Signum_SIGTERM; return 0;}
-#endif /* ndef SIGTERM */
-#ifdef SIGSTKFLT
- if (x == SIGSTKFLT)
- {*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
-#endif /* ndef SIGSTKFLT */
-#ifdef SIGCHLD
- if (x == SIGCHLD)
- {*r = Mono_Posix_Signum_SIGCHLD; return 0;}
-#endif /* ndef SIGCHLD */
-#ifdef SIGCLD
- if (x == SIGCLD)
- {*r = Mono_Posix_Signum_SIGCLD; return 0;}
-#endif /* ndef SIGCLD */
-#ifdef SIGCONT
- if (x == SIGCONT)
- {*r = Mono_Posix_Signum_SIGCONT; return 0;}
-#endif /* ndef SIGCONT */
-#ifdef SIGSTOP
- if (x == SIGSTOP)
- {*r = Mono_Posix_Signum_SIGSTOP; return 0;}
-#endif /* ndef SIGSTOP */
-#ifdef SIGTSTP
- if (x == SIGTSTP)
- {*r = Mono_Posix_Signum_SIGTSTP; return 0;}
-#endif /* ndef SIGTSTP */
-#ifdef SIGTTIN
- if (x == SIGTTIN)
- {*r = Mono_Posix_Signum_SIGTTIN; return 0;}
-#endif /* ndef SIGTTIN */
-#ifdef SIGTTOU
- if (x == SIGTTOU)
- {*r = Mono_Posix_Signum_SIGTTOU; return 0;}
-#endif /* ndef SIGTTOU */
-#ifdef SIGURG
- if (x == SIGURG)
- {*r = Mono_Posix_Signum_SIGURG; return 0;}
-#endif /* ndef SIGURG */
-#ifdef SIGXCPU
- if (x == SIGXCPU)
- {*r = Mono_Posix_Signum_SIGXCPU; return 0;}
-#endif /* ndef SIGXCPU */
-#ifdef SIGXFSZ
- if (x == SIGXFSZ)
- {*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
-#endif /* ndef SIGXFSZ */
-#ifdef SIGVTALRM
- if (x == SIGVTALRM)
- {*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
-#endif /* ndef SIGVTALRM */
-#ifdef SIGPROF
- if (x == SIGPROF)
- {*r = Mono_Posix_Signum_SIGPROF; return 0;}
-#endif /* ndef SIGPROF */
-#ifdef SIGWINCH
- if (x == SIGWINCH)
- {*r = Mono_Posix_Signum_SIGWINCH; return 0;}
-#endif /* ndef SIGWINCH */
-#ifdef SIGIO
- if (x == SIGIO)
- {*r = Mono_Posix_Signum_SIGIO; return 0;}
-#endif /* ndef SIGIO */
-#ifdef SIGPOLL
- if (x == SIGPOLL)
- {*r = Mono_Posix_Signum_SIGPOLL; return 0;}
-#endif /* ndef SIGPOLL */
-#ifdef SIGPWR
- if (x == SIGPWR)
- {*r = Mono_Posix_Signum_SIGPWR; return 0;}
-#endif /* ndef SIGPWR */
-#ifdef SIGSYS
- if (x == SIGSYS)
- {*r = Mono_Posix_Signum_SIGSYS; return 0;}
-#endif /* ndef SIGSYS */
-#ifdef SIGUNUSED
- if (x == SIGUNUSED)
- {*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
-#endif /* ndef SIGUNUSED */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromWaitOptions (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
-#ifdef WNOHANG
- *r |= WNOHANG;
-#else /* def WNOHANG */
- {errno = EINVAL; return -1;}
-#endif /* ndef WNOHANG */
- if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
-#ifdef WUNTRACED
- *r |= WUNTRACED;
-#else /* def WUNTRACED */
- {errno = EINVAL; return -1;}
-#endif /* ndef WUNTRACED */
- return 0;
-}
-
-int Mono_Posix_ToWaitOptions (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef WNOHANG
- if ((x & WNOHANG) == WNOHANG)
- *r |= Mono_Posix_WaitOptions_WNOHANG;
-#endif /* ndef WNOHANG */
-#ifdef WUNTRACED
- if ((x & WUNTRACED) == WUNTRACED)
- *r |= Mono_Posix_WaitOptions_WUNTRACED;
-#endif /* ndef WUNTRACED */
- return 0;
-}
-
-int Mono_Posix_FromAccessMode (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if ((x & Mono_Posix_AccessMode_R_OK) == Mono_Posix_AccessMode_R_OK)
-#ifdef R_OK
- *r |= R_OK;
-#else /* def R_OK */
- {errno = EINVAL; return -1;}
-#endif /* ndef R_OK */
- if ((x & Mono_Posix_AccessMode_W_OK) == Mono_Posix_AccessMode_W_OK)
-#ifdef W_OK
- *r |= W_OK;
-#else /* def W_OK */
- {errno = EINVAL; return -1;}
-#endif /* ndef W_OK */
- if ((x & Mono_Posix_AccessMode_X_OK) == Mono_Posix_AccessMode_X_OK)
-#ifdef X_OK
- *r |= X_OK;
-#else /* def X_OK */
- {errno = EINVAL; return -1;}
-#endif /* ndef X_OK */
- if ((x & Mono_Posix_AccessMode_F_OK) == Mono_Posix_AccessMode_F_OK)
-#ifdef F_OK
- *r |= F_OK;
-#else /* def F_OK */
- {errno = EINVAL; return -1;}
-#endif /* ndef F_OK */
- return 0;
-}
-
-int Mono_Posix_ToAccessMode (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef R_OK
- if ((x & R_OK) == R_OK)
- *r |= Mono_Posix_AccessMode_R_OK;
-#endif /* ndef R_OK */
-#ifdef W_OK
- if ((x & W_OK) == W_OK)
- *r |= Mono_Posix_AccessMode_W_OK;
-#endif /* ndef W_OK */
-#ifdef X_OK
- if ((x & X_OK) == X_OK)
- *r |= Mono_Posix_AccessMode_X_OK;
-#endif /* ndef X_OK */
-#ifdef F_OK
- if ((x & F_OK) == F_OK)
- *r |= Mono_Posix_AccessMode_F_OK;
-#endif /* ndef F_OK */
- return 0;
-}
-
-int Mono_Posix_FromPathConf (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_PathConf__PC_LINK_MAX)
-#ifdef _PC_LINK_MAX
- {*r = _PC_LINK_MAX; return 0;}
-#else /* def _PC_LINK_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_LINK_MAX */
- if (x == Mono_Posix_PathConf__PC_MAX_CANON)
-#ifdef _PC_MAX_CANON
- {*r = _PC_MAX_CANON; return 0;}
-#else /* def _PC_MAX_CANON */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_MAX_CANON */
- if (x == Mono_Posix_PathConf__PC_MAX_INPUT)
-#ifdef _PC_MAX_INPUT
- {*r = _PC_MAX_INPUT; return 0;}
-#else /* def _PC_MAX_INPUT */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_MAX_INPUT */
- if (x == Mono_Posix_PathConf__PC_NAME_MAX)
-#ifdef _PC_NAME_MAX
- {*r = _PC_NAME_MAX; return 0;}
-#else /* def _PC_NAME_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_NAME_MAX */
- if (x == Mono_Posix_PathConf__PC_PATH_MAX)
-#ifdef _PC_PATH_MAX
- {*r = _PC_PATH_MAX; return 0;}
-#else /* def _PC_PATH_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_PATH_MAX */
- if (x == Mono_Posix_PathConf__PC_PIPE_BUF)
-#ifdef _PC_PIPE_BUF
- {*r = _PC_PIPE_BUF; return 0;}
-#else /* def _PC_PIPE_BUF */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_PIPE_BUF */
- if (x == Mono_Posix_PathConf__PC_CHOWN_RESTRICTED)
-#ifdef _PC_CHOWN_RESTRICTED
- {*r = _PC_CHOWN_RESTRICTED; return 0;}
-#else /* def _PC_CHOWN_RESTRICTED */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_CHOWN_RESTRICTED */
- if (x == Mono_Posix_PathConf__PC_NO_TRUNC)
-#ifdef _PC_NO_TRUNC
- {*r = _PC_NO_TRUNC; return 0;}
-#else /* def _PC_NO_TRUNC */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_NO_TRUNC */
- if (x == Mono_Posix_PathConf__PC_VDISABLE)
-#ifdef _PC_VDISABLE
- {*r = _PC_VDISABLE; return 0;}
-#else /* def _PC_VDISABLE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_VDISABLE */
- if (x == Mono_Posix_PathConf__PC_SYNC_IO)
-#ifdef _PC_SYNC_IO
- {*r = _PC_SYNC_IO; return 0;}
-#else /* def _PC_SYNC_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_SYNC_IO */
- if (x == Mono_Posix_PathConf__PC_ASYNC_IO)
-#ifdef _PC_ASYNC_IO
- {*r = _PC_ASYNC_IO; return 0;}
-#else /* def _PC_ASYNC_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_ASYNC_IO */
- if (x == Mono_Posix_PathConf__PC_PRIO_IO)
-#ifdef _PC_PRIO_IO
- {*r = _PC_PRIO_IO; return 0;}
-#else /* def _PC_PRIO_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_PRIO_IO */
- if (x == Mono_Posix_PathConf__PC_SOCK_MAXBUF)
-#ifdef _PC_SOCK_MAXBUF
- {*r = _PC_SOCK_MAXBUF; return 0;}
-#else /* def _PC_SOCK_MAXBUF */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_SOCK_MAXBUF */
- if (x == Mono_Posix_PathConf__PC_FILESIZEBITS)
-#ifdef _PC_FILESIZEBITS
- {*r = _PC_FILESIZEBITS; return 0;}
-#else /* def _PC_FILESIZEBITS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_FILESIZEBITS */
- if (x == Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE)
-#ifdef _PC_REC_INCR_XFER_SIZE
- {*r = _PC_REC_INCR_XFER_SIZE; return 0;}
-#else /* def _PC_REC_INCR_XFER_SIZE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_REC_INCR_XFER_SIZE */
- if (x == Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE)
-#ifdef _PC_REC_MAX_XFER_SIZE
- {*r = _PC_REC_MAX_XFER_SIZE; return 0;}
-#else /* def _PC_REC_MAX_XFER_SIZE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_REC_MAX_XFER_SIZE */
- if (x == Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE)
-#ifdef _PC_REC_MIN_XFER_SIZE
- {*r = _PC_REC_MIN_XFER_SIZE; return 0;}
-#else /* def _PC_REC_MIN_XFER_SIZE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_REC_MIN_XFER_SIZE */
- if (x == Mono_Posix_PathConf__PC_REC_XFER_ALIGN)
-#ifdef _PC_REC_XFER_ALIGN
- {*r = _PC_REC_XFER_ALIGN; return 0;}
-#else /* def _PC_REC_XFER_ALIGN */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_REC_XFER_ALIGN */
- if (x == Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN)
-#ifdef _PC_ALLOC_SIZE_MIN
- {*r = _PC_ALLOC_SIZE_MIN; return 0;}
-#else /* def _PC_ALLOC_SIZE_MIN */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_ALLOC_SIZE_MIN */
- if (x == Mono_Posix_PathConf__PC_SYMLINK_MAX)
-#ifdef _PC_SYMLINK_MAX
- {*r = _PC_SYMLINK_MAX; return 0;}
-#else /* def _PC_SYMLINK_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_SYMLINK_MAX */
- if (x == Mono_Posix_PathConf__PC_2_SYMLINKS)
-#ifdef _PC_2_SYMLINKS
- {*r = _PC_2_SYMLINKS; return 0;}
-#else /* def _PC_2_SYMLINKS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _PC_2_SYMLINKS */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_ToPathConf (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
-#ifdef _PC_LINK_MAX
- if (x == _PC_LINK_MAX)
- {*r = Mono_Posix_PathConf__PC_LINK_MAX; return 0;}
-#endif /* ndef _PC_LINK_MAX */
-#ifdef _PC_MAX_CANON
- if (x == _PC_MAX_CANON)
- {*r = Mono_Posix_PathConf__PC_MAX_CANON; return 0;}
-#endif /* ndef _PC_MAX_CANON */
-#ifdef _PC_MAX_INPUT
- if (x == _PC_MAX_INPUT)
- {*r = Mono_Posix_PathConf__PC_MAX_INPUT; return 0;}
-#endif /* ndef _PC_MAX_INPUT */
-#ifdef _PC_NAME_MAX
- if (x == _PC_NAME_MAX)
- {*r = Mono_Posix_PathConf__PC_NAME_MAX; return 0;}
-#endif /* ndef _PC_NAME_MAX */
-#ifdef _PC_PATH_MAX
- if (x == _PC_PATH_MAX)
- {*r = Mono_Posix_PathConf__PC_PATH_MAX; return 0;}
-#endif /* ndef _PC_PATH_MAX */
-#ifdef _PC_PIPE_BUF
- if (x == _PC_PIPE_BUF)
- {*r = Mono_Posix_PathConf__PC_PIPE_BUF; return 0;}
-#endif /* ndef _PC_PIPE_BUF */
-#ifdef _PC_CHOWN_RESTRICTED
- if (x == _PC_CHOWN_RESTRICTED)
- {*r = Mono_Posix_PathConf__PC_CHOWN_RESTRICTED; return 0;}
-#endif /* ndef _PC_CHOWN_RESTRICTED */
-#ifdef _PC_NO_TRUNC
- if (x == _PC_NO_TRUNC)
- {*r = Mono_Posix_PathConf__PC_NO_TRUNC; return 0;}
-#endif /* ndef _PC_NO_TRUNC */
-#ifdef _PC_VDISABLE
- if (x == _PC_VDISABLE)
- {*r = Mono_Posix_PathConf__PC_VDISABLE; return 0;}
-#endif /* ndef _PC_VDISABLE */
-#ifdef _PC_SYNC_IO
- if (x == _PC_SYNC_IO)
- {*r = Mono_Posix_PathConf__PC_SYNC_IO; return 0;}
-#endif /* ndef _PC_SYNC_IO */
-#ifdef _PC_ASYNC_IO
- if (x == _PC_ASYNC_IO)
- {*r = Mono_Posix_PathConf__PC_ASYNC_IO; return 0;}
-#endif /* ndef _PC_ASYNC_IO */
-#ifdef _PC_PRIO_IO
- if (x == _PC_PRIO_IO)
- {*r = Mono_Posix_PathConf__PC_PRIO_IO; return 0;}
-#endif /* ndef _PC_PRIO_IO */
-#ifdef _PC_SOCK_MAXBUF
- if (x == _PC_SOCK_MAXBUF)
- {*r = Mono_Posix_PathConf__PC_SOCK_MAXBUF; return 0;}
-#endif /* ndef _PC_SOCK_MAXBUF */
-#ifdef _PC_FILESIZEBITS
- if (x == _PC_FILESIZEBITS)
- {*r = Mono_Posix_PathConf__PC_FILESIZEBITS; return 0;}
-#endif /* ndef _PC_FILESIZEBITS */
-#ifdef _PC_REC_INCR_XFER_SIZE
- if (x == _PC_REC_INCR_XFER_SIZE)
- {*r = Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE; return 0;}
-#endif /* ndef _PC_REC_INCR_XFER_SIZE */
-#ifdef _PC_REC_MAX_XFER_SIZE
- if (x == _PC_REC_MAX_XFER_SIZE)
- {*r = Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE; return 0;}
-#endif /* ndef _PC_REC_MAX_XFER_SIZE */
-#ifdef _PC_REC_MIN_XFER_SIZE
- if (x == _PC_REC_MIN_XFER_SIZE)
- {*r = Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE; return 0;}
-#endif /* ndef _PC_REC_MIN_XFER_SIZE */
-#ifdef _PC_REC_XFER_ALIGN
- if (x == _PC_REC_XFER_ALIGN)
- {*r = Mono_Posix_PathConf__PC_REC_XFER_ALIGN; return 0;}
-#endif /* ndef _PC_REC_XFER_ALIGN */
-#ifdef _PC_ALLOC_SIZE_MIN
- if (x == _PC_ALLOC_SIZE_MIN)
- {*r = Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN; return 0;}
-#endif /* ndef _PC_ALLOC_SIZE_MIN */
-#ifdef _PC_SYMLINK_MAX
- if (x == _PC_SYMLINK_MAX)
- {*r = Mono_Posix_PathConf__PC_SYMLINK_MAX; return 0;}
-#endif /* ndef _PC_SYMLINK_MAX */
-#ifdef _PC_2_SYMLINKS
- if (x == _PC_2_SYMLINKS)
- {*r = Mono_Posix_PathConf__PC_2_SYMLINKS; return 0;}
-#endif /* ndef _PC_2_SYMLINKS */
- errno = EINVAL; return -1;
-}
-
-int Mono_Posix_FromSysConf (int x, int *r)
-{
- *r = 0;
- if (x == 0)
- return 0;
- if (x == Mono_Posix_SysConf__SC_ARG_MAX)
-#ifdef _SC_ARG_MAX
- {*r = _SC_ARG_MAX; return 0;}
-#else /* def _SC_ARG_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_ARG_MAX */
- if (x == Mono_Posix_SysConf__SC_CHILD_MAX)
-#ifdef _SC_CHILD_MAX
- {*r = _SC_CHILD_MAX; return 0;}
-#else /* def _SC_CHILD_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_CHILD_MAX */
- if (x == Mono_Posix_SysConf__SC_CLK_TCK)
-#ifdef _SC_CLK_TCK
- {*r = _SC_CLK_TCK; return 0;}
-#else /* def _SC_CLK_TCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_CLK_TCK */
- if (x == Mono_Posix_SysConf__SC_NGROUPS_MAX)
-#ifdef _SC_NGROUPS_MAX
- {*r = _SC_NGROUPS_MAX; return 0;}
-#else /* def _SC_NGROUPS_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_NGROUPS_MAX */
- if (x == Mono_Posix_SysConf__SC_OPEN_MAX)
-#ifdef _SC_OPEN_MAX
- {*r = _SC_OPEN_MAX; return 0;}
-#else /* def _SC_OPEN_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_OPEN_MAX */
- if (x == Mono_Posix_SysConf__SC_STREAM_MAX)
-#ifdef _SC_STREAM_MAX
- {*r = _SC_STREAM_MAX; return 0;}
-#else /* def _SC_STREAM_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_STREAM_MAX */
- if (x == Mono_Posix_SysConf__SC_TZNAME_MAX)
-#ifdef _SC_TZNAME_MAX
- {*r = _SC_TZNAME_MAX; return 0;}
-#else /* def _SC_TZNAME_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_TZNAME_MAX */
- if (x == Mono_Posix_SysConf__SC_JOB_CONTROL)
-#ifdef _SC_JOB_CONTROL
- {*r = _SC_JOB_CONTROL; return 0;}
-#else /* def _SC_JOB_CONTROL */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_JOB_CONTROL */
- if (x == Mono_Posix_SysConf__SC_SAVED_IDS)
-#ifdef _SC_SAVED_IDS
- {*r = _SC_SAVED_IDS; return 0;}
-#else /* def _SC_SAVED_IDS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SAVED_IDS */
- if (x == Mono_Posix_SysConf__SC_REALTIME_SIGNALS)
-#ifdef _SC_REALTIME_SIGNALS
- {*r = _SC_REALTIME_SIGNALS; return 0;}
-#else /* def _SC_REALTIME_SIGNALS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_REALTIME_SIGNALS */
- if (x == Mono_Posix_SysConf__SC_PRIORITY_SCHEDULING)
-#ifdef _SC_PRIORITY_SCHEDULING
- {*r = _SC_PRIORITY_SCHEDULING; return 0;}
-#else /* def _SC_PRIORITY_SCHEDULING */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_PRIORITY_SCHEDULING */
- if (x == Mono_Posix_SysConf__SC_TIMERS)
-#ifdef _SC_TIMERS
- {*r = _SC_TIMERS; return 0;}
-#else /* def _SC_TIMERS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_TIMERS */
- if (x == Mono_Posix_SysConf__SC_ASYNCHRONOUS_IO)
-#ifdef _SC_ASYNCHRONOUS_IO
- {*r = _SC_ASYNCHRONOUS_IO; return 0;}
-#else /* def _SC_ASYNCHRONOUS_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_ASYNCHRONOUS_IO */
- if (x == Mono_Posix_SysConf__SC_PRIORITIZED_IO)
-#ifdef _SC_PRIORITIZED_IO
- {*r = _SC_PRIORITIZED_IO; return 0;}
-#else /* def _SC_PRIORITIZED_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_PRIORITIZED_IO */
- if (x == Mono_Posix_SysConf__SC_SYNCHRONIZED_IO)
-#ifdef _SC_SYNCHRONIZED_IO
- {*r = _SC_SYNCHRONIZED_IO; return 0;}
-#else /* def _SC_SYNCHRONIZED_IO */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SYNCHRONIZED_IO */
- if (x == Mono_Posix_SysConf__SC_FSYNC)
-#ifdef _SC_FSYNC
- {*r = _SC_FSYNC; return 0;}
-#else /* def _SC_FSYNC */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_FSYNC */
- if (x == Mono_Posix_SysConf__SC_MAPPED_FILES)
-#ifdef _SC_MAPPED_FILES
- {*r = _SC_MAPPED_FILES; return 0;}
-#else /* def _SC_MAPPED_FILES */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MAPPED_FILES */
- if (x == Mono_Posix_SysConf__SC_MEMLOCK)
-#ifdef _SC_MEMLOCK
- {*r = _SC_MEMLOCK; return 0;}
-#else /* def _SC_MEMLOCK */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MEMLOCK */
- if (x == Mono_Posix_SysConf__SC_MEMLOCK_RANGE)
-#ifdef _SC_MEMLOCK_RANGE
- {*r = _SC_MEMLOCK_RANGE; return 0;}
-#else /* def _SC_MEMLOCK_RANGE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MEMLOCK_RANGE */
- if (x == Mono_Posix_SysConf__SC_MEMORY_PROTECTION)
-#ifdef _SC_MEMORY_PROTECTION
- {*r = _SC_MEMORY_PROTECTION; return 0;}
-#else /* def _SC_MEMORY_PROTECTION */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MEMORY_PROTECTION */
- if (x == Mono_Posix_SysConf__SC_MESSAGE_PASSING)
-#ifdef _SC_MESSAGE_PASSING
- {*r = _SC_MESSAGE_PASSING; return 0;}
-#else /* def _SC_MESSAGE_PASSING */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MESSAGE_PASSING */
- if (x == Mono_Posix_SysConf__SC_SEMAPHORES)
-#ifdef _SC_SEMAPHORES
- {*r = _SC_SEMAPHORES; return 0;}
-#else /* def _SC_SEMAPHORES */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SEMAPHORES */
- if (x == Mono_Posix_SysConf__SC_SHARED_MEMORY_OBJECTS)
-#ifdef _SC_SHARED_MEMORY_OBJECTS
- {*r = _SC_SHARED_MEMORY_OBJECTS; return 0;}
-#else /* def _SC_SHARED_MEMORY_OBJECTS */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SHARED_MEMORY_OBJECTS */
- if (x == Mono_Posix_SysConf__SC_AIO_LISTIO_MAX)
-#ifdef _SC_AIO_LISTIO_MAX
- {*r = _SC_AIO_LISTIO_MAX; return 0;}
-#else /* def _SC_AIO_LISTIO_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_AIO_LISTIO_MAX */
- if (x == Mono_Posix_SysConf__SC_AIO_MAX)
-#ifdef _SC_AIO_MAX
- {*r = _SC_AIO_MAX; return 0;}
-#else /* def _SC_AIO_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_AIO_MAX */
- if (x == Mono_Posix_SysConf__SC_AIO_PRIO_DELTA_MAX)
-#ifdef _SC_AIO_PRIO_DELTA_MAX
- {*r = _SC_AIO_PRIO_DELTA_MAX; return 0;}
-#else /* def _SC_AIO_PRIO_DELTA_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_AIO_PRIO_DELTA_MAX */
- if (x == Mono_Posix_SysConf__SC_DELAYTIMER_MAX)
-#ifdef _SC_DELAYTIMER_MAX
- {*r = _SC_DELAYTIMER_MAX; return 0;}
-#else /* def _SC_DELAYTIMER_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_DELAYTIMER_MAX */
- if (x == Mono_Posix_SysConf__SC_MQ_OPEN_MAX)
-#ifdef _SC_MQ_OPEN_MAX
- {*r = _SC_MQ_OPEN_MAX; return 0;}
-#else /* def _SC_MQ_OPEN_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MQ_OPEN_MAX */
- if (x == Mono_Posix_SysConf__SC_MQ_PRIO_MAX)
-#ifdef _SC_MQ_PRIO_MAX
- {*r = _SC_MQ_PRIO_MAX; return 0;}
-#else /* def _SC_MQ_PRIO_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_MQ_PRIO_MAX */
- if (x == Mono_Posix_SysConf__SC_VERSION)
-#ifdef _SC_VERSION
- {*r = _SC_VERSION; return 0;}
-#else /* def _SC_VERSION */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_VERSION */
- if (x == Mono_Posix_SysConf__SC_PAGESIZE)
-#ifdef _SC_PAGESIZE
- {*r = _SC_PAGESIZE; return 0;}
-#else /* def _SC_PAGESIZE */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_PAGESIZE */
- if (x == Mono_Posix_SysConf__SC_RTSIG_MAX)
-#ifdef _SC_RTSIG_MAX
- {*r = _SC_RTSIG_MAX; return 0;}
-#else /* def _SC_RTSIG_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_RTSIG_MAX */
- if (x == Mono_Posix_SysConf__SC_SEM_NSEMS_MAX)
-#ifdef _SC_SEM_NSEMS_MAX
- {*r = _SC_SEM_NSEMS_MAX; return 0;}
-#else /* def _SC_SEM_NSEMS_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SEM_NSEMS_MAX */
- if (x == Mono_Posix_SysConf__SC_SEM_VALUE_MAX)
-#ifdef _SC_SEM_VALUE_MAX
- {*r = _SC_SEM_VALUE_MAX; return 0;}
-#else /* def _SC_SEM_VALUE_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SEM_VALUE_MAX */
- if (x == Mono_Posix_SysConf__SC_SIGQUEUE_MAX)
-#ifdef _SC_SIGQUEUE_MAX
- {*r = _SC_SIGQUEUE_MAX; return 0;}
-#else /* def _SC_SIGQUEUE_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_SIGQUEUE_MAX */
- if (x == Mono_Posix_SysConf__SC_TIMER_MAX)
-#ifdef _SC_TIMER_MAX
- {*r = _SC_TIMER_MAX; return 0;}
-#else /* def _SC_TIMER_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_TIMER_MAX */
- if (x == Mono_Posix_SysConf__SC_BC_BASE_MAX)
-#ifdef _SC_BC_BASE_MAX
- {*r = _SC_BC_BASE_MAX; return 0;}
-#else /* def _SC_BC_BASE_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_BC_BASE_MAX */
- if (x == Mono_Posix_SysConf__SC_BC_DIM_MAX)
-#ifdef _SC_BC_DIM_MAX
- {*r = _SC_BC_DIM_MAX; return 0;}
-#else /* def _SC_BC_DIM_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_BC_DIM_MAX */
- if (x == Mono_Posix_SysConf__SC_BC_SCALE_MAX)
-#ifdef _SC_BC_SCALE_MAX
- {*r = _SC_BC_SCALE_MAX; return 0;}
-#else /* def _SC_BC_SCALE_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_BC_SCALE_MAX */
- if (x == Mono_Posix_SysConf__SC_BC_STRING_MAX)
-#ifdef _SC_BC_STRING_MAX
- {*r = _SC_BC_STRING_MAX; return 0;}
-#else /* def _SC_BC_STRING_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_BC_STRING_MAX */
- if (x == Mono_Posix_SysConf__SC_COLL_WEIGHTS_MAX)
-#ifdef _SC_COLL_WEIGHTS_MAX
- {*r = _SC_COLL_WEIGHTS_MAX; return 0;}
-#else /* def _SC_COLL_WEIGHTS_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_COLL_WEIGHTS_MAX */
- if (x == Mono_Posix_SysConf__SC_EQUIV_CLASS_MAX)
-#ifdef _SC_EQUIV_CLASS_MAX
- {*r = _SC_EQUIV_CLASS_MAX; return 0;}
-#else /* def _SC_EQUIV_CLASS_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_EQUIV_CLASS_MAX */
- if (x == Mono_Posix_SysConf__SC_EXPR_NEST_MAX)
-#ifdef _SC_EXPR_NEST_MAX
- {*r = _SC_EXPR_NEST_MAX; return 0;}
-#else /* def _SC_EXPR_NEST_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_EXPR_NEST_MAX */
- if (x == Mono_Posix_SysConf__SC_LINE_MAX)
-#ifdef _SC_LINE_MAX
- {*r = _SC_LINE_MAX; return 0;}
-#else /* def _SC_LINE_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_LINE_MAX */
- if (x == Mono_Posix_SysConf__SC_RE_DUP_MAX)
-#ifdef _SC_RE_DUP_MAX
- {*r = _SC_RE_DUP_MAX; return 0;}
-#else /* def _SC_RE_DUP_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_RE_DUP_MAX */
- if (x == Mono_Posix_SysConf__SC_CHARCLASS_NAME_MAX)
-#ifdef _SC_CHARCLASS_NAME_MAX
- {*r = _SC_CHARCLASS_NAME_MAX; return 0;}
-#else /* def _SC_CHARCLASS_NAME_MAX */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_CHARCLASS_NAME_MAX */
- if (x == Mono_Posix_SysConf__SC_2_VERSION)
-#ifdef _SC_2_VERSION
- {*r = _SC_2_VERSION; return 0;}
-#else /* def _SC_2_VERSION */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_VERSION */
- if (x == Mono_Posix_SysConf__SC_2_C_BIND)
-#ifdef _SC_2_C_BIND
- {*r = _SC_2_C_BIND; return 0;}
-#else /* def _SC_2_C_BIND */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_C_BIND */
- if (x == Mono_Posix_SysConf__SC_2_C_DEV)
-#ifdef _SC_2_C_DEV
- {*r = _SC_2_C_DEV; return 0;}
-#else /* def _SC_2_C_DEV */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_C_DEV */
- if (x == Mono_Posix_SysConf__SC_2_FORT_DEV)
-#ifdef _SC_2_FORT_DEV
- {*r = _SC_2_FORT_DEV; return 0;}
-#else /* def _SC_2_FORT_DEV */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_FORT_DEV */
- if (x == Mono_Posix_SysConf__SC_2_FORT_RUN)
-#ifdef _SC_2_FORT_RUN
- {*r = _SC_2_FORT_RUN; return 0;}
-#else /* def _SC_2_FORT_RUN */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_FORT_RUN */
- if (x == Mono_Posix_SysConf__SC_2_SW_DEV)
-#ifdef _SC_2_SW_DEV
- {*r = _SC_2_SW_DEV; return 0;}
-#else /* def _SC_2_SW_DEV */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_SW_DEV */
- if (x == Mono_Posix_SysConf__SC_2_LOCALEDEF)
-#ifdef _SC_2_LOCALEDEF
- {*r = _SC_2_LOCALEDEF; return 0;}
-#else /* def _SC_2_LOCALEDEF */
- {errno = EINVAL; return -1;}
-#endif /* ndef _SC_2_LOCALEDEF */
- if (x == Mono_Posix_SysConf__SC_PII)
-#ifdef _SC_PII
- {*r = _SC_PII; return 0;}
-#else /* def _SC_PII */