diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-10-22 20:48:39 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-10-22 20:48:39 +0400 |
commit | 231527ee6286af554c59396037c8504a6564395e (patch) | |
tree | d191da0e06c1e3698a875877305304a3a28cc0f7 /support | |
parent | b50141c93a330ab924f0412e0ca0822907b85999 (diff) |
Update mappings after latest changes to Mono.Posix
New mappings created for the epoll code.
Diffstat (limited to 'support')
-rw-r--r-- | support/map.c | 182 | ||||
-rw-r--r-- | support/map.h | 40 |
2 files changed, 222 insertions, 0 deletions
diff --git a/support/map.c b/support/map.c index 0fc5255640b..cb653bcda9a 100644 --- a/support/map.c +++ b/support/map.c @@ -834,6 +834,188 @@ int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r) return 0; } +int Mono_Posix_FromEpollEvents (unsigned int x, unsigned int *r) +{ + *r = 0; + if ((x & Mono_Posix_EpollEvents_EPOLLERR) == Mono_Posix_EpollEvents_EPOLLERR) +#ifdef EPOLLERR + *r |= EPOLLERR; +#else /* def EPOLLERR */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLERR */ + if ((x & Mono_Posix_EpollEvents_EPOLLET) == Mono_Posix_EpollEvents_EPOLLET) +#ifdef EPOLLET + *r |= EPOLLET; +#else /* def EPOLLET */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLET */ + if ((x & Mono_Posix_EpollEvents_EPOLLHUP) == Mono_Posix_EpollEvents_EPOLLHUP) +#ifdef EPOLLHUP + *r |= EPOLLHUP; +#else /* def EPOLLHUP */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLHUP */ + if ((x & Mono_Posix_EpollEvents_EPOLLIN) == Mono_Posix_EpollEvents_EPOLLIN) +#ifdef EPOLLIN + *r |= EPOLLIN; +#else /* def EPOLLIN */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLIN */ + if ((x & Mono_Posix_EpollEvents_EPOLLMSG) == Mono_Posix_EpollEvents_EPOLLMSG) +#ifdef EPOLLMSG + *r |= EPOLLMSG; +#else /* def EPOLLMSG */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLMSG */ + if ((x & Mono_Posix_EpollEvents_EPOLLONESHOT) == Mono_Posix_EpollEvents_EPOLLONESHOT) +#ifdef EPOLLONESHOT + *r |= EPOLLONESHOT; +#else /* def EPOLLONESHOT */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLONESHOT */ + if ((x & Mono_Posix_EpollEvents_EPOLLOUT) == Mono_Posix_EpollEvents_EPOLLOUT) +#ifdef EPOLLOUT + *r |= EPOLLOUT; +#else /* def EPOLLOUT */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLOUT */ + if ((x & Mono_Posix_EpollEvents_EPOLLPRI) == Mono_Posix_EpollEvents_EPOLLPRI) +#ifdef EPOLLPRI + *r |= EPOLLPRI; +#else /* def EPOLLPRI */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLPRI */ + if ((x & Mono_Posix_EpollEvents_EPOLLRDBAND) == Mono_Posix_EpollEvents_EPOLLRDBAND) +#ifdef EPOLLRDBAND + *r |= EPOLLRDBAND; +#else /* def EPOLLRDBAND */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLRDBAND */ + if ((x & Mono_Posix_EpollEvents_EPOLLRDHUP) == Mono_Posix_EpollEvents_EPOLLRDHUP) +#ifdef EPOLLRDHUP + *r |= EPOLLRDHUP; +#else /* def EPOLLRDHUP */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLRDHUP */ + if ((x & Mono_Posix_EpollEvents_EPOLLRDNORM) == Mono_Posix_EpollEvents_EPOLLRDNORM) +#ifdef EPOLLRDNORM + *r |= EPOLLRDNORM; +#else /* def EPOLLRDNORM */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLRDNORM */ + if ((x & Mono_Posix_EpollEvents_EPOLLWRBAND) == Mono_Posix_EpollEvents_EPOLLWRBAND) +#ifdef EPOLLWRBAND + *r |= EPOLLWRBAND; +#else /* def EPOLLWRBAND */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLWRBAND */ + if ((x & Mono_Posix_EpollEvents_EPOLLWRNORM) == Mono_Posix_EpollEvents_EPOLLWRNORM) +#ifdef EPOLLWRNORM + *r |= EPOLLWRNORM; +#else /* def EPOLLWRNORM */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLLWRNORM */ + if (x == 0) + return 0; + return 0; +} + +int Mono_Posix_ToEpollEvents (unsigned int x, unsigned int *r) +{ + *r = 0; + if (x == 0) + return 0; +#ifdef EPOLLERR + if ((x & EPOLLERR) == EPOLLERR) + *r |= Mono_Posix_EpollEvents_EPOLLERR; +#endif /* ndef EPOLLERR */ +#ifdef EPOLLET + if ((x & EPOLLET) == EPOLLET) + *r |= Mono_Posix_EpollEvents_EPOLLET; +#endif /* ndef EPOLLET */ +#ifdef EPOLLHUP + if ((x & EPOLLHUP) == EPOLLHUP) + *r |= Mono_Posix_EpollEvents_EPOLLHUP; +#endif /* ndef EPOLLHUP */ +#ifdef EPOLLIN + if ((x & EPOLLIN) == EPOLLIN) + *r |= Mono_Posix_EpollEvents_EPOLLIN; +#endif /* ndef EPOLLIN */ +#ifdef EPOLLMSG + if ((x & EPOLLMSG) == EPOLLMSG) + *r |= Mono_Posix_EpollEvents_EPOLLMSG; +#endif /* ndef EPOLLMSG */ +#ifdef EPOLLONESHOT + if ((x & EPOLLONESHOT) == EPOLLONESHOT) + *r |= Mono_Posix_EpollEvents_EPOLLONESHOT; +#endif /* ndef EPOLLONESHOT */ +#ifdef EPOLLOUT + if ((x & EPOLLOUT) == EPOLLOUT) + *r |= Mono_Posix_EpollEvents_EPOLLOUT; +#endif /* ndef EPOLLOUT */ +#ifdef EPOLLPRI + if ((x & EPOLLPRI) == EPOLLPRI) + *r |= Mono_Posix_EpollEvents_EPOLLPRI; +#endif /* ndef EPOLLPRI */ +#ifdef EPOLLRDBAND + if ((x & EPOLLRDBAND) == EPOLLRDBAND) + *r |= Mono_Posix_EpollEvents_EPOLLRDBAND; +#endif /* ndef EPOLLRDBAND */ +#ifdef EPOLLRDHUP + if ((x & EPOLLRDHUP) == EPOLLRDHUP) + *r |= Mono_Posix_EpollEvents_EPOLLRDHUP; +#endif /* ndef EPOLLRDHUP */ +#ifdef EPOLLRDNORM + if ((x & EPOLLRDNORM) == EPOLLRDNORM) + *r |= Mono_Posix_EpollEvents_EPOLLRDNORM; +#endif /* ndef EPOLLRDNORM */ +#ifdef EPOLLWRBAND + if ((x & EPOLLWRBAND) == EPOLLWRBAND) + *r |= Mono_Posix_EpollEvents_EPOLLWRBAND; +#endif /* ndef EPOLLWRBAND */ +#ifdef EPOLLWRNORM + if ((x & EPOLLWRNORM) == EPOLLWRNORM) + *r |= Mono_Posix_EpollEvents_EPOLLWRNORM; +#endif /* ndef EPOLLWRNORM */ + return 0; +} + +int Mono_Posix_FromEpollFlags (int x, int *r) +{ + *r = 0; + if ((x & Mono_Posix_EpollFlags_EPOLL_CLOEXEC) == Mono_Posix_EpollFlags_EPOLL_CLOEXEC) +#ifdef EPOLL_CLOEXEC + *r |= EPOLL_CLOEXEC; +#else /* def EPOLL_CLOEXEC */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLL_CLOEXEC */ + if ((x & Mono_Posix_EpollFlags_EPOLL_NONBLOCK) == Mono_Posix_EpollFlags_EPOLL_NONBLOCK) +#ifdef EPOLL_NONBLOCK + *r |= EPOLL_NONBLOCK; +#else /* def EPOLL_NONBLOCK */ + {errno = EINVAL; return -1;} +#endif /* ndef EPOLL_NONBLOCK */ + if (x == 0) + return 0; + return 0; +} + +int Mono_Posix_ToEpollFlags (int x, int *r) +{ + *r = 0; + if (x == 0) + return 0; +#ifdef EPOLL_CLOEXEC + if ((x & EPOLL_CLOEXEC) == EPOLL_CLOEXEC) + *r |= Mono_Posix_EpollFlags_EPOLL_CLOEXEC; +#endif /* ndef EPOLL_CLOEXEC */ +#ifdef EPOLL_NONBLOCK + if ((x & EPOLL_NONBLOCK) == EPOLL_NONBLOCK) + *r |= Mono_Posix_EpollFlags_EPOLL_NONBLOCK; +#endif /* ndef EPOLL_NONBLOCK */ + return 0; +} + int Mono_Posix_FromErrno (int x, int *r) { *r = 0; diff --git a/support/map.h b/support/map.h index a2e59fd9309..aab06b7b9cd 100644 --- a/support/map.h +++ b/support/map.h @@ -147,6 +147,46 @@ enum Mono_Posix_DirectoryNotifyFlags { int Mono_Posix_FromDirectoryNotifyFlags (int x, int *r); int Mono_Posix_ToDirectoryNotifyFlags (int x, int *r); +enum Mono_Posix_EpollEvents { + Mono_Posix_EpollEvents_EPOLLERR = 0x00000008, + #define Mono_Posix_EpollEvents_EPOLLERR Mono_Posix_EpollEvents_EPOLLERR + Mono_Posix_EpollEvents_EPOLLET = 0x80000000, + #define Mono_Posix_EpollEvents_EPOLLET Mono_Posix_EpollEvents_EPOLLET + Mono_Posix_EpollEvents_EPOLLHUP = 0x00000010, + #define Mono_Posix_EpollEvents_EPOLLHUP Mono_Posix_EpollEvents_EPOLLHUP + Mono_Posix_EpollEvents_EPOLLIN = 0x00000001, + #define Mono_Posix_EpollEvents_EPOLLIN Mono_Posix_EpollEvents_EPOLLIN + Mono_Posix_EpollEvents_EPOLLMSG = 0x00000400, + #define Mono_Posix_EpollEvents_EPOLLMSG Mono_Posix_EpollEvents_EPOLLMSG + Mono_Posix_EpollEvents_EPOLLONESHOT = 0x40000000, + #define Mono_Posix_EpollEvents_EPOLLONESHOT Mono_Posix_EpollEvents_EPOLLONESHOT + Mono_Posix_EpollEvents_EPOLLOUT = 0x00000004, + #define Mono_Posix_EpollEvents_EPOLLOUT Mono_Posix_EpollEvents_EPOLLOUT + Mono_Posix_EpollEvents_EPOLLPRI = 0x00000002, + #define Mono_Posix_EpollEvents_EPOLLPRI Mono_Posix_EpollEvents_EPOLLPRI + Mono_Posix_EpollEvents_EPOLLRDBAND = 0x00000080, + #define Mono_Posix_EpollEvents_EPOLLRDBAND Mono_Posix_EpollEvents_EPOLLRDBAND + Mono_Posix_EpollEvents_EPOLLRDHUP = 0x00002000, + #define Mono_Posix_EpollEvents_EPOLLRDHUP Mono_Posix_EpollEvents_EPOLLRDHUP + Mono_Posix_EpollEvents_EPOLLRDNORM = 0x00000040, + #define Mono_Posix_EpollEvents_EPOLLRDNORM Mono_Posix_EpollEvents_EPOLLRDNORM + Mono_Posix_EpollEvents_EPOLLWRBAND = 0x00000200, + #define Mono_Posix_EpollEvents_EPOLLWRBAND Mono_Posix_EpollEvents_EPOLLWRBAND + Mono_Posix_EpollEvents_EPOLLWRNORM = 0x00000100, + #define Mono_Posix_EpollEvents_EPOLLWRNORM Mono_Posix_EpollEvents_EPOLLWRNORM +}; +int Mono_Posix_FromEpollEvents (unsigned int x, unsigned int *r); +int Mono_Posix_ToEpollEvents (unsigned int x, unsigned int *r); + +enum Mono_Posix_EpollFlags { + Mono_Posix_EpollFlags_EPOLL_CLOEXEC = 0x001e8480, + #define Mono_Posix_EpollFlags_EPOLL_CLOEXEC Mono_Posix_EpollFlags_EPOLL_CLOEXEC + Mono_Posix_EpollFlags_EPOLL_NONBLOCK = 0x00000fa0, + #define Mono_Posix_EpollFlags_EPOLL_NONBLOCK Mono_Posix_EpollFlags_EPOLL_NONBLOCK +}; +int Mono_Posix_FromEpollFlags (int x, int *r); +int Mono_Posix_ToEpollFlags (int x, int *r); + enum Mono_Posix_Errno { Mono_Posix_Errno_E2BIG = 0x00000007, #define Mono_Posix_Errno_E2BIG Mono_Posix_Errno_E2BIG |