2004-08-24 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / support / map.c
1 /* This file was automatically generated by make-map from ../../mcs/class/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 #ifdef O_SYNC
33         if ((x & Mono_Posix_OpenFlags_O_SYNC) != 0)
34                 r |= O_SYNC;
35 #endif
36         return r;
37 }
38
39 int map_Mono_Posix_FileMode (int x)
40 {
41         int r = 0;
42         if ((x & Mono_Posix_FileMode_S_ISUID) != 0)
43                 r |= S_ISUID;
44         if ((x & Mono_Posix_FileMode_S_ISGID) != 0)
45                 r |= S_ISGID;
46         if ((x & Mono_Posix_FileMode_S_ISVTX) != 0)
47                 r |= S_ISVTX;
48         if ((x & Mono_Posix_FileMode_S_IRUSR) != 0)
49                 r |= S_IRUSR;
50         if ((x & Mono_Posix_FileMode_S_IWUSR) != 0)
51                 r |= S_IWUSR;
52         if ((x & Mono_Posix_FileMode_S_IXUSR) != 0)
53                 r |= S_IXUSR;
54         if ((x & Mono_Posix_FileMode_S_IRGRP) != 0)
55                 r |= S_IRGRP;
56         if ((x & Mono_Posix_FileMode_S_IWGRP) != 0)
57                 r |= S_IWGRP;
58         if ((x & Mono_Posix_FileMode_S_IXGRP) != 0)
59                 r |= S_IXGRP;
60         if ((x & Mono_Posix_FileMode_S_IROTH) != 0)
61                 r |= S_IROTH;
62         if ((x & Mono_Posix_FileMode_S_IWOTH) != 0)
63                 r |= S_IWOTH;
64         if ((x & Mono_Posix_FileMode_S_IXOTH) != 0)
65                 r |= S_IXOTH;
66         return r;
67 }
68
69 int map_Mono_Posix_WaitOptions (int x)
70 {
71         int r = 0;
72         if ((x & Mono_Posix_WaitOptions_WNOHANG) != 0)
73                 r |= WNOHANG;
74         if ((x & Mono_Posix_WaitOptions_WUNTRACED) != 0)
75                 r |= WUNTRACED;
76         return r;
77 }
78
79 int map_Mono_Posix_AccessMode (int x)
80 {
81         int r = 0;
82         if ((x & Mono_Posix_AccessMode_R_OK) != 0)
83                 r |= R_OK;
84         if ((x & Mono_Posix_AccessMode_W_OK) != 0)
85                 r |= W_OK;
86         if ((x & Mono_Posix_AccessMode_X_OK) != 0)
87                 r |= X_OK;
88         if ((x & Mono_Posix_AccessMode_F_OK) != 0)
89                 r |= F_OK;
90         return r;
91 }
92
93 int map_Mono_Posix_Signals (int x)
94 {
95         if (x == Mono_Posix_Signals_SIGHUP)
96                  return SIGHUP;
97         if (x == Mono_Posix_Signals_SIGINT)
98                  return SIGINT;
99         if (x == Mono_Posix_Signals_SIGQUIT)
100                  return SIGQUIT;
101         if (x == Mono_Posix_Signals_SIGILL)
102                  return SIGILL;
103         if (x == Mono_Posix_Signals_SIGTRAP)
104                  return SIGTRAP;
105         if (x == Mono_Posix_Signals_SIGABRT)
106                  return SIGABRT;
107         if (x == Mono_Posix_Signals_SIGBUS)
108                  return SIGBUS;
109         if (x == Mono_Posix_Signals_SIGFPE)
110                  return SIGFPE;
111         if (x == Mono_Posix_Signals_SIGKILL)
112                  return SIGKILL;
113         if (x == Mono_Posix_Signals_SIGUSR1)
114                  return SIGUSR1;
115         if (x == Mono_Posix_Signals_SIGSEGV)
116                  return SIGSEGV;
117         if (x == Mono_Posix_Signals_SIGUSR2)
118                  return SIGUSR2;
119         if (x == Mono_Posix_Signals_SIGPIPE)
120                  return SIGPIPE;
121         if (x == Mono_Posix_Signals_SIGALRM)
122                  return SIGALRM;
123         if (x == Mono_Posix_Signals_SIGTERM)
124                  return SIGTERM;
125         if (x == Mono_Posix_Signals_SIGCHLD)
126                  return SIGCHLD;
127         if (x == Mono_Posix_Signals_SIGCONT)
128                  return SIGCONT;
129         if (x == Mono_Posix_Signals_SIGSTOP)
130                  return SIGSTOP;
131         if (x == Mono_Posix_Signals_SIGTSTP)
132                  return SIGTSTP;
133         if (x == Mono_Posix_Signals_SIGTTIN)
134                  return SIGTTIN;
135         if (x == Mono_Posix_Signals_SIGTTOU)
136                  return SIGTTOU;
137         if (x == Mono_Posix_Signals_SIGURG)
138                  return SIGURG;
139         if (x == Mono_Posix_Signals_SIGXCPU)
140                  return SIGXCPU;
141         if (x == Mono_Posix_Signals_SIGXFSZ)
142                  return SIGXFSZ;
143         if (x == Mono_Posix_Signals_SIGVTALRM)
144                  return SIGVTALRM;
145         if (x == Mono_Posix_Signals_SIGPROF)
146                  return SIGPROF;
147         if (x == Mono_Posix_Signals_SIGWINCH)
148                  return SIGWINCH;
149         if (x == Mono_Posix_Signals_SIGIO)
150                  return SIGIO;
151         if (x == Mono_Posix_Signals_SIGSYS)
152                  return SIGSYS;
153         return -1;
154 }
155