Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / libc / spec / linux.td
blob9b5dc8e30c95e4e8f807c78d28b8a268c1a06e04
1 def StructEpollEvent : NamedType<"struct epoll_event">;
2 def StructEpollEventPtr : PtrType<StructEpollEvent>;
4 def StructEpollData : NamedType<"struct epoll_data">;
6 def Linux : StandardSpec<"Linux"> {
7   HeaderSpec Errno = HeaderSpec<
8       "errno.h",
9       [
10         Macro<"ENOMEDIUM">,
11         Macro<"ENOTBLK">,
12         Macro<"EMEDIUMTYPE">,
13         Macro<"EBADSLT">,
14         Macro<"ECHRNG">,
15         Macro<"ERFKILL">,
16         Macro<"EUSERS">,
17         Macro<"EBADR">,
18         Macro<"EL3HLT">,
19         Macro<"ENOTUNIQ">,
20         Macro<"EXFULL">,
21         Macro<"EHOSTDOWN">,
22         Macro<"EL3RST">,
23         Macro<"ENOPKG">,
24         Macro<"ENOCSI">,
25         Macro<"EUNATCH">,
26         Macro<"EREMCHG">,
27         Macro<"ETOOMANYREFS">,
28         Macro<"EL2HLT">,
29         Macro<"EBADFD">,
30         Macro<"EREMOTEIO">,
31         Macro<"ENAVAIL">,
32         Macro<"ELIBEXEC">,
33         Macro<"ESHUTDOWN">,
34         Macro<"ENOKEY">,
35         Macro<"ESTRPIPE">,
36         Macro<"EKEYREJECTED">,
37         Macro<"ESRMNT">,
38         Macro<"EKEYREVOKED">,
39         Macro<"EBADE">,
40         Macro<"ELIBBAD">,
41         Macro<"EISNAM">,
42         Macro<"EBFONT">,
43         Macro<"EPFNOSUPPORT">,
44         Macro<"EREMOTE">,
45         Macro<"EDEADLOCK">,
46         Macro<"ENONET">,
47         Macro<"EDOTDOT">,
48         Macro<"EKEYEXPIRED">,
49         Macro<"ELIBSCN">,
50         Macro<"ERESTART">,
51         Macro<"EBADRQC">,
52         Macro<"EUCLEAN">,
53         Macro<"ENOANO">,
54         Macro<"ELIBACC">,
55         Macro<"EHWPOISON">,
56         Macro<"ELIBMAX">,
57         Macro<"ESOCKTNOSUPPORT">,
58         Macro<"ENOTNAM">,
59         Macro<"ELNRNG">,
60         Macro<"EL2NSYNC">,
61         Macro<"EADV">,
62         Macro<"ECOMM">,
63       ]
64   >;
66   HeaderSpec Sched = HeaderSpec<
67       "sched.h",
68       [
69         Macro<"SCHED_OTHER">,
70         Macro<"SCHED_FIFO">,
71         Macro<"SCHED_RR">,
72         Macro<"SCHED_BATCH">,
73         Macro<"SCHED_ISO">,
74         Macro<"SCHED_IDLE">,
75         Macro<"SCHED_DEADLINE">,
76       ],
77       [], // Types
78       [], // Enumerations
79       []  // Functions
80   >;
82   HeaderSpec SysMMan = HeaderSpec<
83       "sys/mman.h",
84       [Macro<"MAP_ANONYMOUS">],
85       [], // Types
86       [], // Enumerations
87       [
88         FunctionSpec<
89             "mincore",
90             RetValSpec<IntType>,
91             [
92               ArgSpec<VoidPtr>,
93               ArgSpec<SizeTType>,
94               ArgSpec<UnsignedCharPtr>,
95             ]
96         >,
97         FunctionSpec<
98           "mlock2",
99           RetValSpec<IntType>,
100           [
101             ArgSpec<VoidPtr>,
102             ArgSpec<SizeTType>,
103             ArgSpec<UnsignedIntType>,
104           ]
105         >,
106         FunctionSpec<
107           "remap_file_pages",
108           RetValSpec<IntType>,
109           [
110             ArgSpec<VoidPtr>,
111             ArgSpec<SizeTType>,
112             ArgSpec<IntType>,
113             ArgSpec<SizeTType>,
114             ArgSpec<IntType>,
115           ]
116         >,
117         FunctionSpec<
118           "mremap",
119           RetValSpec<VoidPtr>,
120           [
121             ArgSpec<VoidPtr>,
122             ArgSpec<SizeTType>,
123             ArgSpec<SizeTType>,
124             ArgSpec<IntType>,
125             ArgSpec<VarArgType>,
126           ]
127         >,
128       ]  // Functions
129   >;
132   HeaderSpec SysPrctl = HeaderSpec<
133       "sys/prctl.h",
134       [], // Macros
135       [], // Types
136       [], // Enumerations
137       [
138         FunctionSpec<
139           "prctl",
140           RetValSpec<IntType>,
141           [
142             ArgSpec<IntType>,
143             ArgSpec<UnsignedLongType>,
144             ArgSpec<UnsignedLongType>,
145             ArgSpec<UnsignedLongType>,
146             ArgSpec<UnsignedLongType>,
147           ]
148         >,
149       ]  // Functions
150   >;
152   HeaderSpec SysRandom = HeaderSpec<
153       "sys/random.h",
154       [
155         Macro<"GRND_RANDOM">,
156         Macro<"GRND_NONBLOCK">,
157         Macro<"GRND_INSECURE">,
158       ],
159       [SizeTType, SSizeTType], // Types
160       [], // Enumerations
161       [
162         FunctionSpec<
163           "getrandom",
164           RetValSpec<SSizeTType>,
165           [
166             ArgSpec<VoidPtr>,
167             ArgSpec<SizeTType>,
168             ArgSpec<UnsignedIntType>
169           ]
170         >,
171       ]
172   >;
174   HeaderSpec SysTime = HeaderSpec<
175       "sys/time.h",
176       [
177         Macro<"timeradd">,
178         Macro<"timersub">,
179         Macro<"timerclear">,
180         Macro<"timerisset">,
181         Macro<"timercmp">,
182       ],
183       [StructTimevalType], // Types
184       [], // Enumerations
185       []  // Functions
186   >;
189   HeaderSpec SysEpoll = HeaderSpec<
190       "sys/epoll.h",
191       [], // Macros
192       [
193         StructEpollEvent,
194         StructEpollData,
195         SigSetType,
196         StructTimeSpec,
197       ], // Types
198       [], // Enumerations
199       [
200         FunctionSpec<
201           "epoll_create",
202           RetValSpec<IntType>,
203           [
204             ArgSpec<IntType>
205           ]
206         >,
207         FunctionSpec<
208           "epoll_create1",
209           RetValSpec<IntType>,
210           [
211             ArgSpec<IntType>
212           ]
213         >,
214         FunctionSpec<
215           "epoll_ctl",
216           RetValSpec<IntType>,
217           [
218             ArgSpec<IntType>,
219             ArgSpec<IntType>,
220             ArgSpec<IntType>,
221             ArgSpec<StructEpollEventPtr>
222           ]
223         >,
224         FunctionSpec<
225           "epoll_wait",
226           RetValSpec<IntType>,
227           [
228             ArgSpec<IntType>,
229             ArgSpec<StructEpollEventPtr>,
230             ArgSpec<IntType>,
231             ArgSpec<IntType>
232           ]
233         >,
234         FunctionSpec<
235           "epoll_pwait",
236           RetValSpec<IntType>,
237           [
238             ArgSpec<IntType>,
239             ArgSpec<StructEpollEventPtr>,
240             ArgSpec<IntType>,
241             ArgSpec<IntType>,
242             ArgSpec<ConstSigSetPtrType>
243           ]
244         >,
245         FunctionSpec<
246           "epoll_pwait2",
247           RetValSpec<IntType>,
248           [
249             ArgSpec<IntType>,
250             ArgSpec<StructEpollEventPtr>,
251             ArgSpec<IntType>,
252             ArgSpec<ConstStructTimeSpecPtr>,
253             ArgSpec<ConstSigSetPtrType>
254           ]
255         >,
256       ]  // Functions
257   >;
259   HeaderSpec Signal = HeaderSpec<
260       "signal.h",
261       [
262         Macro<"NSIG">,
264         Macro<"SIGHUP">,
265         Macro<"SIGINT">,
266         Macro<"SIGQUIT">,
267         Macro<"SIGILL">,
268         Macro<"SIGTRAP">,
269         Macro<"SIGABRT">,
270         Macro<"SIGIOT">,
271         Macro<"SIGBUS">,
272         Macro<"SIGFPE">,
273         Macro<"SIGKILL">,
274         Macro<"SIGUSR1">,
275         Macro<"SIGSEGV">,
276         Macro<"SIGUSR2">,
277         Macro<"SIGPIPE">,
278         Macro<"SIGALRM">,
279         Macro<"SIGTERM">,
280         Macro<"SIGSTKFLT">,
281         Macro<"SIGCHLD">,
282         Macro<"SIGCONT">,
283         Macro<"SIGSTOP">,
284         Macro<"SIGTSTP">,
285         Macro<"SIGTTIN">,
286         Macro<"SIGTTOU">,
287         Macro<"SIGURG">,
288         Macro<"SIGXCPU">,
289         Macro<"SIGXFSZ">,
290         Macro<"SIGVTALRM">,
291         Macro<"SIGPROF">,
292         Macro<"SIGWINCH">,
293         Macro<"SIGIO">,
294         Macro<"SIGPOLL">,
295         Macro<"SIGPWR">,
296         Macro<"SIGSYS">,
297         Macro<"SIGUNUSED">,
298       ]
299   >;
302   HeaderSpec UniStd = HeaderSpec<
303     "unistd.h",
304     [], // Macros
305     [],
306     [], // Enumerations
307     [
308         FunctionSpec<
309           "pipe2",
310           RetValSpec<IntType>,
311           [ArgSpec<IntPtr>, ArgSpec<IntType>] //TODO: make this int[2]
312         >,
313     ],
314     []
315   >;
316   
318   let Headers = [
319     Errno,
320     SysEpoll,
321     SysMMan,
322     SysPrctl,
323     SysRandom,
324     SysTime,
325     Signal,
326     UniStd,
327   ];