1 /* This file was automatically generated by make-map from Mono.Posix.dll */ 2 3 #ifndef _GNU_SOURCE 4 #define _GNU_SOURCE 5 #endif 6 7 #include <sys/types.h> 8 #include <sys/stat.h> 9 #include <sys/wait.h> 10 #include <unistd.h> 11 #include <fcntl.h> 12 #include <signal.h> 13 #include <poll.h> 14 #include "mph.h" 15 #include "old-map.h" 16 17 int map_Mono_Posix_AccessMode (int mode); 18 int map_Mono_Posix_FileMode (int mode); 19 int map_Mono_Posix_OpenFlags (int flags); 20 int map_Mono_Posix_PollEvents (int x); 21 int map_Mono_Posix_Signals (int x); 22 int map_Mono_Posix_WaitOptions (int wait_options); 23 map_Mono_Posix_OpenFlags(int x)24int map_Mono_Posix_OpenFlags (int x) 25 { 26 int r = 0; 27 if ((x & Mono_Posix_OpenFlags_O_RDONLY) != 0) 28 r |= O_RDONLY; 29 if ((x & Mono_Posix_OpenFlags_O_WRONLY) != 0) 30 r |= O_WRONLY; 31 if ((x & Mono_Posix_OpenFlags_O_RDWR) != 0) 32 r |= O_RDWR; 33 if ((x & Mono_Posix_OpenFlags_O_CREAT) != 0) 34 r |= O_CREAT; 35 if ((x & Mono_Posix_OpenFlags_O_EXCL) != 0) 36 r |= O_EXCL; 37 if ((x & Mono_Posix_OpenFlags_O_NOCTTY) != 0) 38 r |= O_NOCTTY; 39 if ((x & Mono_Posix_OpenFlags_O_TRUNC) != 0) 40 r |= O_TRUNC; 41 if ((x & Mono_Posix_OpenFlags_O_APPEND) != 0) 42 r |= O_APPEND; 43 if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) != 0) 44 r |= O_NONBLOCK; 45 #ifdef O_SYNC 46 if ((x & Mono_Posix_OpenFlags_O_SYNC) != 0) 47 r |= O_SYNC; 48 #endif 49 return r; 50 } 51 map_Mono_Posix_FileMode(int x)52int map_Mono_Posix_FileMode (int x) 53 { 54 int r = 0; 55 if ((x & Mono_Posix_FileMode_S_ISUID) != 0) 56 r |= S_ISUID; 57 if ((x & Mono_Posix_FileMode_S_ISGID) != 0) 58 r |= S_ISGID; 59 if ((x & Mono_Posix_FileMode_S_ISVTX) != 0) 60 r |= S_ISVTX; 61 if ((x & Mono_Posix_FileMode_S_IRUSR) != 0) 62 r |= S_IRUSR; 63 if ((x & Mono_Posix_FileMode_S_IWUSR) != 0) 64 r |= S_IWUSR; 65 if ((x & Mono_Posix_FileMode_S_IXUSR) != 0) 66 r |= S_IXUSR; 67 if ((x & Mono_Posix_FileMode_S_IRGRP) != 0) 68 r |= S_IRGRP; 69 if ((x & Mono_Posix_FileMode_S_IWGRP) != 0) 70 r |= S_IWGRP; 71 if ((x & Mono_Posix_FileMode_S_IXGRP) != 0) 72 r |= S_IXGRP; 73 if ((x & Mono_Posix_FileMode_S_IROTH) != 0) 74 r |= S_IROTH; 75 if ((x & Mono_Posix_FileMode_S_IWOTH) != 0) 76 r |= S_IWOTH; 77 if ((x & Mono_Posix_FileMode_S_IXOTH) != 0) 78 r |= S_IXOTH; 79 return r; 80 } 81 map_Mono_Posix_WaitOptions(int x)82int map_Mono_Posix_WaitOptions (int x) 83 { 84 int r = 0; 85 if ((x & Mono_Posix_WaitOptions_WNOHANG) != 0) 86 r |= WNOHANG; 87 if ((x & Mono_Posix_WaitOptions_WUNTRACED) != 0) 88 r |= WUNTRACED; 89 return r; 90 } 91 map_Mono_Posix_AccessMode(int x)92int map_Mono_Posix_AccessMode (int x) 93 { 94 int r = 0; 95 if ((x & Mono_Posix_AccessMode_R_OK) != 0) 96 r |= R_OK; 97 if ((x & Mono_Posix_AccessMode_W_OK) != 0) 98 r |= W_OK; 99 if ((x & Mono_Posix_AccessMode_X_OK) != 0) 100 r |= X_OK; 101 if ((x & Mono_Posix_AccessMode_F_OK) != 0) 102 r |= F_OK; 103 return r; 104 } 105 map_Mono_Posix_Signals(int x)106int map_Mono_Posix_Signals (int x) 107 { 108 if (x == Mono_Posix_Signals_SIGHUP) 109 return SIGHUP; 110 if (x == Mono_Posix_Signals_SIGINT) 111 return SIGINT; 112 if (x == Mono_Posix_Signals_SIGQUIT) 113 return SIGQUIT; 114 if (x == Mono_Posix_Signals_SIGILL) 115 return SIGILL; 116 if (x == Mono_Posix_Signals_SIGTRAP) 117 return SIGTRAP; 118 if (x == Mono_Posix_Signals_SIGABRT) 119 return SIGABRT; 120 if (x == Mono_Posix_Signals_SIGBUS) 121 return SIGBUS; 122 if (x == Mono_Posix_Signals_SIGFPE) 123 return SIGFPE; 124 if (x == Mono_Posix_Signals_SIGKILL) 125 return SIGKILL; 126 if (x == Mono_Posix_Signals_SIGUSR1) 127 return SIGUSR1; 128 if (x == Mono_Posix_Signals_SIGSEGV) 129 return SIGSEGV; 130 if (x == Mono_Posix_Signals_SIGUSR2) 131 return SIGUSR2; 132 if (x == Mono_Posix_Signals_SIGPIPE) 133 return SIGPIPE; 134 if (x == Mono_Posix_Signals_SIGALRM) 135 return SIGALRM; 136 if (x == Mono_Posix_Signals_SIGTERM) 137 return SIGTERM; 138 if (x == Mono_Posix_Signals_SIGCHLD) 139 return SIGCHLD; 140 if (x == Mono_Posix_Signals_SIGCONT) 141 return SIGCONT; 142 if (x == Mono_Posix_Signals_SIGSTOP) 143 return SIGSTOP; 144 if (x == Mono_Posix_Signals_SIGTSTP) 145 return SIGTSTP; 146 if (x == Mono_Posix_Signals_SIGTTIN) 147 return SIGTTIN; 148 if (x == Mono_Posix_Signals_SIGTTOU) 149 return SIGTTOU; 150 if (x == Mono_Posix_Signals_SIGURG) 151 return SIGURG; 152 if (x == Mono_Posix_Signals_SIGXCPU) 153 return SIGXCPU; 154 if (x == Mono_Posix_Signals_SIGXFSZ) 155 return SIGXFSZ; 156 if (x == Mono_Posix_Signals_SIGVTALRM) 157 return SIGVTALRM; 158 #ifdef SIGPROF 159 if (x == Mono_Posix_Signals_SIGPROF) 160 return SIGPROF; 161 #endif 162 if (x == Mono_Posix_Signals_SIGWINCH) 163 return SIGWINCH; 164 #ifdef SIGIO 165 if (x == Mono_Posix_Signals_SIGIO) 166 return SIGIO; 167 #endif 168 if (x == Mono_Posix_Signals_SIGSYS) 169 return SIGSYS; 170 return -1; 171 } 172 map_Mono_Posix_PollEvents(int x)173int map_Mono_Posix_PollEvents (int x) 174 { 175 int r = 0; 176 if ((x & Mono_Posix_PollEvents_POLLIN) != 0) 177 r |= POLLIN; 178 if ((x & Mono_Posix_PollEvents_POLLPRI) != 0) 179 r |= POLLPRI; 180 if ((x & Mono_Posix_PollEvents_POLLOUT) != 0) 181 r |= POLLOUT; 182 if ((x & Mono_Posix_PollEvents_POLLERR) != 0) 183 r |= POLLERR; 184 if ((x & Mono_Posix_PollEvents_POLLHUP) != 0) 185 r |= POLLHUP; 186 if ((x & Mono_Posix_PollEvents_POLLNVAL) != 0) 187 r |= POLLNVAL; 188 return r; 189 } 190 191