| 1 |
// SPDX-License-Identifier: MPL-2.0 |
| 2 |
// (c) Hare authors <https://harelang.org> |
| 3 |
|
| 4 |
export type off_t = i64; |
| 5 |
export type dev_t = u64; |
| 6 |
export type ino_t = u64; |
| 7 |
export type nlink_t = u64; |
| 8 |
export type mode_t = uint; |
| 9 |
export type id_t = uint; |
| 10 |
export type uid_t = uint; |
| 11 |
export type gid_t = uint; |
| 12 |
export type time_t = i64; |
| 13 |
export type suseconds_t = i64; |
| 14 |
export type nfds_t = u64; |
| 15 |
export type pid_t = int; |
| 16 |
export type timer_t = *opaque; |
| 17 |
export type clock_t = i64; |
| 18 |
export type si_band_t = i64; |
| 19 |
export type rlim_t = u64; |
| 20 |
|
| 21 |
export def NGROUPS_MAX: size = 32; |
| 22 |
export def NSIG: int = 64; |
| 23 |
|
| 24 |
export type sigset = struct { |
| 25 |
__val: [1]u64, |
| 26 |
}; |
| 27 |
|
| 28 |
export type timeval = struct { |
| 29 |
tv_sec: time_t, |
| 30 |
tv_usec: suseconds_t, |
| 31 |
}; |
| 32 |
|
| 33 |
export type timespec = struct { |
| 34 |
tv_sec: time_t, |
| 35 |
tv_nsec: i64, |
| 36 |
}; |
| 37 |
|
| 38 |
export def UTIME_OMIT = 0x3ffffffe; |
| 39 |
|
| 40 |
export type itimerspec = struct { |
| 41 |
it_interval: timespec, |
| 42 |
it_value: timespec, |
| 43 |
}; |
| 44 |
|
| 45 |
export def AT_FDCWD: int = -100; |
| 46 |
export def AT_SYMLINK_NOFOLLOW: int = 0x100; |
| 47 |
export def AT_REMOVEDIR: int = 0x200; |
| 48 |
export def AT_SYMLINK_FOLLOW: int = 0x400; |
| 49 |
export def AT_EACCESS: int = 0x200; |
| 50 |
export def AT_NO_AUTOMOUNT: int = 0x800; |
| 51 |
export def AT_EMPTY_PATH: int = 0x1000; |
| 52 |
export def AT_STATX_SYNC_TYPE: int = 0x6000; |
| 53 |
export def AT_STATX_SYNC_AS_STAT: int = 0x0000; |
| 54 |
export def AT_STATX_FORCE_SYNC: int = 0x2000; |
| 55 |
export def AT_STATX_DONT_SYNC: int = 0x4000; |
| 56 |
export def AT_RECURSIVE: int = 0x8000; |
| 57 |
|
| 58 |
export def S_IFDIR: mode_t = 0o040000; |
| 59 |
export def S_IFCHR: mode_t = 0o020000; |
| 60 |
export def S_IFBLK: mode_t = 0o060000; |
| 61 |
export def S_IFREG: mode_t = 0o100000; |
| 62 |
export def S_IFIFO: mode_t = 0o010000; |
| 63 |
export def S_IFLNK: mode_t = 0o120000; |
| 64 |
export def S_IFSOCK: mode_t = 0o140000; |
| 65 |
|
| 66 |
// O_DIRECTORY is arch specific |
| 67 |
export def O_RDONLY: int = 0o0; |
| 68 |
export def O_WRONLY: int = 0o1; |
| 69 |
export def O_RDWR: int = 0o2; |
| 70 |
export def O_ACCMODE: int = 0o3; |
| 71 |
export def O_CREATE: int = 0o100; |
| 72 |
export def O_EXCLUSIVE: int = 0o200; |
| 73 |
export def O_NOCTTY: int = 0o400; |
| 74 |
export def O_TRUNC: int = 0o1000; |
| 75 |
export def O_APPEND: int = 0o2000; |
| 76 |
export def O_NONBLOCK: int = 0o4000; |
| 77 |
export def O_DSYNC: int = 0o10000; |
| 78 |
export def O_SYNC: int = 0o4010000; |
| 79 |
export def O_RSYNC: int = 0o4010000; |
| 80 |
export def O_NOFOLLOW: int = 0o400000; |
| 81 |
export def O_NOATIME: int = 0o1000000; |
| 82 |
export def O_CLOEXEC: int = 0o2000000; |
| 83 |
export def O_PATH: int = 0o10000000; |
| 84 |
export def O_TMPFILE: int = 0o20000000; |
| 85 |
|
| 86 |
type statx_timestamp = struct { |
| 87 |
tv_sec: i64, |
| 88 |
tv_nsec: u32, |
| 89 |
}; |
| 90 |
|
| 91 |
type stx = struct { |
| 92 |
mask: u32, |
| 93 |
blksize: u32, |
| 94 |
attributes: u64, |
| 95 |
nlink: u32, |
| 96 |
uid: u32, |
| 97 |
gid: u32, |
| 98 |
mode: u16, |
| 99 |
ino: u64, |
| 100 |
sz: u64, |
| 101 |
blocks: u64, |
| 102 |
attr_mask: u64, |
| 103 |
atime: statx_timestamp, |
| 104 |
btime: statx_timestamp, |
| 105 |
ctime: statx_timestamp, |
| 106 |
mtime: statx_timestamp, |
| 107 |
rdev_major: u32, |
| 108 |
rdev_minor: u32, |
| 109 |
dev_major: u32, |
| 110 |
dev_minor: u32, |
| 111 |
_: [14]u64, // reserved |
| 112 |
}; |
| 113 |
|
| 114 |
// Note: the st type does not match the kernel API. The kernel API has a stat |
| 115 |
// buffer which varies from arch to arch, but because we always use statx(2) and |
| 116 |
// copy the data from the stx type, we don't have to deal with that nonsense. |
| 117 |
export type st = struct { |
| 118 |
dev: dev_t, |
| 119 |
ino: ino_t, |
| 120 |
mode: mode_t, |
| 121 |
nlink: nlink_t, |
| 122 |
uid: uid_t, |
| 123 |
gid: gid_t, |
| 124 |
rdev: dev_t, |
| 125 |
sz: u64, |
| 126 |
blksz: u64, |
| 127 |
blocks: u64, |
| 128 |
atime: timespec, |
| 129 |
mtime: timespec, |
| 130 |
ctime: timespec, |
| 131 |
}; |
| 132 |
|
| 133 |
def STATX_TYPE: uint = 0x00000001; |
| 134 |
def STATX_MODE: uint = 0x00000002; |
| 135 |
def STATX_NLINK: uint = 0x00000004; |
| 136 |
def STATX_UID: uint = 0x00000008; |
| 137 |
def STATX_GID: uint = 0x00000010; |
| 138 |
def STATX_ATIME: uint = 0x00000020; |
| 139 |
def STATX_MTIME: uint = 0x00000040; |
| 140 |
def STATX_CTIME: uint = 0x00000080; |
| 141 |
def STATX_INO: uint = 0x00000100; |
| 142 |
def STATX_SIZE: uint = 0x00000200; |
| 143 |
def STATX_BLOCKS: uint = 0x00000400; |
| 144 |
def STATX_BASIC_STATS: uint = 0x000007FF; |
| 145 |
def STATX_BTIME: uint = 0x00000800; |
| 146 |
def STATX_MNT_ID: uint = 0x00001000; |
| 147 |
|
| 148 |
export def SIGHUP: int = 1; |
| 149 |
export def SIGINT: int = 2; |
| 150 |
export def SIGQUIT: int = 3; |
| 151 |
export def SIGILL: int = 4; |
| 152 |
export def SIGTRAP: int = 5; |
| 153 |
export def SIGABRT: int = 6; |
| 154 |
export def SIGBUS: int = 7; |
| 155 |
export def SIGFPE: int = 8; |
| 156 |
export def SIGKILL: int = 9; |
| 157 |
export def SIGUSR1: int = 10; |
| 158 |
export def SIGSEGV: int = 11; |
| 159 |
export def SIGUSR2: int = 12; |
| 160 |
export def SIGPIPE: int = 13; |
| 161 |
export def SIGALRM: int = 14; |
| 162 |
export def SIGTERM: int = 15; |
| 163 |
export def SIGSTKFLT: int = 16; |
| 164 |
export def SIGCHLD: int = 17; |
| 165 |
export def SIGCONT: int = 18; |
| 166 |
export def SIGSTOP: int = 19; |
| 167 |
export def SIGTSTP: int = 20; |
| 168 |
export def SIGTTIN: int = 21; |
| 169 |
export def SIGTTOU: int = 22; |
| 170 |
export def SIGURG: int = 23; |
| 171 |
export def SIGXCPU: int = 24; |
| 172 |
export def SIGXFSZ: int = 25; |
| 173 |
export def SIGVTALRM: int = 26; |
| 174 |
export def SIGPROF: int = 27; |
| 175 |
export def SIGWINCH: int = 28; |
| 176 |
export def SIGIO: int = 29; |
| 177 |
export def SIGPOLL: int = 29; |
| 178 |
export def SIGPWR: int = 30; |
| 179 |
export def SIGSYS: int = 31; |
| 180 |
|
| 181 |
export def MAP_SHARED: uint = 0x01; |
| 182 |
export def MAP_PRIVATE: uint = 0x02; |
| 183 |
export def MAP_SHARED_VALIDATE: uint = 0x03; |
| 184 |
export def MAP_FIXED: uint = 0x10; |
| 185 |
export def MAP_ANON: uint = 0x20; |
| 186 |
export def MAP_NORESERVE: uint = 0x4000; |
| 187 |
export def MAP_GROWSDOWN: uint = 0x0100; |
| 188 |
export def MAP_DENYWRITE: uint = 0x0800; |
| 189 |
export def MAP_EXECUTABLE: uint = 0x1000; |
| 190 |
export def MAP_LOCKED: uint = 0x2000; |
| 191 |
export def MAP_POPULATE: uint = 0x8000; |
| 192 |
export def MAP_NONBLOCK: uint = 0x10000; |
| 193 |
export def MAP_STACK: uint = 0x20000; |
| 194 |
export def MAP_HUGETLB: uint = 0x40000; |
| 195 |
export def MAP_SYNC: uint = 0x80000; |
| 196 |
export def MAP_FIXED_NOREPLACE: uint = 0x100000; |
| 197 |
export def MAP_FILE: uint = 0; |
| 198 |
export def MAP_HUGE_SHIFT: uint = 26; |
| 199 |
export def MAP_HUGE_MASK: uint = 0x3F; |
| 200 |
export def MAP_HUGE_64KB: uint = 16 << 26; |
| 201 |
export def MAP_HUGE_512KB: uint = 19 << 26; |
| 202 |
export def MAP_HUGE_1MB: uint = 20 << 26; |
| 203 |
export def MAP_HUGE_2MB: uint = 21 << 26; |
| 204 |
export def MAP_HUGE_8MB: uint = 23 << 26; |
| 205 |
export def MAP_HUGE_16MB: uint = 24 << 26; |
| 206 |
export def MAP_HUGE_32MB: uint = 25 << 26; |
| 207 |
export def MAP_HUGE_256MB: uint = 28 << 26; |
| 208 |
export def MAP_HUGE_512MB: uint = 29 << 26; |
| 209 |
export def MAP_HUGE_1GB: uint = 30 << 26; |
| 210 |
export def MAP_HUGE_2GB: uint = 31 << 26; |
| 211 |
export def MAP_HUGE_16GB: uint = 34 << 26; |
| 212 |
|
| 213 |
export def PROT_NONE: uint = 0; |
| 214 |
export def PROT_READ: uint = 1; |
| 215 |
export def PROT_WRITE: uint = 2; |
| 216 |
export def PROT_EXEC: uint = 4; |
| 217 |
export def PROT_GROWSDOWN: uint = 0x01000000; |
| 218 |
export def PROT_GROWSUP: uint = 0x02000000; |
| 219 |
|
| 220 |
export def F_OK: int = 0; |
| 221 |
export def R_OK: int = 4; |
| 222 |
export def W_OK: int = 2; |
| 223 |
export def X_OK: int = 1; |
| 224 |
|
| 225 |
export def F_DUPFD: int = 0; |
| 226 |
export def F_DUPFD_CLOEXEC: int = 1030; |
| 227 |
export def F_GETFD: int = 1; |
| 228 |
export def F_SETFD: int = 2; |
| 229 |
export def F_GETFL: int = 3; |
| 230 |
export def F_SETFL: int = 4; |
| 231 |
export def F_SETOWN: int = 8; |
| 232 |
export def F_GETOWN: int = 9; |
| 233 |
export def F_SETSIG: int = 10; |
| 234 |
export def F_GETSIG: int = 11; |
| 235 |
export def F_GETLK: int = 12; |
| 236 |
export def F_SETLK: int = 13; |
| 237 |
export def F_SETLKW: int = 14; |
| 238 |
export def F_SETOWN_EX: int = 15; |
| 239 |
export def F_GETOWN_EX: int = 16; |
| 240 |
export def F_GETOWNER_UIDS: int = 17; |
| 241 |
|
| 242 |
export def F_RDLCK: i16 = 0; |
| 243 |
export def F_WRLCK: i16 = 1; |
| 244 |
export def F_UNLCK: i16 = 2; |
| 245 |
|
| 246 |
export def FD_CLOEXEC: int = 1; |
| 247 |
|
| 248 |
export type st_flock = struct { |
| 249 |
l_type: i16, |
| 250 |
l_whence: i16, |
| 251 |
l_start: i64, |
| 252 |
l_len: i64, |
| 253 |
l_pid: pid_t, |
| 254 |
}; |
| 255 |
|
| 256 |
export type f_owner_ex = struct { |
| 257 |
_type: int, |
| 258 |
pid: pid_t, |
| 259 |
}; |
| 260 |
|
| 261 |
export def CLOCK_REALTIME: int = 0; |
| 262 |
export def CLOCK_MONOTONIC: int = 1; |
| 263 |
export def CLOCK_PROCESS_CPUTIME_ID: int = 2; |
| 264 |
export def CLOCK_THREAD_CPUTIME_ID: int = 3; |
| 265 |
export def CLOCK_MONOTONIC_RAW: int = 4; |
| 266 |
export def CLOCK_REALTIME_COARSE: int = 5; |
| 267 |
export def CLOCK_MONOTONIC_COARSE: int = 6; |
| 268 |
export def CLOCK_BOOTTIME: int = 7; |
| 269 |
export def CLOCK_REALTIME_ALARM: int = 8; |
| 270 |
export def CLOCK_BOOTTIME_ALARM: int = 9; |
| 271 |
export def CLOCK_SGI_CYCLE: int = 10; |
| 272 |
export def CLOCK_TAI: int = 11; |
| 273 |
|
| 274 |
export def TIMER_ABSTIME: int = 1; |
| 275 |
|
| 276 |
export type open_how = struct { |
| 277 |
flags: u64, |
| 278 |
mode: u64, |
| 279 |
resolve: u64, |
| 280 |
}; |
| 281 |
|
| 282 |
export def RESOLVE_NO_XDEV: u64 = 0x01; |
| 283 |
export def RESOLVE_NO_MAGICLINKS: u64 = 0x02; |
| 284 |
export def RESOLVE_NO_SYMLINKS: u64 = 0x04; |
| 285 |
export def RESOLVE_BENEATH: u64 = 0x08; |
| 286 |
export def RESOLVE_IN_ROOT: u64 = 0x10; |
| 287 |
|
| 288 |
export def DT_UNKNOWN: u8 = 0; |
| 289 |
export def DT_FIFO: u8 = 1; |
| 290 |
export def DT_CHR: u8 = 2; |
| 291 |
export def DT_DIR: u8 = 4; |
| 292 |
export def DT_BLK: u8 = 6; |
| 293 |
export def DT_REG: u8 = 8; |
| 294 |
export def DT_LNK: u8 = 10; |
| 295 |
export def DT_SOCK: u8 = 12; |
| 296 |
|
| 297 |
export type dirent64 = struct { |
| 298 |
d_ino: ino_t, |
| 299 |
d_off: off_t, |
| 300 |
d_reclen: u16, |
| 301 |
d_type: u8, |
| 302 |
d_name: [*]u8, |
| 303 |
}; |
| 304 |
|
| 305 |
export def WNOHANG: int = 1; |
| 306 |
export def WUNTRACED: int = 2; |
| 307 |
export def WSTOPPED: int = 2; |
| 308 |
export def WEXITED: int = 4; |
| 309 |
export def WCONTINUED: int = 8; |
| 310 |
export def WNOWAIT: int = 0x1000000; |
| 311 |
|
| 312 |
export fn wexitstatus(s: int) int = (s & 0xff00) >> 8; |
| 313 |
export fn wtermsig(s: int) int = s & 0x7f; |
| 314 |
export fn wstopsig(s: int) int = wexitstatus(s); |
| 315 |
export fn wcoredump(s: int) int = s & 0x80; |
| 316 |
export fn wifexited(s: int) bool = wtermsig(s) <= 0; |
| 317 |
export fn wifstopped(s: int) bool = (((s & 0xFFFF) * 0x10001) >> 8) > 0x7f00; |
| 318 |
export fn wifsignaled(s: int) bool = (s & 0xFFFF) - 1 < 0xFF; |
| 319 |
export fn wifcontinued(s: int) bool = s == 0xFFFF; |
| 320 |
|
| 321 |
export type rusage = struct { |
| 322 |
ru_utime: timeval, |
| 323 |
ru_stime: timeval, |
| 324 |
ru_maxrss: u64, |
| 325 |
ru_ixrss: u64, |
| 326 |
ru_idrss: u64, |
| 327 |
ru_isrss: u64, |
| 328 |
ru_minflt: u64, |
| 329 |
ru_majflt: u64, |
| 330 |
ru_nswap: u64, |
| 331 |
ru_inblock: u64, |
| 332 |
ru_oublock: u64, |
| 333 |
ru_msgsnd: u64, |
| 334 |
ru_msgrcv: u64, |
| 335 |
ru_nsignals: u64, |
| 336 |
ru_nvcsw: u64, |
| 337 |
ru_nivcsw: u64, |
| 338 |
_: [16]u64, // reserved |
| 339 |
}; |
| 340 |
|
| 341 |
export type utsname = struct { |
| 342 |
sysname: [65]u8, |
| 343 |
nodename: [65]u8, |
| 344 |
release: [65]u8, |
| 345 |
version: [65]u8, |
| 346 |
machine: [65]u8, |
| 347 |
domainname: [65]u8, |
| 348 |
}; |
| 349 |
|
| 350 |
export def POLLIN: i16 = 0x001; |
| 351 |
export def POLLPRI: i16 = 0x002; |
| 352 |
export def POLLOUT: i16 = 0x004; |
| 353 |
export def POLLERR: i16 = 0x008; |
| 354 |
export def POLLHUP: i16 = 0x010; |
| 355 |
export def POLLNVAL: i16 = 0x020; |
| 356 |
|
| 357 |
export type pollfd = struct { |
| 358 |
fd: int, |
| 359 |
events: i16, |
| 360 |
revents: i16, |
| 361 |
}; |
| 362 |
|
| 363 |
export def EPOLL_CLOEXEC: int = O_CLOEXEC; |
| 364 |
|
| 365 |
// Valid opcodes to issue to sys_epoll_ctl() |
| 366 |
export def EPOLL_CTL_ADD: int = 1; |
| 367 |
export def EPOLL_CTL_DEL: int = 2; |
| 368 |
export def EPOLL_CTL_MOD: int = 3; |
| 369 |
|
| 370 |
// Epoll event masks |
| 371 |
export def EPOLLIN: u32 = 0x00000001; |
| 372 |
export def EPOLLPRI: u32 = 0x00000002; |
| 373 |
export def EPOLLOUT: u32 = 0x00000004; |
| 374 |
export def EPOLLERR: u32 = 0x00000008; |
| 375 |
export def EPOLLHUP: u32 = 0x00000010; |
| 376 |
export def EPOLLNVAL: u32 = 0x00000020; |
| 377 |
export def EPOLLRDNORM: u32 = 0x00000040; |
| 378 |
export def EPOLLRDBAND: u32 = 0x00000080; |
| 379 |
export def EPOLLWRNORM: u32 = 0x00000100; |
| 380 |
export def EPOLLWRBAND: u32 = 0x00000200; |
| 381 |
export def EPOLLMSG: u32 = 0x00000400; |
| 382 |
export def EPOLLRDHUP: u32 = 0x00002000; |
| 383 |
export def EPOLLWAKEUP: u32 = 1 << 29; |
| 384 |
export def EPOLLONESHOT: u32 = 1 << 30; |
| 385 |
export def EPOLLET: u32 = 1 << 31; |
| 386 |
|
| 387 |
export type epoll_data = union { |
| 388 |
ptr: *opaque, |
| 389 |
fd: int, |
| 390 |
u32_: u32, |
| 391 |
u64_: u64, |
| 392 |
}; |
| 393 |
|
| 394 |
export def EFD_CLOEXEC: int = O_CLOEXEC; |
| 395 |
export def EFD_NONBLOCK: int = O_NONBLOCK; |
| 396 |
export def EFD_SEMAPHORE: int = 1; |
| 397 |
|
| 398 |
export def TFD_CLOEXEC: int = O_CLOEXEC; |
| 399 |
export def TFD_NONBLOCK: int = O_NONBLOCK; |
| 400 |
export def TFD_TIMER_ABSTIME: int = 1; |
| 401 |
export def TFD_TIMER_CANCEL_ON_SET: int = 2; |
| 402 |
|
| 403 |
export def PIDFD_NONBLOCK: uint = O_NONBLOCK: uint; |
| 404 |
|
| 405 |
export def CLONE_NEWTIME = 0x00000080; |
| 406 |
export def CLONE_VM = 0x00000100; |
| 407 |
export def CLONE_FS = 0x00000200; |
| 408 |
export def CLONE_FILES = 0x00000400; |
| 409 |
export def CLONE_SIGHAND = 0x00000800; |
| 410 |
export def CLONE_PIDFD = 0x00001000; |
| 411 |
export def CLONE_PTRACE = 0x00002000; |
| 412 |
export def CLONE_VFORK = 0x00004000; |
| 413 |
export def CLONE_PARENT = 0x00008000; |
| 414 |
export def CLONE_THREAD = 0x00010000; |
| 415 |
export def CLONE_NEWNS = 0x00020000; |
| 416 |
export def CLONE_SYSVSEM = 0x00040000; |
| 417 |
export def CLONE_SETTLS = 0x00080000; |
| 418 |
export def CLONE_PARENT_SETTID = 0x00100000; |
| 419 |
export def CLONE_CHILD_CLEARTID = 0x00200000; |
| 420 |
export def CLONE_DETACHED = 0x00400000; |
| 421 |
export def CLONE_UNTRACED = 0x00800000; |
| 422 |
export def CLONE_CHILD_SETTID = 0x01000000; |
| 423 |
export def CLONE_NEWCGROUP = 0x02000000; |
| 424 |
export def CLONE_NEWUTS = 0x04000000; |
| 425 |
export def CLONE_NEWIPC = 0x08000000; |
| 426 |
export def CLONE_NEWUSER = 0x10000000; |
| 427 |
export def CLONE_NEWPID = 0x20000000; |
| 428 |
export def CLONE_NEWNET = 0x40000000; |
| 429 |
export def CLONE_IO = 0x80000000; |
| 430 |
|
| 431 |
export type clone_args = struct { |
| 432 |
flags: u64, |
| 433 |
pidfd: u64, |
| 434 |
child_tid: u64, |
| 435 |
parent_tid: u64, |
| 436 |
exit_signal: u64, |
| 437 |
stack: u64, |
| 438 |
stack_size: u64, |
| 439 |
tls: u64, |
| 440 |
set_tid: u64, |
| 441 |
set_tid_size: u64, |
| 442 |
cgroup: u64, |
| 443 |
}; |
| 444 |
|
| 445 |
export type idtype = enum { |
| 446 |
P_ALL = 0, |
| 447 |
P_PID = 1, |
| 448 |
P_PGID = 2, |
| 449 |
P_PIDFD = 3, |
| 450 |
}; |
| 451 |
|
| 452 |
export def SIG_BLOCK: int = 0; |
| 453 |
export def SIG_UNBLOCK: int = 1; |
| 454 |
export def SIG_SETMASK: int = 2; |
| 455 |
|
| 456 |
def SI_MAX_SIZE: size = 128; |
| 457 |
|
| 458 |
export type sigval = union { |
| 459 |
sival_int: int, |
| 460 |
sival_ptr: *opaque, |
| 461 |
}; |
| 462 |
|
| 463 |
export type siginfo = union { |
| 464 |
struct { |
| 465 |
si_signo: int, |
| 466 |
si_errno: int, |
| 467 |
si_code: int, |
| 468 |
|
| 469 |
union { |
| 470 |
// kill() |
| 471 |
struct { |
| 472 |
si_pid: pid_t, |
| 473 |
si_uid: u32, |
| 474 |
}, |
| 475 |
|
| 476 |
// POSIX.1b timers |
| 477 |
struct { |
| 478 |
si_tid: timer_t, |
| 479 |
si_overrun: int, |
| 480 |
_sigval: sigval, // @ signals |
| 481 |
si_sys_private: int, |
| 482 |
}, |
| 483 |
|
| 484 |
// POSIX.1b signals |
| 485 |
struct { |
| 486 |
_sig_pid: pid_t, // @kill |
| 487 |
_sig_uid: u32, // @ kill |
| 488 |
union { |
| 489 |
si_value: sigval, |
| 490 |
si_int: int, |
| 491 |
si_ptr: *opaque, |
| 492 |
} |
| 493 |
}, |
| 494 |
|
| 495 |
// SIGCHLD |
| 496 |
struct { |
| 497 |
_chld_pid: pid_t, // @ kill |
| 498 |
_chld_uid: u32, // @ kill |
| 499 |
si_status: int, |
| 500 |
si_utime: clock_t, |
| 501 |
si_stime: clock_t, |
| 502 |
}, |
| 503 |
|
| 504 |
// SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT |
| 505 |
struct { |
| 506 |
si_addr: *opaque, |
| 507 |
|
| 508 |
union { |
| 509 |
// used when si_code=BUS_MCEERR_AR or |
| 510 |
// used when si_code=BUS_MCEERR_AO |
| 511 |
si_addr_lsb: i16, |
| 512 |
|
| 513 |
struct { |
| 514 |
_dummy_bnd: [__ADDR_BND_PKEY_PAD]u8, |
| 515 |
si_lower: *opaque, |
| 516 |
si_upper: *opaque, |
| 517 |
}, |
| 518 |
|
| 519 |
struct { |
| 520 |
_dummy_pkey: [__ADDR_BND_PKEY_PAD]u8, |
| 521 |
si_pkey: u32, |
| 522 |
}, |
| 523 |
}, |
| 524 |
}, |
| 525 |
|
| 526 |
// SIGPOLL |
| 527 |
struct { |
| 528 |
si_band: si_band_t, |
| 529 |
si_fd: int, |
| 530 |
}, |
| 531 |
|
| 532 |
// SIGSYS |
| 533 |
struct { |
| 534 |
si_call_addr: *opaque, |
| 535 |
si_syscall: int, |
| 536 |
si_arch: uint, |
| 537 |
}, |
| 538 |
}, |
| 539 |
}, |
| 540 |
_: [SI_MAX_SIZE]u8, |
| 541 |
}; |
| 542 |
static assert(size(siginfo) == SI_MAX_SIZE); |
| 543 |
|
| 544 |
export def SA_NOCLDSTOP: u64 = 0x00000001; |
| 545 |
export def SA_NOCLDWAIT: u64 = 0x00000002; |
| 546 |
export def SA_SIGINFO: u64 = 0x00000004; |
| 547 |
export def SA_ONSTACK: u64 = 0x08000000; |
| 548 |
export def SA_RESTART: u64 = 0x10000000; |
| 549 |
export def SA_NODEFER: u64 = 0x40000000; |
| 550 |
export def SA_RESETHAND: u64 = 0x80000000; |
| 551 |
export def SA_NOMASK: u64 = SA_NODEFER; |
| 552 |
export def SA_ONESHOT: u64 = SA_RESETHAND; |
| 553 |
export def SA_RESTORER: u64 = 0x04000000; |
| 554 |
|
| 555 |
export def SIG_ERR: uintptr = -1; |
| 556 |
export def SIG_DFL: uintptr = 0; |
| 557 |
export def SIG_IGN: uintptr = 1; |
| 558 |
export def SIG_HOLD: uintptr = 2; |
| 559 |
|
| 560 |
export type sigact = struct { |
| 561 |
union { |
| 562 |
sa_handler: nullable *fn (_: int) void, |
| 563 |
sa_sigaction: nullable *fn (_: int, |
| 564 |
_: *siginfo, _: *opaque) void, |
| 565 |
}, |
| 566 |
sa_flags: u64, |
| 567 |
sa_restorer: nullable *fn () void, |
| 568 |
sa_mask: sigset, |
| 569 |
}; |
| 570 |
|
| 571 |
export type stack_t = struct { |
| 572 |
ss_sp: *opaque, |
| 573 |
ss_flags: int, |
| 574 |
ss_size: size, |
| 575 |
}; |
| 576 |
|
| 577 |
export def SFD_NONBLOCK: int = O_NONBLOCK; |
| 578 |
export def SFD_CLOEXEC: int = O_CLOEXEC; |
| 579 |
|
| 580 |
export type signalfd_siginfo = struct { |
| 581 |
ssi_signo: u32, |
| 582 |
ssi_errno: i32, |
| 583 |
ssi_code: i32, |
| 584 |
ssi_pid: u32, |
| 585 |
ssi_uid: u32, |
| 586 |
ssi_fd: i32 , |
| 587 |
ssi_tid: u32, |
| 588 |
ssi_band: u32, |
| 589 |
ssi_overrun: u32, |
| 590 |
ssi_trapno: u32, |
| 591 |
ssi_status: i32, |
| 592 |
ssi_int: i32, |
| 593 |
ssi_ptr: u64, |
| 594 |
ssi_utime: u64, |
| 595 |
ssi_stime: u64, |
| 596 |
ssi_addr: u64, |
| 597 |
ssi_addr_lsb: u16, |
| 598 |
_: u16, // padding |
| 599 |
ssi_syscall: i32, |
| 600 |
ssi_call_addr: u64, |
| 601 |
ssi_arch: u32, |
| 602 |
|
| 603 |
_: [28]u8, // pad to 128 bytes |
| 604 |
}; |
| 605 |
|
| 606 |
export type iovec = struct { |
| 607 |
iov_base: nullable *opaque, |
| 608 |
iov_len: size |
| 609 |
}; |
| 610 |
|
| 611 |
export def PRIO_PROCESS: int = 0; |
| 612 |
export def PRIO_PGRP: int = 1; |
| 613 |
export def PRIO_USER: int = 2; |
| 614 |
|
| 615 |
export type winsize = struct { |
| 616 |
ws_row: u16, |
| 617 |
ws_col: u16, |
| 618 |
ws_xpixel: u16, |
| 619 |
ws_ypixel: u16, |
| 620 |
}; |
| 621 |
|
| 622 |
export type termios = struct { |
| 623 |
c_iflag: tcflag, |
| 624 |
c_oflag: tcflag, |
| 625 |
c_cflag: tcflag, |
| 626 |
c_lflag: tcflag, |
| 627 |
c_line: cc, |
| 628 |
c_cc: [NCCS]cc, |
| 629 |
}; |
| 630 |
|
| 631 |
export def NCCS: size = 19; |
| 632 |
|
| 633 |
export type cc = enum u8 { |
| 634 |
VINTR = 0, |
| 635 |
VQUIT = 1, |
| 636 |
VERASE = 2, |
| 637 |
VKILL = 3, |
| 638 |
VEOF = 4, |
| 639 |
VTIME = 5, |
| 640 |
VMIN = 6, |
| 641 |
VSWTC = 7, |
| 642 |
VSTART = 8, |
| 643 |
VSTOP = 9, |
| 644 |
VSUSP = 10, |
| 645 |
VEOL = 11, |
| 646 |
VREPRINT = 12, |
| 647 |
VDISCARD = 13, |
| 648 |
VWERASE = 14, |
| 649 |
VLNEXT = 15, |
| 650 |
VEOL2 = 16, |
| 651 |
}; |
| 652 |
|
| 653 |
export type tcflag = enum uint { |
| 654 |
// c_iflag bit meaning |
| 655 |
IGNBRK = 0o00001, |
| 656 |
BRKINT = 0o00002, |
| 657 |
IGNPAR = 0o00004, |
| 658 |
PARMRK = 0o00010, |
| 659 |
INPCK = 0o00020, |
| 660 |
ISTRIP = 0o00040, |
| 661 |
INLCR = 0o00100, |
| 662 |
IGNCR = 0o00200, |
| 663 |
ICRNL = 0o00400, |
| 664 |
IUCLC = 0o01000, |
| 665 |
IXON = 0o02000, |
| 666 |
IXANY = 0o04000, |
| 667 |
IXOFF = 0o10000, |
| 668 |
IMAXBEL = 0o20000, |
| 669 |
IUTF8 = 0o40000, |
| 670 |
|
| 671 |
// c_oflag bit meaning |
| 672 |
OPOST = 0o000001, |
| 673 |
OLCUC = 0o000002, |
| 674 |
ONLCR = 0o000004, |
| 675 |
OCRNL = 0o000010, |
| 676 |
ONOCR = 0o000020, |
| 677 |
ONLRET = 0o000040, |
| 678 |
OFILL = 0o000100, |
| 679 |
OFDEL = 0o000200, |
| 680 |
NLDLY = 0o000400, |
| 681 |
NL0 = 0o000000, |
| 682 |
NL1 = 0o000400, |
| 683 |
CRDLY = 0o003000, |
| 684 |
CR0 = 0o000000, |
| 685 |
CR1 = 0o001000, |
| 686 |
CR2 = 0o002000, |
| 687 |
CR3 = 0o003000, |
| 688 |
TABDLY = 0o014000, |
| 689 |
TAB0 = 0o000000, |
| 690 |
TAB1 = 0o004000, |
| 691 |
TAB2 = 0o010000, |
| 692 |
TAB3 = 0o014000, |
| 693 |
XTABS = 0o014000, |
| 694 |
BSDLY = 0o020000, |
| 695 |
BS0 = 0o000000, |
| 696 |
BS1 = 0o020000, |
| 697 |
VTDLY = 0o040000, |
| 698 |
VT0 = 0o000000, |
| 699 |
VT1 = 0o040000, |
| 700 |
FFDLY = 0o100000, |
| 701 |
FF0 = 0o000000, |
| 702 |
FF1 = 0o100000, |
| 703 |
|
| 704 |
// c_cflag bit meaning |
| 705 |
CBAUD = 0o010017, |
| 706 |
B0 = 0o000000, |
| 707 |
B50 = 0o000001, |
| 708 |
B75 = 0o000002, |
| 709 |
B110 = 0o000003, |
| 710 |
B134 = 0o000004, |
| 711 |
B150 = 0o000005, |
| 712 |
B200 = 0o000006, |
| 713 |
B300 = 0o000007, |
| 714 |
B600 = 0o000010, |
| 715 |
B1200 = 0o000011, |
| 716 |
B1800 = 0o000012, |
| 717 |
B2400 = 0o000013, |
| 718 |
B4800 = 0o000014, |
| 719 |
B9600 = 0o000015, |
| 720 |
B19200 = 0o000016, |
| 721 |
B38400 = 0o000017, |
| 722 |
EXTA = B19200, |
| 723 |
EXTB = B38400, |
| 724 |
CSIZE = 0o000060, |
| 725 |
CS5 = 0o000000, |
| 726 |
CS6 = 0o000020, |
| 727 |
CS7 = 0o000040, |
| 728 |
CS8 = 0o000060, |
| 729 |
CSTOPB = 0o000100, |
| 730 |
CREAD = 0o000200, |
| 731 |
PARENB = 0o000400, |
| 732 |
PARODD = 0o001000, |
| 733 |
HUPCL = 0o002000, |
| 734 |
CLOCAL = 0o004000, |
| 735 |
CBAUDEX = 0o010000, |
| 736 |
BOTHER = 0o010000, |
| 737 |
B57600 = 0o010001, |
| 738 |
B115200 = 0o010002, |
| 739 |
B230400 = 0o010003, |
| 740 |
B460800 = 0o010004, |
| 741 |
B500000 = 0o010005, |
| 742 |
B576000 = 0o010006, |
| 743 |
B921600 = 0o010007, |
| 744 |
B1000000 = 0o010010, |
| 745 |
B1152000 = 0o010011, |
| 746 |
B1500000 = 0o010012, |
| 747 |
B2000000 = 0o010013, |
| 748 |
B2500000 = 0o010014, |
| 749 |
B3000000 = 0o010015, |
| 750 |
B3500000 = 0o010016, |
| 751 |
B4000000 = 0o010017, |
| 752 |
CIBAUD = 0o02003600000, |
| 753 |
CMSPAR = 0o10000000000, |
| 754 |
CRTSCTS = 0o20000000000, |
| 755 |
|
| 756 |
// c_lflag bit meaning |
| 757 |
ISIG = 0o000001, |
| 758 |
ICANON = 0o000002, |
| 759 |
XCASE = 0o000004, |
| 760 |
ECHO = 0o000010, |
| 761 |
ECHOE = 0o000020, |
| 762 |
ECHOK = 0o000040, |
| 763 |
ECHONL = 0o000100, |
| 764 |
NOFLSH = 0o000200, |
| 765 |
TOSTOP = 0o000400, |
| 766 |
ECHOCTL = 0o001000, |
| 767 |
ECHOPRT = 0o002000, |
| 768 |
ECHOKE = 0o004000, |
| 769 |
FLUSHO = 0o010000, |
| 770 |
PENDIN = 0o040000, |
| 771 |
IEXTEN = 0o100000, |
| 772 |
EXTPROC = 0o200000, |
| 773 |
}; |
| 774 |
|
| 775 |
|
| 776 |
export def TIOCSPGRP: u64 = 0x5410; |
| 777 |
export def TIOCGPGRP: u64 = 0x540f; |
| 778 |
export def TIOCGWINSZ: u64 = 0x5413; |
| 779 |
export def TIOCSWINSZ: u64 = 0x5414; |
| 780 |
export def TIOCSCTTY: u64 = 0x540e; |
| 781 |
export def TIOCNOTTY: u64 = 0x5422; |
| 782 |
export def TIOCGPTN: u64 = 0x80045430; |
| 783 |
export def TIOCGPTPEER: u64 = 0x5441; |
| 784 |
export def TIOCSPTLCK: u64 = 0x40045431; |
| 785 |
export def TCGETS: u64 = 0x5401; |
| 786 |
export def TCSETS: u64 = 0x5402; |
| 787 |
|
| 788 |
export def MLOCK_ONFAULT: uint = 0x01; |
| 789 |
|
| 790 |
export def MCL_CURRENT: uint = 1; |
| 791 |
export def MCL_FUTURE: uint = 2; |
| 792 |
export def MCL_ONFAULT: uint = 4; |
| 793 |
|
| 794 |
export def PTRACE_TRACEME: int = 0; |
| 795 |
export def PTRACE_PEEKTEXT: int = 1; |
| 796 |
export def PTRACE_PEEKDATA: int = 2; |
| 797 |
export def PTRACE_PEEKUSER: int = 3; |
| 798 |
export def PTRACE_POKETEXT: int = 4; |
| 799 |
export def PTRACE_POKEDATA: int = 5; |
| 800 |
export def PTRACE_POKEUSER: int = 6; |
| 801 |
export def PTRACE_CONT: int = 7; |
| 802 |
export def PTRACE_KILL: int = 8; |
| 803 |
export def PTRACE_SINGLESTEP: int = 9; |
| 804 |
export def PTRACE_GETREGS: int = 12; |
| 805 |
export def PTRACE_SETREGS: int = 13; |
| 806 |
export def PTRACE_GETFPREGS: int = 14; |
| 807 |
export def PTRACE_SETFPREGS: int = 15; |
| 808 |
export def PTRACE_ATTACH: int = 16; |
| 809 |
export def PTRACE_DETACH: int = 17; |
| 810 |
export def PTRACE_GETFPXREGS: int = 18; |
| 811 |
export def PTRACE_SETFPXREGS: int = 19; |
| 812 |
export def PTRACE_SYSCALL: int = 24; |
| 813 |
export def PTRACE_SETOPTIONS: int = 0x4200; |
| 814 |
export def PTRACE_GETEVENTMSG: int = 0x4201; |
| 815 |
export def PTRACE_GETSIGINFO: int = 0x4202; |
| 816 |
export def PTRACE_SETSIGINFO: int = 0x4203; |
| 817 |
export def PTRACE_GETREGSET: int = 0x4204; |
| 818 |
export def PTRACE_SETREGSET: int = 0x4205; |
| 819 |
export def PTRACE_SEIZE: int = 0x4206; |
| 820 |
export def PTRACE_INTERRUPT: int = 0x4207; |
| 821 |
export def PTRACE_LISTEN: int = 0x4208; |
| 822 |
export def PTRACE_PEEKSIGINFO: int = 0x4209; |
| 823 |
export def PTRACE_GETSIGMASK: int = 0x420a; |
| 824 |
export def PTRACE_SETSIGMASK: int = 0x420b; |
| 825 |
export def PTRACE_SECCOMP_GET_FILTER: int = 0x420c; |
| 826 |
export def PTRACE_SECCOMP_GET_METADATA: int = 0x420d; |
| 827 |
export def PTRACE_GET_SYSCALL_INFO: int = 0x420e; |
| 828 |
export def PTRACE_GET_RSEQ_CONFIGURATION: int = 0x420f; |
| 829 |
|
| 830 |
export def PTRACE_O_TRACESYSGOOD: u64 = 0x00000001; |
| 831 |
export def PTRACE_O_TRACEFORK: u64 = 0x00000002; |
| 832 |
export def PTRACE_O_TRACEVFORK: u64 = 0x00000004; |
| 833 |
export def PTRACE_O_TRACECLONE: u64 = 0x00000008; |
| 834 |
export def PTRACE_O_TRACEEXEC: u64 = 0x00000010; |
| 835 |
export def PTRACE_O_TRACEVFORKDONE: u64 = 0x00000020; |
| 836 |
export def PTRACE_O_TRACEEXIT: u64 = 0x00000040; |
| 837 |
export def PTRACE_O_TRACESECCOMP: u64 = 0x00000080; |
| 838 |
export def PTRACE_O_EXITKILL: u64 = 0x00100000; |
| 839 |
export def PTRACE_O_SUSPEND_SECCOMP: u64 = 0x00200000; |
| 840 |
export def PTRACE_O_MASK: u64 = 0x003000ff; |
| 841 |
|
| 842 |
export def PTRACE_EVENT_FORK: int = 1; |
| 843 |
export def PTRACE_EVENT_VFORK: int = 2; |
| 844 |
export def PTRACE_EVENT_CLONE: int = 3; |
| 845 |
export def PTRACE_EVENT_EXEC: int = 4; |
| 846 |
export def PTRACE_EVENT_VFORK_DONE: int = 5; |
| 847 |
export def PTRACE_EVENT_EXIT: int = 6; |
| 848 |
export def PTRACE_EVENT_SECCOMP: int = 7; |
| 849 |
export def PTRACE_EVENT_STOP: int = 128; |
| 850 |
|
| 851 |
export def PTRACE_SYSCALL_INFO_NONE: u8 = 0; |
| 852 |
export def PTRACE_SYSCALL_INFO_ENTRY: u8 = 1; |
| 853 |
export def PTRACE_SYSCALL_INFO_EXIT: u8 = 2; |
| 854 |
export def PTRACE_SYSCALL_INFO_SECCOMP: u8 = 3; |
| 855 |
|
| 856 |
export def PTRACE_PEEKSIGINFO_SHARED: u32 = 1; |
| 857 |
|
| 858 |
export type ptrace_peeksiginfo_args = struct { |
| 859 |
off: u64, |
| 860 |
flags: u32, |
| 861 |
nr: i32, |
| 862 |
}; |
| 863 |
|
| 864 |
export type ptrace_syscall_info = struct { |
| 865 |
op: u8, |
| 866 |
arch: u32, |
| 867 |
instruction_pointer: u64, |
| 868 |
stack_pointer: u64, |
| 869 |
union { |
| 870 |
entry: struct { |
| 871 |
nr: u64, |
| 872 |
args: [6]u64, |
| 873 |
}, |
| 874 |
exit: struct { |
| 875 |
rval: i64, |
| 876 |
is_error: u8, |
| 877 |
}, |
| 878 |
seccomp: struct { |
| 879 |
nr: u64, |
| 880 |
args: [6]u64, |
| 881 |
ret_data: u64, |
| 882 |
}, |
| 883 |
}, |
| 884 |
}; |
| 885 |
|
| 886 |
export def STDIN_FILENO: int = 0; |
| 887 |
export def STDOUT_FILENO: int = 1; |
| 888 |
export def STDERR_FILENO: int = 2; |
| 889 |
|
| 890 |
export def MFD_CLOEXEC: uint = 1; |
| 891 |
export def MFD_ALLOW_SEALING: uint = 2; |
| 892 |
export def MFD_HUGETLB: uint = 4; |
| 893 |
|
| 894 |
export def SPLICE_F_MOVE: uint = 1; |
| 895 |
export def SPLICE_F_NONBLOCK: uint = 2; |
| 896 |
export def SPLICE_F_MORE: uint = 4; |
| 897 |
export def SPLICE_F_GIFT: uint = 8; |
| 898 |
|
| 899 |
export def SEEK_SET: int = 0; |
| 900 |
export def SEEK_CUR: int = 1; |
| 901 |
export def SEEK_END: int = 2; |
| 902 |
|
| 903 |
// Flock operations |
| 904 |
export def LOCK_SH: int = 1; |
| 905 |
export def LOCK_EX: int = 2; |
| 906 |
export def LOCK_NB: int = 4; |
| 907 |
export def LOCK_UN: int = 8; |
| 908 |
|
| 909 |
// Inotify init1 flags |
| 910 |
export def IN_NONBLOCK: int = O_NONBLOCK; |
| 911 |
export def IN_CLOEXEC: int = O_CLOEXEC; |
| 912 |
|
| 913 |
// Inotify event masks |
| 914 |
export def INACCESS: u32 = 0x00000001; |
| 915 |
export def INMODIFY: u32 = 0x00000002; |
| 916 |
export def INATTRIB: u32 = 0x00000004; |
| 917 |
export def INCLOSEWRITE: u32 = 0x00000008; |
| 918 |
export def INCLOSENOWRITE: u32 = 0x00000010; |
| 919 |
export def INOPEN: u32 = 0x00000020; |
| 920 |
export def INMOVEDFROM: u32 = 0x00000040; |
| 921 |
export def INMOVEDTO: u32 = 0x00000080; |
| 922 |
export def INCREATE: u32 = 0x00000100; |
| 923 |
export def INDELETE: u32 = 0x00000200; |
| 924 |
export def INDELETESELF: u32 = 0x00000400; |
| 925 |
export def INMOVESELF: u32 = 0x00000800; |
| 926 |
export def INONLYDIR: u32 = 0x01000000; |
| 927 |
export def INDONTFOLLOW: u32 = 0x02000000; |
| 928 |
export def INEXCLUNLINK: u32 = 0x04000000; |
| 929 |
export def INMASKCREATE: u32 = 0x10000000; |
| 930 |
export def INMASKADD: u32 = 0x20000000; |
| 931 |
export def INISDIR: u32 = 0x40000000; |
| 932 |
export def INONESHOT: u32 = 0x80000000; |
| 933 |
export def INUNMOUNT: u32 = 0x00002000; |
| 934 |
export def INQOVERFLOW: u32 = 0x00004000; |
| 935 |
export def INIGNORED: u32 = 0x00008000; |
| 936 |
export def INMOVE: u32 = INMOVEDFROM | INMOVEDTO; |
| 937 |
export def INCLOSE: u32 = INCLOSEWRITE | INCLOSENOWRITE; |
| 938 |
|
| 939 |
export type rlimit = struct { |
| 940 |
rlim_cur: rlim_t, |
| 941 |
rlim_max: rlim_t, |
| 942 |
}; |
| 943 |
|
| 944 |
export def RLIM_INFINITY: rlim_t = -1; |
| 945 |
|
| 946 |
export def RLIMIT_CPU: int = 0; |
| 947 |
export def RLIMIT_FSIZE: int = 1; |
| 948 |
export def RLIMIT_DATA: int = 2; |
| 949 |
export def RLIMIT_STACK: int = 3; |
| 950 |
export def RLIMIT_CORE: int = 4; |
| 951 |
export def RLIMIT_RSS: int = 5; |
| 952 |
export def RLIMIT_NPROC: int = 6; |
| 953 |
export def RLIMIT_NOFILE: int = 7; |
| 954 |
export def RLIMIT_MEMLOCK: int = 8; |
| 955 |
export def RLIMIT_AS: int = 9; |
| 956 |
export def RLIMIT_LOCKS: int = 10; |
| 957 |
export def RLIMIT_SIGPENDING: int = 11; |
| 958 |
export def RLIMIT_MSGQUEUE: int = 12; |
| 959 |
export def RLIMIT_NICE: int = 13; |
| 960 |
export def RLIMIT_RTPRIO: int = 14; |
| 961 |
export def RLIMIT_RTTIME: int = 15; |
| 962 |
export def RLIMIT_NLIMITS: int = 16; |
| 963 |
|
| 964 |
export def SHUT_RD: int = 0; |
| 965 |
export def SHUT_WR: int = 1; |
| 966 |
export def SHUT_RDWR: int = 2; |
| 967 |
|
| 968 |
export type io_uring_sqe = struct { |
| 969 |
opcode: u8, |
| 970 |
flags: u8, |
| 971 |
ioprio: u16, |
| 972 |
fd: i32, |
| 973 |
union { |
| 974 |
off: u64, |
| 975 |
addr2: u64, |
| 976 |
struct { |
| 977 |
cmd_op: u32, |
| 978 |
_: u32, // padding |
| 979 |
}, |
| 980 |
}, |
| 981 |
union { |
| 982 |
addr: u64, |
| 983 |
splice_off_in: u64, |
| 984 |
}, |
| 985 |
length: u32, |
| 986 |
union { |
| 987 |
rw_flags: int, |
| 988 |
fsync_flags: u32, |
| 989 |
poll_events: u32, |
| 990 |
poll32_events: u32, |
| 991 |
sync_range_flags: u32, |
| 992 |
msg_flags: u32, |
| 993 |
timeout_flags: u32, |
| 994 |
accept_flags: u32, |
| 995 |
cancel_flags: u32, |
| 996 |
open_flags: u32, |
| 997 |
statx_flags: u32, |
| 998 |
fadvise_advice: u32, |
| 999 |
splice_flags: u32, |
| 1000 |
rename_flags: u32, |
| 1001 |
unlink_flags: u32, |
| 1002 |
hardlink_flags: u32, |
| 1003 |
xattr_flags: u32, |
| 1004 |
msg_ring_flags: u32, |
| 1005 |
uring_cmd_flags: u32, |
| 1006 |
}, |
| 1007 |
user_data: u64, |
| 1008 |
// TODO: use @packed once size() stop returning different sizes |
| 1009 |
union { |
| 1010 |
buf_index: u16, |
| 1011 |
buf_group: u16, |
| 1012 |
}, |
| 1013 |
personality: u16, |
| 1014 |
union { |
| 1015 |
splice_fd_in: i32, |
| 1016 |
file_index: u32, |
| 1017 |
struct { |
| 1018 |
addr_len: u16, |
| 1019 |
_: [1]u16, // padding |
| 1020 |
}, |
| 1021 |
}, |
| 1022 |
union { |
| 1023 |
struct { |
| 1024 |
addr3: u64, |
| 1025 |
_: [1]u64, // padding |
| 1026 |
}, |
| 1027 |
cmd: [*]u8, |
| 1028 |
}, |
| 1029 |
}; |
| 1030 |
|
| 1031 |
export def IORING_FILE_INDEX_ALLOC: u32 = ~0; |
| 1032 |
|
| 1033 |
export def IOSQE_FIXED_FILE: u8 = 1 << 0; |
| 1034 |
export def IOSQE_IO_DRAIN: u8 = 1 << 1; |
| 1035 |
export def IOSQE_IO_LINK: u8 = 1 << 2; |
| 1036 |
export def IOSQE_IO_HARDLINK: u8 = 1 << 3; |
| 1037 |
export def IOSQE_ASYNC: u8 = 1 << 4; |
| 1038 |
export def IOSQE_BUFFER_SELECT: u8 = 1 << 5; |
| 1039 |
export def IOSQE_CQE_SKIP_SUCCESS: u8 = 1 << 6; |
| 1040 |
|
| 1041 |
export def IORING_SETUP_IOPOLL: u32 = 1 << 0; |
| 1042 |
export def IORING_SETUP_SQPOLL: u32 = 1 << 1; |
| 1043 |
export def IORING_SETUP_SQ_AFF: u32 = 1 << 2; |
| 1044 |
export def IORING_SETUP_CQSIZE: u32 = 1 << 3; |
| 1045 |
export def IORING_SETUP_CLAMP: u32 = 1 << 4; |
| 1046 |
export def IORING_SETUP_ATTACH_WQ: u32 = 1 << 5; |
| 1047 |
export def IORING_SETUP_R_DISABLED: u32 = 1 << 6; |
| 1048 |
export def IORING_SETUP_SUBMIT_ALL: u32 = 1 << 7; |
| 1049 |
export def IORING_SETUP_COOP_TASKRUN: u32 = 1 << 8; |
| 1050 |
export def IORING_SETUP_TASKRUN_FLAG: u32 = 1 << 9; |
| 1051 |
export def IORING_SETUP_SQE128: u32 = 1 << 10; |
| 1052 |
export def IORING_SETUP_CQE32: u32 = 1 << 11; |
| 1053 |
export def IORING_SETUP_SINGLE_ISSUER: u32 = 1 << 12; |
| 1054 |
export def IORING_SETUP_DEFER_TASKRUN: u32 = 1 << 13; |
| 1055 |
export def IORING_SETUP_NO_MMAP: u32 = 1 << 14; |
| 1056 |
export def IORING_SETUP_REGISTERED_FD_ONLY: u32 = 1 << 15; |
| 1057 |
|
| 1058 |
export def IORING_OP_NOP: u8 = 0; |
| 1059 |
export def IORING_OP_READV: u8 = 1; |
| 1060 |
export def IORING_OP_WRITEV: u8 = 2; |
| 1061 |
export def IORING_OP_FSYNC: u8 = 3; |
| 1062 |
export def IORING_OP_READ_FIXED: u8 = 4; |
| 1063 |
export def IORING_OP_WRITE_FIXED: u8 = 5; |
| 1064 |
export def IORING_OP_POLL_ADD: u8 = 6; |
| 1065 |
export def IORING_OP_POLL_REMOVE: u8 = 7; |
| 1066 |
export def IORING_OP_SYNC_FILE_RANGE: u8 = 8; |
| 1067 |
export def IORING_OP_SENDMSG: u8 = 9; |
| 1068 |
export def IORING_OP_RECVMSG: u8 = 10; |
| 1069 |
export def IORING_OP_TIMEOUT: u8 = 11; |
| 1070 |
export def IORING_OP_TIMEOUT_REMOVE: u8 = 12; |
| 1071 |
export def IORING_OP_ACCEPT: u8 = 13; |
| 1072 |
export def IORING_OP_ASYNC_CANCEL: u8 = 14; |
| 1073 |
export def IORING_OP_LINK_TIMEOUT: u8 = 15; |
| 1074 |
export def IORING_OP_CONNECT: u8 = 16; |
| 1075 |
export def IORING_OP_FALLOCATE: u8 = 17; |
| 1076 |
export def IORING_OP_OPENAT: u8 = 18; |
| 1077 |
export def IORING_OP_CLOSE: u8 = 19; |
| 1078 |
export def IORING_OP_FILES_UPDATE: u8 = 20; |
| 1079 |
export def IORING_OP_STATX: u8 = 21; |
| 1080 |
export def IORING_OP_READ: u8 = 22; |
| 1081 |
export def IORING_OP_WRITE: u8 = 23; |
| 1082 |
export def IORING_OP_FADVISE: u8 = 24; |
| 1083 |
export def IORING_OP_MADVISE: u8 = 25; |
| 1084 |
export def IORING_OP_SEND: u8 = 26; |
| 1085 |
export def IORING_OP_RECV: u8 = 27; |
| 1086 |
export def IORING_OP_OPENAT2: u8 = 28; |
| 1087 |
export def IORING_OP_EPOLL_CTL: u8 = 29; |
| 1088 |
export def IORING_OP_SPLICE: u8 = 30; |
| 1089 |
export def IORING_OP_PROVIDE_BUFFERS: u8 = 31; |
| 1090 |
export def IORING_OP_REMOVE_BUFFERS: u8 = 32; |
| 1091 |
export def IORING_OP_TEE: u8 = 33; |
| 1092 |
export def IORING_OP_SHUTDOWN: u8 = 34; |
| 1093 |
export def IORING_OP_RENAMEAT: u8 = 35; |
| 1094 |
export def IORING_OP_UNLINKAT: u8 = 36; |
| 1095 |
export def IORING_OP_MKDIRAT: u8 = 37; |
| 1096 |
export def IORING_OP_SYMLINKAT: u8 = 38; |
| 1097 |
export def IORING_OP_LINKAT: u8 = 39; |
| 1098 |
export def IORING_OP_MSG_RING: u8 = 40; |
| 1099 |
export def IORING_OP_FSETXATTR: u8 = 41; |
| 1100 |
export def IORING_OP_SETXATTR: u8 = 42; |
| 1101 |
export def IORING_OP_FGETXATTR: u8 = 43; |
| 1102 |
export def IORING_OP_GETXATTR: u8 = 44; |
| 1103 |
export def IORING_OP_SOCKET: u8 = 45; |
| 1104 |
export def IORING_OP_URING_CMD: u8 = 46; |
| 1105 |
export def IORING_OP_SEND_ZC: u8 = 47; |
| 1106 |
export def IORING_OP_SENDMSG_ZC: u8 = 48; |
| 1107 |
|
| 1108 |
export def IORING_URING_CMD_FIXED: u32 = 1 << 0; |
| 1109 |
export def IORING_URING_CMD_POLLED: u32 = 1 << 31; |
| 1110 |
|
| 1111 |
export def IORING_FSYNC_DATASYNC: u32 = 1 << 0; |
| 1112 |
|
| 1113 |
export def IORING_TIMEOUT_ABS: u32 = 1 << 0; |
| 1114 |
export def IORING_TIMEOUT_UPDATE: u32 = 1 << 1; |
| 1115 |
export def IORING_TIMEOUT_BOOTTIME: u32 = 1 << 2; |
| 1116 |
export def IORING_TIMEOUT_REALTIME: u32 = 1 << 3; |
| 1117 |
export def IORING_LINK_TIMEOUT_UPDATE: u32 = 1 << 4; |
| 1118 |
export def IORING_TIMEOUT_ETIME_SUCCESS: u32 = 1 << 5; |
| 1119 |
export def IORING_TIMEOUT_MULTISHOT: u32 = 1 << 6; |
| 1120 |
|
| 1121 |
export def SPLICE_F_FD_IN_FIXED: u32 = 1 << 31; |
| 1122 |
|
| 1123 |
export def IORING_POLL_ADD_MULTI: u32 = 1 << 0; |
| 1124 |
export def IORING_POLL_UPDATE_EVENTS: u32 = 1 << 1; |
| 1125 |
export def IORING_POLL_UPDATE_USER_DATA: u32 = 1 << 2; |
| 1126 |
export def IORING_POLL_ADD_LEVEL: u32 = 1 << 3; |
| 1127 |
|
| 1128 |
export def IORING_ASYNC_CANCEL_ALL: u32 = 1 << 0; |
| 1129 |
export def IORING_ASYNC_CANCEL_FD: u32 = 1 << 1; |
| 1130 |
export def IORING_ASYNC_CANCEL_ANY: u32 = 1 << 2; |
| 1131 |
export def IORING_ASYNC_CANCEL_FD_FIXED: u32 = 1 << 3; |
| 1132 |
|
| 1133 |
export def IORING_RECVSEND_POLL_FIRST: u16 = 1 << 0; |
| 1134 |
export def IORING_RECV_MULTISHOT: u16 = 1 << 1; |
| 1135 |
export def IORING_RECVSEND_FIXED_BUF: u16 = 1 << 2; |
| 1136 |
export def IORING_SEND_ZC_REPORT_USAGE: u16 = 1 << 3; |
| 1137 |
|
| 1138 |
// TODO: https://todo.sr.ht/~sircmpwn/hare/771 |
| 1139 |
// export def IORING_NOTIF_USAGE_ZC_COPIED: i32 = 1 << 31; |
| 1140 |
|
| 1141 |
export def IORING_ACCEPT_MULTISHOT: u16 = 1 << 0; |
| 1142 |
|
| 1143 |
export def IORING_MSG_DATA: u64 = 0; |
| 1144 |
export def IORING_MSG_SEND_FD: u64 = 1; |
| 1145 |
|
| 1146 |
export def IORING_MSG_RING_CQE_SKIP: u32 = 1 << 0; |
| 1147 |
export def IORING_MSG_RING_FLAGS_PASS: u32 = 1 << 1; |
| 1148 |
|
| 1149 |
export type _io_uring_cqe = struct { |
| 1150 |
user_data: u64, |
| 1151 |
res: i32, |
| 1152 |
flags: u32, |
| 1153 |
}; |
| 1154 |
|
| 1155 |
export type io_uring_cqe = struct { |
| 1156 |
_io_uring_cqe, |
| 1157 |
big_cqe: [*]u64, |
| 1158 |
}; |
| 1159 |
|
| 1160 |
export def IORING_CQE_F_BUFFER: u32 = 1 << 0; |
| 1161 |
export def IORING_CQE_F_MORE: u32 = 1 << 1; |
| 1162 |
export def IORING_CQE_F_SOCK_NONEMPTY: u32 = 1 << 2; |
| 1163 |
export def IORING_CQE_F_NOTIF: u32 = 1 << 3; |
| 1164 |
|
| 1165 |
export def IORING_CQE_BUFFER_SHIFT: u32 = 16; |
| 1166 |
|
| 1167 |
export def IORING_OFF_SQ_RING: u64 = 0; |
| 1168 |
export def IORING_OFF_CQ_RING: u64 = 0x8000000; |
| 1169 |
export def IORING_OFF_SQES: u64 = 0x10000000; |
| 1170 |
export def IORING_OFF_PBUF_RING: u64 = 0x80000000; |
| 1171 |
export def IORING_OFF_PBUF_SHIFT: u64 = 16; |
| 1172 |
export def IORING_OFF_MMAP_MASK: u64 = 0xf8000000; |
| 1173 |
|
| 1174 |
export type io_sqring_offsets = struct { |
| 1175 |
head: u32, |
| 1176 |
tail: u32, |
| 1177 |
ring_mask: u32, |
| 1178 |
ring_entries: u32, |
| 1179 |
flags: u32, |
| 1180 |
dropped: u32, |
| 1181 |
array: u32, |
| 1182 |
resv1: u32, |
| 1183 |
user_addr: u64, |
| 1184 |
}; |
| 1185 |
|
| 1186 |
export def IORING_SQ_NEED_WAKEUP: u32 = 1 << 0; |
| 1187 |
export def IORING_SQ_CQ_OVERFLOW: u32 = 1 << 1; |
| 1188 |
export def IORING_SQ_TASKRUN: u32 = 1 << 2; |
| 1189 |
|
| 1190 |
export type io_cqring_offsets = struct { |
| 1191 |
head: u32, |
| 1192 |
tail: u32, |
| 1193 |
ring_mask: u32, |
| 1194 |
ring_entries: u32, |
| 1195 |
overflow: u32, |
| 1196 |
cqes: u32, |
| 1197 |
flags: u32, |
| 1198 |
resv1: u32, |
| 1199 |
user_addr: u64, |
| 1200 |
}; |
| 1201 |
|
| 1202 |
export def IORING_CQ_EVENTFD_DISABLED: u32 = 1 << 0; |
| 1203 |
|
| 1204 |
export def IORING_ENTER_GETEVENTS: u32 = 1 << 0; |
| 1205 |
export def IORING_ENTER_SQ_WAKEUP: u32 = 1 << 1; |
| 1206 |
export def IORING_ENTER_SQ_WAIT: u32 = 1 << 2; |
| 1207 |
export def IORING_ENTER_EXT_ARG: u32 = 1 << 3; |
| 1208 |
export def IORING_ENTER_REGISTERED_RING: u32 = 1 << 4; |
| 1209 |
|
| 1210 |
export type io_uring_params = struct { |
| 1211 |
sq_entries: u32, |
| 1212 |
cq_entries: u32, |
| 1213 |
flags: u32, |
| 1214 |
sq_thread_cpu: u32, |
| 1215 |
sq_thread_idle: u32, |
| 1216 |
features: u32, |
| 1217 |
wq_fd: u32, |
| 1218 |
resv: [3]u32, |
| 1219 |
sq_off: io_sqring_offsets, |
| 1220 |
cq_off: io_cqring_offsets, |
| 1221 |
}; |
| 1222 |
|
| 1223 |
export def IORING_FEAT_SINGLE_MMAP: u32 = 1 << 0; |
| 1224 |
export def IORING_FEAT_NODROP: u32 = 1 << 1; |
| 1225 |
export def IORING_FEAT_SUBMIT_STABLE: u32 = 1 << 2; |
| 1226 |
export def IORING_FEAT_RW_CUR_POS: u32 = 1 << 3; |
| 1227 |
export def IORING_FEAT_CUR_PERSONALITY: u32 = 1 << 4; |
| 1228 |
export def IORING_FEAT_FAST_POLL: u32 = 1 << 5; |
| 1229 |
export def IORING_FEAT_POLL_32BITS: u32 = 1 << 6; |
| 1230 |
export def IORING_FEAT_SQPOLL_NONFIXED: u32 = 1 << 7; |
| 1231 |
export def IORING_FEAT_EXT_ARG: u32 = 1 << 8; |
| 1232 |
export def IORING_FEAT_NATIVE_WORKERS: u32 = 1 << 9; |
| 1233 |
export def IORING_FEAT_RSRC_TAGS: u32 = 1 << 10; |
| 1234 |
export def IORING_FEAT_CQE_SKIP: u32 = 1 << 11; |
| 1235 |
export def IORING_FEAT_LINKED_FILE: u32 = 1 << 12; |
| 1236 |
export def IORING_FEAT_REG_REG_RING: u32 = 1 << 13; |
| 1237 |
|
| 1238 |
export def IORING_REGISTER_BUFFERS: uint = 0; |
| 1239 |
export def IORING_UNREGISTER_BUFFERS: uint = 1; |
| 1240 |
export def IORING_REGISTER_FILES: uint = 2; |
| 1241 |
export def IORING_UNREGISTER_FILES: uint = 3; |
| 1242 |
export def IORING_REGISTER_EVENTFD: uint = 4; |
| 1243 |
export def IORING_UNREGISTER_EVENTFD: uint = 5; |
| 1244 |
export def IORING_REGISTER_FILES_UPDATE: uint = 6; |
| 1245 |
export def IORING_REGISTER_EVENTFD_ASYNC: uint = 7; |
| 1246 |
export def IORING_REGISTER_PROBE: uint = 8; |
| 1247 |
export def IORING_REGISTER_PERSONALITY: uint = 9; |
| 1248 |
export def IORING_UNREGISTER_PERSONALITY: uint = 10; |
| 1249 |
export def IORING_REGISTER_RESTRICTIONS: uint = 11; |
| 1250 |
export def IORING_REGISTER_ENABLE_RINGS: uint = 12; |
| 1251 |
export def IORING_REGISTER_FILES2: uint = 13; |
| 1252 |
export def IORING_REGISTER_FILES_UPDATE2: uint = 14; |
| 1253 |
export def IORING_REGISTER_BUFFERS2: uint = 15; |
| 1254 |
export def IORING_REGISTER_BUFFERS_UPDATE: uint = 16; |
| 1255 |
export def IORING_REGISTER_IOWQ_AFF: uint = 17; |
| 1256 |
export def IORING_UNREGISTER_IOWQ_AFF: uint = 18; |
| 1257 |
export def IORING_REGISTER_IOWQ_MAX_WORKERS: uint = 19; |
| 1258 |
export def IORING_REGISTER_RING_FDS: uint = 20; |
| 1259 |
export def IORING_UNREGISTER_RING_FDS: uint = 21; |
| 1260 |
export def IORING_REGISTER_PBUF_RING: uint = 22; |
| 1261 |
export def IORING_UNREGISTER_PBUF_RING: uint = 23; |
| 1262 |
export def IORING_REGISTER_SYNC_CANCEL: uint = 24; |
| 1263 |
export def IORING_REGISTER_FILE_ALLOC_RANGE: uint = 25; |
| 1264 |
|
| 1265 |
export def IORING_REGISTER_USE_REGISTERED_RING: uint = 1 << 31; |
| 1266 |
|
| 1267 |
export type io_uring_files_update = struct { |
| 1268 |
off: u32, |
| 1269 |
resv: u32, |
| 1270 |
fds: u64, |
| 1271 |
}; |
| 1272 |
|
| 1273 |
export def IORING_RSRC_REGISTER_SPARSE: u32 = 1 << 0; |
| 1274 |
|
| 1275 |
export type io_uring_rsrc_register = struct { |
| 1276 |
nr: u32, |
| 1277 |
flags: u32, |
| 1278 |
resv2: u64, |
| 1279 |
data: u64, |
| 1280 |
tags: u64, |
| 1281 |
}; |
| 1282 |
|
| 1283 |
export type io_uring_rsrc_update = struct { |
| 1284 |
off: u32, |
| 1285 |
resv: u32, |
| 1286 |
data: u64, |
| 1287 |
}; |
| 1288 |
|
| 1289 |
export type io_uring_rsrc_update2 = struct { |
| 1290 |
off: u32, |
| 1291 |
resv: u32, |
| 1292 |
data: u64, |
| 1293 |
tags: u64, |
| 1294 |
nr: u32, |
| 1295 |
resv2: u32, |
| 1296 |
}; |
| 1297 |
|
| 1298 |
export def IORING_REGISTER_FILES_SKIP: int = -2; |
| 1299 |
|
| 1300 |
export def IO_URING_OP_SUPPORTED: u16 = 1 << 0; |
| 1301 |
|
| 1302 |
export type io_uring_probe_op = struct { |
| 1303 |
op: u8, |
| 1304 |
resv: u8, |
| 1305 |
flags: u16, |
| 1306 |
resv2: u32, |
| 1307 |
}; |
| 1308 |
|
| 1309 |
export type io_uring_probe = struct { |
| 1310 |
last_op: u8, |
| 1311 |
ops_len: u8, |
| 1312 |
resv: u16, |
| 1313 |
resv2: [3]u32, |
| 1314 |
ops: [*]io_uring_probe_op, |
| 1315 |
}; |
| 1316 |
|
| 1317 |
export type io_uring_restriction = struct { |
| 1318 |
opcode: u16, |
| 1319 |
union { |
| 1320 |
register_op: u8, |
| 1321 |
sqe_op: u8, |
| 1322 |
sqe_flags: u8, |
| 1323 |
}, |
| 1324 |
resv: u8, |
| 1325 |
resv2: [3]u32, |
| 1326 |
}; |
| 1327 |
|
| 1328 |
export type io_uring_buf = struct { |
| 1329 |
addr: u64, |
| 1330 |
length: u32, |
| 1331 |
bid: u16, |
| 1332 |
resv: u16, |
| 1333 |
}; |
| 1334 |
|
| 1335 |
export type io_uring_buf_ring = struct { |
| 1336 |
union { |
| 1337 |
struct { |
| 1338 |
resv1: u64, |
| 1339 |
resv2: u32, |
| 1340 |
resv3: u16, |
| 1341 |
tail: u16, |
| 1342 |
}, |
| 1343 |
bufs: [*]io_uring_buf, |
| 1344 |
}, |
| 1345 |
}; |
| 1346 |
|
| 1347 |
export def IOU_PBUF_RING_MMAP: u16 = 1; |
| 1348 |
|
| 1349 |
export type io_uring_buf_reg = struct { |
| 1350 |
ring_addr: u64, |
| 1351 |
ring_entries: u32, |
| 1352 |
bgid: u16, |
| 1353 |
flags: u16, |
| 1354 |
resv: [3]u64, |
| 1355 |
}; |
| 1356 |
|
| 1357 |
export def IORING_RESTRICTION_REGISTER_OP: u16 = 0; |
| 1358 |
export def IORING_RESTRICTION_SQE_OP: u16 = 1; |
| 1359 |
export def IORING_RESTRICTION_SQE_FLAGS_ALLOWED: u16 = 2; |
| 1360 |
export def IORING_RESTRICTION_SQE_FLAGS_REQUIRED: u16 = 3; |
| 1361 |
|
| 1362 |
export type io_uring_getevents_arg = struct { |
| 1363 |
sigmask: u64, |
| 1364 |
sigmask_sz: u32, |
| 1365 |
pad: u32, |
| 1366 |
ts: u64, |
| 1367 |
}; |
| 1368 |
|
| 1369 |
export type io_uring_sync_cancel_reg = struct { |
| 1370 |
addr: u64, |
| 1371 |
fd: i32, |
| 1372 |
flags: u32, |
| 1373 |
timeout: timespec, |
| 1374 |
pad: [4]u64, |
| 1375 |
}; |
| 1376 |
|
| 1377 |
export type io_uring_file_index_range = struct { |
| 1378 |
off: u32, |
| 1379 |
length: u32, |
| 1380 |
resv: u64, |
| 1381 |
}; |
| 1382 |
|
| 1383 |
export type io_uring_recvmsg_out = struct { |
| 1384 |
namelen: u32, |
| 1385 |
controllen: u32, |
| 1386 |
payloadlen: u32, |
| 1387 |
flags: u32, |
| 1388 |
}; |
| 1389 |
|
| 1390 |
|
| 1391 |
// Scheduling policies. |
| 1392 |
export def SCHED_OTHER: int = 0; |
| 1393 |
export def SCHED_FIFO: int = 1; |
| 1394 |
export def SCHED_RR: int = 2; |
| 1395 |
export def SCHED_NORMAL: int = 0; |
| 1396 |
export def SCHED_BATCH: int = 3; |
| 1397 |
export def SCHED_ISO: int = 4; |
| 1398 |
export def SCHED_IDLE: int = 5; |
| 1399 |
export def SCHED_DEADLINE: int = 6; |
| 1400 |
export def SCHED_EXT: int = 7; |
| 1401 |
// This flag can be ORed with policy values. |
| 1402 |
// This is the reason why the above scheduling policies can't be an enum. |
| 1403 |
export def SCHED_RESET_ON_FORK: int = 0x40000000; |
| 1404 |
|
| 1405 |
export type sched_param = struct { |
| 1406 |
sched_priority: int |
| 1407 |
}; |
| 1408 |
|
| 1409 |
// sched_attr support. (linux only) |
| 1410 |
export type sched_attr = struct { |
| 1411 |
size_: u32, |
| 1412 |
sched_policy: u32, |
| 1413 |
sched_flags: u64, |
| 1414 |
sched_nice: i32, |
| 1415 |
sched_priority: u32, |
| 1416 |
sched_runtime: u64, |
| 1417 |
sched_deadline: u64, |
| 1418 |
sched_period: u64, |
| 1419 |
sched_util_min: u32, |
| 1420 |
sched_util_max: u32, |
| 1421 |
// Additional fields may be added at the end. |
| 1422 |
}; |
| 1423 |
// Flags for the sched_flags field in struct sched_attr. |
| 1424 |
export def SCHED_FLAG_RESET_ON_FORK: u64 = 0x01; |
| 1425 |
export def SCHED_FLAG_RECLAIM: u64 = 0x02; |
| 1426 |
export def SCHED_FLAG_DL_OVERRUN: u64 = 0x04; |
| 1427 |
export def SCHED_FLAG_KEEP_POLICY: u64 = 0x08; |
| 1428 |
export def SCHED_FLAG_KEEP_PARAMS: u64 = 0x10; |
| 1429 |
export def SCHED_FLAG_UTIL_CLAMP_MIN: u64 = 0x20; |
| 1430 |
export def SCHED_FLAG_UTIL_CLAMP_MAX: u64 = 0x40; |
| 1431 |
// Combinations of sched_flags fields. |
| 1432 |
export def SCHED_FLAG_KEEP_ALL = SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS; |
| 1433 |
export def SCHED_FLAG_UTIL_CLAMP = SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX; |