types.ha (21286B)
1 // SPDX-License-Identifier: MPL-2.0 2 // (c) Hare authors <https://harelang.org> 3 4 export type time_t = i64; 5 export type clock_t = i64; 6 export type clockid_t = i32; 7 export type suseconds_t = i64; 8 export type dev_t = i32; 9 export type ino_t = u64; 10 export type nlink_t = u32; 11 export type id_t = u32; 12 export type pid_t = i32; 13 export type uid_t = u32; 14 export type gid_t = u32; 15 export type off_t = i64; 16 export type blkcnt_t = i64; 17 export type blksize_t = i32; 18 export type nfds_t = uint; 19 export type mode_t = u32; 20 export type sigset = uint; 21 22 // Passing this to a pledge() promise specifies to not change the current value. 23 export type nullpromise = void; 24 25 // Maximum length of a file path including the NUL terminator. 26 export def PATH_MAX: size = 1024; 27 28 export def PATH_PTMDEV: str = "/dev/ptm"; 29 export def PTMGET: u64 = 0x40287401; 30 31 export type ptmget = struct { 32 cfd: int, 33 sfd: int, 34 cn: [16]u8, 35 sn: [16]u8 36 }; 37 38 export def S_ISUID: mode_t = 0o4000; 39 export def S_ISGID: mode_t = 0o2000; 40 export def S_ISTXT: mode_t = 0o1000; 41 export def S_IRWXU: mode_t = 0o700; 42 export def S_IRUSR: mode_t = 0o400; 43 export def S_IWUSR: mode_t = 0o200; 44 export def S_IXUSR: mode_t = 0o100; 45 export def S_IRWXG: mode_t = 0o070; 46 export def S_IRGRP: mode_t = 0o040; 47 export def S_IWGRP: mode_t = 0o020; 48 export def S_IXGRP: mode_t = 0o010; 49 export def S_IRWXO: mode_t = 0o007; 50 export def S_IROTH: mode_t = 0o004; 51 export def S_IWOTH: mode_t = 0o002; 52 export def S_IXOTH: mode_t = 0o001; 53 export def S_IFMT: mode_t = 0o170000; 54 export def S_IFIFO: mode_t = 0o010000; 55 export def S_IFCHR: mode_t = 0o020000; 56 export def S_IFDIR: mode_t = 0o040000; 57 export def S_IFBLK: mode_t = 0o060000; 58 export def S_IFREG: mode_t = 0o100000; 59 export def S_IFLNK: mode_t = 0o120000; 60 export def S_IFSOCK: mode_t = 0o140000; 61 export def S_ISVTX: mode_t = 0o001000; 62 63 export def O_RDONLY: int = 0x0; 64 export def O_WRONLY: int = 0x1; 65 export def O_RDWR: int = 0x2; 66 export def O_ACCMODE: int = 0x3; 67 export def O_NONBLOCK: int = 0x4; 68 export def O_APPEND: int = 0x8; 69 export def O_SHLOCK: int = 0x10; 70 export def O_EXLOCK: int = 0x20; 71 export def O_ASYNC: int = 0x40; 72 export def O_FSYNC: int = 0x80; 73 export def O_SYNC: int = 0x80; 74 export def O_NOFOLLOW: int = 0x100; 75 export def O_CREAT: int = 0x200; 76 export def O_TRUNC: int = 0x400; 77 export def O_EXCL: int = 0x800; 78 export def O_DSYNC: int = O_SYNC; 79 export def O_RSYNC: int = O_SYNC; 80 export def O_NOCTTY: int = 0x8000; 81 export def O_CLOEXEC: int = 0x10000; 82 export def O_DIRECTORY: int = 0x20000; 83 84 export def WAIT_ANY: pid_t = -1; 85 export def WAIT_MYPGRP: pid_t = 0; 86 87 export def WNOHANG: int = 0x1; 88 export def WUNTRACED: int = 0x2; 89 export def WSTOPPED: int = WUNTRACED; 90 export def WEXITED: int = 0x4; 91 export def WCONTINUED: int = 0x8; 92 export def WNOWAIT: int = 0x10; 93 export def WTRAPPED: int = 0x20; 94 95 export fn wtermsig(status: int) int = status & 0o177; 96 97 export fn wifexited(status: int) bool = wtermsig(status) == 0; 98 export fn wexitstatus(status: int) int = (status >> 8) & 0xff; 99 100 export fn wifsignaled(status: int) bool = 101 wtermsig(status) != 0o177 && wtermsig(status) != 0; 102 103 export type rusage = struct { 104 ru_utime: timeval, 105 ru_stime: timeval, 106 ru_maxrss: i64, 107 ru_ixrss: i64, 108 ru_idrss: i64, 109 ru_isrss: i64, 110 ru_minflt: i64, 111 ru_majflt: i64, 112 ru_nswap: i64, 113 ru_inblock: i64, 114 ru_oublock: i64, 115 ru_msgsnd: i64, 116 ru_msgrcv: i64, 117 ru_nsignals: i64, 118 ru_nvcsw: i64, 119 ru_nivcsw: i64, 120 }; 121 122 export def RUSAGE_SELF: int = 0; 123 export def RUSAGE_CHILDREN: int = -1; 124 export def RUSAGE_THREAD: int = 1; 125 126 export def F_OK: int = 0; 127 export def X_OK: int = 0x1; 128 export def W_OK: int = 0x2; 129 export def R_OK: int = 0x4; 130 131 export def AT_FDCWD: int = -100; 132 export def AT_EACCESS: int = 0x1; 133 export def AT_SYMLINK_NOFOLLOW: int = 0x2; 134 export def AT_SYMLINK_FOLLOW: int = 0x4; 135 export def AT_REMOVEDIR: int = 0x8; 136 137 export def PROT_NONE: int = 0x0; 138 export def PROT_READ: int = 0x1; 139 export def PROT_WRITE: int = 0x2; 140 export def PROT_EXEC: int = 0x4; 141 142 export def MAP_SHARED: int = 0x1; 143 export def MAP_PRIVATE: int = 0x2; 144 export def MAP_FIXED: int = 0x10; 145 export def __MAP_NOREPLACE: int = 0x800; 146 export def MAP_ANON: int = 0x1000; 147 export def __MAP_NOFAULT: int = 0x2000; 148 export def MAP_STACK: int = 0x4000; 149 export def MAP_CONCEAL: int = 0x8000; 150 151 export def MAP_FLAGMASK: int = 0xfff7; 152 153 export def RB_AUTOBOOT: int = 0x0; 154 export def RB_ASKNAME: int = 0x1; 155 export def RB_SINGLE: int = 0x2; 156 export def RB_NOSYNC: int = 0x4; 157 export def RB_HALT: int = 0x8; 158 export def RB_INITNAME: int = 0x10; 159 export def RB_DFLTROOT: int = 0x20; 160 export def RB_KDB: int = 0x40; 161 export def RB_RDONLY: int = 0x80; 162 export def RB_DUMP: int = 0x100; 163 export def RB_MINIROOT: int = 0x200; 164 export def RB_CONFIG: int = 0x400; 165 export def RB_TIMEBAD: int = 0x800; 166 export def RB_POWERDOWN: int = 0x1000; 167 export def RB_SERCONS: int = 0x2000; 168 export def RB_USERREQ: int = 0x4000; 169 export def RB_RESET: int = 0x8000; 170 export def RB_GOODRANDOM: int = 0x10000; 171 export def RB_UNHIBERNATE: int = 0x20000; 172 173 export def NGROUPS_MAX: size = 16; 174 175 export type timespec = struct { 176 tv_sec: time_t, 177 tv_nsec: i64, 178 }; 179 180 export def UTIME_OMIT = -0x1; 181 182 export def CLOCK_REALTIME: clockid_t = 0; 183 export def CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; 184 export def CLOCK_MONOTONIC: clockid_t = 3; 185 export def CLOCK_THREAD_CPUTIME_ID: clockid_t = 4; 186 export def CLOCK_UPTIME: clockid_t = 5; 187 export def CLOCK_BOOTTIME: clockid_t = 6; 188 189 export def F_DUPFD: int = 0; 190 export def F_GETFD: int = 1; 191 export def F_SETFD: int = 2; 192 export def F_GETFL: int = 3; 193 export def F_SETFL: int = 4; 194 export def F_GETOWN: int = 5; 195 export def F_SETOWN: int = 6; 196 export def F_GETLK: int = 7; 197 export def F_SETLK: int = 8; 198 export def F_SETLKW: int = 9; 199 export def F_DUPFD_CLOEXEC: int = 10; 200 export def F_ISATTY: int = 11; 201 202 export def FD_CLOEXEC: int = 1; 203 204 export def F_RDLCK: i16 = 1; 205 export def F_UNLCK: i16 = 2; 206 export def F_WRLCK: i16 = 3; 207 208 export type st_flock = struct { 209 l_start: off_t, 210 l_len: off_t, 211 l_pid: pid_t, 212 l_type: i16, 213 l_whence: i16, 214 }; 215 216 export type dirent = struct { 217 d_fileno: ino_t, 218 d_off: off_t, 219 d_reclen: u16, 220 d_type: u8, 221 d_namlen: u8, 222 __d_padding: [4]u8, 223 d_name: [*]u8, 224 }; 225 226 export def MAXNAMLEN: size = 255; 227 export def MAXHOSTNAMELEN: size = 255; 228 export def DT_UNKNOWN: u8 = 0; 229 export def DT_FIFO: u8 = 1; 230 export def DT_CHR: u8 = 2; 231 export def DT_DIR: u8 = 4; 232 export def DT_BLK: u8 = 6; 233 export def DT_REG: u8 = 8; 234 export def DT_LNK: u8 = 10; 235 export def DT_SOCK: u8 = 12; 236 237 export type pollfd = struct { 238 fd: int, 239 events: i16, 240 revents: i16, 241 }; 242 243 export def POLLIN: i16 = 0x1; 244 export def POLLPRI: i16 = 0x2; 245 export def POLLOUT: i16 = 0x4; 246 export def POLLERR: i16 = 0x8; 247 export def POLLHUP: i16 = 0x10; 248 export def POLLNVAL: i16 = 0x20; 249 export def POLLRDNORM: i16 = 0x40; 250 export def POLLNORM: i16 = POLLRDNORM; 251 export def POLLWRNORM: i16 = POLLOUT; 252 export def POLLRDBAND: i16 = 0x80; 253 export def POLLWRBAND: i16 = 0x100; 254 255 export type iovec = struct { 256 iov_base: *opaque, 257 iov_len: size, 258 }; 259 260 export def NSIG: int = 32; 261 262 export type sigact = struct { 263 union { 264 sa_handler: *fn (int) void, 265 sa_sigaction: *fn (int, *siginfo, *opaque) void, 266 }, 267 sa_mask: sigset, 268 sa_flags: int, 269 }; 270 271 export type siginfo = struct { 272 si_signo: int, 273 si_code: int, 274 si_errno: int, 275 _data: union { 276 _pad: [128/4 - 3]int, 277 _proc: struct { 278 _pid: pid_t, 279 _uid: uid_t, 280 _pdata: union { 281 _kill: struct { 282 _value: sigval, 283 }, 284 _cid: struct { 285 _utime: clock_t, 286 _stime: clock_t, 287 _status: int 288 }, 289 }, 290 }, 291 _fault: struct { 292 _addr: nullable *opaque, 293 _trapno: int, 294 }, 295 }, 296 }; 297 298 export type sigval = union { 299 sival_int: int, 300 sival_ptr: *opaque, 301 }; 302 303 export type stack_t = struct { 304 ss_sp: *opaque, 305 ss_size: size, 306 ss_flags: int, 307 }; 308 309 export type timeval = struct { 310 tv_sec: time_t, 311 tv_usec: suseconds_t, 312 }; 313 314 export type stat = struct { 315 st_mode: mode_t, 316 st_dev: dev_t, 317 st_ino: ino_t, 318 st_nlink: nlink_t, 319 st_uid: uid_t, 320 st_gid: gid_t, 321 st_rdev: dev_t, 322 st_atim: timespec, 323 st_mtim: timespec, 324 st_ctim: timespec, 325 st_size: off_t, 326 st_blocks: blkcnt_t, 327 st_blksize: blksize_t, 328 st_flags: u32, 329 st_gen: u32, 330 st_birthtim: timespec, 331 }; 332 333 export type winsize = struct { 334 ws_row: u16, 335 ws_col: u16, 336 ws_xpixel: u16, 337 ws_ypixel: u16, 338 }; 339 340 export type termios = struct { 341 c_iflag: tcflag, 342 c_oflag: tcflag, 343 c_cflag: tcflag, 344 c_lflag: tcflag, 345 c_cc: [NCCS]cc, 346 c_ispeed: int, 347 c_ospeed: int, 348 }; 349 350 export def NCCS: size = 20; 351 352 export type tcflag = enum uint { 353 // c_iflag bits 354 IGNBRK = 0x1, 355 BRKINT = 0x2, 356 IGNPAR = 0x4, 357 PARMRK = 0x8, 358 INPCK = 0x10, 359 ISTRIP = 0x20, 360 INLCR = 0x40, 361 IGNCR = 0x80, 362 ICRNL = 0x100, 363 IXON = 0x200, 364 IXOFF = 0x400, 365 IXANY = 0x800, 366 IUCLC = 0x1000, 367 IMAXBEL = 0x2000, 368 369 // c_oflag bits 370 OPOST = 0x1, 371 ONLCR = 0x2, 372 TABDLY = 0x4, 373 TAB0 = 0x0, 374 TAB3 = 0x4, 375 OXTABS = TAB3, 376 ONOEOT = 0x8, 377 OCRNL = 0x10, 378 OLCUC = 0x20, 379 ONOCR = 0x40, 380 ONLRET = 0x80, 381 382 // c_cflag bits 383 CIGNORE = 0x1, 384 CSIZE = 0x300, 385 CS5 = 0x0, 386 CS6 = 0x100, 387 CS7 = 0x200, 388 CS8 = 0x300, 389 CSTOPB = 0x400, 390 CREAD = 0x800, 391 PARENB = 0x1000, 392 PARODD = 0x2000, 393 HUPCL = 0x4000, 394 CLOCAL = 0x8000, 395 CRTSCTS = 0x10000, 396 CRTS_IFLOW = CRTSCTS, 397 CCTS_OFLOW = CRTSCTS, 398 MDMBUF = 0x100000, 399 CHWFLOW = (MDMBUF | CRTSCTS), 400 401 // c_lflag bits 402 ECHOKE = 0x1, 403 ECHOE = 0x2, 404 ECHOK = 0x4, 405 ECHO = 0x8, 406 ECHONL = 0x10, 407 ECHOPRT = 0x20, 408 ECHOCTL = 0x40, 409 ISIG = 0x80, 410 ICANON = 0x100, 411 ALTWERASE = 0x200, 412 IEXTEN = 0x400, 413 EXTPROC = 0x800, 414 TOSTOP = 0x400000, 415 FLUSHO = 0x800000, 416 XCASE = 0x1000000, 417 NOKERNINFO = 0x2000000, 418 PENDIN = 0x20000000, 419 NOFLSH = 0x80000000, 420 }; 421 422 export type cc = enum u8 { 423 VEOF = 0, 424 VEOL = 1, 425 VEOL2 = 2, 426 VERASE = 3, 427 VWERASE = 4, 428 VKILL = 5, 429 VREPRINT = 6, 430 VERASE2 = 7, 431 VINTR = 8, 432 VQUIT = 9, 433 VSUSP = 10, 434 VDSUSP = 11, 435 VSTART = 12, 436 VSTOP = 13, 437 VLNEXT = 14, 438 VDISCARD = 15, 439 VMIN = 16, 440 VTIME = 17, 441 VSTATUS = 18, 442 }; 443 444 export def TIOCSPGRP: u64 = 0x80047476; 445 export def TIOCGWINSZ: u64 = 0x40087468; 446 export def TIOCSWINSZ: u64 = 0x80087467; 447 export def TIOCGETA: u64 = 0x402c7413; 448 export def TIOCSETA: u64 = 0x802c7414; 449 450 export def SIG_DFL: uintptr = 0; 451 export def SIG_IGN: uintptr = 1; 452 453 export def SIG_BLOCK: int = 1; 454 export def SIG_UNBLOCK: int = 2; 455 export def SIG_SETMASK: int = 3; 456 457 export def SA_ONSTACK: int = 0x1; 458 export def SA_RESTART: int = 0x2; 459 export def SA_RESETHAND: int = 0x4; 460 export def SA_NOCLDSTOP: int = 0x8; 461 export def SA_NODEFER: int = 0x10; 462 export def SA_NOCLDWAIT: int = 0x20; 463 export def SA_SIGINFO: u64 = 0x40; 464 465 export def SIGHUP: int = 1; 466 export def SIGINT: int = 2; 467 export def SIGQUIT: int = 3; 468 export def SIGILL: int = 4; 469 export def SIGTRAP: int = 5; 470 export def SIGABRT: int = 6; 471 export def SIGEMT: int = 7; 472 export def SIGFPE: int = 8; 473 export def SIGKILL: int = 9; 474 export def SIGBUS: int = 10; 475 export def SIGSEGV: int = 11; 476 export def SIGSYS: int = 12; 477 export def SIGPIPE: int = 13; 478 export def SIGALRM: int = 14; 479 export def SIGTERM: int = 15; 480 export def SIGURG: int = 16; 481 export def SIGSTOP: int = 17; 482 export def SIGTSTP: int = 18; 483 export def SIGCONT: int = 19; 484 export def SIGCHLD: int = 20; 485 export def SIGTTIN: int = 21; 486 export def SIGTTOU: int = 22; 487 export def SIGIO: int = 23; 488 export def SIGXCPU: int = 24; 489 export def SIGXFSZ: int = 25; 490 export def SIGVTALRM: int = 26; 491 export def SIGPROF: int = 27; 492 export def SIGWINCH: int = 28; 493 export def SIGINFO: int = 29; 494 export def SIGUSR1: int = 30; 495 export def SIGUSR2: int = 31; 496 export def SIGTHR: int = 32; 497 498 export def PRIO_PROCESS: int = 0; 499 export def PRIO_PGRP: int = 1; 500 export def PRIO_USER: int = 2; 501 502 export def STDIN_FILENO: int = 0; 503 export def STDOUT_FILENO: int = 1; 504 export def STDERR_FILENO: int = 2; 505 506 export def SEEK_SET: int = 0; 507 export def SEEK_CUR: int = 1; 508 export def SEEK_END: int = 2; 509 510 export def LOCK_SH: int = 1; 511 export def LOCK_EX: int = 2; 512 export def LOCK_NB: int = 4; 513 export def LOCK_UN: int = 8; 514 515 // sysctl 516 export def CTL_KERN: int = 1; 517 export def CTL_VM: int = 2; 518 export def CTL_FS: int = 3; 519 export def CTL_NET: int = 4; 520 export def CTL_DEBUG: int = 5; 521 export def CTL_HW: int = 6; 522 export def CTL_MACHDEP: int = 7; 523 export def CTL_DDB: int = 9; 524 export def CTL_VFS: int = 10; 525 526 export def KERN_OSTYPE: int = 1; 527 export def KERN_OSRELEASE: int = 2; 528 export def KERN_OSREV: int = 3; 529 export def KERN_VERSION: int = 4; 530 export def KERN_MAXVNODES: int = 5; 531 export def KERN_MAXPROC: int = 6; 532 export def KERN_MAXFILES: int = 7; 533 export def KERN_ARGMAX: int = 8; 534 export def KERN_SECURELVL: int = 9; 535 export def KERN_HOSTNAME: int = 10; 536 export def KERN_HOSTID: int = 11; 537 export def KERN_CLOCKRATE: int = 12; 538 export def KERN_PROF: int = 16; 539 export def KERN_POSIX1: int = 17; 540 export def KERN_NGROUPS: int = 18; 541 export def KERN_JOB_CONTROL: int = 19; 542 export def KERN_SAVED_IDS: int = 20; 543 export def KERN_BOOTTIME: int = 21; 544 export def KERN_DOMAINNAME: int = 22; 545 export def KERN_MAXPARTITIONS: int = 23; 546 export def KERN_RAWPARTITION: int = 24; 547 export def KERN_MAXTHREAD: int = 25; 548 export def KERN_NTHREADS: int = 26; 549 export def KERN_OSVERSION: int = 27; 550 export def KERN_SOMAXCONN: int = 28; 551 export def KERN_SOMINCONN: int = 29; 552 export def KERN_NOSUIDCOREDUMP: int = 32; 553 export def KERN_FSYNC: int = 33; 554 export def KERN_SYSVMSG: int = 34; 555 export def KERN_SYSVSEM: int = 35; 556 export def KERN_SYSVSHM: int = 36; 557 export def KERN_MSGBUFSIZE: int = 38; 558 export def KERN_MALLOCSTATS: int = 39; 559 export def KERN_CPTIME: int = 40; 560 export def KERN_NCHSTATS: int = 41; 561 export def KERN_FORKSTAT: int = 42; 562 export def KERN_TTY: int = 44; 563 export def KERN_CCPU: int = 45; 564 export def KERN_FSCALE: int = 46; 565 export def KERN_NPROCS: int = 47; 566 export def KERN_MSGBUF: int = 48; 567 export def KERN_POOL: int = 49; 568 export def KERN_STACKGAPRANDOM: int = 50; 569 export def KERN_SYSVIPC_INFO: int = 51; 570 export def KERN_ALLOWKMEM: int = 52; 571 export def KERN_WITNESSWATCH: int = 53; 572 export def KERN_SPLASSERT: int = 54; 573 export def KERN_PROC_ARGS: int = 55; 574 export def KERN_NFILES: int = 56; 575 export def KERN_TTYCOUNT: int = 57; 576 export def KERN_NUMVNODES: int = 58; 577 export def KERN_MBSTAT: int = 59; 578 export def KERN_WITNESS: int = 60; 579 export def KERN_SEMINFO: int = 61; 580 export def KERN_SHMINFO: int = 62; 581 export def KERN_INTRCNT: int = 63; 582 export def KERN_WATCHDOG: int = 64; 583 export def KERN_ALLOWDT: int = 65; 584 export def KERN_PROC: int = 66; 585 export def KERN_MAXCLUSTERS: int = 67; 586 export def KERN_EVCOUNT: int = 68; 587 export def KERN_TIMECOUNTER: int = 69; 588 export def KERN_MAXLOCKSPERUID: int = 70; 589 export def KERN_CPTIME2: int = 71; 590 export def KERN_CACHEPCT: int = 72; 591 export def KERN_FILE: int = 73; 592 export def KERN_WXABORT: int = 74; 593 export def KERN_CONSDEV: int = 75; 594 export def KERN_NETLIVELOCKS: int = 76; 595 export def KERN_POOL_DEBUG: int = 77; 596 export def KERN_PROC_CWD: int = 78; 597 export def KERN_PROC_NOBROADCASTKILL: int = 79; 598 export def KERN_PROC_VMMAP: int = 80; 599 export def KERN_GLOBAL_PTRACE: int = 81; 600 export def KERN_CONSBUFSIZE: int = 82; 601 export def KERN_CONSBUF: int = 83; 602 export def KERN_AUDIO: int = 84; 603 export def KERN_CPUSTATS: int = 85; 604 export def KERN_PFSTATUS: int = 86; 605 export def KERN_TIMEOUT_STATS: int = 87; 606 export def KERN_UTC_OFFSET: int = 88; 607 export def KERN_VIDEO: int = 89; 608 export def KERN_CLOCKINTR: int = 90; 609 export def KERN_AUTOCONF_SERIAL: int = 91; 610 export def KERN_MAXID: int = 92; 611 612 export def KERN_PROC_ALL: int = 0; 613 export def KERN_PROC_PID: int = 1; 614 export def KERN_PROC_PGRP: int = 2; 615 export def KERN_PROC_SESSION: int = 3; 616 export def KERN_PROC_TTY: int = 4; 617 export def KERN_PROC_UID: int = 5; 618 export def KERN_PROC_RUID: int = 6; 619 export def KERN_PROC_KTHREAD: int = 7; 620 export def KERN_PROC_SHOW_THREADS: int = 0x40000000; 621 622 export def KERN_SYSVIPC_MSG_INFO: int = 1; 623 export def KERN_SYSVIPC_SEM_INFO: int = 2; 624 export def KERN_SYSVIPC_SHM_INFO: int = 3; 625 626 export def KERN_PROC_ARGV: int = 1; 627 export def KERN_PROC_NARGV: int = 2; 628 export def KERN_PROC_ENV: int = 3; 629 export def KERN_PROC_NENV: int = 4; 630 631 export def KERN_AUDIO_RECORD: int = 1; 632 export def KERN_AUDIO_MAXID: int = 2; 633 634 export def KERN_VIDEO_RECORD: int = 1; 635 export def KERN_VIDEO_MAXID: int = 2; 636 637 export def KERN_FILE_BYFILE: int = 1; 638 export def KERN_FILE_BYPID: int = 2; 639 export def KERN_FILE_BYUID: int = 3; 640 export def KERN_FILESLOP: int = 10; 641 642 export def KERN_FILE_TEXT: int = -1; 643 export def KERN_FILE_CDIR: int = -2; 644 export def KERN_FILE_RDIR: int = -3; 645 export def KERN_FILE_TRACE: int = -4; 646 647 export def KI_MNAMELEN: int = 96; 648 export def KI_UNPPATHLEN: int = 104; 649 650 export def KERN_INTRCNT_NUM: int = 1; 651 export def KERN_INTRCNT_CNT: int = 2; 652 export def KERN_INTRCNT_NAME: int = 3; 653 export def KERN_INTRCNT_VECTOR: int = 4; 654 export def KERN_INTRCNT_MAXID: int = 5; 655 656 export def KERN_WATCHDOG_PERIOD: int = 1; 657 export def KERN_WATCHDOG_AUTO: int = 2; 658 export def KERN_WATCHDOG_MAXID: int = 3; 659 660 export def KERN_TIMECOUNTER_TICK: int = 1; 661 export def KERN_TIMECOUNTER_TIMESTEPWARNINGS: int = 2; 662 export def KERN_TIMECOUNTER_HARDWARE: int = 3; 663 export def KERN_TIMECOUNTER_CHOICE: int = 4; 664 export def KERN_TIMECOUNTER_MAXID: int = 5; 665 666 export def KERN_CLOCKINTR_STATS: int = 1; 667 export def KERN_CLOCKINTR_MAXID: int = 2; 668 669 export def FS_POSIX: int = 1; 670 export def FS_MAXID: int = 2; 671 672 export def FS_POSIX_SETUID: int = 1; 673 export def FS_POSIX_MAXID: int = 2; 674 675 export def HW_MACHINE: int = 1; 676 export def HW_MODEL: int = 2; 677 export def HW_NCPU: int = 3; 678 export def HW_BYTEORDER: int = 4; 679 export def HW_PHYSMEM: int = 5; 680 export def HW_USERMEM: int = 6; 681 export def HW_PAGESIZE: int = 7; 682 export def HW_DISKNAMES: int = 8; 683 export def HW_DISKSTATS: int = 9; 684 export def HW_DISKCOUNT: int = 10; 685 export def HW_SENSORS: int = 11; 686 export def HW_CPUSPEED: int = 12; 687 export def HW_SETPERF: int = 13; 688 export def HW_VENDOR: int = 14; 689 export def HW_PRODUCT: int = 15; 690 export def HW_VERSION: int = 16; 691 export def HW_SERIALNO: int = 17; 692 export def HW_UUID: int = 18; 693 export def HW_PHYSMEM64: int = 19; 694 export def HW_USERMEM64: int = 20; 695 export def HW_NCPUFOUND: int = 21; 696 export def HW_ALLOWPOWERDOWN: int = 22; 697 export def HW_PERFPOLICY: int = 23; 698 export def HW_SMT: int = 24; 699 export def HW_NCPUONLINE: int = 25; 700 export def HW_POWER: int = 26; 701 export def HW_BATTERY: int = 27; 702 export def HW_UCOMNAMES: int = 28; 703 export def HW_MAXID: int = 30; 704 705 export def HW_BATTERY_CHARGEMODE: int = 1; 706 export def HW_BATTERY_CHARGESTART: int = 2; 707 export def HW_BATTERY_CHARGESTOP: int = 3; 708 export def HW_BATTERY_MAXID: int = 4; 709 710 export def CTL_DEBUG_NAME: int = 0; 711 export def CTL_DEBUG_VALUE: int = 1; 712 export def CTL_DEBUG_MAXID: int = 20; 713 714 export def SI_NOINFO: int = 32767; 715 export def SI_USER: int = 0; 716 export def SI_LWP: int = -1; 717 export def SI_QUEUE: int = -2; 718 export def SI_TIMER: int = -3; 719 720 export def ILL_ILLOPC: int = 1; 721 export def ILL_ILLOPN: int = 2; 722 export def ILL_ILLADR: int = 3; 723 export def ILL_ILLTRP: int = 4; 724 export def ILL_PRVOPC: int = 5; 725 export def ILL_PRVREG: int = 6; 726 export def ILL_COPROC: int = 7; 727 export def ILL_BADSTK: int = 8; 728 729 export def FPE_INTDIV: int = 1; 730 export def FPE_INTOVF: int = 2; 731 export def FPE_FLTDIV: int = 3; 732 export def FPE_FLTOVF: int = 4; 733 export def FPE_FLTUND: int = 5; 734 export def FPE_FLTRES: int = 6; 735 export def FPE_FLTINV: int = 7; 736 export def FPE_FLTSUB: int = 8; 737 738 export def SEGV_MAPERR: int = 1; 739 export def SEGV_ACCERR: int = 2; 740 741 export def BUS_ADRALN: int = 1; 742 export def BUS_ADRERR: int = 2; 743 export def BUS_OBJERR: int = 3; 744 745 export def TRAP_BRKPT: int = 1; 746 export def TRAP_TRACE: int = 2; 747 748 export def CLD_EXITED: int = 1; 749 export def CLD_KILLED: int = 2; 750 export def CLD_DUMPED: int = 3; 751 export def CLD_TRAPPED: int = 4; 752 export def CLD_STOPPED: int = 5; 753 export def CLD_CONTINUED: int = 6; 754 755 export def EVFILT_READ: i16 = -1; 756 export def EVFILT_WRITE: i16 = -2; 757 export def EVFILT_AIO: i16 = -3; 758 export def EVFILT_VNODE: i16 = -4; 759 export def EVFILT_PROC: i16 = -5; 760 export def EVFILT_SIGNAL: i16 = -6; 761 export def EVFILT_TIMER: i16 = -7; 762 export def EVFILT_DEVICE: i16 = -8; 763 export def EVFILT_EXCEPT: i16 = -9; 764 765 export def EV_ADD: u16 = 0x0001; 766 export def EV_DELETE: u16 = 0x0002; 767 export def EV_ENABLE: u16 = 0x0004; 768 export def EV_DISABLE: u16 = 0x0008; 769 770 export def EV_ONESHOT: u16 = 0x0010; 771 export def EV_CLEAR: u16 = 0x0020; 772 export def EV_RECEIPT: u16 = 0x0040; 773 export def EV_DISPATCH: u16 = 0x0080; 774 775 export def EV_SYSFLAGS: u16 = 0xf800; 776 export def EV_FLAG1: u16 = 0x2000; 777 778 export def EV_EOF: u16 = 0x8000; 779 export def EV_ERROR: u16 = 0x4000; 780 781 export def NOTE_LOWAT: uint = 0x0001; 782 export def NOTE_EOF: uint = 0x0002; 783 784 export def NOTE_OOB: uint = 0x0004; 785 786 export def NOTE_DELETE: uint = 0x0001; 787 export def NOTE_WRITE: uint = 0x0002; 788 export def NOTE_EXTEND: uint = 0x0004; 789 export def NOTE_ATTRIB: uint = 0x0008; 790 export def NOTE_LINK: uint = 0x0010; 791 export def NOTE_RENAME: uint = 0x0020; 792 export def NOTE_REVOKE: uint = 0x0040; 793 export def NOTE_TRUNCATE: uint = 0x0080; 794 795 export def NOTE_EXIT: uint = 0x80000000; 796 export def NOTE_FORK: uint = 0x40000000; 797 export def NOTE_EXEC: uint = 0x20000000; 798 export def NOTE_PCTRLMASK: uint = 0xf0000000; 799 export def NOTE_PDATAMASK: uint = 0x000fffff; 800 801 export def NOTE_TRACK: uint = 0x00000001; 802 export def NOTE_TRACKERR: uint = 0x00000002; 803 export def NOTE_CHILD: uint = 0x00000004; 804 805 export def NOTE_CHANGE: uint = 0x00000001; 806 807 export def NOTE_MSECONDS: uint = 0x00000000; 808 export def NOTE_SECONDS: uint = 0x00000001; 809 export def NOTE_USECONDS: uint = 0x00000002; 810 export def NOTE_NSECONDS: uint = 0x00000003; 811 export def NOTE_ABSTIME: uint = 0x00000010; 812 813 export type kevent = struct { 814 ident: uintptr, 815 filter: i16, 816 flags: u16, 817 fflags: uint, 818 data: i64, 819 udata: nullable *opaque, 820 };