hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

types.ha (21338B)


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