Move the platform dependent code here; Temporary solution until I get time to redo...
[mono.git] / support / map.c
1 /* This file was automatically generated by make-map from ../lib/Mono.Posix.dll */
2
3 #define _GNU_SOURCE
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <sys/wait.h>
7 #include <unistd.h>
8 #include <fcntl.h>
9 #include <signal.h>
10 #include "map.h"
11 int map_Mono_Posix_OpenFlags (int x)
12 {
13         int r = 0;
14         if ((x & Mono_Posix_OpenFlags_O_RDONLY) != 0)
15                 r |= O_RDONLY;
16         if ((x & Mono_Posix_OpenFlags_O_WRONLY) != 0)
17                 r |= O_WRONLY;
18         if ((x & Mono_Posix_OpenFlags_O_RDWR) != 0)
19                 r |= O_RDWR;
20         if ((x & Mono_Posix_OpenFlags_O_CREAT) != 0)
21                 r |= O_CREAT;
22         if ((x & Mono_Posix_OpenFlags_O_EXCL) != 0)
23                 r |= O_EXCL;
24         if ((x & Mono_Posix_OpenFlags_O_NOCTTY) != 0)
25                 r |= O_NOCTTY;
26         if ((x & Mono_Posix_OpenFlags_O_TRUNC) != 0)
27                 r |= O_TRUNC;
28         if ((x & Mono_Posix_OpenFlags_O_APPEND) != 0)
29                 r |= O_APPEND;
30         if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) != 0)
31                 r |= O_NONBLOCK;
32         if ((x & Mono_Posix_OpenFlags_O_SYNC) != 0)
33                 r |= O_SYNC;
34         return r;
35 }
36
37 int map_Mono_Posix_FileMode (int x)
38 {
39         int r = 0;
40         if ((x & Mono_Posix_FileMode_S_ISUID) != 0)
41                 r |= S_ISUID;
42         if ((x & Mono_Posix_FileMode_S_ISGID) != 0)
43                 r |= S_ISGID;
44         if ((x & Mono_Posix_FileMode_S_ISVTX) != 0)
45                 r |= S_ISVTX;
46         if ((x & Mono_Posix_FileMode_S_IRUSR) != 0)
47                 r |= S_IRUSR;
48         if ((x & Mono_Posix_FileMode_S_IWUSR) != 0)
49                 r |= S_IWUSR;
50         if ((x & Mono_Posix_FileMode_S_IXUSR) != 0)
51                 r |= S_IXUSR;
52         if ((x & Mono_Posix_FileMode_S_IRGRP) != 0)
53                 r |= S_IRGRP;
54         if ((x & Mono_Posix_FileMode_S_IWGRP) != 0)
55                 r |= S_IWGRP;
56         if ((x & Mono_Posix_FileMode_S_IXGRP) != 0)
57                 r |= S_IXGRP;
58         if ((x & Mono_Posix_FileMode_S_IROTH) != 0)
59                 r |= S_IROTH;
60         if ((x & Mono_Posix_FileMode_S_IWOTH) != 0)
61                 r |= S_IWOTH;
62         if ((x & Mono_Posix_FileMode_S_IXOTH) != 0)
63                 r |= S_IXOTH;
64         return r;
65 }
66
67 int map_Mono_Posix_WaitOptions (int x)
68 {
69         int r = 0;
70         if ((x & Mono_Posix_WaitOptions_WNOHANG) != 0)
71                 r |= WNOHANG;
72         if ((x & Mono_Posix_WaitOptions_WUNTRACED) != 0)
73                 r |= WUNTRACED;
74         return r;
75 }
76
77 int map_Mono_Posix_AccessMode (int x)
78 {
79         int r = 0;
80         if ((x & Mono_Posix_AccessMode_R_OK) != 0)
81                 r |= R_OK;
82         if ((x & Mono_Posix_AccessMode_W_OK) != 0)
83                 r |= W_OK;
84         if ((x & Mono_Posix_AccessMode_X_OK) != 0)
85                 r |= X_OK;
86         if ((x & Mono_Posix_AccessMode_F_OK) != 0)
87                 r |= F_OK;
88         return r;
89 }
90
91 int map_Mono_Posix_Signals (int x)
92 {
93         if (x == Mono_Posix_Signals_SIGHUP)
94                  return SIGHUP;
95         if (x == Mono_Posix_Signals_SIGINT)
96                  return SIGINT;
97         if (x == Mono_Posix_Signals_SIGQUIT)
98                  return SIGQUIT;
99         if (x == Mono_Posix_Signals_SIGILL)
100                  return SIGILL;
101         if (x == Mono_Posix_Signals_SIGTRAP)
102                  return SIGTRAP;
103         if (x == Mono_Posix_Signals_SIGABRT)
104                  return SIGABRT;
105         if (x == Mono_Posix_Signals_SIGBUS)
106                  return SIGBUS;
107         if (x == Mono_Posix_Signals_SIGFPE)
108                  return SIGFPE;
109         if (x == Mono_Posix_Signals_SIGKILL)
110                  return SIGKILL;
111         if (x == Mono_Posix_Signals_SIGUSR1)
112                  return SIGUSR1;
113         if (x == Mono_Posix_Signals_SIGSEGV)
114                  return SIGSEGV;
115         if (x == Mono_Posix_Signals_SIGUSR2)
116                  return SIGUSR2;
117         if (x == Mono_Posix_Signals_SIGPIPE)
118                  return SIGPIPE;
119         if (x == Mono_Posix_Signals_SIGALRM)
120                  return SIGALRM;
121         if (x == Mono_Posix_Signals_SIGTERM)
122                  return SIGTERM;
123         if (x == Mono_Posix_Signals_SIGCHLD)
124                  return SIGCHLD;
125         if (x == Mono_Posix_Signals_SIGCONT)
126                  return SIGCONT;
127         if (x == Mono_Posix_Signals_SIGSTOP)
128                  return SIGSTOP;
129         if (x == Mono_Posix_Signals_SIGTSTP)
130                  return SIGTSTP;
131         if (x == Mono_Posix_Signals_SIGTTIN)
132                  return SIGTTIN;
133         if (x == Mono_Posix_Signals_SIGTTOU)
134                  return SIGTTOU;
135         if (x == Mono_Posix_Signals_SIGURG)
136                  return SIGURG;
137         if (x == Mono_Posix_Signals_SIGXCPU)
138                  return SIGXCPU;
139         if (x == Mono_Posix_Signals_SIGXFSZ)
140                  return SIGXFSZ;
141         if (x == Mono_Posix_Signals_SIGVTALRM)
142                  return SIGVTALRM;
143         if (x == Mono_Posix_Signals_SIGPROF)
144                  return SIGPROF;
145         if (x == Mono_Posix_Signals_SIGWINCH)
146                  return SIGWINCH;
147         if (x == Mono_Posix_Signals_SIGIO)
148                  return SIGIO;
149         if (x == Mono_Posix_Signals_SIGSYS)
150                  return SIGSYS;
151         return -1;
152 }
153