Debian Codegraph @

rt/+openbsd/types.ha

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