Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
6486 lines (6428 sloc) 199 KB
/*
* This file was automatically generated by make-map from ../../mcs/class/lib/default/Mono.Posix.dll.
*
* DO NOT MODIFY.
*/
#include <config.h>
#include "map.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif /* ndef _GNU_SOURCE */
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif /* ndef _XOPEN_SOURCE */
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#include <errno.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
int Mono_Posix_FromError (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_Error_EPERM)
#ifdef EPERM
{*r = EPERM; return 0;}
#else /* def EPERM */
{errno = EINVAL; return -1;}
#endif /* ndef EPERM */
if (x == Mono_Posix_Error_ENOENT)
#ifdef ENOENT
{*r = ENOENT; return 0;}
#else /* def ENOENT */
{errno = EINVAL; return -1;}
#endif /* ndef ENOENT */
if (x == Mono_Posix_Error_ESRCH)
#ifdef ESRCH
{*r = ESRCH; return 0;}
#else /* def ESRCH */
{errno = EINVAL; return -1;}
#endif /* ndef ESRCH */
if (x == Mono_Posix_Error_EINTR)
#ifdef EINTR
{*r = EINTR; return 0;}
#else /* def EINTR */
{errno = EINVAL; return -1;}
#endif /* ndef EINTR */
if (x == Mono_Posix_Error_EIO)
#ifdef EIO
{*r = EIO; return 0;}
#else /* def EIO */
{errno = EINVAL; return -1;}
#endif /* ndef EIO */
if (x == Mono_Posix_Error_ENXIO)
#ifdef ENXIO
{*r = ENXIO; return 0;}
#else /* def ENXIO */
{errno = EINVAL; return -1;}
#endif /* ndef ENXIO */
if (x == Mono_Posix_Error_E2BIG)
#ifdef E2BIG
{*r = E2BIG; return 0;}
#else /* def E2BIG */
{errno = EINVAL; return -1;}
#endif /* ndef E2BIG */
if (x == Mono_Posix_Error_ENOEXEC)
#ifdef ENOEXEC
{*r = ENOEXEC; return 0;}
#else /* def ENOEXEC */
{errno = EINVAL; return -1;}
#endif /* ndef ENOEXEC */
if (x == Mono_Posix_Error_EBADF)
#ifdef EBADF
{*r = EBADF; return 0;}
#else /* def EBADF */
{errno = EINVAL; return -1;}
#endif /* ndef EBADF */
if (x == Mono_Posix_Error_ECHILD)
#ifdef ECHILD
{*r = ECHILD; return 0;}
#else /* def ECHILD */
{errno = EINVAL; return -1;}
#endif /* ndef ECHILD */
if (x == Mono_Posix_Error_EAGAIN)
#ifdef EAGAIN
{*r = EAGAIN; return 0;}
#else /* def EAGAIN */
{errno = EINVAL; return -1;}
#endif /* ndef EAGAIN */
if (x == Mono_Posix_Error_ENOMEM)
#ifdef ENOMEM
{*r = ENOMEM; return 0;}
#else /* def ENOMEM */
{errno = EINVAL; return -1;}
#endif /* ndef ENOMEM */
if (x == Mono_Posix_Error_EACCES)
#ifdef EACCES
{*r = EACCES; return 0;}
#else /* def EACCES */
{errno = EINVAL; return -1;}
#endif /* ndef EACCES */
if (x == Mono_Posix_Error_EFAULT)
#ifdef EFAULT
{*r = EFAULT; return 0;}
#else /* def EFAULT */
{errno = EINVAL; return -1;}
#endif /* ndef EFAULT */
if (x == Mono_Posix_Error_ENOTBLK)
#ifdef ENOTBLK
{*r = ENOTBLK; return 0;}
#else /* def ENOTBLK */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTBLK */
if (x == Mono_Posix_Error_EBUSY)
#ifdef EBUSY
{*r = EBUSY; return 0;}
#else /* def EBUSY */
{errno = EINVAL; return -1;}
#endif /* ndef EBUSY */
if (x == Mono_Posix_Error_EEXIST)
#ifdef EEXIST
{*r = EEXIST; return 0;}
#else /* def EEXIST */
{errno = EINVAL; return -1;}
#endif /* ndef EEXIST */
if (x == Mono_Posix_Error_EXDEV)
#ifdef EXDEV
{*r = EXDEV; return 0;}
#else /* def EXDEV */
{errno = EINVAL; return -1;}
#endif /* ndef EXDEV */
if (x == Mono_Posix_Error_ENODEV)
#ifdef ENODEV
{*r = ENODEV; return 0;}
#else /* def ENODEV */
{errno = EINVAL; return -1;}
#endif /* ndef ENODEV */
if (x == Mono_Posix_Error_ENOTDIR)
#ifdef ENOTDIR
{*r = ENOTDIR; return 0;}
#else /* def ENOTDIR */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTDIR */
if (x == Mono_Posix_Error_EISDIR)
#ifdef EISDIR
{*r = EISDIR; return 0;}
#else /* def EISDIR */
{errno = EINVAL; return -1;}
#endif /* ndef EISDIR */
if (x == Mono_Posix_Error_EINVAL)
#ifdef EINVAL
{*r = EINVAL; return 0;}
#else /* def EINVAL */
{errno = EINVAL; return -1;}
#endif /* ndef EINVAL */
if (x == Mono_Posix_Error_ENFILE)
#ifdef ENFILE
{*r = ENFILE; return 0;}
#else /* def ENFILE */
{errno = EINVAL; return -1;}
#endif /* ndef ENFILE */
if (x == Mono_Posix_Error_EMFILE)
#ifdef EMFILE
{*r = EMFILE; return 0;}
#else /* def EMFILE */
{errno = EINVAL; return -1;}
#endif /* ndef EMFILE */
if (x == Mono_Posix_Error_ENOTTY)
#ifdef ENOTTY
{*r = ENOTTY; return 0;}
#else /* def ENOTTY */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTTY */
if (x == Mono_Posix_Error_ETXTBSY)
#ifdef ETXTBSY
{*r = ETXTBSY; return 0;}
#else /* def ETXTBSY */
{errno = EINVAL; return -1;}
#endif /* ndef ETXTBSY */
if (x == Mono_Posix_Error_EFBIG)
#ifdef EFBIG
{*r = EFBIG; return 0;}
#else /* def EFBIG */
{errno = EINVAL; return -1;}
#endif /* ndef EFBIG */
if (x == Mono_Posix_Error_ENOSPC)
#ifdef ENOSPC
{*r = ENOSPC; return 0;}
#else /* def ENOSPC */
{errno = EINVAL; return -1;}
#endif /* ndef ENOSPC */
if (x == Mono_Posix_Error_ESPIPE)
#ifdef ESPIPE
{*r = ESPIPE; return 0;}
#else /* def ESPIPE */
{errno = EINVAL; return -1;}
#endif /* ndef ESPIPE */
if (x == Mono_Posix_Error_EROFS)
#ifdef EROFS
{*r = EROFS; return 0;}
#else /* def EROFS */
{errno = EINVAL; return -1;}
#endif /* ndef EROFS */
if (x == Mono_Posix_Error_EMLINK)
#ifdef EMLINK
{*r = EMLINK; return 0;}
#else /* def EMLINK */
{errno = EINVAL; return -1;}
#endif /* ndef EMLINK */
if (x == Mono_Posix_Error_EPIPE)
#ifdef EPIPE
{*r = EPIPE; return 0;}
#else /* def EPIPE */
{errno = EINVAL; return -1;}
#endif /* ndef EPIPE */
if (x == Mono_Posix_Error_EDOM)
#ifdef EDOM
{*r = EDOM; return 0;}
#else /* def EDOM */
{errno = EINVAL; return -1;}
#endif /* ndef EDOM */
if (x == Mono_Posix_Error_ERANGE)
#ifdef ERANGE
{*r = ERANGE; return 0;}
#else /* def ERANGE */
{errno = EINVAL; return -1;}
#endif /* ndef ERANGE */
if (x == Mono_Posix_Error_EDEADLK)
#ifdef EDEADLK
{*r = EDEADLK; return 0;}
#else /* def EDEADLK */
{errno = EINVAL; return -1;}
#endif /* ndef EDEADLK */
if (x == Mono_Posix_Error_ENAMETOOLONG)
#ifdef ENAMETOOLONG
{*r = ENAMETOOLONG; return 0;}
#else /* def ENAMETOOLONG */
{errno = EINVAL; return -1;}
#endif /* ndef ENAMETOOLONG */
if (x == Mono_Posix_Error_ENOLCK)
#ifdef ENOLCK
{*r = ENOLCK; return 0;}
#else /* def ENOLCK */
{errno = EINVAL; return -1;}
#endif /* ndef ENOLCK */
if (x == Mono_Posix_Error_ENOSYS)
#ifdef ENOSYS
{*r = ENOSYS; return 0;}
#else /* def ENOSYS */
{errno = EINVAL; return -1;}
#endif /* ndef ENOSYS */
if (x == Mono_Posix_Error_ENOTEMPTY)
#ifdef ENOTEMPTY
{*r = ENOTEMPTY; return 0;}
#else /* def ENOTEMPTY */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTEMPTY */
if (x == Mono_Posix_Error_ELOOP)
#ifdef ELOOP
{*r = ELOOP; return 0;}
#else /* def ELOOP */
{errno = EINVAL; return -1;}
#endif /* ndef ELOOP */
if (x == Mono_Posix_Error_EWOULDBLOCK)
#ifdef EWOULDBLOCK
{*r = EWOULDBLOCK; return 0;}
#else /* def EWOULDBLOCK */
{errno = EINVAL; return -1;}
#endif /* ndef EWOULDBLOCK */
if (x == Mono_Posix_Error_ENOMSG)
#ifdef ENOMSG
{*r = ENOMSG; return 0;}
#else /* def ENOMSG */
{errno = EINVAL; return -1;}
#endif /* ndef ENOMSG */
if (x == Mono_Posix_Error_EIDRM)
#ifdef EIDRM
{*r = EIDRM; return 0;}
#else /* def EIDRM */
{errno = EINVAL; return -1;}
#endif /* ndef EIDRM */
if (x == Mono_Posix_Error_ECHRNG)
#ifdef ECHRNG
{*r = ECHRNG; return 0;}
#else /* def ECHRNG */
{errno = EINVAL; return -1;}
#endif /* ndef ECHRNG */
if (x == Mono_Posix_Error_EL2NSYNC)
#ifdef EL2NSYNC
{*r = EL2NSYNC; return 0;}
#else /* def EL2NSYNC */
{errno = EINVAL; return -1;}
#endif /* ndef EL2NSYNC */
if (x == Mono_Posix_Error_EL3HLT)
#ifdef EL3HLT
{*r = EL3HLT; return 0;}
#else /* def EL3HLT */
{errno = EINVAL; return -1;}
#endif /* ndef EL3HLT */
if (x == Mono_Posix_Error_EL3RST)
#ifdef EL3RST
{*r = EL3RST; return 0;}
#else /* def EL3RST */
{errno = EINVAL; return -1;}
#endif /* ndef EL3RST */
if (x == Mono_Posix_Error_ELNRNG)
#ifdef ELNRNG
{*r = ELNRNG; return 0;}
#else /* def ELNRNG */
{errno = EINVAL; return -1;}
#endif /* ndef ELNRNG */
if (x == Mono_Posix_Error_EUNATCH)
#ifdef EUNATCH
{*r = EUNATCH; return 0;}
#else /* def EUNATCH */
{errno = EINVAL; return -1;}
#endif /* ndef EUNATCH */
if (x == Mono_Posix_Error_ENOCSI)
#ifdef ENOCSI
{*r = ENOCSI; return 0;}
#else /* def ENOCSI */
{errno = EINVAL; return -1;}
#endif /* ndef ENOCSI */
if (x == Mono_Posix_Error_EL2HLT)
#ifdef EL2HLT
{*r = EL2HLT; return 0;}
#else /* def EL2HLT */
{errno = EINVAL; return -1;}
#endif /* ndef EL2HLT */
if (x == Mono_Posix_Error_EBADE)
#ifdef EBADE
{*r = EBADE; return 0;}
#else /* def EBADE */
{errno = EINVAL; return -1;}
#endif /* ndef EBADE */
if (x == Mono_Posix_Error_EBADR)
#ifdef EBADR
{*r = EBADR; return 0;}
#else /* def EBADR */
{errno = EINVAL; return -1;}
#endif /* ndef EBADR */
if (x == Mono_Posix_Error_EXFULL)
#ifdef EXFULL
{*r = EXFULL; return 0;}
#else /* def EXFULL */
{errno = EINVAL; return -1;}
#endif /* ndef EXFULL */
if (x == Mono_Posix_Error_ENOANO)
#ifdef ENOANO
{*r = ENOANO; return 0;}
#else /* def ENOANO */
{errno = EINVAL; return -1;}
#endif /* ndef ENOANO */
if (x == Mono_Posix_Error_EBADRQC)
#ifdef EBADRQC
{*r = EBADRQC; return 0;}
#else /* def EBADRQC */
{errno = EINVAL; return -1;}
#endif /* ndef EBADRQC */
if (x == Mono_Posix_Error_EBADSLT)
#ifdef EBADSLT
{*r = EBADSLT; return 0;}
#else /* def EBADSLT */
{errno = EINVAL; return -1;}
#endif /* ndef EBADSLT */
if (x == Mono_Posix_Error_EDEADLOCK)
#ifdef EDEADLOCK
{*r = EDEADLOCK; return 0;}
#else /* def EDEADLOCK */
{errno = EINVAL; return -1;}
#endif /* ndef EDEADLOCK */
if (x == Mono_Posix_Error_EBFONT)
#ifdef EBFONT
{*r = EBFONT; return 0;}
#else /* def EBFONT */
{errno = EINVAL; return -1;}
#endif /* ndef EBFONT */
if (x == Mono_Posix_Error_ENOSTR)
#ifdef ENOSTR
{*r = ENOSTR; return 0;}
#else /* def ENOSTR */
{errno = EINVAL; return -1;}
#endif /* ndef ENOSTR */
if (x == Mono_Posix_Error_ENODATA)
#ifdef ENODATA
{*r = ENODATA; return 0;}
#else /* def ENODATA */
{errno = EINVAL; return -1;}
#endif /* ndef ENODATA */
if (x == Mono_Posix_Error_ETIME)
#ifdef ETIME
{*r = ETIME; return 0;}
#else /* def ETIME */
{errno = EINVAL; return -1;}
#endif /* ndef ETIME */
if (x == Mono_Posix_Error_ENOSR)
#ifdef ENOSR
{*r = ENOSR; return 0;}
#else /* def ENOSR */
{errno = EINVAL; return -1;}
#endif /* ndef ENOSR */
if (x == Mono_Posix_Error_ENONET)
#ifdef ENONET
{*r = ENONET; return 0;}
#else /* def ENONET */
{errno = EINVAL; return -1;}
#endif /* ndef ENONET */
if (x == Mono_Posix_Error_ENOPKG)
#ifdef ENOPKG
{*r = ENOPKG; return 0;}
#else /* def ENOPKG */
{errno = EINVAL; return -1;}
#endif /* ndef ENOPKG */
if (x == Mono_Posix_Error_EREMOTE)
#ifdef EREMOTE
{*r = EREMOTE; return 0;}
#else /* def EREMOTE */
{errno = EINVAL; return -1;}
#endif /* ndef EREMOTE */
if (x == Mono_Posix_Error_ENOLINK)
#ifdef ENOLINK
{*r = ENOLINK; return 0;}
#else /* def ENOLINK */
{errno = EINVAL; return -1;}
#endif /* ndef ENOLINK */
if (x == Mono_Posix_Error_EADV)
#ifdef EADV
{*r = EADV; return 0;}
#else /* def EADV */
{errno = EINVAL; return -1;}
#endif /* ndef EADV */
if (x == Mono_Posix_Error_ESRMNT)
#ifdef ESRMNT
{*r = ESRMNT; return 0;}
#else /* def ESRMNT */
{errno = EINVAL; return -1;}
#endif /* ndef ESRMNT */
if (x == Mono_Posix_Error_ECOMM)
#ifdef ECOMM
{*r = ECOMM; return 0;}
#else /* def ECOMM */
{errno = EINVAL; return -1;}
#endif /* ndef ECOMM */
if (x == Mono_Posix_Error_EPROTO)
#ifdef EPROTO
{*r = EPROTO; return 0;}
#else /* def EPROTO */
{errno = EINVAL; return -1;}
#endif /* ndef EPROTO */
if (x == Mono_Posix_Error_EMULTIHOP)
#ifdef EMULTIHOP
{*r = EMULTIHOP; return 0;}
#else /* def EMULTIHOP */
{errno = EINVAL; return -1;}
#endif /* ndef EMULTIHOP */
if (x == Mono_Posix_Error_EDOTDOT)
#ifdef EDOTDOT
{*r = EDOTDOT; return 0;}
#else /* def EDOTDOT */
{errno = EINVAL; return -1;}
#endif /* ndef EDOTDOT */
if (x == Mono_Posix_Error_EBADMSG)
#ifdef EBADMSG
{*r = EBADMSG; return 0;}
#else /* def EBADMSG */
{errno = EINVAL; return -1;}
#endif /* ndef EBADMSG */
if (x == Mono_Posix_Error_EOVERFLOW)
#ifdef EOVERFLOW
{*r = EOVERFLOW; return 0;}
#else /* def EOVERFLOW */
{errno = EINVAL; return -1;}
#endif /* ndef EOVERFLOW */
if (x == Mono_Posix_Error_ENOTUNIQ)
#ifdef ENOTUNIQ
{*r = ENOTUNIQ; return 0;}
#else /* def ENOTUNIQ */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTUNIQ */
if (x == Mono_Posix_Error_EBADFD)
#ifdef EBADFD
{*r = EBADFD; return 0;}
#else /* def EBADFD */
{errno = EINVAL; return -1;}
#endif /* ndef EBADFD */
if (x == Mono_Posix_Error_EREMCHG)
#ifdef EREMCHG
{*r = EREMCHG; return 0;}
#else /* def EREMCHG */
{errno = EINVAL; return -1;}
#endif /* ndef EREMCHG */
if (x == Mono_Posix_Error_ELIBACC)
#ifdef ELIBACC
{*r = ELIBACC; return 0;}
#else /* def ELIBACC */
{errno = EINVAL; return -1;}
#endif /* ndef ELIBACC */
if (x == Mono_Posix_Error_ELIBBAD)
#ifdef ELIBBAD
{*r = ELIBBAD; return 0;}
#else /* def ELIBBAD */
{errno = EINVAL; return -1;}
#endif /* ndef ELIBBAD */
if (x == Mono_Posix_Error_ELIBSCN)
#ifdef ELIBSCN
{*r = ELIBSCN; return 0;}
#else /* def ELIBSCN */
{errno = EINVAL; return -1;}
#endif /* ndef ELIBSCN */
if (x == Mono_Posix_Error_ELIBMAX)
#ifdef ELIBMAX
{*r = ELIBMAX; return 0;}
#else /* def ELIBMAX */
{errno = EINVAL; return -1;}
#endif /* ndef ELIBMAX */
if (x == Mono_Posix_Error_ELIBEXEC)
#ifdef ELIBEXEC
{*r = ELIBEXEC; return 0;}
#else /* def ELIBEXEC */
{errno = EINVAL; return -1;}
#endif /* ndef ELIBEXEC */
if (x == Mono_Posix_Error_EILSEQ)
#ifdef EILSEQ
{*r = EILSEQ; return 0;}
#else /* def EILSEQ */
{errno = EINVAL; return -1;}
#endif /* ndef EILSEQ */
if (x == Mono_Posix_Error_ERESTART)
#ifdef ERESTART
{*r = ERESTART; return 0;}
#else /* def ERESTART */
{errno = EINVAL; return -1;}
#endif /* ndef ERESTART */
if (x == Mono_Posix_Error_ESTRPIPE)
#ifdef ESTRPIPE
{*r = ESTRPIPE; return 0;}
#else /* def ESTRPIPE */
{errno = EINVAL; return -1;}
#endif /* ndef ESTRPIPE */
if (x == Mono_Posix_Error_EUSERS)
#ifdef EUSERS
{*r = EUSERS; return 0;}
#else /* def EUSERS */
{errno = EINVAL; return -1;}
#endif /* ndef EUSERS */
if (x == Mono_Posix_Error_ENOTSOCK)
#ifdef ENOTSOCK
{*r = ENOTSOCK; return 0;}
#else /* def ENOTSOCK */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTSOCK */
if (x == Mono_Posix_Error_EDESTADDRREQ)
#ifdef EDESTADDRREQ
{*r = EDESTADDRREQ; return 0;}
#else /* def EDESTADDRREQ */
{errno = EINVAL; return -1;}
#endif /* ndef EDESTADDRREQ */
if (x == Mono_Posix_Error_EMSGSIZE)
#ifdef EMSGSIZE
{*r = EMSGSIZE; return 0;}
#else /* def EMSGSIZE */
{errno = EINVAL; return -1;}
#endif /* ndef EMSGSIZE */
if (x == Mono_Posix_Error_EPROTOTYPE)
#ifdef EPROTOTYPE
{*r = EPROTOTYPE; return 0;}
#else /* def EPROTOTYPE */
{errno = EINVAL; return -1;}
#endif /* ndef EPROTOTYPE */
if (x == Mono_Posix_Error_ENOPROTOOPT)
#ifdef ENOPROTOOPT
{*r = ENOPROTOOPT; return 0;}
#else /* def ENOPROTOOPT */
{errno = EINVAL; return -1;}
#endif /* ndef ENOPROTOOPT */
if (x == Mono_Posix_Error_EPROTONOSUPPORT)
#ifdef EPROTONOSUPPORT
{*r = EPROTONOSUPPORT; return 0;}
#else /* def EPROTONOSUPPORT */
{errno = EINVAL; return -1;}
#endif /* ndef EPROTONOSUPPORT */
if (x == Mono_Posix_Error_ESOCKTNOSUPPORT)
#ifdef ESOCKTNOSUPPORT
{*r = ESOCKTNOSUPPORT; return 0;}
#else /* def ESOCKTNOSUPPORT */
{errno = EINVAL; return -1;}
#endif /* ndef ESOCKTNOSUPPORT */
if (x == Mono_Posix_Error_EOPNOTSUPP)
#ifdef EOPNOTSUPP
{*r = EOPNOTSUPP; return 0;}
#else /* def EOPNOTSUPP */
{errno = EINVAL; return -1;}
#endif /* ndef EOPNOTSUPP */
if (x == Mono_Posix_Error_EPFNOSUPPORT)
#ifdef EPFNOSUPPORT
{*r = EPFNOSUPPORT; return 0;}
#else /* def EPFNOSUPPORT */
{errno = EINVAL; return -1;}
#endif /* ndef EPFNOSUPPORT */
if (x == Mono_Posix_Error_EAFNOSUPPORT)
#ifdef EAFNOSUPPORT
{*r = EAFNOSUPPORT; return 0;}
#else /* def EAFNOSUPPORT */
{errno = EINVAL; return -1;}
#endif /* ndef EAFNOSUPPORT */
if (x == Mono_Posix_Error_EADDRINUSE)
#ifdef EADDRINUSE
{*r = EADDRINUSE; return 0;}
#else /* def EADDRINUSE */
{errno = EINVAL; return -1;}
#endif /* ndef EADDRINUSE */
if (x == Mono_Posix_Error_EADDRNOTAVAIL)
#ifdef EADDRNOTAVAIL
{*r = EADDRNOTAVAIL; return 0;}
#else /* def EADDRNOTAVAIL */
{errno = EINVAL; return -1;}
#endif /* ndef EADDRNOTAVAIL */
if (x == Mono_Posix_Error_ENETDOWN)
#ifdef ENETDOWN
{*r = ENETDOWN; return 0;}
#else /* def ENETDOWN */
{errno = EINVAL; return -1;}
#endif /* ndef ENETDOWN */
if (x == Mono_Posix_Error_ENETUNREACH)
#ifdef ENETUNREACH
{*r = ENETUNREACH; return 0;}
#else /* def ENETUNREACH */
{errno = EINVAL; return -1;}
#endif /* ndef ENETUNREACH */
if (x == Mono_Posix_Error_ENETRESET)
#ifdef ENETRESET
{*r = ENETRESET; return 0;}
#else /* def ENETRESET */
{errno = EINVAL; return -1;}
#endif /* ndef ENETRESET */
if (x == Mono_Posix_Error_ECONNABORTED)
#ifdef ECONNABORTED
{*r = ECONNABORTED; return 0;}
#else /* def ECONNABORTED */
{errno = EINVAL; return -1;}
#endif /* ndef ECONNABORTED */
if (x == Mono_Posix_Error_ECONNRESET)
#ifdef ECONNRESET
{*r = ECONNRESET; return 0;}
#else /* def ECONNRESET */
{errno = EINVAL; return -1;}
#endif /* ndef ECONNRESET */
if (x == Mono_Posix_Error_ENOBUFS)
#ifdef ENOBUFS
{*r = ENOBUFS; return 0;}
#else /* def ENOBUFS */
{errno = EINVAL; return -1;}
#endif /* ndef ENOBUFS */
if (x == Mono_Posix_Error_EISCONN)
#ifdef EISCONN
{*r = EISCONN; return 0;}
#else /* def EISCONN */
{errno = EINVAL; return -1;}
#endif /* ndef EISCONN */
if (x == Mono_Posix_Error_ENOTCONN)
#ifdef ENOTCONN
{*r = ENOTCONN; return 0;}
#else /* def ENOTCONN */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTCONN */
if (x == Mono_Posix_Error_ESHUTDOWN)
#ifdef ESHUTDOWN
{*r = ESHUTDOWN; return 0;}
#else /* def ESHUTDOWN */
{errno = EINVAL; return -1;}
#endif /* ndef ESHUTDOWN */
if (x == Mono_Posix_Error_ETOOMANYREFS)
#ifdef ETOOMANYREFS
{*r = ETOOMANYREFS; return 0;}
#else /* def ETOOMANYREFS */
{errno = EINVAL; return -1;}
#endif /* ndef ETOOMANYREFS */
if (x == Mono_Posix_Error_ETIMEDOUT)
#ifdef ETIMEDOUT
{*r = ETIMEDOUT; return 0;}
#else /* def ETIMEDOUT */
{errno = EINVAL; return -1;}
#endif /* ndef ETIMEDOUT */
if (x == Mono_Posix_Error_ECONNREFUSED)
#ifdef ECONNREFUSED
{*r = ECONNREFUSED; return 0;}
#else /* def ECONNREFUSED */
{errno = EINVAL; return -1;}
#endif /* ndef ECONNREFUSED */
if (x == Mono_Posix_Error_EHOSTDOWN)
#ifdef EHOSTDOWN
{*r = EHOSTDOWN; return 0;}
#else /* def EHOSTDOWN */
{errno = EINVAL; return -1;}
#endif /* ndef EHOSTDOWN */
if (x == Mono_Posix_Error_EHOSTUNREACH)
#ifdef EHOSTUNREACH
{*r = EHOSTUNREACH; return 0;}
#else /* def EHOSTUNREACH */
{errno = EINVAL; return -1;}
#endif /* ndef EHOSTUNREACH */
if (x == Mono_Posix_Error_EALREADY)
#ifdef EALREADY
{*r = EALREADY; return 0;}
#else /* def EALREADY */
{errno = EINVAL; return -1;}
#endif /* ndef EALREADY */
if (x == Mono_Posix_Error_EINPROGRESS)
#ifdef EINPROGRESS
{*r = EINPROGRESS; return 0;}
#else /* def EINPROGRESS */
{errno = EINVAL; return -1;}
#endif /* ndef EINPROGRESS */
if (x == Mono_Posix_Error_ESTALE)
#ifdef ESTALE
{*r = ESTALE; return 0;}
#else /* def ESTALE */
{errno = EINVAL; return -1;}
#endif /* ndef ESTALE */
if (x == Mono_Posix_Error_EUCLEAN)
#ifdef EUCLEAN
{*r = EUCLEAN; return 0;}
#else /* def EUCLEAN */
{errno = EINVAL; return -1;}
#endif /* ndef EUCLEAN */
if (x == Mono_Posix_Error_ENOTNAM)
#ifdef ENOTNAM
{*r = ENOTNAM; return 0;}
#else /* def ENOTNAM */
{errno = EINVAL; return -1;}
#endif /* ndef ENOTNAM */
if (x == Mono_Posix_Error_ENAVAIL)
#ifdef ENAVAIL
{*r = ENAVAIL; return 0;}
#else /* def ENAVAIL */
{errno = EINVAL; return -1;}
#endif /* ndef ENAVAIL */
if (x == Mono_Posix_Error_EISNAM)
#ifdef EISNAM
{*r = EISNAM; return 0;}
#else /* def EISNAM */
{errno = EINVAL; return -1;}
#endif /* ndef EISNAM */
if (x == Mono_Posix_Error_EREMOTEIO)
#ifdef EREMOTEIO
{*r = EREMOTEIO; return 0;}
#else /* def EREMOTEIO */
{errno = EINVAL; return -1;}
#endif /* ndef EREMOTEIO */
if (x == Mono_Posix_Error_EDQUOT)
#ifdef EDQUOT
{*r = EDQUOT; return 0;}
#else /* def EDQUOT */
{errno = EINVAL; return -1;}
#endif /* ndef EDQUOT */
if (x == Mono_Posix_Error_ENOMEDIUM)
#ifdef ENOMEDIUM
{*r = ENOMEDIUM; return 0;}
#else /* def ENOMEDIUM */
{errno = EINVAL; return -1;}
#endif /* ndef ENOMEDIUM */
if (x == Mono_Posix_Error_EMEDIUMTYPE)
#ifdef EMEDIUMTYPE
{*r = EMEDIUMTYPE; return 0;}
#else /* def EMEDIUMTYPE */
{errno = EINVAL; return -1;}
#endif /* ndef EMEDIUMTYPE */
errno = EINVAL; return -1;
}
int Mono_Posix_ToError (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef EPERM
if (x == EPERM)
{*r = Mono_Posix_Error_EPERM; return 0;}
#endif /* ndef EPERM */
#ifdef ENOENT
if (x == ENOENT)
{*r = Mono_Posix_Error_ENOENT; return 0;}
#endif /* ndef ENOENT */
#ifdef ESRCH
if (x == ESRCH)
{*r = Mono_Posix_Error_ESRCH; return 0;}
#endif /* ndef ESRCH */
#ifdef EINTR
if (x == EINTR)
{*r = Mono_Posix_Error_EINTR; return 0;}
#endif /* ndef EINTR */
#ifdef EIO
if (x == EIO)
{*r = Mono_Posix_Error_EIO; return 0;}
#endif /* ndef EIO */
#ifdef ENXIO
if (x == ENXIO)
{*r = Mono_Posix_Error_ENXIO; return 0;}
#endif /* ndef ENXIO */
#ifdef E2BIG
if (x == E2BIG)
{*r = Mono_Posix_Error_E2BIG; return 0;}
#endif /* ndef E2BIG */
#ifdef ENOEXEC
if (x == ENOEXEC)
{*r = Mono_Posix_Error_ENOEXEC; return 0;}
#endif /* ndef ENOEXEC */
#ifdef EBADF
if (x == EBADF)
{*r = Mono_Posix_Error_EBADF; return 0;}
#endif /* ndef EBADF */
#ifdef ECHILD
if (x == ECHILD)
{*r = Mono_Posix_Error_ECHILD; return 0;}
#endif /* ndef ECHILD */
#ifdef EAGAIN
if (x == EAGAIN)
{*r = Mono_Posix_Error_EAGAIN; return 0;}
#endif /* ndef EAGAIN */
#ifdef ENOMEM
if (x == ENOMEM)
{*r = Mono_Posix_Error_ENOMEM; return 0;}
#endif /* ndef ENOMEM */
#ifdef EACCES
if (x == EACCES)
{*r = Mono_Posix_Error_EACCES; return 0;}
#endif /* ndef EACCES */
#ifdef EFAULT
if (x == EFAULT)
{*r = Mono_Posix_Error_EFAULT; return 0;}
#endif /* ndef EFAULT */
#ifdef ENOTBLK
if (x == ENOTBLK)
{*r = Mono_Posix_Error_ENOTBLK; return 0;}
#endif /* ndef ENOTBLK */
#ifdef EBUSY
if (x == EBUSY)
{*r = Mono_Posix_Error_EBUSY; return 0;}
#endif /* ndef EBUSY */
#ifdef EEXIST
if (x == EEXIST)
{*r = Mono_Posix_Error_EEXIST; return 0;}
#endif /* ndef EEXIST */
#ifdef EXDEV
if (x == EXDEV)
{*r = Mono_Posix_Error_EXDEV; return 0;}
#endif /* ndef EXDEV */
#ifdef ENODEV
if (x == ENODEV)
{*r = Mono_Posix_Error_ENODEV; return 0;}
#endif /* ndef ENODEV */
#ifdef ENOTDIR
if (x == ENOTDIR)
{*r = Mono_Posix_Error_ENOTDIR; return 0;}
#endif /* ndef ENOTDIR */
#ifdef EISDIR
if (x == EISDIR)
{*r = Mono_Posix_Error_EISDIR; return 0;}
#endif /* ndef EISDIR */
#ifdef EINVAL
if (x == EINVAL)
{*r = Mono_Posix_Error_EINVAL; return 0;}
#endif /* ndef EINVAL */
#ifdef ENFILE
if (x == ENFILE)
{*r = Mono_Posix_Error_ENFILE; return 0;}
#endif /* ndef ENFILE */
#ifdef EMFILE
if (x == EMFILE)
{*r = Mono_Posix_Error_EMFILE; return 0;}
#endif /* ndef EMFILE */
#ifdef ENOTTY
if (x == ENOTTY)
{*r = Mono_Posix_Error_ENOTTY; return 0;}
#endif /* ndef ENOTTY */
#ifdef ETXTBSY
if (x == ETXTBSY)
{*r = Mono_Posix_Error_ETXTBSY; return 0;}
#endif /* ndef ETXTBSY */
#ifdef EFBIG
if (x == EFBIG)
{*r = Mono_Posix_Error_EFBIG; return 0;}
#endif /* ndef EFBIG */
#ifdef ENOSPC
if (x == ENOSPC)
{*r = Mono_Posix_Error_ENOSPC; return 0;}
#endif /* ndef ENOSPC */
#ifdef ESPIPE
if (x == ESPIPE)
{*r = Mono_Posix_Error_ESPIPE; return 0;}
#endif /* ndef ESPIPE */
#ifdef EROFS
if (x == EROFS)
{*r = Mono_Posix_Error_EROFS; return 0;}
#endif /* ndef EROFS */
#ifdef EMLINK
if (x == EMLINK)
{*r = Mono_Posix_Error_EMLINK; return 0;}
#endif /* ndef EMLINK */
#ifdef EPIPE
if (x == EPIPE)
{*r = Mono_Posix_Error_EPIPE; return 0;}
#endif /* ndef EPIPE */
#ifdef EDOM
if (x == EDOM)
{*r = Mono_Posix_Error_EDOM; return 0;}
#endif /* ndef EDOM */
#ifdef ERANGE
if (x == ERANGE)
{*r = Mono_Posix_Error_ERANGE; return 0;}
#endif /* ndef ERANGE */
#ifdef EDEADLK
if (x == EDEADLK)
{*r = Mono_Posix_Error_EDEADLK; return 0;}
#endif /* ndef EDEADLK */
#ifdef ENAMETOOLONG
if (x == ENAMETOOLONG)
{*r = Mono_Posix_Error_ENAMETOOLONG; return 0;}
#endif /* ndef ENAMETOOLONG */
#ifdef ENOLCK
if (x == ENOLCK)
{*r = Mono_Posix_Error_ENOLCK; return 0;}
#endif /* ndef ENOLCK */
#ifdef ENOSYS
if (x == ENOSYS)
{*r = Mono_Posix_Error_ENOSYS; return 0;}
#endif /* ndef ENOSYS */
#ifdef ENOTEMPTY
if (x == ENOTEMPTY)
{*r = Mono_Posix_Error_ENOTEMPTY; return 0;}
#endif /* ndef ENOTEMPTY */
#ifdef ELOOP
if (x == ELOOP)
{*r = Mono_Posix_Error_ELOOP; return 0;}
#endif /* ndef ELOOP */
#ifdef EWOULDBLOCK
if (x == EWOULDBLOCK)
{*r = Mono_Posix_Error_EWOULDBLOCK; return 0;}
#endif /* ndef EWOULDBLOCK */
#ifdef ENOMSG
if (x == ENOMSG)
{*r = Mono_Posix_Error_ENOMSG; return 0;}
#endif /* ndef ENOMSG */
#ifdef EIDRM
if (x == EIDRM)
{*r = Mono_Posix_Error_EIDRM; return 0;}
#endif /* ndef EIDRM */
#ifdef ECHRNG
if (x == ECHRNG)
{*r = Mono_Posix_Error_ECHRNG; return 0;}
#endif /* ndef ECHRNG */
#ifdef EL2NSYNC
if (x == EL2NSYNC)
{*r = Mono_Posix_Error_EL2NSYNC; return 0;}
#endif /* ndef EL2NSYNC */
#ifdef EL3HLT
if (x == EL3HLT)
{*r = Mono_Posix_Error_EL3HLT; return 0;}
#endif /* ndef EL3HLT */
#ifdef EL3RST
if (x == EL3RST)
{*r = Mono_Posix_Error_EL3RST; return 0;}
#endif /* ndef EL3RST */
#ifdef ELNRNG
if (x == ELNRNG)
{*r = Mono_Posix_Error_ELNRNG; return 0;}
#endif /* ndef ELNRNG */
#ifdef EUNATCH
if (x == EUNATCH)
{*r = Mono_Posix_Error_EUNATCH; return 0;}
#endif /* ndef EUNATCH */
#ifdef ENOCSI
if (x == ENOCSI)
{*r = Mono_Posix_Error_ENOCSI; return 0;}
#endif /* ndef ENOCSI */
#ifdef EL2HLT
if (x == EL2HLT)
{*r = Mono_Posix_Error_EL2HLT; return 0;}
#endif /* ndef EL2HLT */
#ifdef EBADE
if (x == EBADE)
{*r = Mono_Posix_Error_EBADE; return 0;}
#endif /* ndef EBADE */
#ifdef EBADR
if (x == EBADR)
{*r = Mono_Posix_Error_EBADR; return 0;}
#endif /* ndef EBADR */
#ifdef EXFULL
if (x == EXFULL)
{*r = Mono_Posix_Error_EXFULL; return 0;}
#endif /* ndef EXFULL */
#ifdef ENOANO
if (x == ENOANO)
{*r = Mono_Posix_Error_ENOANO; return 0;}
#endif /* ndef ENOANO */
#ifdef EBADRQC
if (x == EBADRQC)
{*r = Mono_Posix_Error_EBADRQC; return 0;}
#endif /* ndef EBADRQC */
#ifdef EBADSLT
if (x == EBADSLT)
{*r = Mono_Posix_Error_EBADSLT; return 0;}
#endif /* ndef EBADSLT */
#ifdef EDEADLOCK
if (x == EDEADLOCK)
{*r = Mono_Posix_Error_EDEADLOCK; return 0;}
#endif /* ndef EDEADLOCK */
#ifdef EBFONT
if (x == EBFONT)
{*r = Mono_Posix_Error_EBFONT; return 0;}
#endif /* ndef EBFONT */
#ifdef ENOSTR
if (x == ENOSTR)
{*r = Mono_Posix_Error_ENOSTR; return 0;}
#endif /* ndef ENOSTR */
#ifdef ENODATA
if (x == ENODATA)
{*r = Mono_Posix_Error_ENODATA; return 0;}
#endif /* ndef ENODATA */
#ifdef ETIME
if (x == ETIME)
{*r = Mono_Posix_Error_ETIME; return 0;}
#endif /* ndef ETIME */
#ifdef ENOSR
if (x == ENOSR)
{*r = Mono_Posix_Error_ENOSR; return 0;}
#endif /* ndef ENOSR */
#ifdef ENONET
if (x == ENONET)
{*r = Mono_Posix_Error_ENONET; return 0;}
#endif /* ndef ENONET */
#ifdef ENOPKG
if (x == ENOPKG)
{*r = Mono_Posix_Error_ENOPKG; return 0;}
#endif /* ndef ENOPKG */
#ifdef EREMOTE
if (x == EREMOTE)
{*r = Mono_Posix_Error_EREMOTE; return 0;}
#endif /* ndef EREMOTE */
#ifdef ENOLINK
if (x == ENOLINK)
{*r = Mono_Posix_Error_ENOLINK; return 0;}
#endif /* ndef ENOLINK */
#ifdef EADV
if (x == EADV)
{*r = Mono_Posix_Error_EADV; return 0;}
#endif /* ndef EADV */
#ifdef ESRMNT
if (x == ESRMNT)
{*r = Mono_Posix_Error_ESRMNT; return 0;}
#endif /* ndef ESRMNT */
#ifdef ECOMM
if (x == ECOMM)
{*r = Mono_Posix_Error_ECOMM; return 0;}
#endif /* ndef ECOMM */
#ifdef EPROTO
if (x == EPROTO)
{*r = Mono_Posix_Error_EPROTO; return 0;}
#endif /* ndef EPROTO */
#ifdef EMULTIHOP
if (x == EMULTIHOP)
{*r = Mono_Posix_Error_EMULTIHOP; return 0;}
#endif /* ndef EMULTIHOP */
#ifdef EDOTDOT
if (x == EDOTDOT)
{*r = Mono_Posix_Error_EDOTDOT; return 0;}
#endif /* ndef EDOTDOT */
#ifdef EBADMSG
if (x == EBADMSG)
{*r = Mono_Posix_Error_EBADMSG; return 0;}
#endif /* ndef EBADMSG */
#ifdef EOVERFLOW
if (x == EOVERFLOW)
{*r = Mono_Posix_Error_EOVERFLOW; return 0;}
#endif /* ndef EOVERFLOW */
#ifdef ENOTUNIQ
if (x == ENOTUNIQ)
{*r = Mono_Posix_Error_ENOTUNIQ; return 0;}
#endif /* ndef ENOTUNIQ */
#ifdef EBADFD
if (x == EBADFD)
{*r = Mono_Posix_Error_EBADFD; return 0;}
#endif /* ndef EBADFD */
#ifdef EREMCHG
if (x == EREMCHG)
{*r = Mono_Posix_Error_EREMCHG; return 0;}
#endif /* ndef EREMCHG */
#ifdef ELIBACC
if (x == ELIBACC)
{*r = Mono_Posix_Error_ELIBACC; return 0;}
#endif /* ndef ELIBACC */
#ifdef ELIBBAD
if (x == ELIBBAD)
{*r = Mono_Posix_Error_ELIBBAD; return 0;}
#endif /* ndef ELIBBAD */
#ifdef ELIBSCN
if (x == ELIBSCN)
{*r = Mono_Posix_Error_ELIBSCN; return 0;}
#endif /* ndef ELIBSCN */
#ifdef ELIBMAX
if (x == ELIBMAX)
{*r = Mono_Posix_Error_ELIBMAX; return 0;}
#endif /* ndef ELIBMAX */
#ifdef ELIBEXEC
if (x == ELIBEXEC)
{*r = Mono_Posix_Error_ELIBEXEC; return 0;}
#endif /* ndef ELIBEXEC */
#ifdef EILSEQ
if (x == EILSEQ)
{*r = Mono_Posix_Error_EILSEQ; return 0;}
#endif /* ndef EILSEQ */
#ifdef ERESTART
if (x == ERESTART)
{*r = Mono_Posix_Error_ERESTART; return 0;}
#endif /* ndef ERESTART */
#ifdef ESTRPIPE
if (x == ESTRPIPE)
{*r = Mono_Posix_Error_ESTRPIPE; return 0;}
#endif /* ndef ESTRPIPE */
#ifdef EUSERS
if (x == EUSERS)
{*r = Mono_Posix_Error_EUSERS; return 0;}
#endif /* ndef EUSERS */
#ifdef ENOTSOCK
if (x == ENOTSOCK)
{*r = Mono_Posix_Error_ENOTSOCK; return 0;}
#endif /* ndef ENOTSOCK */
#ifdef EDESTADDRREQ
if (x == EDESTADDRREQ)
{*r = Mono_Posix_Error_EDESTADDRREQ; return 0;}
#endif /* ndef EDESTADDRREQ */
#ifdef EMSGSIZE
if (x == EMSGSIZE)
{*r = Mono_Posix_Error_EMSGSIZE; return 0;}
#endif /* ndef EMSGSIZE */
#ifdef EPROTOTYPE
if (x == EPROTOTYPE)
{*r = Mono_Posix_Error_EPROTOTYPE; return 0;}
#endif /* ndef EPROTOTYPE */
#ifdef ENOPROTOOPT
if (x == ENOPROTOOPT)
{*r = Mono_Posix_Error_ENOPROTOOPT; return 0;}
#endif /* ndef ENOPROTOOPT */
#ifdef EPROTONOSUPPORT
if (x == EPROTONOSUPPORT)
{*r = Mono_Posix_Error_EPROTONOSUPPORT; return 0;}
#endif /* ndef EPROTONOSUPPORT */
#ifdef ESOCKTNOSUPPORT
if (x == ESOCKTNOSUPPORT)
{*r = Mono_Posix_Error_ESOCKTNOSUPPORT; return 0;}
#endif /* ndef ESOCKTNOSUPPORT */
#ifdef EOPNOTSUPP
if (x == EOPNOTSUPP)
{*r = Mono_Posix_Error_EOPNOTSUPP; return 0;}
#endif /* ndef EOPNOTSUPP */
#ifdef EPFNOSUPPORT
if (x == EPFNOSUPPORT)
{*r = Mono_Posix_Error_EPFNOSUPPORT; return 0;}
#endif /* ndef EPFNOSUPPORT */
#ifdef EAFNOSUPPORT
if (x == EAFNOSUPPORT)
{*r = Mono_Posix_Error_EAFNOSUPPORT; return 0;}
#endif /* ndef EAFNOSUPPORT */
#ifdef EADDRINUSE
if (x == EADDRINUSE)
{*r = Mono_Posix_Error_EADDRINUSE; return 0;}
#endif /* ndef EADDRINUSE */
#ifdef EADDRNOTAVAIL
if (x == EADDRNOTAVAIL)
{*r = Mono_Posix_Error_EADDRNOTAVAIL; return 0;}
#endif /* ndef EADDRNOTAVAIL */
#ifdef ENETDOWN
if (x == ENETDOWN)
{*r = Mono_Posix_Error_ENETDOWN; return 0;}
#endif /* ndef ENETDOWN */
#ifdef ENETUNREACH
if (x == ENETUNREACH)
{*r = Mono_Posix_Error_ENETUNREACH; return 0;}
#endif /* ndef ENETUNREACH */
#ifdef ENETRESET
if (x == ENETRESET)
{*r = Mono_Posix_Error_ENETRESET; return 0;}
#endif /* ndef ENETRESET */
#ifdef ECONNABORTED
if (x == ECONNABORTED)
{*r = Mono_Posix_Error_ECONNABORTED; return 0;}
#endif /* ndef ECONNABORTED */
#ifdef ECONNRESET
if (x == ECONNRESET)
{*r = Mono_Posix_Error_ECONNRESET; return 0;}
#endif /* ndef ECONNRESET */
#ifdef ENOBUFS
if (x == ENOBUFS)
{*r = Mono_Posix_Error_ENOBUFS; return 0;}
#endif /* ndef ENOBUFS */
#ifdef EISCONN
if (x == EISCONN)
{*r = Mono_Posix_Error_EISCONN; return 0;}
#endif /* ndef EISCONN */
#ifdef ENOTCONN
if (x == ENOTCONN)
{*r = Mono_Posix_Error_ENOTCONN; return 0;}
#endif /* ndef ENOTCONN */
#ifdef ESHUTDOWN
if (x == ESHUTDOWN)
{*r = Mono_Posix_Error_ESHUTDOWN; return 0;}
#endif /* ndef ESHUTDOWN */
#ifdef ETOOMANYREFS
if (x == ETOOMANYREFS)
{*r = Mono_Posix_Error_ETOOMANYREFS; return 0;}
#endif /* ndef ETOOMANYREFS */
#ifdef ETIMEDOUT
if (x == ETIMEDOUT)
{*r = Mono_Posix_Error_ETIMEDOUT; return 0;}
#endif /* ndef ETIMEDOUT */
#ifdef ECONNREFUSED
if (x == ECONNREFUSED)
{*r = Mono_Posix_Error_ECONNREFUSED; return 0;}
#endif /* ndef ECONNREFUSED */
#ifdef EHOSTDOWN
if (x == EHOSTDOWN)
{*r = Mono_Posix_Error_EHOSTDOWN; return 0;}
#endif /* ndef EHOSTDOWN */
#ifdef EHOSTUNREACH
if (x == EHOSTUNREACH)
{*r = Mono_Posix_Error_EHOSTUNREACH; return 0;}
#endif /* ndef EHOSTUNREACH */
#ifdef EALREADY
if (x == EALREADY)
{*r = Mono_Posix_Error_EALREADY; return 0;}
#endif /* ndef EALREADY */
#ifdef EINPROGRESS
if (x == EINPROGRESS)
{*r = Mono_Posix_Error_EINPROGRESS; return 0;}
#endif /* ndef EINPROGRESS */
#ifdef ESTALE
if (x == ESTALE)
{*r = Mono_Posix_Error_ESTALE; return 0;}
#endif /* ndef ESTALE */
#ifdef EUCLEAN
if (x == EUCLEAN)
{*r = Mono_Posix_Error_EUCLEAN; return 0;}
#endif /* ndef EUCLEAN */
#ifdef ENOTNAM
if (x == ENOTNAM)
{*r = Mono_Posix_Error_ENOTNAM; return 0;}
#endif /* ndef ENOTNAM */
#ifdef ENAVAIL
if (x == ENAVAIL)
{*r = Mono_Posix_Error_ENAVAIL; return 0;}
#endif /* ndef ENAVAIL */
#ifdef EISNAM
if (x == EISNAM)
{*r = Mono_Posix_Error_EISNAM; return 0;}
#endif /* ndef EISNAM */
#ifdef EREMOTEIO
if (x == EREMOTEIO)
{*r = Mono_Posix_Error_EREMOTEIO; return 0;}
#endif /* ndef EREMOTEIO */
#ifdef EDQUOT
if (x == EDQUOT)
{*r = Mono_Posix_Error_EDQUOT; return 0;}
#endif /* ndef EDQUOT */
#ifdef ENOMEDIUM
if (x == ENOMEDIUM)
{*r = Mono_Posix_Error_ENOMEDIUM; return 0;}
#endif /* ndef ENOMEDIUM */
#ifdef EMEDIUMTYPE
if (x == EMEDIUMTYPE)
{*r = Mono_Posix_Error_EMEDIUMTYPE; return 0;}
#endif /* ndef EMEDIUMTYPE */
errno = EINVAL; return -1;
}
int Mono_Posix_FromSyslogOptions (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_SyslogOptions_LOG_PID) == Mono_Posix_SyslogOptions_LOG_PID)
#ifdef LOG_PID
*r |= LOG_PID;
#else /* def LOG_PID */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_PID */
if ((x & Mono_Posix_SyslogOptions_LOG_CONS) == Mono_Posix_SyslogOptions_LOG_CONS)
#ifdef LOG_CONS
*r |= LOG_CONS;
#else /* def LOG_CONS */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_CONS */
if ((x & Mono_Posix_SyslogOptions_LOG_ODELAY) == Mono_Posix_SyslogOptions_LOG_ODELAY)
#ifdef LOG_ODELAY
*r |= LOG_ODELAY;
#else /* def LOG_ODELAY */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_ODELAY */
if ((x & Mono_Posix_SyslogOptions_LOG_NDELAY) == Mono_Posix_SyslogOptions_LOG_NDELAY)
#ifdef LOG_NDELAY
*r |= LOG_NDELAY;
#else /* def LOG_NDELAY */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_NDELAY */
if ((x & Mono_Posix_SyslogOptions_LOG_NOWAIT) == Mono_Posix_SyslogOptions_LOG_NOWAIT)
#ifdef LOG_NOWAIT
*r |= LOG_NOWAIT;
#else /* def LOG_NOWAIT */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_NOWAIT */
if ((x & Mono_Posix_SyslogOptions_LOG_PERROR) == Mono_Posix_SyslogOptions_LOG_PERROR)
#ifdef LOG_PERROR
*r |= LOG_PERROR;
#else /* def LOG_PERROR */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_PERROR */
return 0;
}
int Mono_Posix_ToSyslogOptions (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef LOG_PID
if ((x & LOG_PID) == LOG_PID)
*r |= Mono_Posix_SyslogOptions_LOG_PID;
#endif /* ndef LOG_PID */
#ifdef LOG_CONS
if ((x & LOG_CONS) == LOG_CONS)
*r |= Mono_Posix_SyslogOptions_LOG_CONS;
#endif /* ndef LOG_CONS */
#ifdef LOG_ODELAY
if ((x & LOG_ODELAY) == LOG_ODELAY)
*r |= Mono_Posix_SyslogOptions_LOG_ODELAY;
#endif /* ndef LOG_ODELAY */
#ifdef LOG_NDELAY
if ((x & LOG_NDELAY) == LOG_NDELAY)
*r |= Mono_Posix_SyslogOptions_LOG_NDELAY;
#endif /* ndef LOG_NDELAY */
#ifdef LOG_NOWAIT
if ((x & LOG_NOWAIT) == LOG_NOWAIT)
*r |= Mono_Posix_SyslogOptions_LOG_NOWAIT;
#endif /* ndef LOG_NOWAIT */
#ifdef LOG_PERROR
if ((x & LOG_PERROR) == LOG_PERROR)
*r |= Mono_Posix_SyslogOptions_LOG_PERROR;
#endif /* ndef LOG_PERROR */
return 0;
}
int Mono_Posix_FromSyslogFacility (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_SyslogFacility_LOG_KERN) == Mono_Posix_SyslogFacility_LOG_KERN)
#ifdef LOG_KERN
*r |= LOG_KERN;
#else /* def LOG_KERN */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_KERN */
if ((x & Mono_Posix_SyslogFacility_LOG_USRE) == Mono_Posix_SyslogFacility_LOG_USRE)
#ifdef LOG_USRE
*r |= LOG_USRE;
#else /* def LOG_USRE */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_USRE */
if ((x & Mono_Posix_SyslogFacility_LOG_MAIL) == Mono_Posix_SyslogFacility_LOG_MAIL)
#ifdef LOG_MAIL
*r |= LOG_MAIL;
#else /* def LOG_MAIL */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_MAIL */
if ((x & Mono_Posix_SyslogFacility_LOG_DAEMON) == Mono_Posix_SyslogFacility_LOG_DAEMON)
#ifdef LOG_DAEMON
*r |= LOG_DAEMON;
#else /* def LOG_DAEMON */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_DAEMON */
if ((x & Mono_Posix_SyslogFacility_LOG_AUTH) == Mono_Posix_SyslogFacility_LOG_AUTH)
#ifdef LOG_AUTH
*r |= LOG_AUTH;
#else /* def LOG_AUTH */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_AUTH */
if ((x & Mono_Posix_SyslogFacility_LOG_SYSLOG) == Mono_Posix_SyslogFacility_LOG_SYSLOG)
#ifdef LOG_SYSLOG
*r |= LOG_SYSLOG;
#else /* def LOG_SYSLOG */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_SYSLOG */
if ((x & Mono_Posix_SyslogFacility_LOG_LPR) == Mono_Posix_SyslogFacility_LOG_LPR)
#ifdef LOG_LPR
*r |= LOG_LPR;
#else /* def LOG_LPR */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LPR */
if ((x & Mono_Posix_SyslogFacility_LOG_NEWS) == Mono_Posix_SyslogFacility_LOG_NEWS)
#ifdef LOG_NEWS
*r |= LOG_NEWS;
#else /* def LOG_NEWS */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_NEWS */
if ((x & Mono_Posix_SyslogFacility_LOG_UUCP) == Mono_Posix_SyslogFacility_LOG_UUCP)
#ifdef LOG_UUCP
*r |= LOG_UUCP;
#else /* def LOG_UUCP */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_UUCP */
if ((x & Mono_Posix_SyslogFacility_LOG_CRON) == Mono_Posix_SyslogFacility_LOG_CRON)
#ifdef LOG_CRON
*r |= LOG_CRON;
#else /* def LOG_CRON */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_CRON */
if ((x & Mono_Posix_SyslogFacility_LOG_AUTHPRIV) == Mono_Posix_SyslogFacility_LOG_AUTHPRIV)
#ifdef LOG_AUTHPRIV
*r |= LOG_AUTHPRIV;
#else /* def LOG_AUTHPRIV */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_AUTHPRIV */
if ((x & Mono_Posix_SyslogFacility_LOG_FTP) == Mono_Posix_SyslogFacility_LOG_FTP)
#ifdef LOG_FTP
*r |= LOG_FTP;
#else /* def LOG_FTP */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_FTP */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL0) == Mono_Posix_SyslogFacility_LOG_LOCAL0)
#ifdef LOG_LOCAL0
*r |= LOG_LOCAL0;
#else /* def LOG_LOCAL0 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL0 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL1) == Mono_Posix_SyslogFacility_LOG_LOCAL1)
#ifdef LOG_LOCAL1
*r |= LOG_LOCAL1;
#else /* def LOG_LOCAL1 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL1 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL2) == Mono_Posix_SyslogFacility_LOG_LOCAL2)
#ifdef LOG_LOCAL2
*r |= LOG_LOCAL2;
#else /* def LOG_LOCAL2 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL2 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL3) == Mono_Posix_SyslogFacility_LOG_LOCAL3)
#ifdef LOG_LOCAL3
*r |= LOG_LOCAL3;
#else /* def LOG_LOCAL3 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL3 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL4) == Mono_Posix_SyslogFacility_LOG_LOCAL4)
#ifdef LOG_LOCAL4
*r |= LOG_LOCAL4;
#else /* def LOG_LOCAL4 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL4 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL5) == Mono_Posix_SyslogFacility_LOG_LOCAL5)
#ifdef LOG_LOCAL5
*r |= LOG_LOCAL5;
#else /* def LOG_LOCAL5 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL5 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL6) == Mono_Posix_SyslogFacility_LOG_LOCAL6)
#ifdef LOG_LOCAL6
*r |= LOG_LOCAL6;
#else /* def LOG_LOCAL6 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL6 */
if ((x & Mono_Posix_SyslogFacility_LOG_LOCAL7) == Mono_Posix_SyslogFacility_LOG_LOCAL7)
#ifdef LOG_LOCAL7
*r |= LOG_LOCAL7;
#else /* def LOG_LOCAL7 */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_LOCAL7 */
return 0;
}
int Mono_Posix_ToSyslogFacility (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef LOG_KERN
if ((x & LOG_KERN) == LOG_KERN)
*r |= Mono_Posix_SyslogFacility_LOG_KERN;
#endif /* ndef LOG_KERN */
#ifdef LOG_USRE
if ((x & LOG_USRE) == LOG_USRE)
*r |= Mono_Posix_SyslogFacility_LOG_USRE;
#endif /* ndef LOG_USRE */
#ifdef LOG_MAIL
if ((x & LOG_MAIL) == LOG_MAIL)
*r |= Mono_Posix_SyslogFacility_LOG_MAIL;
#endif /* ndef LOG_MAIL */
#ifdef LOG_DAEMON
if ((x & LOG_DAEMON) == LOG_DAEMON)
*r |= Mono_Posix_SyslogFacility_LOG_DAEMON;
#endif /* ndef LOG_DAEMON */
#ifdef LOG_AUTH
if ((x & LOG_AUTH) == LOG_AUTH)
*r |= Mono_Posix_SyslogFacility_LOG_AUTH;
#endif /* ndef LOG_AUTH */
#ifdef LOG_SYSLOG
if ((x & LOG_SYSLOG) == LOG_SYSLOG)
*r |= Mono_Posix_SyslogFacility_LOG_SYSLOG;
#endif /* ndef LOG_SYSLOG */
#ifdef LOG_LPR
if ((x & LOG_LPR) == LOG_LPR)
*r |= Mono_Posix_SyslogFacility_LOG_LPR;
#endif /* ndef LOG_LPR */
#ifdef LOG_NEWS
if ((x & LOG_NEWS) == LOG_NEWS)
*r |= Mono_Posix_SyslogFacility_LOG_NEWS;
#endif /* ndef LOG_NEWS */
#ifdef LOG_UUCP
if ((x & LOG_UUCP) == LOG_UUCP)
*r |= Mono_Posix_SyslogFacility_LOG_UUCP;
#endif /* ndef LOG_UUCP */
#ifdef LOG_CRON
if ((x & LOG_CRON) == LOG_CRON)
*r |= Mono_Posix_SyslogFacility_LOG_CRON;
#endif /* ndef LOG_CRON */
#ifdef LOG_AUTHPRIV
if ((x & LOG_AUTHPRIV) == LOG_AUTHPRIV)
*r |= Mono_Posix_SyslogFacility_LOG_AUTHPRIV;
#endif /* ndef LOG_AUTHPRIV */
#ifdef LOG_FTP
if ((x & LOG_FTP) == LOG_FTP)
*r |= Mono_Posix_SyslogFacility_LOG_FTP;
#endif /* ndef LOG_FTP */
#ifdef LOG_LOCAL0
if ((x & LOG_LOCAL0) == LOG_LOCAL0)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL0;
#endif /* ndef LOG_LOCAL0 */
#ifdef LOG_LOCAL1
if ((x & LOG_LOCAL1) == LOG_LOCAL1)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL1;
#endif /* ndef LOG_LOCAL1 */
#ifdef LOG_LOCAL2
if ((x & LOG_LOCAL2) == LOG_LOCAL2)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL2;
#endif /* ndef LOG_LOCAL2 */
#ifdef LOG_LOCAL3
if ((x & LOG_LOCAL3) == LOG_LOCAL3)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL3;
#endif /* ndef LOG_LOCAL3 */
#ifdef LOG_LOCAL4
if ((x & LOG_LOCAL4) == LOG_LOCAL4)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL4;
#endif /* ndef LOG_LOCAL4 */
#ifdef LOG_LOCAL5
if ((x & LOG_LOCAL5) == LOG_LOCAL5)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL5;
#endif /* ndef LOG_LOCAL5 */
#ifdef LOG_LOCAL6
if ((x & LOG_LOCAL6) == LOG_LOCAL6)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL6;
#endif /* ndef LOG_LOCAL6 */
#ifdef LOG_LOCAL7
if ((x & LOG_LOCAL7) == LOG_LOCAL7)
*r |= Mono_Posix_SyslogFacility_LOG_LOCAL7;
#endif /* ndef LOG_LOCAL7 */
return 0;
}
int Mono_Posix_FromSyslogLevel (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_SyslogLevel_LOG_EMERG) == Mono_Posix_SyslogLevel_LOG_EMERG)
#ifdef LOG_EMERG
*r |= LOG_EMERG;
#else /* def LOG_EMERG */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_EMERG */
if ((x & Mono_Posix_SyslogLevel_LOG_ALERT) == Mono_Posix_SyslogLevel_LOG_ALERT)
#ifdef LOG_ALERT
*r |= LOG_ALERT;
#else /* def LOG_ALERT */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_ALERT */
if ((x & Mono_Posix_SyslogLevel_LOG_CRIT) == Mono_Posix_SyslogLevel_LOG_CRIT)
#ifdef LOG_CRIT
*r |= LOG_CRIT;
#else /* def LOG_CRIT */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_CRIT */
if ((x & Mono_Posix_SyslogLevel_LOG_ERR) == Mono_Posix_SyslogLevel_LOG_ERR)
#ifdef LOG_ERR
*r |= LOG_ERR;
#else /* def LOG_ERR */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_ERR */
if ((x & Mono_Posix_SyslogLevel_LOG_WARNING) == Mono_Posix_SyslogLevel_LOG_WARNING)
#ifdef LOG_WARNING
*r |= LOG_WARNING;
#else /* def LOG_WARNING */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_WARNING */
if ((x & Mono_Posix_SyslogLevel_LOG_NOTICE) == Mono_Posix_SyslogLevel_LOG_NOTICE)
#ifdef LOG_NOTICE
*r |= LOG_NOTICE;
#else /* def LOG_NOTICE */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_NOTICE */
if ((x & Mono_Posix_SyslogLevel_LOG_INFO) == Mono_Posix_SyslogLevel_LOG_INFO)
#ifdef LOG_INFO
*r |= LOG_INFO;
#else /* def LOG_INFO */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_INFO */
if ((x & Mono_Posix_SyslogLevel_LOG_DEBUG) == Mono_Posix_SyslogLevel_LOG_DEBUG)
#ifdef LOG_DEBUG
*r |= LOG_DEBUG;
#else /* def LOG_DEBUG */
{errno = EINVAL; return -1;}
#endif /* ndef LOG_DEBUG */
return 0;
}
int Mono_Posix_ToSyslogLevel (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef LOG_EMERG
if ((x & LOG_EMERG) == LOG_EMERG)
*r |= Mono_Posix_SyslogLevel_LOG_EMERG;
#endif /* ndef LOG_EMERG */
#ifdef LOG_ALERT
if ((x & LOG_ALERT) == LOG_ALERT)
*r |= Mono_Posix_SyslogLevel_LOG_ALERT;
#endif /* ndef LOG_ALERT */
#ifdef LOG_CRIT
if ((x & LOG_CRIT) == LOG_CRIT)
*r |= Mono_Posix_SyslogLevel_LOG_CRIT;
#endif /* ndef LOG_CRIT */
#ifdef LOG_ERR
if ((x & LOG_ERR) == LOG_ERR)
*r |= Mono_Posix_SyslogLevel_LOG_ERR;
#endif /* ndef LOG_ERR */
#ifdef LOG_WARNING
if ((x & LOG_WARNING) == LOG_WARNING)
*r |= Mono_Posix_SyslogLevel_LOG_WARNING;
#endif /* ndef LOG_WARNING */
#ifdef LOG_NOTICE
if ((x & LOG_NOTICE) == LOG_NOTICE)
*r |= Mono_Posix_SyslogLevel_LOG_NOTICE;
#endif /* ndef LOG_NOTICE */
#ifdef LOG_INFO
if ((x & LOG_INFO) == LOG_INFO)
*r |= Mono_Posix_SyslogLevel_LOG_INFO;
#endif /* ndef LOG_INFO */
#ifdef LOG_DEBUG
if ((x & LOG_DEBUG) == LOG_DEBUG)
*r |= Mono_Posix_SyslogLevel_LOG_DEBUG;
#endif /* ndef LOG_DEBUG */
return 0;
}
int Mono_Posix_FromOpenFlags (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_OpenFlags_O_RDONLY) == Mono_Posix_OpenFlags_O_RDONLY)
#ifdef O_RDONLY
*r |= O_RDONLY;
#else /* def O_RDONLY */
{errno = EINVAL; return -1;}
#endif /* ndef O_RDONLY */
if ((x & Mono_Posix_OpenFlags_O_WRONLY) == Mono_Posix_OpenFlags_O_WRONLY)
#ifdef O_WRONLY
*r |= O_WRONLY;
#else /* def O_WRONLY */
{errno = EINVAL; return -1;}
#endif /* ndef O_WRONLY */
if ((x & Mono_Posix_OpenFlags_O_RDWR) == Mono_Posix_OpenFlags_O_RDWR)
#ifdef O_RDWR
*r |= O_RDWR;
#else /* def O_RDWR */
{errno = EINVAL; return -1;}
#endif /* ndef O_RDWR */
if ((x & Mono_Posix_OpenFlags_O_CREAT) == Mono_Posix_OpenFlags_O_CREAT)
#ifdef O_CREAT
*r |= O_CREAT;
#else /* def O_CREAT */
{errno = EINVAL; return -1;}
#endif /* ndef O_CREAT */
if ((x & Mono_Posix_OpenFlags_O_EXCL) == Mono_Posix_OpenFlags_O_EXCL)
#ifdef O_EXCL
*r |= O_EXCL;
#else /* def O_EXCL */
{errno = EINVAL; return -1;}
#endif /* ndef O_EXCL */
if ((x & Mono_Posix_OpenFlags_O_NOCTTY) == Mono_Posix_OpenFlags_O_NOCTTY)
#ifdef O_NOCTTY
*r |= O_NOCTTY;
#else /* def O_NOCTTY */
{errno = EINVAL; return -1;}
#endif /* ndef O_NOCTTY */
if ((x & Mono_Posix_OpenFlags_O_TRUNC) == Mono_Posix_OpenFlags_O_TRUNC)
#ifdef O_TRUNC
*r |= O_TRUNC;
#else /* def O_TRUNC */
{errno = EINVAL; return -1;}
#endif /* ndef O_TRUNC */
if ((x & Mono_Posix_OpenFlags_O_APPEND) == Mono_Posix_OpenFlags_O_APPEND)
#ifdef O_APPEND
*r |= O_APPEND;
#else /* def O_APPEND */
{errno = EINVAL; return -1;}
#endif /* ndef O_APPEND */
if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) == Mono_Posix_OpenFlags_O_NONBLOCK)
#ifdef O_NONBLOCK
*r |= O_NONBLOCK;
#else /* def O_NONBLOCK */
{errno = EINVAL; return -1;}
#endif /* ndef O_NONBLOCK */
if ((x & Mono_Posix_OpenFlags_O_SYNC) == Mono_Posix_OpenFlags_O_SYNC)
#ifdef O_SYNC
*r |= O_SYNC;
#else /* def O_SYNC */
{errno = EINVAL; return -1;}
#endif /* ndef O_SYNC */
if ((x & Mono_Posix_OpenFlags_O_NOFOLLOW) == Mono_Posix_OpenFlags_O_NOFOLLOW)
#ifdef O_NOFOLLOW
*r |= O_NOFOLLOW;
#else /* def O_NOFOLLOW */
{errno = EINVAL; return -1;}
#endif /* ndef O_NOFOLLOW */
if ((x & Mono_Posix_OpenFlags_O_DIRECTORY) == Mono_Posix_OpenFlags_O_DIRECTORY)
#ifdef O_DIRECTORY
*r |= O_DIRECTORY;
#else /* def O_DIRECTORY */
{errno = EINVAL; return -1;}
#endif /* ndef O_DIRECTORY */
if ((x & Mono_Posix_OpenFlags_O_DIRECT) == Mono_Posix_OpenFlags_O_DIRECT)
#ifdef O_DIRECT
*r |= O_DIRECT;
#else /* def O_DIRECT */
{errno = EINVAL; return -1;}
#endif /* ndef O_DIRECT */
if ((x & Mono_Posix_OpenFlags_O_ASYNC) == Mono_Posix_OpenFlags_O_ASYNC)
#ifdef O_ASYNC
*r |= O_ASYNC;
#else /* def O_ASYNC */
{errno = EINVAL; return -1;}
#endif /* ndef O_ASYNC */
if ((x & Mono_Posix_OpenFlags_O_LARGEFILE) == Mono_Posix_OpenFlags_O_LARGEFILE)
#ifdef O_LARGEFILE
*r |= O_LARGEFILE;
#else /* def O_LARGEFILE */
{errno = EINVAL; return -1;}
#endif /* ndef O_LARGEFILE */
return 0;
}
int Mono_Posix_ToOpenFlags (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef O_RDONLY
if ((x & O_RDONLY) == O_RDONLY)
*r |= Mono_Posix_OpenFlags_O_RDONLY;
#endif /* ndef O_RDONLY */
#ifdef O_WRONLY
if ((x & O_WRONLY) == O_WRONLY)
*r |= Mono_Posix_OpenFlags_O_WRONLY;
#endif /* ndef O_WRONLY */
#ifdef O_RDWR
if ((x & O_RDWR) == O_RDWR)
*r |= Mono_Posix_OpenFlags_O_RDWR;
#endif /* ndef O_RDWR */
#ifdef O_CREAT
if ((x & O_CREAT) == O_CREAT)
*r |= Mono_Posix_OpenFlags_O_CREAT;
#endif /* ndef O_CREAT */
#ifdef O_EXCL
if ((x & O_EXCL) == O_EXCL)
*r |= Mono_Posix_OpenFlags_O_EXCL;
#endif /* ndef O_EXCL */
#ifdef O_NOCTTY
if ((x & O_NOCTTY) == O_NOCTTY)
*r |= Mono_Posix_OpenFlags_O_NOCTTY;
#endif /* ndef O_NOCTTY */
#ifdef O_TRUNC
if ((x & O_TRUNC) == O_TRUNC)
*r |= Mono_Posix_OpenFlags_O_TRUNC;
#endif /* ndef O_TRUNC */
#ifdef O_APPEND
if ((x & O_APPEND) == O_APPEND)
*r |= Mono_Posix_OpenFlags_O_APPEND;
#endif /* ndef O_APPEND */
#ifdef O_NONBLOCK
if ((x & O_NONBLOCK) == O_NONBLOCK)
*r |= Mono_Posix_OpenFlags_O_NONBLOCK;
#endif /* ndef O_NONBLOCK */
#ifdef O_SYNC
if ((x & O_SYNC) == O_SYNC)
*r |= Mono_Posix_OpenFlags_O_SYNC;
#endif /* ndef O_SYNC */
#ifdef O_NOFOLLOW
if ((x & O_NOFOLLOW) == O_NOFOLLOW)
*r |= Mono_Posix_OpenFlags_O_NOFOLLOW;
#endif /* ndef O_NOFOLLOW */
#ifdef O_DIRECTORY
if ((x & O_DIRECTORY) == O_DIRECTORY)
*r |= Mono_Posix_OpenFlags_O_DIRECTORY;
#endif /* ndef O_DIRECTORY */
#ifdef O_DIRECT
if ((x & O_DIRECT) == O_DIRECT)
*r |= Mono_Posix_OpenFlags_O_DIRECT;
#endif /* ndef O_DIRECT */
#ifdef O_ASYNC
if ((x & O_ASYNC) == O_ASYNC)
*r |= Mono_Posix_OpenFlags_O_ASYNC;
#endif /* ndef O_ASYNC */
#ifdef O_LARGEFILE
if ((x & O_LARGEFILE) == O_LARGEFILE)
*r |= Mono_Posix_OpenFlags_O_LARGEFILE;
#endif /* ndef O_LARGEFILE */
return 0;
}
int Mono_Posix_FromFilePermissions (unsigned int x, unsigned int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_FilePermissions_S_ISUID) == Mono_Posix_FilePermissions_S_ISUID)
#ifdef S_ISUID
*r |= S_ISUID;
#else /* def S_ISUID */
{errno = EINVAL; return -1;}
#endif /* ndef S_ISUID */
if ((x & Mono_Posix_FilePermissions_S_ISGID) == Mono_Posix_FilePermissions_S_ISGID)
#ifdef S_ISGID
*r |= S_ISGID;
#else /* def S_ISGID */
{errno = EINVAL; return -1;}
#endif /* ndef S_ISGID */
if ((x & Mono_Posix_FilePermissions_S_ISVTX) == Mono_Posix_FilePermissions_S_ISVTX)
#ifdef S_ISVTX
*r |= S_ISVTX;
#else /* def S_ISVTX */
{errno = EINVAL; return -1;}
#endif /* ndef S_ISVTX */
if ((x & Mono_Posix_FilePermissions_S_IRUSR) == Mono_Posix_FilePermissions_S_IRUSR)
#ifdef S_IRUSR
*r |= S_IRUSR;
#else /* def S_IRUSR */
{errno = EINVAL; return -1;}
#endif /* ndef S_IRUSR */
if ((x & Mono_Posix_FilePermissions_S_IWUSR) == Mono_Posix_FilePermissions_S_IWUSR)
#ifdef S_IWUSR
*r |= S_IWUSR;
#else /* def S_IWUSR */
{errno = EINVAL; return -1;}
#endif /* ndef S_IWUSR */
if ((x & Mono_Posix_FilePermissions_S_IXUSR) == Mono_Posix_FilePermissions_S_IXUSR)
#ifdef S_IXUSR
*r |= S_IXUSR;
#else /* def S_IXUSR */
{errno = EINVAL; return -1;}
#endif /* ndef S_IXUSR */
if ((x & Mono_Posix_FilePermissions_S_IRGRP) == Mono_Posix_FilePermissions_S_IRGRP)
#ifdef S_IRGRP
*r |= S_IRGRP;
#else /* def S_IRGRP */
{errno = EINVAL; return -1;}
#endif /* ndef S_IRGRP */
if ((x & Mono_Posix_FilePermissions_S_IWGRP) == Mono_Posix_FilePermissions_S_IWGRP)
#ifdef S_IWGRP
*r |= S_IWGRP;
#else /* def S_IWGRP */
{errno = EINVAL; return -1;}
#endif /* ndef S_IWGRP */
if ((x & Mono_Posix_FilePermissions_S_IXGRP) == Mono_Posix_FilePermissions_S_IXGRP)
#ifdef S_IXGRP
*r |= S_IXGRP;
#else /* def S_IXGRP */
{errno = EINVAL; return -1;}
#endif /* ndef S_IXGRP */
if ((x & Mono_Posix_FilePermissions_S_IROTH) == Mono_Posix_FilePermissions_S_IROTH)
#ifdef S_IROTH
*r |= S_IROTH;
#else /* def S_IROTH */
{errno = EINVAL; return -1;}
#endif /* ndef S_IROTH */
if ((x & Mono_Posix_FilePermissions_S_IWOTH) == Mono_Posix_FilePermissions_S_IWOTH)
#ifdef S_IWOTH
*r |= S_IWOTH;
#else /* def S_IWOTH */
{errno = EINVAL; return -1;}
#endif /* ndef S_IWOTH */
if ((x & Mono_Posix_FilePermissions_S_IXOTH) == Mono_Posix_FilePermissions_S_IXOTH)
#ifdef S_IXOTH
*r |= S_IXOTH;
#else /* def S_IXOTH */
{errno = EINVAL; return -1;}
#endif /* ndef S_IXOTH */
if ((x & Mono_Posix_FilePermissions_S_IRWXG) == Mono_Posix_FilePermissions_S_IRWXG)
#ifdef S_IRWXG
*r |= S_IRWXG;
#else /* def S_IRWXG */
{errno = EINVAL; return -1;}
#endif /* ndef S_IRWXG */
if ((x & Mono_Posix_FilePermissions_S_IRWXU) == Mono_Posix_FilePermissions_S_IRWXU)
#ifdef S_IRWXU
*r |= S_IRWXU;
#else /* def S_IRWXU */
{errno = EINVAL; return -1;}
#endif /* ndef S_IRWXU */
if ((x & Mono_Posix_FilePermissions_S_IRWXO) == Mono_Posix_FilePermissions_S_IRWXO)
#ifdef S_IRWXO
*r |= S_IRWXO;
#else /* def S_IRWXO */
{errno = EINVAL; return -1;}
#endif /* ndef S_IRWXO */
if ((x & Mono_Posix_FilePermissions_ACCESSPERMS) == Mono_Posix_FilePermissions_ACCESSPERMS)
#ifdef ACCESSPERMS
*r |= ACCESSPERMS;
#else /* def ACCESSPERMS */
{errno = EINVAL; return -1;}
#endif /* ndef ACCESSPERMS */
if ((x & Mono_Posix_FilePermissions_ALLPERMS) == Mono_Posix_FilePermissions_ALLPERMS)
#ifdef ALLPERMS
*r |= ALLPERMS;
#else /* def ALLPERMS */
{errno = EINVAL; return -1;}
#endif /* ndef ALLPERMS */
if ((x & Mono_Posix_FilePermissions_DEFFILEMODE) == Mono_Posix_FilePermissions_DEFFILEMODE)
#ifdef DEFFILEMODE
*r |= DEFFILEMODE;
#else /* def DEFFILEMODE */
{errno = EINVAL; return -1;}
#endif /* ndef DEFFILEMODE */
if ((x & Mono_Posix_FilePermissions_S_IFMT) == Mono_Posix_FilePermissions_S_IFMT)
#ifdef S_IFMT
*r |= S_IFMT;
#else /* def S_IFMT */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFMT */
if ((x & Mono_Posix_FilePermissions_S_IFDIR) == Mono_Posix_FilePermissions_S_IFDIR)
#ifdef S_IFDIR
*r |= S_IFDIR;
#else /* def S_IFDIR */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFDIR */
if ((x & Mono_Posix_FilePermissions_S_IFCHR) == Mono_Posix_FilePermissions_S_IFCHR)
#ifdef S_IFCHR
*r |= S_IFCHR;
#else /* def S_IFCHR */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFCHR */
if ((x & Mono_Posix_FilePermissions_S_IFBLK) == Mono_Posix_FilePermissions_S_IFBLK)
#ifdef S_IFBLK
*r |= S_IFBLK;
#else /* def S_IFBLK */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFBLK */
if ((x & Mono_Posix_FilePermissions_S_IFREG) == Mono_Posix_FilePermissions_S_IFREG)
#ifdef S_IFREG
*r |= S_IFREG;
#else /* def S_IFREG */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFREG */
if ((x & Mono_Posix_FilePermissions_S_IFIFO) == Mono_Posix_FilePermissions_S_IFIFO)
#ifdef S_IFIFO
*r |= S_IFIFO;
#else /* def S_IFIFO */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFIFO */
if ((x & Mono_Posix_FilePermissions_S_IFLNK) == Mono_Posix_FilePermissions_S_IFLNK)
#ifdef S_IFLNK
*r |= S_IFLNK;
#else /* def S_IFLNK */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFLNK */
if ((x & Mono_Posix_FilePermissions_S_IFSOCK) == Mono_Posix_FilePermissions_S_IFSOCK)
#ifdef S_IFSOCK
*r |= S_IFSOCK;
#else /* def S_IFSOCK */
{errno = EINVAL; return -1;}
#endif /* ndef S_IFSOCK */
return 0;
}
int Mono_Posix_ToFilePermissions (unsigned int x, unsigned int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef S_ISUID
if ((x & S_ISUID) == S_ISUID)
*r |= Mono_Posix_FilePermissions_S_ISUID;
#endif /* ndef S_ISUID */
#ifdef S_ISGID
if ((x & S_ISGID) == S_ISGID)
*r |= Mono_Posix_FilePermissions_S_ISGID;
#endif /* ndef S_ISGID */
#ifdef S_ISVTX
if ((x & S_ISVTX) == S_ISVTX)
*r |= Mono_Posix_FilePermissions_S_ISVTX;
#endif /* ndef S_ISVTX */
#ifdef S_IRUSR
if ((x & S_IRUSR) == S_IRUSR)
*r |= Mono_Posix_FilePermissions_S_IRUSR;
#endif /* ndef S_IRUSR */
#ifdef S_IWUSR
if ((x & S_IWUSR) == S_IWUSR)
*r |= Mono_Posix_FilePermissions_S_IWUSR;
#endif /* ndef S_IWUSR */
#ifdef S_IXUSR
if ((x & S_IXUSR) == S_IXUSR)
*r |= Mono_Posix_FilePermissions_S_IXUSR;
#endif /* ndef S_IXUSR */
#ifdef S_IRGRP
if ((x & S_IRGRP) == S_IRGRP)
*r |= Mono_Posix_FilePermissions_S_IRGRP;
#endif /* ndef S_IRGRP */
#ifdef S_IWGRP
if ((x & S_IWGRP) == S_IWGRP)
*r |= Mono_Posix_FilePermissions_S_IWGRP;
#endif /* ndef S_IWGRP */
#ifdef S_IXGRP
if ((x & S_IXGRP) == S_IXGRP)
*r |= Mono_Posix_FilePermissions_S_IXGRP;
#endif /* ndef S_IXGRP */
#ifdef S_IROTH
if ((x & S_IROTH) == S_IROTH)
*r |= Mono_Posix_FilePermissions_S_IROTH;
#endif /* ndef S_IROTH */
#ifdef S_IWOTH
if ((x & S_IWOTH) == S_IWOTH)
*r |= Mono_Posix_FilePermissions_S_IWOTH;
#endif /* ndef S_IWOTH */
#ifdef S_IXOTH
if ((x & S_IXOTH) == S_IXOTH)
*r |= Mono_Posix_FilePermissions_S_IXOTH;
#endif /* ndef S_IXOTH */
#ifdef S_IRWXG
if ((x & S_IRWXG) == S_IRWXG)
*r |= Mono_Posix_FilePermissions_S_IRWXG;
#endif /* ndef S_IRWXG */
#ifdef S_IRWXU
if ((x & S_IRWXU) == S_IRWXU)
*r |= Mono_Posix_FilePermissions_S_IRWXU;
#endif /* ndef S_IRWXU */
#ifdef S_IRWXO
if ((x & S_IRWXO) == S_IRWXO)
*r |= Mono_Posix_FilePermissions_S_IRWXO;
#endif /* ndef S_IRWXO */
#ifdef ACCESSPERMS
if ((x & ACCESSPERMS) == ACCESSPERMS)
*r |= Mono_Posix_FilePermissions_ACCESSPERMS;
#endif /* ndef ACCESSPERMS */
#ifdef ALLPERMS
if ((x & ALLPERMS) == ALLPERMS)
*r |= Mono_Posix_FilePermissions_ALLPERMS;
#endif /* ndef ALLPERMS */
#ifdef DEFFILEMODE
if ((x & DEFFILEMODE) == DEFFILEMODE)
*r |= Mono_Posix_FilePermissions_DEFFILEMODE;
#endif /* ndef DEFFILEMODE */
#ifdef S_IFMT
if ((x & S_IFMT) == S_IFMT)
*r |= Mono_Posix_FilePermissions_S_IFMT;
#endif /* ndef S_IFMT */
#ifdef S_IFDIR
if ((x & S_IFDIR) == S_IFDIR)
*r |= Mono_Posix_FilePermissions_S_IFDIR;
#endif /* ndef S_IFDIR */
#ifdef S_IFCHR
if ((x & S_IFCHR) == S_IFCHR)
*r |= Mono_Posix_FilePermissions_S_IFCHR;
#endif /* ndef S_IFCHR */
#ifdef S_IFBLK
if ((x & S_IFBLK) == S_IFBLK)
*r |= Mono_Posix_FilePermissions_S_IFBLK;
#endif /* ndef S_IFBLK */
#ifdef S_IFREG
if ((x & S_IFREG) == S_IFREG)
*r |= Mono_Posix_FilePermissions_S_IFREG;
#endif /* ndef S_IFREG */
#ifdef S_IFIFO
if ((x & S_IFIFO) == S_IFIFO)
*r |= Mono_Posix_FilePermissions_S_IFIFO;
#endif /* ndef S_IFIFO */
#ifdef S_IFLNK
if ((x & S_IFLNK) == S_IFLNK)
*r |= Mono_Posix_FilePermissions_S_IFLNK;
#endif /* ndef S_IFLNK */
#ifdef S_IFSOCK
if ((x & S_IFSOCK) == S_IFSOCK)
*r |= Mono_Posix_FilePermissions_S_IFSOCK;
#endif /* ndef S_IFSOCK */
return 0;
}
int Mono_Posix_FromFcntlCommand (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_FcntlCommand_F_DUPFD)
#ifdef F_DUPFD
{*r = F_DUPFD; return 0;}
#else /* def F_DUPFD */
{errno = EINVAL; return -1;}
#endif /* ndef F_DUPFD */
if (x == Mono_Posix_FcntlCommand_F_GETFD)
#ifdef F_GETFD
{*r = F_GETFD; return 0;}
#else /* def F_GETFD */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETFD */
if (x == Mono_Posix_FcntlCommand_F_SETFD)
#ifdef F_SETFD
{*r = F_SETFD; return 0;}
#else /* def F_SETFD */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETFD */
if (x == Mono_Posix_FcntlCommand_F_GETFL)
#ifdef F_GETFL
{*r = F_GETFL; return 0;}
#else /* def F_GETFL */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETFL */
if (x == Mono_Posix_FcntlCommand_F_SETFL)
#ifdef F_SETFL
{*r = F_SETFL; return 0;}
#else /* def F_SETFL */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETFL */
if (x == Mono_Posix_FcntlCommand_F_GETLK)
#ifdef F_GETLK
{*r = F_GETLK; return 0;}
#else /* def F_GETLK */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETLK */
if (x == Mono_Posix_FcntlCommand_F_SETLK)
#ifdef F_SETLK
{*r = F_SETLK; return 0;}
#else /* def F_SETLK */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETLK */
if (x == Mono_Posix_FcntlCommand_F_SETLKW)
#ifdef F_SETLKW
{*r = F_SETLKW; return 0;}
#else /* def F_SETLKW */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETLKW */
if (x == Mono_Posix_FcntlCommand_F_SETOWN)
#ifdef F_SETOWN
{*r = F_SETOWN; return 0;}
#else /* def F_SETOWN */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETOWN */
if (x == Mono_Posix_FcntlCommand_F_GETOWN)
#ifdef F_GETOWN
{*r = F_GETOWN; return 0;}
#else /* def F_GETOWN */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETOWN */
if (x == Mono_Posix_FcntlCommand_F_SETSIG)
#ifdef F_SETSIG
{*r = F_SETSIG; return 0;}
#else /* def F_SETSIG */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETSIG */
if (x == Mono_Posix_FcntlCommand_F_GETSIG)
#ifdef F_GETSIG
{*r = F_GETSIG; return 0;}
#else /* def F_GETSIG */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETSIG */
if (x == Mono_Posix_FcntlCommand_F_SETLEASE)
#ifdef F_SETLEASE
{*r = F_SETLEASE; return 0;}
#else /* def F_SETLEASE */
{errno = EINVAL; return -1;}
#endif /* ndef F_SETLEASE */
if (x == Mono_Posix_FcntlCommand_F_GETLEASE)
#ifdef F_GETLEASE
{*r = F_GETLEASE; return 0;}
#else /* def F_GETLEASE */
{errno = EINVAL; return -1;}
#endif /* ndef F_GETLEASE */
if (x == Mono_Posix_FcntlCommand_F_NOTIFY)
#ifdef F_NOTIFY
{*r = F_NOTIFY; return 0;}
#else /* def F_NOTIFY */
{errno = EINVAL; return -1;}
#endif /* ndef F_NOTIFY */
errno = EINVAL; return -1;
}
int Mono_Posix_ToFcntlCommand (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef F_DUPFD
if (x == F_DUPFD)
{*r = Mono_Posix_FcntlCommand_F_DUPFD; return 0;}
#endif /* ndef F_DUPFD */
#ifdef F_GETFD
if (x == F_GETFD)
{*r = Mono_Posix_FcntlCommand_F_GETFD; return 0;}
#endif /* ndef F_GETFD */
#ifdef F_SETFD
if (x == F_SETFD)
{*r = Mono_Posix_FcntlCommand_F_SETFD; return 0;}
#endif /* ndef F_SETFD */
#ifdef F_GETFL
if (x == F_GETFL)
{*r = Mono_Posix_FcntlCommand_F_GETFL; return 0;}
#endif /* ndef F_GETFL */
#ifdef F_SETFL
if (x == F_SETFL)
{*r = Mono_Posix_FcntlCommand_F_SETFL; return 0;}
#endif /* ndef F_SETFL */
#ifdef F_GETLK
if (x == F_GETLK)
{*r = Mono_Posix_FcntlCommand_F_GETLK; return 0;}
#endif /* ndef F_GETLK */
#ifdef F_SETLK
if (x == F_SETLK)
{*r = Mono_Posix_FcntlCommand_F_SETLK; return 0;}
#endif /* ndef F_SETLK */
#ifdef F_SETLKW
if (x == F_SETLKW)
{*r = Mono_Posix_FcntlCommand_F_SETLKW; return 0;}
#endif /* ndef F_SETLKW */
#ifdef F_SETOWN
if (x == F_SETOWN)
{*r = Mono_Posix_FcntlCommand_F_SETOWN; return 0;}
#endif /* ndef F_SETOWN */
#ifdef F_GETOWN
if (x == F_GETOWN)
{*r = Mono_Posix_FcntlCommand_F_GETOWN; return 0;}
#endif /* ndef F_GETOWN */
#ifdef F_SETSIG
if (x == F_SETSIG)
{*r = Mono_Posix_FcntlCommand_F_SETSIG; return 0;}
#endif /* ndef F_SETSIG */
#ifdef F_GETSIG
if (x == F_GETSIG)
{*r = Mono_Posix_FcntlCommand_F_GETSIG; return 0;}
#endif /* ndef F_GETSIG */
#ifdef F_SETLEASE
if (x == F_SETLEASE)
{*r = Mono_Posix_FcntlCommand_F_SETLEASE; return 0;}
#endif /* ndef F_SETLEASE */
#ifdef F_GETLEASE
if (x == F_GETLEASE)
{*r = Mono_Posix_FcntlCommand_F_GETLEASE; return 0;}
#endif /* ndef F_GETLEASE */
#ifdef F_NOTIFY
if (x == F_NOTIFY)
{*r = Mono_Posix_FcntlCommand_F_NOTIFY; return 0;}
#endif /* ndef F_NOTIFY */
errno = EINVAL; return -1;
}
int Mono_Posix_FromLockType (short x, short *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_LockType_F_RDLCK)
#ifdef F_RDLCK
{*r = F_RDLCK; return 0;}
#else /* def F_RDLCK */
{errno = EINVAL; return -1;}
#endif /* ndef F_RDLCK */
if (x == Mono_Posix_LockType_F_WRLCK)
#ifdef F_WRLCK
{*r = F_WRLCK; return 0;}
#else /* def F_WRLCK */
{errno = EINVAL; return -1;}
#endif /* ndef F_WRLCK */
if (x == Mono_Posix_LockType_F_UNLCK)
#ifdef F_UNLCK
{*r = F_UNLCK; return 0;}
#else /* def F_UNLCK */
{errno = EINVAL; return -1;}
#endif /* ndef F_UNLCK */
errno = EINVAL; return -1;
}
int Mono_Posix_ToLockType (short x, short *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef F_RDLCK
if (x == F_RDLCK)
{*r = Mono_Posix_LockType_F_RDLCK; return 0;}
#endif /* ndef F_RDLCK */
#ifdef F_WRLCK
if (x == F_WRLCK)
{*r = Mono_Posix_LockType_F_WRLCK; return 0;}
#endif /* ndef F_WRLCK */
#ifdef F_UNLCK
if (x == F_UNLCK)
{*r = Mono_Posix_LockType_F_UNLCK; return 0;}
#endif /* ndef F_UNLCK */
errno = EINVAL; return -1;
}
int Mono_Posix_FromSeekFlags (short x, short *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_SeekFlags_SEEK_SET)
#ifdef SEEK_SET
{*r = SEEK_SET; return 0;}
#else /* def SEEK_SET */
{errno = EINVAL; return -1;}
#endif /* ndef SEEK_SET */
if (x == Mono_Posix_SeekFlags_SEEK_CUR)
#ifdef SEEK_CUR
{*r = SEEK_CUR; return 0;}
#else /* def SEEK_CUR */
{errno = EINVAL; return -1;}
#endif /* ndef SEEK_CUR */
if (x == Mono_Posix_SeekFlags_SEEK_END)
#ifdef SEEK_END
{*r = SEEK_END; return 0;}
#else /* def SEEK_END */
{errno = EINVAL; return -1;}
#endif /* ndef SEEK_END */
if (x == Mono_Posix_SeekFlags_L_SET)
#ifdef L_SET
{*r = L_SET; return 0;}
#else /* def L_SET */
{errno = EINVAL; return -1;}
#endif /* ndef L_SET */
if (x == Mono_Posix_SeekFlags_L_INCR)
#ifdef L_INCR
{*r = L_INCR; return 0;}
#else /* def L_INCR */
{errno = EINVAL; return -1;}
#endif /* ndef L_INCR */
if (x == Mono_Posix_SeekFlags_L_XTND)
#ifdef L_XTND
{*r = L_XTND; return 0;}
#else /* def L_XTND */
{errno = EINVAL; return -1;}
#endif /* ndef L_XTND */
errno = EINVAL; return -1;
}
int Mono_Posix_ToSeekFlags (short x, short *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef SEEK_SET
if (x == SEEK_SET)
{*r = Mono_Posix_SeekFlags_SEEK_SET; return 0;}
#endif /* ndef SEEK_SET */
#ifdef SEEK_CUR
if (x == SEEK_CUR)
{*r = Mono_Posix_SeekFlags_SEEK_CUR; return 0;}
#endif /* ndef SEEK_CUR */
#ifdef SEEK_END
if (x == SEEK_END)
{*r = Mono_Posix_SeekFlags_SEEK_END; return 0;}
#endif /* ndef SEEK_END */
#ifdef L_SET
if (x == L_SET)
{*r = Mono_Posix_SeekFlags_L_SET; return 0;}
#endif /* ndef L_SET */
#ifdef L_INCR
if (x == L_INCR)
{*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
#endif /* ndef L_INCR */
#ifdef L_XTND
if (x == L_XTND)
{*r = Mono_Posix_SeekFlags_L_XTND; return 0;}
#endif /* ndef L_XTND */
errno = EINVAL; return -1;
}
int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ACCESS) == Mono_Posix_DirectoryNotifyFlags_DN_ACCESS)
#ifdef DN_ACCESS
*r |= DN_ACCESS;
#else /* def DN_ACCESS */
{errno = EINVAL; return -1;}
#endif /* ndef DN_ACCESS */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MODIFY) == Mono_Posix_DirectoryNotifyFlags_DN_MODIFY)
#ifdef DN_MODIFY
*r |= DN_MODIFY;
#else /* def DN_MODIFY */
{errno = EINVAL; return -1;}
#endif /* ndef DN_MODIFY */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_CREATE) == Mono_Posix_DirectoryNotifyFlags_DN_CREATE)
#ifdef DN_CREATE
*r |= DN_CREATE;
#else /* def DN_CREATE */
{errno = EINVAL; return -1;}
#endif /* ndef DN_CREATE */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_DELETE) == Mono_Posix_DirectoryNotifyFlags_DN_DELETE)
#ifdef DN_DELETE
*r |= DN_DELETE;
#else /* def DN_DELETE */
{errno = EINVAL; return -1;}
#endif /* ndef DN_DELETE */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_RENAME) == Mono_Posix_DirectoryNotifyFlags_DN_RENAME)
#ifdef DN_RENAME
*r |= DN_RENAME;
#else /* def DN_RENAME */
{errno = EINVAL; return -1;}
#endif /* ndef DN_RENAME */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB) == Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB)
#ifdef DN_ATTRIB
*r |= DN_ATTRIB;
#else /* def DN_ATTRIB */
{errno = EINVAL; return -1;}
#endif /* ndef DN_ATTRIB */
if ((x & Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT) == Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT)
#ifdef DN_MULTISHOT
*r |= DN_MULTISHOT;
#else /* def DN_MULTISHOT */
{errno = EINVAL; return -1;}
#endif /* ndef DN_MULTISHOT */
return 0;
}
int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef DN_ACCESS
if ((x & DN_ACCESS) == DN_ACCESS)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_ACCESS;
#endif /* ndef DN_ACCESS */
#ifdef DN_MODIFY
if ((x & DN_MODIFY) == DN_MODIFY)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_MODIFY;
#endif /* ndef DN_MODIFY */
#ifdef DN_CREATE
if ((x & DN_CREATE) == DN_CREATE)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_CREATE;
#endif /* ndef DN_CREATE */
#ifdef DN_DELETE
if ((x & DN_DELETE) == DN_DELETE)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_DELETE;
#endif /* ndef DN_DELETE */
#ifdef DN_RENAME
if ((x & DN_RENAME) == DN_RENAME)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_RENAME;
#endif /* ndef DN_RENAME */
#ifdef DN_ATTRIB
if ((x & DN_ATTRIB) == DN_ATTRIB)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_ATTRIB;
#endif /* ndef DN_ATTRIB */
#ifdef DN_MULTISHOT
if ((x & DN_MULTISHOT) == DN_MULTISHOT)
*r |= Mono_Posix_DirectoryNotifyFlags_DN_MULTISHOT;
#endif /* ndef DN_MULTISHOT */
return 0;
}
int Mono_Posix_FromPosixFadviseAdvice (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL)
#ifdef POSIX_FADV_NORMAL
{*r = POSIX_FADV_NORMAL; return 0;}
#else /* def POSIX_FADV_NORMAL */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_NORMAL */
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM)
#ifdef POSIX_FADV_RANDOM
{*r = POSIX_FADV_RANDOM; return 0;}
#else /* def POSIX_FADV_RANDOM */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_RANDOM */
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL)
#ifdef POSIX_FADV_SEQUENTIAL
{*r = POSIX_FADV_SEQUENTIAL; return 0;}
#else /* def POSIX_FADV_SEQUENTIAL */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_SEQUENTIAL */
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED)
#ifdef POSIX_FADV_WILLNEED
{*r = POSIX_FADV_WILLNEED; return 0;}
#else /* def POSIX_FADV_WILLNEED */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_WILLNEED */
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED)
#ifdef POSIX_FADV_DONTNEED
{*r = POSIX_FADV_DONTNEED; return 0;}
#else /* def POSIX_FADV_DONTNEED */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_DONTNEED */
if (x == Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE)
#ifdef POSIX_FADV_NOREUSE
{*r = POSIX_FADV_NOREUSE; return 0;}
#else /* def POSIX_FADV_NOREUSE */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_FADV_NOREUSE */
errno = EINVAL; return -1;
}
int Mono_Posix_ToPosixFadviseAdvice (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef POSIX_FADV_NORMAL
if (x == POSIX_FADV_NORMAL)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NORMAL; return 0;}
#endif /* ndef POSIX_FADV_NORMAL */
#ifdef POSIX_FADV_RANDOM
if (x == POSIX_FADV_RANDOM)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_RANDOM; return 0;}
#endif /* ndef POSIX_FADV_RANDOM */
#ifdef POSIX_FADV_SEQUENTIAL
if (x == POSIX_FADV_SEQUENTIAL)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_SEQUENTIAL; return 0;}
#endif /* ndef POSIX_FADV_SEQUENTIAL */
#ifdef POSIX_FADV_WILLNEED
if (x == POSIX_FADV_WILLNEED)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_WILLNEED; return 0;}
#endif /* ndef POSIX_FADV_WILLNEED */
#ifdef POSIX_FADV_DONTNEED
if (x == POSIX_FADV_DONTNEED)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_DONTNEED; return 0;}
#endif /* ndef POSIX_FADV_DONTNEED */
#ifdef POSIX_FADV_NOREUSE
if (x == POSIX_FADV_NOREUSE)
{*r = Mono_Posix_PosixFadviseAdvice_POSIX_FADV_NOREUSE; return 0;}
#endif /* ndef POSIX_FADV_NOREUSE */
errno = EINVAL; return -1;
}
int Mono_Posix_FromPosixMadviseAdvice (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL)
#ifdef POSIX_MADV_NORMAL
{*r = POSIX_MADV_NORMAL; return 0;}
#else /* def POSIX_MADV_NORMAL */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_MADV_NORMAL */
if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM)
#ifdef POSIX_MADV_RANDOM
{*r = POSIX_MADV_RANDOM; return 0;}
#else /* def POSIX_MADV_RANDOM */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_MADV_RANDOM */
if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL)
#ifdef POSIX_MADV_SEQUENTIAL
{*r = POSIX_MADV_SEQUENTIAL; return 0;}
#else /* def POSIX_MADV_SEQUENTIAL */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_MADV_SEQUENTIAL */
if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED)
#ifdef POSIX_MADV_WILLNEED
{*r = POSIX_MADV_WILLNEED; return 0;}
#else /* def POSIX_MADV_WILLNEED */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_MADV_WILLNEED */
if (x == Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED)
#ifdef POSIX_MADV_DONTNEED
{*r = POSIX_MADV_DONTNEED; return 0;}
#else /* def POSIX_MADV_DONTNEED */
{errno = EINVAL; return -1;}
#endif /* ndef POSIX_MADV_DONTNEED */
errno = EINVAL; return -1;
}
int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef POSIX_MADV_NORMAL
if (x == POSIX_MADV_NORMAL)
{*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_NORMAL; return 0;}
#endif /* ndef POSIX_MADV_NORMAL */
#ifdef POSIX_MADV_RANDOM
if (x == POSIX_MADV_RANDOM)
{*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_RANDOM; return 0;}
#endif /* ndef POSIX_MADV_RANDOM */
#ifdef POSIX_MADV_SEQUENTIAL
if (x == POSIX_MADV_SEQUENTIAL)
{*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_SEQUENTIAL; return 0;}
#endif /* ndef POSIX_MADV_SEQUENTIAL */
#ifdef POSIX_MADV_WILLNEED
if (x == POSIX_MADV_WILLNEED)
{*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_WILLNEED; return 0;}
#endif /* ndef POSIX_MADV_WILLNEED */
#ifdef POSIX_MADV_DONTNEED
if (x == POSIX_MADV_DONTNEED)
{*r = Mono_Posix_PosixMadviseAdvice_POSIX_MADV_DONTNEED; return 0;}
#endif /* ndef POSIX_MADV_DONTNEED */
errno = EINVAL; return -1;
}
int Mono_Posix_FromSignum (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_Signum_SIGHUP)
#ifdef SIGHUP
{*r = SIGHUP; return 0;}
#else /* def SIGHUP */
{errno = EINVAL; return -1;}
#endif /* ndef SIGHUP */
if (x == Mono_Posix_Signum_SIGINT)
#ifdef SIGINT
{*r = SIGINT; return 0;}
#else /* def SIGINT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGINT */
if (x == Mono_Posix_Signum_SIGQUIT)
#ifdef SIGQUIT
{*r = SIGQUIT; return 0;}
#else /* def SIGQUIT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGQUIT */
if (x == Mono_Posix_Signum_SIGILL)
#ifdef SIGILL
{*r = SIGILL; return 0;}
#else /* def SIGILL */
{errno = EINVAL; return -1;}
#endif /* ndef SIGILL */
if (x == Mono_Posix_Signum_SIGTRAP)
#ifdef SIGTRAP
{*r = SIGTRAP; return 0;}
#else /* def SIGTRAP */
{errno = EINVAL; return -1;}
#endif /* ndef SIGTRAP */
if (x == Mono_Posix_Signum_SIGABRT)
#ifdef SIGABRT
{*r = SIGABRT; return 0;}
#else /* def SIGABRT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGABRT */
if (x == Mono_Posix_Signum_SIGIOT)
#ifdef SIGIOT
{*r = SIGIOT; return 0;}
#else /* def SIGIOT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGIOT */
if (x == Mono_Posix_Signum_SIGBUS)
#ifdef SIGBUS
{*r = SIGBUS; return 0;}
#else /* def SIGBUS */
{errno = EINVAL; return -1;}
#endif /* ndef SIGBUS */
if (x == Mono_Posix_Signum_SIGFPE)
#ifdef SIGFPE
{*r = SIGFPE; return 0;}
#else /* def SIGFPE */
{errno = EINVAL; return -1;}
#endif /* ndef SIGFPE */
if (x == Mono_Posix_Signum_SIGKILL)
#ifdef SIGKILL
{*r = SIGKILL; return 0;}
#else /* def SIGKILL */
{errno = EINVAL; return -1;}
#endif /* ndef SIGKILL */
if (x == Mono_Posix_Signum_SIGUSR1)
#ifdef SIGUSR1
{*r = SIGUSR1; return 0;}
#else /* def SIGUSR1 */
{errno = EINVAL; return -1;}
#endif /* ndef SIGUSR1 */
if (x == Mono_Posix_Signum_SIGSEGV)
#ifdef SIGSEGV
{*r = SIGSEGV; return 0;}
#else /* def SIGSEGV */
{errno = EINVAL; return -1;}
#endif /* ndef SIGSEGV */
if (x == Mono_Posix_Signum_SIGUSR2)
#ifdef SIGUSR2
{*r = SIGUSR2; return 0;}
#else /* def SIGUSR2 */
{errno = EINVAL; return -1;}
#endif /* ndef SIGUSR2 */
if (x == Mono_Posix_Signum_SIGPIPE)
#ifdef SIGPIPE
{*r = SIGPIPE; return 0;}
#else /* def SIGPIPE */
{errno = EINVAL; return -1;}
#endif /* ndef SIGPIPE */
if (x == Mono_Posix_Signum_SIGALRM)
#ifdef SIGALRM
{*r = SIGALRM; return 0;}
#else /* def SIGALRM */
{errno = EINVAL; return -1;}
#endif /* ndef SIGALRM */
if (x == Mono_Posix_Signum_SIGTERM)
#ifdef SIGTERM
{*r = SIGTERM; return 0;}
#else /* def SIGTERM */
{errno = EINVAL; return -1;}
#endif /* ndef SIGTERM */
if (x == Mono_Posix_Signum_SIGSTKFLT)
#ifdef SIGSTKFLT
{*r = SIGSTKFLT; return 0;}
#else /* def SIGSTKFLT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGSTKFLT */
if (x == Mono_Posix_Signum_SIGCHLD)
#ifdef SIGCHLD
{*r = SIGCHLD; return 0;}
#else /* def SIGCHLD */
{errno = EINVAL; return -1;}
#endif /* ndef SIGCHLD */
if (x == Mono_Posix_Signum_SIGCLD)
#ifdef SIGCLD
{*r = SIGCLD; return 0;}
#else /* def SIGCLD */
{errno = EINVAL; return -1;}
#endif /* ndef SIGCLD */
if (x == Mono_Posix_Signum_SIGCONT)
#ifdef SIGCONT
{*r = SIGCONT; return 0;}
#else /* def SIGCONT */
{errno = EINVAL; return -1;}
#endif /* ndef SIGCONT */
if (x == Mono_Posix_Signum_SIGSTOP)
#ifdef SIGSTOP
{*r = SIGSTOP; return 0;}
#else /* def SIGSTOP */
{errno = EINVAL; return -1;}
#endif /* ndef SIGSTOP */
if (x == Mono_Posix_Signum_SIGTSTP)
#ifdef SIGTSTP
{*r = SIGTSTP; return 0;}
#else /* def SIGTSTP */
{errno = EINVAL; return -1;}
#endif /* ndef SIGTSTP */
if (x == Mono_Posix_Signum_SIGTTIN)
#ifdef SIGTTIN
{*r = SIGTTIN; return 0;}
#else /* def SIGTTIN */
{errno = EINVAL; return -1;}
#endif /* ndef SIGTTIN */
if (x == Mono_Posix_Signum_SIGTTOU)
#ifdef SIGTTOU
{*r = SIGTTOU; return 0;}
#else /* def SIGTTOU */
{errno = EINVAL; return -1;}
#endif /* ndef SIGTTOU */
if (x == Mono_Posix_Signum_SIGURG)
#ifdef SIGURG
{*r = SIGURG; return 0;}
#else /* def SIGURG */
{errno = EINVAL; return -1;}
#endif /* ndef SIGURG */
if (x == Mono_Posix_Signum_SIGXCPU)
#ifdef SIGXCPU
{*r = SIGXCPU; return 0;}
#else /* def SIGXCPU */
{errno = EINVAL; return -1;}
#endif /* ndef SIGXCPU */
if (x == Mono_Posix_Signum_SIGXFSZ)
#ifdef SIGXFSZ
{*r = SIGXFSZ; return 0;}
#else /* def SIGXFSZ */
{errno = EINVAL; return -1;}
#endif /* ndef SIGXFSZ */
if (x == Mono_Posix_Signum_SIGVTALRM)
#ifdef SIGVTALRM
{*r = SIGVTALRM; return 0;}
#else /* def SIGVTALRM */
{errno = EINVAL; return -1;}
#endif /* ndef SIGVTALRM */
if (x == Mono_Posix_Signum_SIGPROF)
#ifdef SIGPROF
{*r = SIGPROF; return 0;}
#else /* def SIGPROF */
{errno = EINVAL; return -1;}
#endif /* ndef SIGPROF */
if (x == Mono_Posix_Signum_SIGWINCH)
#ifdef SIGWINCH
{*r = SIGWINCH; return 0;}
#else /* def SIGWINCH */
{errno = EINVAL; return -1;}
#endif /* ndef SIGWINCH */
if (x == Mono_Posix_Signum_SIGIO)
#ifdef SIGIO
{*r = SIGIO; return 0;}
#else /* def SIGIO */
{errno = EINVAL; return -1;}
#endif /* ndef SIGIO */
if (x == Mono_Posix_Signum_SIGPOLL)
#ifdef SIGPOLL
{*r = SIGPOLL; return 0;}
#else /* def SIGPOLL */
{errno = EINVAL; return -1;}
#endif /* ndef SIGPOLL */
if (x == Mono_Posix_Signum_SIGPWR)
#ifdef SIGPWR
{*r = SIGPWR; return 0;}
#else /* def SIGPWR */
{errno = EINVAL; return -1;}
#endif /* ndef SIGPWR */
if (x == Mono_Posix_Signum_SIGSYS)
#ifdef SIGSYS
{*r = SIGSYS; return 0;}
#else /* def SIGSYS */
{errno = EINVAL; return -1;}
#endif /* ndef SIGSYS */
if (x == Mono_Posix_Signum_SIGUNUSED)
#ifdef SIGUNUSED
{*r = SIGUNUSED; return 0;}
#else /* def SIGUNUSED */
{errno = EINVAL; return -1;}
#endif /* ndef SIGUNUSED */
errno = EINVAL; return -1;
}
int Mono_Posix_ToSignum (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef SIGHUP
if (x == SIGHUP)
{*r = Mono_Posix_Signum_SIGHUP; return 0;}
#endif /* ndef SIGHUP */
#ifdef SIGINT
if (x == SIGINT)
{*r = Mono_Posix_Signum_SIGINT; return 0;}
#endif /* ndef SIGINT */
#ifdef SIGQUIT
if (x == SIGQUIT)
{*r = Mono_Posix_Signum_SIGQUIT; return 0;}
#endif /* ndef SIGQUIT */
#ifdef SIGILL
if (x == SIGILL)
{*r = Mono_Posix_Signum_SIGILL; return 0;}
#endif /* ndef SIGILL */
#ifdef SIGTRAP
if (x == SIGTRAP)
{*r = Mono_Posix_Signum_SIGTRAP; return 0;}
#endif /* ndef SIGTRAP */
#ifdef SIGABRT
if (x == SIGABRT)
{*r = Mono_Posix_Signum_SIGABRT; return 0;}
#endif /* ndef SIGABRT */
#ifdef SIGIOT
if (x == SIGIOT)
{*r = Mono_Posix_Signum_SIGIOT; return 0;}
#endif /* ndef SIGIOT */
#ifdef SIGBUS
if (x == SIGBUS)
{*r = Mono_Posix_Signum_SIGBUS; return 0;}
#endif /* ndef SIGBUS */
#ifdef SIGFPE
if (x == SIGFPE)
{*r = Mono_Posix_Signum_SIGFPE; return 0;}
#endif /* ndef SIGFPE */
#ifdef SIGKILL
if (x == SIGKILL)
{*r = Mono_Posix_Signum_SIGKILL; return 0;}
#endif /* ndef SIGKILL */
#ifdef SIGUSR1
if (x == SIGUSR1)
{*r = Mono_Posix_Signum_SIGUSR1; return 0;}
#endif /* ndef SIGUSR1 */
#ifdef SIGSEGV
if (x == SIGSEGV)
{*r = Mono_Posix_Signum_SIGSEGV; return 0;}
#endif /* ndef SIGSEGV */
#ifdef SIGUSR2
if (x == SIGUSR2)
{*r = Mono_Posix_Signum_SIGUSR2; return 0;}
#endif /* ndef SIGUSR2 */
#ifdef SIGPIPE
if (x == SIGPIPE)
{*r = Mono_Posix_Signum_SIGPIPE; return 0;}
#endif /* ndef SIGPIPE */
#ifdef SIGALRM
if (x == SIGALRM)
{*r = Mono_Posix_Signum_SIGALRM; return 0;}
#endif /* ndef SIGALRM */
#ifdef SIGTERM
if (x == SIGTERM)
{*r = Mono_Posix_Signum_SIGTERM; return 0;}
#endif /* ndef SIGTERM */
#ifdef SIGSTKFLT
if (x == SIGSTKFLT)
{*r = Mono_Posix_Signum_SIGSTKFLT; return 0;}
#endif /* ndef SIGSTKFLT */
#ifdef SIGCHLD
if (x == SIGCHLD)
{*r = Mono_Posix_Signum_SIGCHLD; return 0;}
#endif /* ndef SIGCHLD */
#ifdef SIGCLD
if (x == SIGCLD)
{*r = Mono_Posix_Signum_SIGCLD; return 0;}
#endif /* ndef SIGCLD */
#ifdef SIGCONT
if (x == SIGCONT)
{*r = Mono_Posix_Signum_SIGCONT; return 0;}
#endif /* ndef SIGCONT */
#ifdef SIGSTOP
if (x == SIGSTOP)
{*r = Mono_Posix_Signum_SIGSTOP; return 0;}
#endif /* ndef SIGSTOP */
#ifdef SIGTSTP
if (x == SIGTSTP)
{*r = Mono_Posix_Signum_SIGTSTP; return 0;}
#endif /* ndef SIGTSTP */
#ifdef SIGTTIN
if (x == SIGTTIN)
{*r = Mono_Posix_Signum_SIGTTIN; return 0;}
#endif /* ndef SIGTTIN */
#ifdef SIGTTOU
if (x == SIGTTOU)
{*r = Mono_Posix_Signum_SIGTTOU; return 0;}
#endif /* ndef SIGTTOU */
#ifdef SIGURG
if (x == SIGURG)
{*r = Mono_Posix_Signum_SIGURG; return 0;}
#endif /* ndef SIGURG */
#ifdef SIGXCPU
if (x == SIGXCPU)
{*r = Mono_Posix_Signum_SIGXCPU; return 0;}
#endif /* ndef SIGXCPU */
#ifdef SIGXFSZ
if (x == SIGXFSZ)
{*r = Mono_Posix_Signum_SIGXFSZ; return 0;}
#endif /* ndef SIGXFSZ */
#ifdef SIGVTALRM
if (x == SIGVTALRM)
{*r = Mono_Posix_Signum_SIGVTALRM; return 0;}
#endif /* ndef SIGVTALRM */
#ifdef SIGPROF
if (x == SIGPROF)
{*r = Mono_Posix_Signum_SIGPROF; return 0;}
#endif /* ndef SIGPROF */
#ifdef SIGWINCH
if (x == SIGWINCH)
{*r = Mono_Posix_Signum_SIGWINCH; return 0;}
#endif /* ndef SIGWINCH */
#ifdef SIGIO
if (x == SIGIO)
{*r = Mono_Posix_Signum_SIGIO; return 0;}
#endif /* ndef SIGIO */
#ifdef SIGPOLL
if (x == SIGPOLL)
{*r = Mono_Posix_Signum_SIGPOLL; return 0;}
#endif /* ndef SIGPOLL */
#ifdef SIGPWR
if (x == SIGPWR)
{*r = Mono_Posix_Signum_SIGPWR; return 0;}
#endif /* ndef SIGPWR */
#ifdef SIGSYS
if (x == SIGSYS)
{*r = Mono_Posix_Signum_SIGSYS; return 0;}
#endif /* ndef SIGSYS */
#ifdef SIGUNUSED
if (x == SIGUNUSED)
{*r = Mono_Posix_Signum_SIGUNUSED; return 0;}
#endif /* ndef SIGUNUSED */
errno = EINVAL; return -1;
}
int Mono_Posix_FromWaitOptions (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_WaitOptions_WNOHANG) == Mono_Posix_WaitOptions_WNOHANG)
#ifdef WNOHANG
*r |= WNOHANG;
#else /* def WNOHANG */
{errno = EINVAL; return -1;}
#endif /* ndef WNOHANG */
if ((x & Mono_Posix_WaitOptions_WUNTRACED) == Mono_Posix_WaitOptions_WUNTRACED)
#ifdef WUNTRACED
*r |= WUNTRACED;
#else /* def WUNTRACED */
{errno = EINVAL; return -1;}
#endif /* ndef WUNTRACED */
return 0;
}
int Mono_Posix_ToWaitOptions (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef WNOHANG
if ((x & WNOHANG) == WNOHANG)
*r |= Mono_Posix_WaitOptions_WNOHANG;
#endif /* ndef WNOHANG */
#ifdef WUNTRACED
if ((x & WUNTRACED) == WUNTRACED)
*r |= Mono_Posix_WaitOptions_WUNTRACED;
#endif /* ndef WUNTRACED */
return 0;
}
int Mono_Posix_FromAccessMode (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if ((x & Mono_Posix_AccessMode_R_OK) == Mono_Posix_AccessMode_R_OK)
#ifdef R_OK
*r |= R_OK;
#else /* def R_OK */
{errno = EINVAL; return -1;}
#endif /* ndef R_OK */
if ((x & Mono_Posix_AccessMode_W_OK) == Mono_Posix_AccessMode_W_OK)
#ifdef W_OK
*r |= W_OK;
#else /* def W_OK */
{errno = EINVAL; return -1;}
#endif /* ndef W_OK */
if ((x & Mono_Posix_AccessMode_X_OK) == Mono_Posix_AccessMode_X_OK)
#ifdef X_OK
*r |= X_OK;
#else /* def X_OK */
{errno = EINVAL; return -1;}
#endif /* ndef X_OK */
if ((x & Mono_Posix_AccessMode_F_OK) == Mono_Posix_AccessMode_F_OK)
#ifdef F_OK
*r |= F_OK;
#else /* def F_OK */
{errno = EINVAL; return -1;}
#endif /* ndef F_OK */
return 0;
}
int Mono_Posix_ToAccessMode (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef R_OK
if ((x & R_OK) == R_OK)
*r |= Mono_Posix_AccessMode_R_OK;
#endif /* ndef R_OK */
#ifdef W_OK
if ((x & W_OK) == W_OK)
*r |= Mono_Posix_AccessMode_W_OK;
#endif /* ndef W_OK */
#ifdef X_OK
if ((x & X_OK) == X_OK)
*r |= Mono_Posix_AccessMode_X_OK;
#endif /* ndef X_OK */
#ifdef F_OK
if ((x & F_OK) == F_OK)
*r |= Mono_Posix_AccessMode_F_OK;
#endif /* ndef F_OK */
return 0;
}
int Mono_Posix_FromPathConf (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
if (x == Mono_Posix_PathConf__PC_LINK_MAX)
#ifdef _PC_LINK_MAX
{*r = _PC_LINK_MAX; return 0;}
#else /* def _PC_LINK_MAX */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_LINK_MAX */
if (x == Mono_Posix_PathConf__PC_MAX_CANON)
#ifdef _PC_MAX_CANON
{*r = _PC_MAX_CANON; return 0;}
#else /* def _PC_MAX_CANON */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_MAX_CANON */
if (x == Mono_Posix_PathConf__PC_MAX_INPUT)
#ifdef _PC_MAX_INPUT
{*r = _PC_MAX_INPUT; return 0;}
#else /* def _PC_MAX_INPUT */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_MAX_INPUT */
if (x == Mono_Posix_PathConf__PC_NAME_MAX)
#ifdef _PC_NAME_MAX
{*r = _PC_NAME_MAX; return 0;}
#else /* def _PC_NAME_MAX */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_NAME_MAX */
if (x == Mono_Posix_PathConf__PC_PATH_MAX)
#ifdef _PC_PATH_MAX
{*r = _PC_PATH_MAX; return 0;}
#else /* def _PC_PATH_MAX */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_PATH_MAX */
if (x == Mono_Posix_PathConf__PC_PIPE_BUF)
#ifdef _PC_PIPE_BUF
{*r = _PC_PIPE_BUF; return 0;}
#else /* def _PC_PIPE_BUF */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_PIPE_BUF */
if (x == Mono_Posix_PathConf__PC_CHOWN_RESTRICTED)
#ifdef _PC_CHOWN_RESTRICTED
{*r = _PC_CHOWN_RESTRICTED; return 0;}
#else /* def _PC_CHOWN_RESTRICTED */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_CHOWN_RESTRICTED */
if (x == Mono_Posix_PathConf__PC_NO_TRUNC)
#ifdef _PC_NO_TRUNC
{*r = _PC_NO_TRUNC; return 0;}
#else /* def _PC_NO_TRUNC */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_NO_TRUNC */
if (x == Mono_Posix_PathConf__PC_VDISABLE)
#ifdef _PC_VDISABLE
{*r = _PC_VDISABLE; return 0;}
#else /* def _PC_VDISABLE */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_VDISABLE */
if (x == Mono_Posix_PathConf__PC_SYNC_IO)
#ifdef _PC_SYNC_IO
{*r = _PC_SYNC_IO; return 0;}
#else /* def _PC_SYNC_IO */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_SYNC_IO */
if (x == Mono_Posix_PathConf__PC_ASYNC_IO)
#ifdef _PC_ASYNC_IO
{*r = _PC_ASYNC_IO; return 0;}
#else /* def _PC_ASYNC_IO */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_ASYNC_IO */
if (x == Mono_Posix_PathConf__PC_PRIO_IO)
#ifdef _PC_PRIO_IO
{*r = _PC_PRIO_IO; return 0;}
#else /* def _PC_PRIO_IO */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_PRIO_IO */
if (x == Mono_Posix_PathConf__PC_SOCK_MAXBUF)
#ifdef _PC_SOCK_MAXBUF
{*r = _PC_SOCK_MAXBUF; return 0;}
#else /* def _PC_SOCK_MAXBUF */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_SOCK_MAXBUF */
if (x == Mono_Posix_PathConf__PC_FILESIZEBITS)
#ifdef _PC_FILESIZEBITS
{*r = _PC_FILESIZEBITS; return 0;}
#else /* def _PC_FILESIZEBITS */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_FILESIZEBITS */
if (x == Mono_Posix_PathConf__PC_REC_INCR_XFER_SIZE)
#ifdef _PC_REC_INCR_XFER_SIZE
{*r = _PC_REC_INCR_XFER_SIZE; return 0;}
#else /* def _PC_REC_INCR_XFER_SIZE */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_REC_INCR_XFER_SIZE */
if (x == Mono_Posix_PathConf__PC_REC_MAX_XFER_SIZE)
#ifdef _PC_REC_MAX_XFER_SIZE
{*r = _PC_REC_MAX_XFER_SIZE; return 0;}
#else /* def _PC_REC_MAX_XFER_SIZE */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_REC_MAX_XFER_SIZE */
if (x == Mono_Posix_PathConf__PC_REC_MIN_XFER_SIZE)
#ifdef _PC_REC_MIN_XFER_SIZE
{*r = _PC_REC_MIN_XFER_SIZE; return 0;}
#else /* def _PC_REC_MIN_XFER_SIZE */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_REC_MIN_XFER_SIZE */
if (x == Mono_Posix_PathConf__PC_REC_XFER_ALIGN)
#ifdef _PC_REC_XFER_ALIGN
{*r = _PC_REC_XFER_ALIGN; return 0;}
#else /* def _PC_REC_XFER_ALIGN */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_REC_XFER_ALIGN */
if (x == Mono_Posix_PathConf__PC_ALLOC_SIZE_MIN)
#ifdef _PC_ALLOC_SIZE_MIN
{*r = _PC_ALLOC_SIZE_MIN; return 0;}
#else /* def _PC_ALLOC_SIZE_MIN */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_ALLOC_SIZE_MIN */
if (x == Mono_Posix_PathConf__PC_SYMLINK_MAX)
#ifdef _PC_SYMLINK_MAX
{*r = _PC_SYMLINK_MAX; return 0;}
#else /* def _PC_SYMLINK_MAX */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_SYMLINK_MAX */
if (x == Mono_Posix_PathConf__PC_2_SYMLINKS)
#ifdef _PC_2_SYMLINKS
{*r = _PC_2_SYMLINKS; return 0;}
#else /* def _PC_2_SYMLINKS */
{errno = EINVAL; return -1;}
#endif /* ndef _PC_2_SYMLINKS */
errno = EINVAL; return -1;
}
int Mono_Posix_ToPathConf (int x, int *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef _PC_LINK_MAX
if (x == _PC_LINK_MAX)
{*r = Mono_Posix_PathConf__PC_LINK_MAX; return 0;}
#endif /* ndef _PC_LINK_MAX */
#ifdef _PC_MAX_CANON
if (x == _PC_MAX_CANON)
{*r = Mono_Posix_PathConf__PC_MAX_CANON; return 0;}
#endif /* ndef _PC_MAX_CANON */
#ifdef _PC_MAX_INPUT
if (x == _PC_MAX_INPUT)
{*r = Mono_Posix_PathConf__PC_MAX_INPUT; return 0;}
#endif /* ndef _PC_MAX_INPUT */
#ifdef _PC_NAME_MAX
if (x == _PC_NAME_MAX)
{*r = Mono_Posix_PathConf__PC_NAME_MAX; return 0;}
#endif /* ndef _PC_NAME_MAX */
#ifdef _PC_PATH_MAX
if (x == _PC_PATH_MAX)
{*r = Mono_Posix_PathConf__PC_PATH_MAX; return 0;}
#endif /* ndef _PC_PATH_MAX */
#ifdef _PC_PIPE_BUF
if (x == _PC_PIPE_BUF)
{*r = Mono_Posix_PathConf__PC_PIPE_BUF; return 0;}
#endif /* ndef _PC_PIPE_BUF */
#ifdef _PC_CHOWN_RESTRICTED
if (x == _PC_CHOWN_RESTRICTED)
{*r = Mono_Posix_PathConf__PC_CHOWN_RESTRICTED; return 0;}
#endif /* ndef _PC_CHOWN_RESTRICTED */
#ifdef _PC_NO_TRUNC
if (x == _PC_NO_TRUNC)
{*r = Mono_Posix_PathConf__PC_NO_TRUNC; return 0;}
#endif /* ndef _PC_NO_TRUNC */
#ifdef _PC_VDISABLE
if (x == _PC_VDISABLE)