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