|
| 1 | +def StructEpollEvent : NamedType<"struct epoll_event">; |
| 2 | +def StructEpollEventPtr : PtrType<StructEpollEvent>; |
| 3 | + |
| 4 | +def StructEpollData : NamedType<"struct epoll_data">; |
| 5 | + |
| 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 | + >; |
| 65 | + |
| 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 | + >; |
| 81 | + |
| 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 | + FunctionSpec< |
| 116 | + "process_mrelease", |
| 117 | + RetValSpec<IntType>, |
| 118 | + [ |
| 119 | + ArgSpec<IntType>, |
| 120 | + ArgSpec<UnsignedIntType> |
| 121 | + ] |
| 122 | + >, |
| 123 | + FunctionSpec< |
| 124 | + "mremap", |
| 125 | + RetValSpec<VoidPtr>, |
| 126 | + [ |
| 127 | + ArgSpec<VoidPtr>, |
| 128 | + ArgSpec<SizeTType>, |
| 129 | + ArgSpec<SizeTType>, |
| 130 | + ArgSpec<IntType>, |
| 131 | + ArgSpec<VarArgType>, |
| 132 | + ] |
| 133 | + >, |
| 134 | + ] // Functions |
| 135 | + >; |
| 136 | + |
| 137 | + |
| 138 | + HeaderSpec SysPrctl = HeaderSpec< |
| 139 | + "sys/prctl.h", |
| 140 | + [], // Macros |
| 141 | + [], // Types |
| 142 | + [], // Enumerations |
| 143 | + [ |
| 144 | + FunctionSpec< |
| 145 | + "prctl", |
| 146 | + RetValSpec<IntType>, |
| 147 | + [ |
| 148 | + ArgSpec<IntType>, |
| 149 | + ArgSpec<UnsignedLongType>, |
| 150 | + ArgSpec<UnsignedLongType>, |
| 151 | + ArgSpec<UnsignedLongType>, |
| 152 | + ArgSpec<UnsignedLongType>, |
| 153 | + ] |
| 154 | + >, |
| 155 | + ] // Functions |
| 156 | + >; |
| 157 | + |
| 158 | + HeaderSpec SysRandom = HeaderSpec< |
| 159 | + "sys/random.h", |
| 160 | + [ |
| 161 | + Macro<"GRND_RANDOM">, |
| 162 | + Macro<"GRND_NONBLOCK">, |
| 163 | + Macro<"GRND_INSECURE">, |
| 164 | + ], |
| 165 | + [SizeTType, SSizeTType], // Types |
| 166 | + [], // Enumerations |
| 167 | + [ |
| 168 | + FunctionSpec< |
| 169 | + "getrandom", |
| 170 | + RetValSpec<SSizeTType>, |
| 171 | + [ |
| 172 | + ArgSpec<VoidPtr>, |
| 173 | + ArgSpec<SizeTType>, |
| 174 | + ArgSpec<UnsignedIntType> |
| 175 | + ] |
| 176 | + >, |
| 177 | + ] |
| 178 | + >; |
| 179 | + |
| 180 | + HeaderSpec SysTime = HeaderSpec< |
| 181 | + "sys/time.h", |
| 182 | + [ |
| 183 | + Macro<"timeradd">, |
| 184 | + Macro<"timersub">, |
| 185 | + Macro<"timerclear">, |
| 186 | + Macro<"timerisset">, |
| 187 | + Macro<"timercmp">, |
| 188 | + ], |
| 189 | + [StructTimevalType], // Types |
| 190 | + [], // Enumerations |
| 191 | + [] // Functions |
| 192 | + >; |
| 193 | + |
| 194 | + |
| 195 | + HeaderSpec SysEpoll = HeaderSpec< |
| 196 | + "sys/epoll.h", |
| 197 | + [], // Macros |
| 198 | + [ |
| 199 | + StructEpollEvent, |
| 200 | + StructEpollData, |
| 201 | + SigSetType, |
| 202 | + StructTimeSpec, |
| 203 | + ], // Types |
| 204 | + [], // Enumerations |
| 205 | + [ |
| 206 | + FunctionSpec< |
| 207 | + "epoll_create", |
| 208 | + RetValSpec<IntType>, |
| 209 | + [ |
| 210 | + ArgSpec<IntType> |
| 211 | + ] |
| 212 | + >, |
| 213 | + FunctionSpec< |
| 214 | + "epoll_create1", |
| 215 | + RetValSpec<IntType>, |
| 216 | + [ |
| 217 | + ArgSpec<IntType> |
| 218 | + ] |
| 219 | + >, |
| 220 | + FunctionSpec< |
| 221 | + "epoll_ctl", |
| 222 | + RetValSpec<IntType>, |
| 223 | + [ |
| 224 | + ArgSpec<IntType>, |
| 225 | + ArgSpec<IntType>, |
| 226 | + ArgSpec<IntType>, |
| 227 | + ArgSpec<StructEpollEventPtr> |
| 228 | + ] |
| 229 | + >, |
| 230 | + FunctionSpec< |
| 231 | + "epoll_wait", |
| 232 | + RetValSpec<IntType>, |
| 233 | + [ |
| 234 | + ArgSpec<IntType>, |
| 235 | + ArgSpec<StructEpollEventPtr>, |
| 236 | + ArgSpec<IntType>, |
| 237 | + ArgSpec<IntType> |
| 238 | + ] |
| 239 | + >, |
| 240 | + FunctionSpec< |
| 241 | + "epoll_pwait", |
| 242 | + RetValSpec<IntType>, |
| 243 | + [ |
| 244 | + ArgSpec<IntType>, |
| 245 | + ArgSpec<StructEpollEventPtr>, |
| 246 | + ArgSpec<IntType>, |
| 247 | + ArgSpec<IntType>, |
| 248 | + ArgSpec<ConstSigSetPtrType> |
| 249 | + ] |
| 250 | + >, |
| 251 | + FunctionSpec< |
| 252 | + "epoll_pwait2", |
| 253 | + RetValSpec<IntType>, |
| 254 | + [ |
| 255 | + ArgSpec<IntType>, |
| 256 | + ArgSpec<StructEpollEventPtr>, |
| 257 | + ArgSpec<IntType>, |
| 258 | + ArgSpec<ConstStructTimeSpecPtr>, |
| 259 | + ArgSpec<ConstSigSetPtrType> |
| 260 | + ] |
| 261 | + >, |
| 262 | + ] // Functions |
| 263 | + >; |
| 264 | + |
| 265 | + HeaderSpec Signal = HeaderSpec< |
| 266 | + "signal.h", |
| 267 | + [ |
| 268 | + Macro<"NSIG">, |
| 269 | + |
| 270 | + Macro<"SIGHUP">, |
| 271 | + Macro<"SIGINT">, |
| 272 | + Macro<"SIGQUIT">, |
| 273 | + Macro<"SIGILL">, |
| 274 | + Macro<"SIGTRAP">, |
| 275 | + Macro<"SIGABRT">, |
| 276 | + Macro<"SIGIOT">, |
| 277 | + Macro<"SIGBUS">, |
| 278 | + Macro<"SIGFPE">, |
| 279 | + Macro<"SIGKILL">, |
| 280 | + Macro<"SIGUSR1">, |
| 281 | + Macro<"SIGSEGV">, |
| 282 | + Macro<"SIGUSR2">, |
| 283 | + Macro<"SIGPIPE">, |
| 284 | + Macro<"SIGALRM">, |
| 285 | + Macro<"SIGTERM">, |
| 286 | + Macro<"SIGSTKFLT">, |
| 287 | + Macro<"SIGCHLD">, |
| 288 | + Macro<"SIGCONT">, |
| 289 | + Macro<"SIGSTOP">, |
| 290 | + Macro<"SIGTSTP">, |
| 291 | + Macro<"SIGTTIN">, |
| 292 | + Macro<"SIGTTOU">, |
| 293 | + Macro<"SIGURG">, |
| 294 | + Macro<"SIGXCPU">, |
| 295 | + Macro<"SIGXFSZ">, |
| 296 | + Macro<"SIGVTALRM">, |
| 297 | + Macro<"SIGPROF">, |
| 298 | + Macro<"SIGWINCH">, |
| 299 | + Macro<"SIGIO">, |
| 300 | + Macro<"SIGPOLL">, |
| 301 | + Macro<"SIGPWR">, |
| 302 | + Macro<"SIGSYS">, |
| 303 | + Macro<"SIGUNUSED">, |
| 304 | + ] |
| 305 | + >; |
| 306 | + |
| 307 | + |
| 308 | + HeaderSpec UniStd = HeaderSpec< |
| 309 | + "unistd.h", |
| 310 | + [], // Macros |
| 311 | + [], |
| 312 | + [], // Enumerations |
| 313 | + [ |
| 314 | + FunctionSpec< |
| 315 | + "pipe2", |
| 316 | + RetValSpec<IntType>, |
| 317 | + [ArgSpec<IntPtr>, ArgSpec<IntType>] //TODO: make this int[2] |
| 318 | + >, |
| 319 | + ], |
| 320 | + [] |
| 321 | + >; |
| 322 | + |
| 323 | + |
| 324 | + let Headers = [ |
| 325 | + Errno, |
| 326 | + SysEpoll, |
| 327 | + SysMMan, |
| 328 | + SysPrctl, |
| 329 | + SysRandom, |
| 330 | + SysTime, |
| 331 | + Signal, |
| 332 | + UniStd, |
| 333 | + ]; |
| 334 | +} |
0 commit comments