| ... | @@ -14,8 +14,12 @@ pub extern "c" fn find_thread(thread_name: ?*c_void) i32; | ... | @@ -14,8 +14,12 @@ pub extern "c" fn find_thread(thread_name: ?*c_void) i32; |
| 14 | | 14 | |
| 15 | pub extern "c" fn get_system_info(system_info: *system_info) usize; | 15 | pub extern "c" fn get_system_info(system_info: *system_info) usize; |
| 16 | | 16 | |
| | 17 | pub extern "c" fn _get_team_info(team: c_int, team_info: *team_info, size: usize) i32; |
| | 18 | |
| | 19 | pub extern "c" fn _get_next_area_info(team: c_int, cookie: *i64, area_info: *area_info, size: usize) i32; |
| | 20 | |
| 17 | // TODO revisit if abi changes or better option becomes apparent | 21 | // TODO revisit if abi changes or better option becomes apparent |
| 18 | pub extern "c" fn _get_next_image_info(team: c_int, cookie: *i32, image_info: *image_info) usize; | 22 | pub extern "c" fn _get_next_image_info(team: c_int, cookie: *i32, image_info: *image_info, size: usize) i32; |
| 19 | | 23 | |
| 20 | pub extern "c" fn _kern_read_dir(fd: c_int, buf_ptr: [*]u8, nbytes: usize, maxcount: u32) usize; | 24 | pub extern "c" fn _kern_read_dir(fd: c_int, buf_ptr: [*]u8, nbytes: usize, maxcount: u32) usize; |
| 21 | | 25 | |
| ... | @@ -24,12 +28,12 @@ pub extern "c" fn _kern_read_stat(fd: c_int, path_ptr: [*]u8, traverse_link: boo | ... | @@ -24,12 +28,12 @@ pub extern "c" fn _kern_read_stat(fd: c_int, path_ptr: [*]u8, traverse_link: boo |
| 24 | pub extern "c" fn _kern_get_current_team() i32; | 28 | pub extern "c" fn _kern_get_current_team() i32; |
| 25 | | 29 | |
| 26 | pub const sem_t = extern struct { | 30 | pub const sem_t = extern struct { |
| 27 | _magic: u32, | 31 | type: i32, |
| 28 | _kern: extern struct { | 32 | u: extern union { |
| 29 | _count: u32, | 33 | named_sem_id: ?i32, |
| 30 | _flags: u32, | 34 | unnamed_sem: ?i32, |
| 31 | }, | 35 | }, |
| 32 | _padding: u32, | 36 | padding: [2]i32, |
| 33 | }; | 37 | }; |
| 34 | | 38 | |
| 35 | pub const pthread_attr_t = extern struct { | 39 | pub const pthread_attr_t = extern struct { |
| ... | @@ -47,6 +51,7 @@ pub const pthread_mutex_t = extern struct { | ... | @@ -47,6 +51,7 @@ pub const pthread_mutex_t = extern struct { |
| 47 | owner: i32 = -1, | 51 | owner: i32 = -1, |
| 48 | owner_count: i32 = 0, | 52 | owner_count: i32 = 0, |
| 49 | }; | 53 | }; |
| | 54 | |
| 50 | pub const pthread_cond_t = extern struct { | 55 | pub const pthread_cond_t = extern struct { |
| 51 | flags: u32 = 0, | 56 | flags: u32 = 0, |
| 52 | unused: i32 = -42, | 57 | unused: i32 = -42, |
| ... | @@ -54,15 +59,6 @@ pub const pthread_cond_t = extern struct { | ... | @@ -54,15 +59,6 @@ pub const pthread_cond_t = extern struct { |
| 54 | waiter_count: i32 = 0, | 59 | waiter_count: i32 = 0, |
| 55 | lock: i32 = 0, | 60 | lock: i32 = 0, |
| 56 | }; | 61 | }; |
| 57 | pub const pthread_rwlock_t = extern struct { | | |
| 58 | flags: u32 = 0, | | |
| 59 | owner: i32 = -1, | | |
| 60 | lock_sem: i32 = 0, | | |
| 61 | lock_count: i32 = 0, | | |
| 62 | reader_count: i32 = 0, | | |
| 63 | writer_count: i32 = 0, | | |
| 64 | waiters: [2]?*c_void = [_]?*c_void{ null, null }, | | |
| 65 | }; | | |
| 66 | | 62 | |
| 67 | pub const EAI = enum(c_int) { | 63 | pub const EAI = enum(c_int) { |
| 68 | /// address family for hostname not supported | 64 | /// address family for hostname not supported |
| ... | @@ -112,6 +108,12 @@ pub const EAI = enum(c_int) { | ... | @@ -112,6 +108,12 @@ pub const EAI = enum(c_int) { |
| 112 | | 108 | |
| 113 | pub const EAI_MAX = 15; | 109 | pub const EAI_MAX = 15; |
| 114 | | 110 | |
| | 111 | pub const AI = struct { |
| | 112 | pub const NUMERICSERV = 0x00000008; |
| | 113 | }; |
| | 114 | |
| | 115 | pub const AI_NUMERICSERV = AI.NUMERICSERV; |
| | 116 | |
| 115 | pub const fd_t = c_int; | 117 | pub const fd_t = c_int; |
| 116 | pub const pid_t = c_int; | 118 | pub const pid_t = c_int; |
| 117 | pub const uid_t = u32; | 119 | pub const uid_t = u32; |
| ... | @@ -120,43 +122,33 @@ pub const mode_t = c_uint; | ... | @@ -120,43 +122,33 @@ pub const mode_t = c_uint; |
| 120 | | 122 | |
| 121 | pub const socklen_t = u32; | 123 | pub const socklen_t = u32; |
| 122 | | 124 | |
| 123 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | | |
| 124 | pub const Kevent = extern struct { | | |
| 125 | ident: usize, | | |
| 126 | filter: i16, | | |
| 127 | flags: u16, | | |
| 128 | fflags: u32, | | |
| 129 | data: i64, | | |
| 130 | udata: usize, | | |
| 131 | // TODO ext | | |
| 132 | }; | | |
| 133 | | | |
| 134 | // Modes and flags for dlopen() | 125 | // Modes and flags for dlopen() |
| 135 | // include/dlfcn.h | 126 | // include/dlfcn.h |
| 136 | | 127 | |
| 137 | pub const POLL = struct { | 128 | pub const POLL = struct { |
| 138 | pub const IN = 0x0001; | 129 | /// input available |
| 139 | pub const ERR = 0x0004; | 130 | pub const IN = 70; |
| 140 | pub const NVAL = 0x1000; | 131 | /// output available |
| 141 | pub const HUP = 0x0080; | 132 | pub const OUT = 71; |
| | 133 | /// input message available |
| | 134 | pub const MSG = 72; |
| | 135 | /// I/O error |
| | 136 | pub const ERR = 73; |
| | 137 | /// high priority input available |
| | 138 | pub const PRI = 74; |
| | 139 | /// device disconnected |
| | 140 | pub const HUP = 75; |
| 142 | }; | 141 | }; |
| 143 | | 142 | |
| 144 | pub const RTLD = struct { | 143 | pub const RTLD = struct { |
| 145 | /// Bind function calls lazily. | 144 | /// relocations are performed as needed |
| 146 | pub const LAZY = 1; | 145 | pub const LAZY = 0; |
| 147 | /// Bind function calls immediately. | 146 | /// the file gets relocated at load time |
| 148 | pub const NOW = 2; | 147 | pub const NOW = 1; |
| 149 | pub const MODEMASK = 0x3; | 148 | /// all symbols are available |
| 150 | /// Make symbols globally available. | 149 | pub const GLOBAL = 2; |
| 151 | pub const GLOBAL = 0x100; | 150 | /// symbols are not available for relocating any other object |
| 152 | /// Opposite of GLOBAL, and the default. | | |
| 153 | pub const LOCAL = 0; | 151 | pub const LOCAL = 0; |
| 154 | /// Trace loaded objects and exit. | | |
| 155 | pub const TRACE = 0x200; | | |
| 156 | /// Do not remove members. | | |
| 157 | pub const NODELETE = 0x01000; | | |
| 158 | /// Do not load if not already loaded. | | |
| 159 | pub const NOLOAD = 0x02000; | | |
| 160 | }; | 152 | }; |
| 161 | | 153 | |
| 162 | pub const dl_phdr_info = extern struct { | 154 | pub const dl_phdr_info = extern struct { |
| ... | @@ -167,13 +159,11 @@ pub const dl_phdr_info = extern struct { | ... | @@ -167,13 +159,11 @@ pub const dl_phdr_info = extern struct { |
| 167 | }; | 159 | }; |
| 168 | | 160 | |
| 169 | pub const Flock = extern struct { | 161 | pub const Flock = extern struct { |
| | 162 | l_type: c_short, |
| | 163 | l_whence: c_short, |
| 170 | l_start: off_t, | 164 | l_start: off_t, |
| 171 | l_len: off_t, | 165 | l_len: off_t, |
| 172 | l_pid: pid_t, | 166 | l_pid: pid_t, |
| 173 | l_type: i16, | | |
| 174 | l_whence: i16, | | |
| 175 | l_sysid: i32, | | |
| 176 | __unused: [4]u8, | | |
| 177 | }; | 167 | }; |
| 178 | | 168 | |
| 179 | pub const msghdr = extern struct { | 169 | pub const msghdr = extern struct { |
| ... | @@ -199,29 +189,6 @@ pub const msghdr = extern struct { | ... | @@ -199,29 +189,6 @@ pub const msghdr = extern struct { |
| 199 | msg_flags: i32, | 189 | msg_flags: i32, |
| 200 | }; | 190 | }; |
| 201 | | 191 | |
| 202 | pub const msghdr_const = extern struct { | | |
| 203 | /// optional address | | |
| 204 | msg_name: ?*const sockaddr, | | |
| 205 | | | |
| 206 | /// size of address | | |
| 207 | msg_namelen: socklen_t, | | |
| 208 | | | |
| 209 | /// scatter/gather array | | |
| 210 | msg_iov: [*]iovec_const, | | |
| 211 | | | |
| 212 | /// # elements in msg_iov | | |
| 213 | msg_iovlen: i32, | | |
| 214 | | | |
| 215 | /// ancillary data | | |
| 216 | msg_control: ?*c_void, | | |
| 217 | | | |
| 218 | /// ancillary data buffer len | | |
| 219 | msg_controllen: socklen_t, | | |
| 220 | | | |
| 221 | /// flags on received message | | |
| 222 | msg_flags: i32, | | |
| 223 | }; | | |
| 224 | | | |
| 225 | pub const off_t = i64; | 192 | pub const off_t = i64; |
| 226 | pub const ino_t = u64; | 193 | pub const ino_t = u64; |
| 227 | | 194 | |
| ... | @@ -282,16 +249,34 @@ pub const dirent = extern struct { | ... | @@ -282,16 +249,34 @@ pub const dirent = extern struct { |
| 282 | } | 249 | } |
| 283 | }; | 250 | }; |
| 284 | | 251 | |
| | 252 | pub const B_OS_NAME_LENGTH = 32; // OS.h |
| | 253 | |
| | 254 | pub const area_info = extern struct { |
| | 255 | area: u32, |
| | 256 | name: [B_OS_NAME_LENGTH]u8, |
| | 257 | size: usize, |
| | 258 | lock: u32, |
| | 259 | protection: u32, |
| | 260 | team_id: i32, |
| | 261 | ram_size: u32, |
| | 262 | copy_count: u32, |
| | 263 | in_count: u32, |
| | 264 | out_count: u32, |
| | 265 | address: *c_void, |
| | 266 | }; |
| | 267 | |
| | 268 | pub const MAXPATHLEN = PATH_MAX; |
| | 269 | |
| 285 | pub const image_info = extern struct { | 270 | pub const image_info = extern struct { |
| 286 | id: u32, | 271 | id: u32, |
| 287 | type: u32, | 272 | image_type: u32, |
| 288 | sequence: i32, | 273 | sequence: i32, |
| 289 | init_order: i32, | 274 | init_order: i32, |
| 290 | init_routine: *c_void, | 275 | init_routine: *c_void, |
| 291 | term_routine: *c_void, | 276 | term_routine: *c_void, |
| 292 | device: i32, | 277 | device: i32, |
| 293 | node: i32, | 278 | node: i64, |
| 294 | name: [1024]u8, | 279 | name: [MAXPATHLEN]u8, |
| 295 | text: *c_void, | 280 | text: *c_void, |
| 296 | data: *c_void, | 281 | data: *c_void, |
| 297 | text_size: i32, | 282 | text_size: i32, |
| ... | @@ -328,6 +313,19 @@ pub const system_info = extern struct { | ... | @@ -328,6 +313,19 @@ pub const system_info = extern struct { |
| 328 | abi: u32, | 313 | abi: u32, |
| 329 | }; | 314 | }; |
| 330 | | 315 | |
| | 316 | pub const team_info = extern struct { |
| | 317 | team_id: i32, |
| | 318 | thread_count: i32, |
| | 319 | image_count: i32, |
| | 320 | area_count: i32, |
| | 321 | debugger_nub_thread: i32, |
| | 322 | debugger_nub_port: i32, |
| | 323 | argc: i32, |
| | 324 | args: [64]u8, |
| | 325 | uid: uid_t, |
| | 326 | gid: gid_t, |
| | 327 | }; |
| | 328 | |
| 331 | pub const in_port_t = u16; | 329 | pub const in_port_t = u16; |
| 332 | pub const sa_family_t = u8; | 330 | pub const sa_family_t = u8; |
| 333 | | 331 | |
| ... | @@ -366,15 +364,11 @@ pub const sockaddr = extern struct { | ... | @@ -366,15 +364,11 @@ pub const sockaddr = extern struct { |
| 366 | }; | 364 | }; |
| 367 | }; | 365 | }; |
| 368 | | 366 | |
| 369 | pub const CTL = struct { | 367 | pub const CTL = struct {}; |
| 370 | pub const KERN = 1; | | |
| 371 | pub const DEBUG = 5; | | |
| 372 | }; | | |
| 373 | | 368 | |
| 374 | pub const KERN = struct { | 369 | pub const KERN = struct {}; |
| 375 | pub const PROC = 14; // struct: process entries | 370 | |
| 376 | pub const PROC_PATHNAME = 12; // path to executable | 371 | pub const IOV_MAX = 1024; |
| 377 | }; | | |
| 378 | | 372 | |
| 379 | pub const PATH_MAX = 1024; | 373 | pub const PATH_MAX = 1024; |
| 380 | | 374 | |
| ... | @@ -383,44 +377,46 @@ pub const STDOUT_FILENO = 1; | ... | @@ -383,44 +377,46 @@ pub const STDOUT_FILENO = 1; |
| 383 | pub const STDERR_FILENO = 2; | 377 | pub const STDERR_FILENO = 2; |
| 384 | | 378 | |
| 385 | pub const PROT = struct { | 379 | pub const PROT = struct { |
| 386 | pub const NONE = 0; | 380 | pub const READ = 0x01; |
| 387 | pub const READ = 1; | 381 | pub const WRITE = 0x02; |
| 388 | pub const WRITE = 2; | 382 | pub const EXEC = 0x04; |
| 389 | pub const EXEC = 4; | 383 | pub const NONE = 0x00; |
| 390 | }; | 384 | }; |
| 391 | | 385 | |
| 392 | pub const CLOCK = struct { | 386 | pub const CLOCK = struct { |
| | 387 | /// system-wide monotonic clock (aka system time) |
| 393 | pub const MONOTONIC = 0; | 388 | pub const MONOTONIC = 0; |
| | 389 | /// system-wide real time clock |
| 394 | pub const REALTIME = -1; | 390 | pub const REALTIME = -1; |
| | 391 | /// clock measuring the used CPU time of the current process |
| 395 | pub const PROCESS_CPUTIME_ID = -2; | 392 | pub const PROCESS_CPUTIME_ID = -2; |
| | 393 | /// clock measuring the used CPU time of the current thread |
| 396 | pub const THREAD_CPUTIME_ID = -3; | 394 | pub const THREAD_CPUTIME_ID = -3; |
| 397 | }; | 395 | }; |
| 398 | | 396 | |
| 399 | pub const MAP = struct { | 397 | pub const MAP = struct { |
| | 398 | /// mmap() error return code |
| 400 | pub const FAILED = @intToPtr(*c_void, maxInt(usize)); | 399 | pub const FAILED = @intToPtr(*c_void, maxInt(usize)); |
| 401 | pub const SHARED = 0x0001; | 400 | /// changes are seen by others |
| 402 | pub const PRIVATE = 0x0002; | 401 | pub const SHARED = 0x01; |
| 403 | pub const FIXED = 0x0010; | 402 | /// changes are only seen by caller |
| 404 | pub const STACK = 0x0400; | 403 | pub const PRIVATE = 0x02; |
| 405 | pub const NOSYNC = 0x0800; | 404 | /// require mapping to specified addr |
| 406 | pub const ANON = 0x1000; | 405 | pub const FIXED = 0x04; |
| 407 | pub const ANONYMOUS = ANON; | 406 | /// no underlying object |
| 408 | pub const FILE = 0; | 407 | pub const ANONYMOUS = 0x0008; |
| 409 | | 408 | pub const ANON = ANONYMOUS; |
| 410 | pub const GUARD = 0x00002000; | 409 | /// don't commit memory |
| 411 | pub const EXCL = 0x00004000; | 410 | pub const NORESERVE = 0x10; |
| 412 | pub const NOCORE = 0x00020000; | | |
| 413 | pub const PREFAULT_READ = 0x00040000; | | |
| 414 | pub const @"32BIT" = 0x00080000; | | |
| 415 | }; | 411 | }; |
| 416 | | 412 | |
| 417 | pub const W = struct { | 413 | pub const W = struct { |
| 418 | pub const NOHANG = 0x1; | 414 | pub const NOHANG = 0x1; |
| 419 | pub const UNTRACED = 0x2; | 415 | pub const UNTRACED = 0x2; |
| 420 | pub const STOPPED = 0x10; | | |
| 421 | pub const CONTINUED = 0x4; | 416 | pub const CONTINUED = 0x4; |
| 422 | pub const NOWAIT = 0x20; | | |
| 423 | pub const EXITED = 0x08; | 417 | pub const EXITED = 0x08; |
| | 418 | pub const STOPPED = 0x10; |
| | 419 | pub const NOWAIT = 0x20; |
| 424 | | 420 | |
| 425 | pub fn EXITSTATUS(s: u32) u8 { | 421 | pub fn EXITSTATUS(s: u32) u8 { |
| 426 | return @intCast(u8, s & 0xff); | 422 | return @intCast(u8, s & 0xff); |
| ... | @@ -431,11 +427,11 @@ pub const W = struct { | ... | @@ -431,11 +427,11 @@ pub const W = struct { |
| 431 | } | 427 | } |
| 432 | | 428 | |
| 433 | pub fn STOPSIG(s: u32) u32 { | 429 | pub fn STOPSIG(s: u32) u32 { |
| 434 | return EXITSTATUS(s); | 430 | return (s >> 16) & 0xff; |
| 435 | } | 431 | } |
| 436 | | 432 | |
| 437 | pub fn IFEXITED(s: u32) bool { | 433 | pub fn IFEXITED(s: u32) bool { |
| 438 | return TERMSIG(s) == 0; | 434 | return (s & ~@as(u32, 0xff)) == 0; |
| 439 | } | 435 | } |
| 440 | | 436 | |
| 441 | pub fn IFSTOPPED(s: u32) bool { | 437 | pub fn IFSTOPPED(s: u32) bool { |
| ... | @@ -499,28 +495,9 @@ pub const SIG = struct { | ... | @@ -499,28 +495,9 @@ pub const SIG = struct { |
| 499 | pub const RESERVED1 = 31; | 495 | pub const RESERVED1 = 31; |
| 500 | pub const RESERVED2 = 32; | 496 | pub const RESERVED2 = 32; |
| 501 | | 497 | |
| 502 | // TODO: check | | |
| 503 | pub const RTMIN = 65; | | |
| 504 | pub const RTMAX = 126; | | |
| 505 | | | |
| 506 | pub const BLOCK = 1; | 498 | pub const BLOCK = 1; |
| 507 | pub const UNBLOCK = 2; | 499 | pub const UNBLOCK = 2; |
| 508 | pub const SETMASK = 3; | 500 | pub const SETMASK = 3; |
| 509 | | | |
| 510 | pub const WORDS = 4; | | |
| 511 | pub const MAXSIG = 128; | | |
| 512 | pub inline fn IDX(sig: usize) usize { | | |
| 513 | return sig - 1; | | |
| 514 | } | | |
| 515 | pub inline fn WORD(sig: usize) usize { | | |
| 516 | return IDX(sig) >> 5; | | |
| 517 | } | | |
| 518 | pub inline fn BIT(sig: usize) usize { | | |
| 519 | return 1 << (IDX(sig) & 31); | | |
| 520 | } | | |
| 521 | pub inline fn VALID(sig: usize) usize { | | |
| 522 | return sig <= MAXSIG and sig > 0; | | |
| 523 | } | | |
| 524 | }; | 501 | }; |
| 525 | | 502 | |
| 526 | // access function | 503 | // access function |
| ... | @@ -534,60 +511,49 @@ pub const O = struct { | ... | @@ -534,60 +511,49 @@ pub const O = struct { |
| 534 | pub const WRONLY = 0x0001; | 511 | pub const WRONLY = 0x0001; |
| 535 | pub const RDWR = 0x0002; | 512 | pub const RDWR = 0x0002; |
| 536 | pub const ACCMODE = 0x0003; | 513 | pub const ACCMODE = 0x0003; |
| | 514 | pub const RWMASK = ACCMODE; |
| 537 | | 515 | |
| 538 | pub const SHLOCK = 0x0010; | 516 | pub const EXCL = 0x0100; |
| 539 | pub const EXLOCK = 0x0020; | | |
| 540 | | | |
| 541 | pub const CREAT = 0x0200; | 517 | pub const CREAT = 0x0200; |
| 542 | pub const EXCL = 0x0800; | | |
| 543 | pub const NOCTTY = 0x8000; | | |
| 544 | pub const TRUNC = 0x0400; | 518 | pub const TRUNC = 0x0400; |
| 545 | pub const APPEND = 0x0008; | 519 | pub const NOCTTY = 0x1000; |
| 546 | pub const NONBLOCK = 0x0004; | 520 | pub const NOTRAVERSE = 0x2000; |
| 547 | pub const DSYNC = 0o10000; | 521 | |
| 548 | pub const SYNC = 0x0080; | 522 | pub const CLOEXEC = 0x00000040; |
| 549 | pub const RSYNC = 0o4010000; | 523 | pub const NONBLOCK = 0x00000080; |
| 550 | pub const DIRECTORY = 0x20000; | | |
| 551 | pub const NOFOLLOW = 0x0100; | | |
| 552 | pub const CLOEXEC = 0x00100000; | | |
| 553 | | | |
| 554 | pub const ASYNC = 0x0040; | | |
| 555 | pub const DIRECT = 0x00010000; | | |
| 556 | pub const NOATIME = 0o1000000; | | |
| 557 | pub const PATH = 0o10000000; | | |
| 558 | pub const TMPFILE = 0o20200000; | | |
| 559 | pub const NDELAY = NONBLOCK; | 524 | pub const NDELAY = NONBLOCK; |
| | 525 | pub const APPEND = 0x00000800; |
| | 526 | pub const SYNC = 0x00010000; |
| | 527 | pub const RSYNC = 0x00020000; |
| | 528 | pub const DSYNC = 0x00040000; |
| | 529 | pub const NOFOLLOW = 0x00080000; |
| | 530 | pub const DIRECT = 0x00100000; |
| | 531 | pub const NOCACHE = DIRECT; |
| | 532 | pub const DIRECTORY = 0x00200000; |
| 560 | }; | 533 | }; |
| 561 | | 534 | |
| 562 | pub const F = struct { | 535 | pub const F = struct { |
| 563 | pub const DUPFD = 0; | 536 | pub const DUPFD = 0x0001; |
| 564 | pub const GETFD = 1; | 537 | pub const GETFD = 0x0002; |
| 565 | pub const SETFD = 2; | 538 | pub const SETFD = 0x0004; |
| 566 | pub const GETFL = 3; | 539 | pub const GETFL = 0x0008; |
| 567 | pub const SETFL = 4; | 540 | pub const SETFL = 0x0010; |
| 568 | | | |
| 569 | pub const GETOWN = 5; | | |
| 570 | pub const SETOWN = 6; | | |
| 571 | | | |
| 572 | pub const GETLK = 11; | | |
| 573 | pub const SETLK = 12; | | |
| 574 | pub const SETLKW = 13; | | |
| 575 | | 541 | |
| 576 | pub const RDLCK = 1; | 542 | pub const GETLK = 0x0020; |
| 577 | pub const WRLCK = 3; | 543 | pub const SETLK = 0x0080; |
| 578 | pub const UNLCK = 2; | 544 | pub const SETLKW = 0x0100; |
| | 545 | pub const DUPFD_CLOEXEC = 0x0200; |
| 579 | | 546 | |
| 580 | pub const SETOWN_EX = 15; | 547 | pub const RDLCK = 0x0040; |
| 581 | pub const GETOWN_EX = 16; | 548 | pub const UNLCK = 0x0200; |
| 582 | | 549 | pub const WRLCK = 0x0400; |
| 583 | pub const GETOWNER_UIDS = 17; | | |
| 584 | }; | 550 | }; |
| 585 | | 551 | |
| 586 | pub const LOCK = struct { | 552 | pub const LOCK = struct { |
| 587 | pub const SH = 1; | 553 | pub const SH = 0x01; |
| 588 | pub const EX = 2; | 554 | pub const EX = 0x02; |
| 589 | pub const UN = 8; | 555 | pub const NB = 0x04; |
| 590 | pub const NB = 4; | 556 | pub const UN = 0x08; |
| 591 | }; | 557 | }; |
| 592 | | 558 | |
| 593 | pub const FD_CLOEXEC = 1; | 559 | pub const FD_CLOEXEC = 1; |
| ... | @@ -602,161 +568,66 @@ pub const SOCK = struct { | ... | @@ -602,161 +568,66 @@ pub const SOCK = struct { |
| 602 | pub const STREAM = 1; | 568 | pub const STREAM = 1; |
| 603 | pub const DGRAM = 2; | 569 | pub const DGRAM = 2; |
| 604 | pub const RAW = 3; | 570 | pub const RAW = 3; |
| 605 | pub const RDM = 4; | | |
| 606 | pub const SEQPACKET = 5; | 571 | pub const SEQPACKET = 5; |
| 607 | | | |
| 608 | pub const CLOEXEC = 0x10000000; | | |
| 609 | pub const NONBLOCK = 0x20000000; | | |
| 610 | }; | 572 | }; |
| 611 | | 573 | |
| 612 | pub const SO = struct { | 574 | pub const SO = struct { |
| 613 | pub const DEBUG = 0x00000001; | 575 | pub const ACCEPTCONN = 0x00000001; |
| 614 | pub const ACCEPTCONN = 0x00000002; | 576 | pub const BROADCAST = 0x00000002; |
| 615 | pub const REUSEADDR = 0x00000004; | 577 | pub const DEBUG = 0x00000004; |
| 616 | pub const KEEPALIVE = 0x00000008; | 578 | pub const DONTROUTE = 0x00000008; |
| 617 | pub const DONTROUTE = 0x00000010; | 579 | pub const KEEPALIVE = 0x00000010; |
| 618 | pub const BROADCAST = 0x00000020; | 580 | pub const OOBINLINE = 0x00000020; |
| 619 | pub const USELOOPBACK = 0x00000040; | 581 | pub const REUSEADDR = 0x00000040; |
| 620 | pub const LINGER = 0x00000080; | 582 | pub const REUSEPORT = 0x00000080; |
| 621 | pub const OOBINLINE = 0x00000100; | 583 | pub const USELOOPBACK = 0x00000100; |
| 622 | pub const REUSEPORT = 0x00000200; | 584 | pub const LINGER = 0x00000200; |
| 623 | pub const TIMESTAMP = 0x00000400; | 585 | |
| 624 | pub const NOSIGPIPE = 0x00000800; | 586 | pub const SNDBUF = 0x40000001; |
| 625 | pub const ACCEPTFILTER = 0x00001000; | 587 | pub const SNDLOWAT = 0x40000002; |
| 626 | pub const BINTIME = 0x00002000; | 588 | pub const SNDTIMEO = 0x40000003; |
| 627 | pub const NO_OFFLOAD = 0x00004000; | 589 | pub const RCVBUF = 0x40000004; |
| 628 | pub const NO_DDP = 0x00008000; | 590 | pub const RCVLOWAT = 0x40000005; |
| 629 | pub const REUSEPORT_LB = 0x00010000; | 591 | pub const RCVTIMEO = 0x40000006; |
| 630 | | 592 | pub const ERROR = 0x40000007; |
| 631 | pub const SNDBUF = 0x1001; | 593 | pub const TYPE = 0x40000008; |
| 632 | pub const RCVBUF = 0x1002; | 594 | pub const NONBLOCK = 0x40000009; |
| 633 | pub const SNDLOWAT = 0x1003; | 595 | pub const BINDTODEVICE = 0x4000000a; |
| 634 | pub const RCVLOWAT = 0x1004; | 596 | pub const PEERCRED = 0x4000000b; |
| 635 | pub const SNDTIMEO = 0x1005; | | |
| 636 | pub const RCVTIMEO = 0x1006; | | |
| 637 | pub const ERROR = 0x1007; | | |
| 638 | pub const TYPE = 0x1008; | | |
| 639 | pub const LABEL = 0x1009; | | |
| 640 | pub const PEERLABEL = 0x1010; | | |
| 641 | pub const LISTENQLIMIT = 0x1011; | | |
| 642 | pub const LISTENQLEN = 0x1012; | | |
| 643 | pub const LISTENINCQLEN = 0x1013; | | |
| 644 | pub const SETFIB = 0x1014; | | |
| 645 | pub const USER_COOKIE = 0x1015; | | |
| 646 | pub const PROTOCOL = 0x1016; | | |
| 647 | pub const PROTOTYPE = PROTOCOL; | | |
| 648 | pub const TS_CLOCK = 0x1017; | | |
| 649 | pub const MAX_PACING_RATE = 0x1018; | | |
| 650 | pub const DOMAIN = 0x1019; | | |
| 651 | }; | 597 | }; |
| 652 | | 598 | |
| 653 | pub const SOL = struct { | 599 | pub const SOL = struct { |
| 654 | pub const SOCKET = 0xffff; | 600 | pub const SOCKET = -1; |
| 655 | }; | 601 | }; |
| 656 | | 602 | |
| 657 | pub const PF = struct { | 603 | pub const PF = struct { |
| 658 | pub const UNSPEC = AF.UNSPEC; | 604 | pub const UNSPEC = AF.UNSPEC; |
| 659 | pub const LOCAL = AF.LOCAL; | | |
| 660 | pub const UNIX = PF.LOCAL; | | |
| 661 | pub const INET = AF.INET; | 605 | pub const INET = AF.INET; |
| 662 | pub const IMPLINK = AF.IMPLINK; | | |
| 663 | pub const PUP = AF.PUP; | | |
| 664 | pub const CHAOS = AF.CHAOS; | | |
| 665 | pub const NETBIOS = AF.NETBIOS; | | |
| 666 | pub const ISO = AF.ISO; | | |
| 667 | pub const OSI = AF.ISO; | | |
| 668 | pub const ECMA = AF.ECMA; | | |
| 669 | pub const DATAKIT = AF.DATAKIT; | | |
| 670 | pub const CCITT = AF.CCITT; | | |
| 671 | pub const DECnet = AF.DECnet; | | |
| 672 | pub const DLI = AF.DLI; | | |
| 673 | pub const LAT = AF.LAT; | | |
| 674 | pub const HYLINK = AF.HYLINK; | | |
| 675 | pub const APPLETALK = AF.APPLETALK; | | |
| 676 | pub const ROUTE = AF.ROUTE; | 606 | pub const ROUTE = AF.ROUTE; |
| 677 | pub const LINK = AF.LINK; | 607 | pub const LINK = AF.LINK; |
| 678 | pub const XTP = AF.pseudo_XTP; | 608 | pub const INET6 = AF.INET6; |
| 679 | pub const COIP = AF.COIP; | 609 | pub const LOCAL = AF.LOCAL; |
| 680 | pub const CNT = AF.CNT; | 610 | pub const UNIX = AF.UNIX; |
| 681 | pub const SIP = AF.SIP; | | |
| 682 | pub const IPX = AF.IPX; | | |
| 683 | pub const RTIP = AF.pseudo_RTIP; | | |
| 684 | pub const PIP = AF.pseudo_PIP; | | |
| 685 | pub const ISDN = AF.ISDN; | | |
| 686 | pub const KEY = AF.pseudo_KEY; | | |
| 687 | pub const INET6 = AF.pseudo_INET6; | | |
| 688 | pub const NATM = AF.NATM; | | |
| 689 | pub const ATM = AF.ATM; | | |
| 690 | pub const NETGRAPH = AF.NETGRAPH; | | |
| 691 | pub const SLOW = AF.SLOW; | | |
| 692 | pub const SCLUSTER = AF.SCLUSTER; | | |
| 693 | pub const ARP = AF.ARP; | | |
| 694 | pub const BLUETOOTH = AF.BLUETOOTH; | 611 | pub const BLUETOOTH = AF.BLUETOOTH; |
| 695 | pub const IEEE80211 = AF.IEEE80211; | | |
| 696 | pub const INET_SDP = AF.INET_SDP; | | |
| 697 | pub const INET6_SDP = AF.INET6_SDP; | | |
| 698 | pub const MAX = AF.MAX; | | |
| 699 | }; | 612 | }; |
| 700 | | 613 | |
| 701 | pub const AF = struct { | 614 | pub const AF = struct { |
| 702 | pub const UNSPEC = 0; | 615 | pub const UNSPEC = 0; |
| 703 | pub const UNIX = 1; | 616 | pub const INET = 1; |
| 704 | pub const LOCAL = UNIX; | 617 | pub const APPLETALK = 2; |
| 705 | pub const FILE = LOCAL; | 618 | pub const ROUTE = 3; |
| 706 | pub const INET = 2; | 619 | pub const LINK = 4; |
| 707 | pub const IMPLINK = 3; | 620 | pub const INET6 = 5; |
| 708 | pub const PUP = 4; | 621 | pub const DLI = 6; |
| 709 | pub const CHAOS = 5; | 622 | pub const IPX = 7; |
| 710 | pub const NETBIOS = 6; | 623 | pub const NOTIFY = 8; |
| 711 | pub const ISO = 7; | 624 | pub const LOCAL = 9; |
| 712 | pub const OSI = ISO; | 625 | pub const UNIX = LOCAL; |
| 713 | pub const ECMA = 8; | 626 | pub const BLUETOOTH = 10; |
| 714 | pub const DATAKIT = 9; | 627 | pub const MAX = 11; |
| 715 | pub const CCITT = 10; | 628 | }; |
| 716 | pub const SNA = 11; | 629 | |
| 717 | pub const DECnet = 12; | 630 | pub const DT = struct {}; |
| 718 | pub const DLI = 13; | | |
| 719 | pub const LAT = 14; | | |
| 720 | pub const HYLINK = 15; | | |
| 721 | pub const APPLETALK = 16; | | |
| 722 | pub const ROUTE = 17; | | |
| 723 | pub const LINK = 18; | | |
| 724 | pub const pseudo_XTP = 19; | | |
| 725 | pub const COIP = 20; | | |
| 726 | pub const CNT = 21; | | |
| 727 | pub const pseudo_RTIP = 22; | | |
| 728 | pub const IPX = 23; | | |
| 729 | pub const SIP = 24; | | |
| 730 | pub const pseudo_PIP = 25; | | |
| 731 | pub const ISDN = 26; | | |
| 732 | pub const E164 = ISDN; | | |
| 733 | pub const pseudo_KEY = 27; | | |
| 734 | pub const INET6 = 28; | | |
| 735 | pub const NATM = 29; | | |
| 736 | pub const ATM = 30; | | |
| 737 | pub const pseudo_HDRCMPLT = 31; | | |
| 738 | pub const NETGRAPH = 32; | | |
| 739 | pub const SLOW = 33; | | |
| 740 | pub const SCLUSTER = 34; | | |
| 741 | pub const ARP = 35; | | |
| 742 | pub const BLUETOOTH = 36; | | |
| 743 | pub const IEEE80211 = 37; | | |
| 744 | pub const INET_SDP = 40; | | |
| 745 | pub const INET6_SDP = 42; | | |
| 746 | pub const MAX = 42; | | |
| 747 | }; | | |
| 748 | | | |
| 749 | pub const DT = struct { | | |
| 750 | pub const UNKNOWN = 0; | | |
| 751 | pub const FIFO = 1; | | |
| 752 | pub const CHR = 2; | | |
| 753 | pub const DIR = 4; | | |
| 754 | pub const BLK = 6; | | |
| 755 | pub const REG = 8; | | |
| 756 | pub const LNK = 10; | | |
| 757 | pub const SOCK = 12; | | |
| 758 | pub const WHT = 14; | | |
| 759 | }; | | |
| 760 | | 631 | |
| 761 | /// add event to kq (implies enable) | 632 | /// add event to kq (implies enable) |
| 762 | pub const EV_ADD = 0x0001; | 633 | pub const EV_ADD = 0x0001; |
| ... | @@ -822,26 +693,32 @@ pub const EVFILT_EMPTY = -13; | ... | @@ -822,26 +693,32 @@ pub const EVFILT_EMPTY = -13; |
| 822 | pub const T = struct { | 693 | pub const T = struct { |
| 823 | pub const CGETA = 0x8000; | 694 | pub const CGETA = 0x8000; |
| 824 | pub const CSETA = 0x8001; | 695 | pub const CSETA = 0x8001; |
| 825 | pub const CSETAW = 0x8004; | 696 | pub const CSETAF = 0x8002; |
| 826 | pub const CSETAF = 0x8003; | 697 | pub const CSETAW = 0x8003; |
| | 698 | pub const CWAITEVENT = 0x8004; |
| 827 | pub const CSBRK = 08005; | 699 | pub const CSBRK = 08005; |
| 828 | pub const CXONC = 0x8007; | | |
| 829 | pub const CFLSH = 0x8006; | 700 | pub const CFLSH = 0x8006; |
| 830 | | 701 | pub const CXONC = 0x8007; |
| 831 | pub const IOCSCTTY = 0x8017; | 702 | pub const CQUERYCONNECTED = 0x8008; |
| 832 | pub const IOCGPGRP = 0x8015; | 703 | pub const CGETBITS = 0x8009; |
| 833 | pub const IOCSPGRP = 0x8016; | 704 | pub const CSETDTR = 0x8010; |
| | 705 | pub const CSETRTS = 0x8011; |
| 834 | pub const IOCGWINSZ = 0x8012; | 706 | pub const IOCGWINSZ = 0x8012; |
| 835 | pub const IOCSWINSZ = 0x8013; | 707 | pub const IOCSWINSZ = 0x8013; |
| | 708 | pub const CVTIME = 0x8014; |
| | 709 | pub const IOCGPGRP = 0x8015; |
| | 710 | pub const IOCSPGRP = 0x8016; |
| | 711 | pub const IOCSCTTY = 0x8017; |
| 836 | pub const IOCMGET = 0x8018; | 712 | pub const IOCMGET = 0x8018; |
| 837 | pub const IOCMBIS = 0x8022; | | |
| 838 | pub const IOCMBIC = 0x8023; | | |
| 839 | pub const IOCMSET = 0x8019; | 713 | pub const IOCMSET = 0x8019; |
| 840 | pub const FIONREAD = 0xbe000001; | | |
| 841 | pub const FIONBIO = 0xbe000000; | | |
| 842 | pub const IOCSBRK = 0x8020; | 714 | pub const IOCSBRK = 0x8020; |
| 843 | pub const IOCCBRK = 0x8021; | 715 | pub const IOCCBRK = 0x8021; |
| | 716 | pub const IOCMBIS = 0x8022; |
| | 717 | pub const IOCMBIC = 0x8023; |
| 844 | pub const IOCGSID = 0x8024; | 718 | pub const IOCGSID = 0x8024; |
| | 719 | |
| | 720 | pub const FIONREAD = 0xbe000001; |
| | 721 | pub const FIONBIO = 0xbe000000; |
| 845 | }; | 722 | }; |
| 846 | | 723 | |
| 847 | pub const winsize = extern struct { | 724 | pub const winsize = extern struct { |
| ... | @@ -871,140 +748,105 @@ pub const sigset_t = extern struct { | ... | @@ -871,140 +748,105 @@ pub const sigset_t = extern struct { |
| 871 | __bits: [SIG.WORDS]u32, | 748 | __bits: [SIG.WORDS]u32, |
| 872 | }; | 749 | }; |
| 873 | | 750 | |
| | 751 | const B_POSIX_ERROR_BASE = -2147454976; |
| | 752 | |
| 874 | pub const E = enum(i32) { | 753 | pub const E = enum(i32) { |
| 875 | /// No error occurred. | 754 | @"2BIG" = B_POSIX_ERROR_BASE + 1, |
| 876 | SUCCESS = 0, | 755 | CHILD = B_POSIX_ERROR_BASE + 2, |
| 877 | PERM = -0x7ffffff1, // Operation not permitted | 756 | DEADLK = B_POSIX_ERROR_BASE + 3, |
| 878 | NOENT = -0x7fff9ffd, // No such file or directory | 757 | FBIG = B_POSIX_ERROR_BASE + 4, |
| 879 | SRCH = -0x7fff8ff3, // No such process | 758 | MLINK = B_POSIX_ERROR_BASE + 5, |
| | 759 | NFILE = B_POSIX_ERROR_BASE + 6, |
| | 760 | NODEV = B_POSIX_ERROR_BASE + 7, |
| | 761 | NOLCK = B_POSIX_ERROR_BASE + 8, |
| | 762 | NOSYS = B_POSIX_ERROR_BASE + 9, |
| | 763 | NOTTY = B_POSIX_ERROR_BASE + 10, |
| | 764 | NXIO = B_POSIX_ERROR_BASE + 11, |
| | 765 | SPIPE = B_POSIX_ERROR_BASE + 12, |
| | 766 | SRCH = B_POSIX_ERROR_BASE + 13, |
| | 767 | FPOS = B_POSIX_ERROR_BASE + 14, |
| | 768 | SIGPARM = B_POSIX_ERROR_BASE + 15, |
| | 769 | DOM = B_POSIX_ERROR_BASE + 16, |
| | 770 | RANGE = B_POSIX_ERROR_BASE + 17, |
| | 771 | PROTOTYPE = B_POSIX_ERROR_BASE + 18, |
| | 772 | PROTONOSUPPORT = B_POSIX_ERROR_BASE + 19, |
| | 773 | PFNOSUPPORT = B_POSIX_ERROR_BASE + 20, |
| | 774 | AFNOSUPPORT = B_POSIX_ERROR_BASE + 21, |
| | 775 | ADDRINUSE = B_POSIX_ERROR_BASE + 22, |
| | 776 | ADDRNOTAVAIL = B_POSIX_ERROR_BASE + 23, |
| | 777 | NETDOWN = B_POSIX_ERROR_BASE + 24, |
| | 778 | NETUNREACH = B_POSIX_ERROR_BASE + 25, |
| | 779 | NETRESET = B_POSIX_ERROR_BASE + 26, |
| | 780 | CONNABORTED = B_POSIX_ERROR_BASE + 27, |
| | 781 | CONNRESET = B_POSIX_ERROR_BASE + 28, |
| | 782 | ISCONN = B_POSIX_ERROR_BASE + 29, |
| | 783 | NOTCONN = B_POSIX_ERROR_BASE + 30, |
| | 784 | SHUTDOWN = B_POSIX_ERROR_BASE + 31, |
| | 785 | CONNREFUSED = B_POSIX_ERROR_BASE + 32, |
| | 786 | HOSTUNREACH = B_POSIX_ERROR_BASE + 33, |
| | 787 | NOPROTOOPT = B_POSIX_ERROR_BASE + 34, |
| | 788 | NOBUFS = B_POSIX_ERROR_BASE + 35, |
| | 789 | INPROGRESS = B_POSIX_ERROR_BASE + 36, |
| | 790 | ALREADY = B_POSIX_ERROR_BASE + 37, |
| | 791 | ILSEQ = B_POSIX_ERROR_BASE + 38, |
| | 792 | NOMSG = B_POSIX_ERROR_BASE + 39, |
| | 793 | STALE = B_POSIX_ERROR_BASE + 40, |
| | 794 | OVERFLOW = B_POSIX_ERROR_BASE + 41, |
| | 795 | MSGSIZE = B_POSIX_ERROR_BASE + 42, |
| | 796 | OPNOTSUPP = B_POSIX_ERROR_BASE + 43, |
| | 797 | NOTSOCK = B_POSIX_ERROR_BASE + 44, |
| | 798 | HOSTDOWN = B_POSIX_ERROR_BASE + 45, |
| | 799 | BADMSG = B_POSIX_ERROR_BASE + 46, |
| | 800 | CANCELED = B_POSIX_ERROR_BASE + 47, |
| | 801 | DESTADDRREQ = B_POSIX_ERROR_BASE + 48, |
| | 802 | DQUOT = B_POSIX_ERROR_BASE + 49, |
| | 803 | IDRM = B_POSIX_ERROR_BASE + 50, |
| | 804 | MULTIHOP = B_POSIX_ERROR_BASE + 51, |
| | 805 | NODATA = B_POSIX_ERROR_BASE + 52, |
| | 806 | NOLINK = B_POSIX_ERROR_BASE + 53, |
| | 807 | NOSR = B_POSIX_ERROR_BASE + 54, |
| | 808 | NOSTR = B_POSIX_ERROR_BASE + 55, |
| | 809 | NOTSUP = B_POSIX_ERROR_BASE + 56, |
| | 810 | PROTO = B_POSIX_ERROR_BASE + 57, |
| | 811 | TIME = B_POSIX_ERROR_BASE + 58, |
| | 812 | TXTBSY = B_POSIX_ERROR_BASE + 59, |
| | 813 | NOATTR = B_POSIX_ERROR_BASE + 60, |
| | 814 | NOTRECOVERABLE = B_POSIX_ERROR_BASE + 61, |
| | 815 | OWNERDEAD = B_POSIX_ERROR_BASE + 62, |
| | 816 | |
| | 817 | ACCES = -0x7ffffffe, // Permission denied |
| 880 | INTR = -0x7ffffff6, // Interrupted system call | 818 | INTR = -0x7ffffff6, // Interrupted system call |
| 881 | IO = -0x7fffffff, // Input/output error | 819 | IO = -0x7fffffff, // Input/output error |
| 882 | NXIO = -0x7fff8ff5, // Device not configured | | |
| 883 | @"2BIG" = -0x7fff8fff, // Argument list too long | | |
| 884 | NOEXEC = -0x7fffecfe, // Exec format error | | |
| 885 | CHILD = -0x7fff8ffe, // No child processes | | |
| 886 | DEADLK = -0x7fff8ffd, // Resource deadlock avoided | | |
| 887 | NOMEM = -0x80000000, // Cannot allocate memory | | |
| 888 | ACCES = -0x7ffffffe, // Permission denied | | |
| 889 | FAULT = -0x7fffecff, // Bad address | | |
| 890 | BUSY = -0x7ffffff2, // Device busy | 820 | BUSY = -0x7ffffff2, // Device busy |
| | 821 | FAULT = -0x7fffecff, // Bad address |
| | 822 | TIMEDOUT = -2147483639, // Operation timed out |
| | 823 | AGAIN = -0x7ffffff5, |
| | 824 | BADF = -0x7fffa000, // Bad file descriptor |
| 891 | EXIST = -0x7fff9ffe, // File exists | 825 | EXIST = -0x7fff9ffe, // File exists |
| 892 | XDEV = -0x7fff9ff5, // Cross-device link | 826 | INVAL = -0x7ffffffb, // Invalid argument |
| 893 | NODEV = -0x7fff8ff9, // Operation not supported by device | 827 | NAMETOOLONG = -2147459068, // File name too long |
| | 828 | NOENT = -0x7fff9ffd, // No such file or directory |
| | 829 | PERM = -0x7ffffff1, // Operation not permitted |
| 894 | NOTDIR = -0x7fff9ffb, // Not a directory | 830 | NOTDIR = -0x7fff9ffb, // Not a directory |
| 895 | ISDIR = -0x7fff9ff7, // Is a directory | 831 | ISDIR = -0x7fff9ff7, // Is a directory |
| 896 | INVAL = -0x7ffffffb, // Invalid argument | 832 | NOTEMPTY = -2147459066, // Directory not empty |
| 897 | NFILE = -0x7fff8ffa, // Too many open files in system | | |
| 898 | MFILE = -0x7fff9ff6, // Too many open files | | |
| 899 | NOTTY = -0x7fff8ff6, // Inappropriate ioctl for device | | |
| 900 | TXTBSY = -0x7fff8fc5, // Text file busy | | |
| 901 | FBIG = -0x7fff8ffc, // File too large | | |
| 902 | NOSPC = -0x7fff9ff9, // No space left on device | 833 | NOSPC = -0x7fff9ff9, // No space left on device |
| 903 | SPIPE = -0x7fff8ff4, // Illegal seek | | |
| 904 | ROFS = -0x7fff9ff8, // Read-only filesystem | 834 | ROFS = -0x7fff9ff8, // Read-only filesystem |
| 905 | MLINK = -0x7fff8ffb, // Too many links | 835 | MFILE = -0x7fff9ff6, // Too many open files |
| | 836 | XDEV = -0x7fff9ff5, // Cross-device link |
| | 837 | NOEXEC = -0x7fffecfe, // Exec format error |
| 906 | PIPE = -0x7fff9ff3, // Broken pipe | 838 | PIPE = -0x7fff9ff3, // Broken pipe |
| 907 | BADF = -0x7fffa000, // Bad file descriptor | 839 | NOMEM = -0x80000000, // Cannot allocate memory |
| 908 | | 840 | LOOP = -2147459060, // Too many levels of symbolic links |
| 909 | // math software | 841 | SUCCESS = 0, |
| 910 | DOM = 33, // Numerical argument out of domain | | |
| 911 | RANGE = 34, // Result too large | | |
| 912 | | | |
| 913 | // non-blocking and interrupt i/o | | |
| 914 | | | |
| 915 | /// Also used for `WOULDBLOCK`. | | |
| 916 | AGAIN = -0x7ffffff5, | | |
| 917 | INPROGRESS = -0x7fff8fdc, | | |
| 918 | ALREADY = -0x7fff8fdb, | | |
| 919 | | | |
| 920 | // ipc/network software -- argument errors | | |
| 921 | NOTSOCK = 38, // Socket operation on non-socket | | |
| 922 | DESTADDRREQ = 39, // Destination address required | | |
| 923 | MSGSIZE = 40, // Message too long | | |
| 924 | PROTOTYPE = 41, // Protocol wrong type for socket | | |
| 925 | NOPROTOOPT = 42, // Protocol not available | | |
| 926 | PROTONOSUPPORT = 43, // Protocol not supported | | |
| 927 | SOCKTNOSUPPORT = 44, // Socket type not supported | | |
| 928 | /// Also used for `NOTSUP`. | | |
| 929 | OPNOTSUPP = 45, // Operation not supported | | |
| 930 | PFNOSUPPORT = 46, // Protocol family not supported | | |
| 931 | AFNOSUPPORT = 47, // Address family not supported by protocol family | | |
| 932 | ADDRINUSE = 48, // Address already in use | | |
| 933 | ADDRNOTAVAIL = 49, // Can't assign requested address | | |
| 934 | | | |
| 935 | // ipc/network software -- operational errors | | |
| 936 | NETDOWN = 50, // Network is down | | |
| 937 | NETUNREACH = 51, // Network is unreachable | | |
| 938 | NETRESET = 52, // Network dropped connection on reset | | |
| 939 | CONNABORTED = 53, // Software caused connection abort | | |
| 940 | CONNRESET = 54, // Connection reset by peer | | |
| 941 | NOBUFS = 55, // No buffer space available | | |
| 942 | ISCONN = 56, // Socket is already connected | | |
| 943 | NOTCONN = 57, // Socket is not connected | | |
| 944 | SHUTDOWN = 58, // Can't send after socket shutdown | | |
| 945 | TOOMANYREFS = 59, // Too many references: can't splice | | |
| 946 | TIMEDOUT = 60, // Operation timed out | | |
| 947 | CONNREFUSED = 61, // Connection refused | | |
| 948 | | | |
| 949 | LOOP = 62, // Too many levels of symbolic links | | |
| 950 | NAMETOOLONG = 63, // File name too long | | |
| 951 | | | |
| 952 | // should be rearranged | | |
| 953 | HOSTDOWN = 64, // Host is down | | |
| 954 | HOSTUNREACH = 65, // No route to host | | |
| 955 | NOTEMPTY = 66, // Directory not empty | | |
| 956 | | | |
| 957 | // quotas & mush | | |
| 958 | PROCLIM = 67, // Too many processes | | |
| 959 | USERS = 68, // Too many users | | |
| 960 | DQUOT = 69, // Disc quota exceeded | | |
| 961 | | | |
| 962 | // Network File System | | |
| 963 | STALE = 70, // Stale NFS file handle | | |
| 964 | REMOTE = 71, // Too many levels of remote in path | | |
| 965 | BADRPC = 72, // RPC struct is bad | | |
| 966 | RPCMISMATCH = 73, // RPC version wrong | | |
| 967 | PROGUNAVAIL = 74, // RPC prog. not avail | | |
| 968 | PROGMISMATCH = 75, // Program version wrong | | |
| 969 | PROCUNAVAIL = 76, // Bad procedure for program | | |
| 970 | | | |
| 971 | NOLCK = 77, // No locks available | | |
| 972 | NOSYS = 78, // Function not implemented | | |
| 973 | | | |
| 974 | FTYPE = 79, // Inappropriate file type or format | | |
| 975 | AUTH = 80, // Authentication error | | |
| 976 | NEEDAUTH = 81, // Need authenticator | | |
| 977 | IDRM = 82, // Identifier removed | | |
| 978 | NOMSG = 83, // No message of desired type | | |
| 979 | OVERFLOW = 84, // Value too large to be stored in data type | | |
| 980 | CANCELED = 85, // Operation canceled | | |
| 981 | ILSEQ = 86, // Illegal byte sequence | | |
| 982 | NOATTR = 87, // Attribute not found | | |
| 983 | | | |
| 984 | DOOFUS = 88, // Programming error | | |
| 985 | | | |
| 986 | BADMSG = 89, // Bad message | | |
| 987 | MULTIHOP = 90, // Multihop attempted | | |
| 988 | NOLINK = 91, // Link has been severed | | |
| 989 | PROTO = 92, // Protocol error | | |
| 990 | | | |
| 991 | NOTCAPABLE = 93, // Capabilities insufficient | | |
| 992 | CAPMODE = 94, // Not permitted in capability mode | | |
| 993 | NOTRECOVERABLE = 95, // State not recoverable | | |
| 994 | OWNERDEAD = 96, // Previous owner died | | |
| 995 | | | |
| 996 | _, | 842 | _, |
| 997 | }; | 843 | }; |
| 998 | | 844 | |
| 999 | pub const MINSIGSTKSZ = switch (builtin.cpu.arch) { | 845 | pub const MINSIGSTKSZ = 8192; |
| 1000 | .i386, .x86_64 => 2048, | 846 | pub const SIGSTKSZ = 16384; |
| 1001 | .arm, .aarch64 => 4096, | | |
| 1002 | else => @compileError("MINSIGSTKSZ not defined for this architecture"), | | |
| 1003 | }; | | |
| 1004 | pub const SIGSTKSZ = MINSIGSTKSZ + 32768; | | |
| 1005 | | 847 | |
| 1006 | pub const SS_ONSTACK = 1; | 848 | pub const SS_ONSTACK = 0x1; |
| 1007 | pub const SS_DISABLE = 4; | 849 | pub const SS_DISABLE = 0x2; |
| 1008 | | 850 | |
| 1009 | pub const stack_t = extern struct { | 851 | pub const stack_t = extern struct { |
| 1010 | sp: [*]u8, | 852 | sp: [*]u8, |
| ... | @@ -1014,16 +856,16 @@ pub const stack_t = extern struct { | ... | @@ -1014,16 +856,16 @@ pub const stack_t = extern struct { |
| 1014 | | 856 | |
| 1015 | pub const S = struct { | 857 | pub const S = struct { |
| 1016 | pub const IFMT = 0o170000; | 858 | pub const IFMT = 0o170000; |
| 1017 | | | |
| 1018 | pub const IFIFO = 0o010000; | | |
| 1019 | pub const IFCHR = 0o020000; | | |
| 1020 | pub const IFDIR = 0o040000; | | |
| 1021 | pub const IFBLK = 0o060000; | | |
| 1022 | pub const IFREG = 0o100000; | | |
| 1023 | pub const IFLNK = 0o120000; | | |
| 1024 | pub const IFSOCK = 0o140000; | 859 | pub const IFSOCK = 0o140000; |
| 1025 | pub const IFWHT = 0o160000; | 860 | pub const IFLNK = 0o120000; |
| | 861 | pub const IFREG = 0o100000; |
| | 862 | pub const IFBLK = 0o060000; |
| | 863 | pub const IFDIR = 0o040000; |
| | 864 | pub const IFCHR = 0o020000; |
| | 865 | pub const IFIFO = 0o010000; |
| | 866 | pub const INDEX_DIR = 04000000000; |
| 1026 | | 867 | |
| | 868 | pub const IUMSK = 0o7777; |
| 1027 | pub const ISUID = 0o4000; | 869 | pub const ISUID = 0o4000; |
| 1028 | pub const ISGID = 0o2000; | 870 | pub const ISGID = 0o2000; |
| 1029 | pub const ISVTX = 0o1000; | 871 | pub const ISVTX = 0o1000; |
| ... | @@ -1040,56 +882,47 @@ pub const S = struct { | ... | @@ -1040,56 +882,47 @@ pub const S = struct { |
| 1040 | pub const IWOTH = 0o002; | 882 | pub const IWOTH = 0o002; |
| 1041 | pub const IXOTH = 0o001; | 883 | pub const IXOTH = 0o001; |
| 1042 | | 884 | |
| 1043 | pub fn ISFIFO(m: u32) bool { | 885 | pub fn ISREG(m: u32) bool { |
| 1044 | return m & IFMT == IFIFO; | 886 | return m & IFMT == IFREG; |
| 1045 | } | | |
| 1046 | | | |
| 1047 | pub fn ISCHR(m: u32) bool { | | |
| 1048 | return m & IFMT == IFCHR; | | |
| 1049 | } | 887 | } |
| 1050 | | 888 | |
| 1051 | pub fn ISDIR(m: u32) bool { | 889 | pub fn ISLNK(m: u32) bool { |
| 1052 | return m & IFMT == IFDIR; | 890 | return m & IFMT == IFLNK; |
| 1053 | } | 891 | } |
| 1054 | | 892 | |
| 1055 | pub fn ISBLK(m: u32) bool { | 893 | pub fn ISBLK(m: u32) bool { |
| 1056 | return m & IFMT == IFBLK; | 894 | return m & IFMT == IFBLK; |
| 1057 | } | 895 | } |
| 1058 | | 896 | |
| 1059 | pub fn ISREG(m: u32) bool { | 897 | pub fn ISDIR(m: u32) bool { |
| 1060 | return m & IFMT == IFREG; | 898 | return m & IFMT == IFDIR; |
| 1061 | } | 899 | } |
| 1062 | | 900 | |
| 1063 | pub fn ISLNK(m: u32) bool { | 901 | pub fn ISCHR(m: u32) bool { |
| 1064 | return m & IFMT == IFLNK; | 902 | return m & IFMT == IFCHR; |
| | 903 | } |
| | 904 | |
| | 905 | pub fn ISFIFO(m: u32) bool { |
| | 906 | return m & IFMT == IFIFO; |
| 1065 | } | 907 | } |
| 1066 | | 908 | |
| 1067 | pub fn ISSOCK(m: u32) bool { | 909 | pub fn ISSOCK(m: u32) bool { |
| 1068 | return m & IFMT == IFSOCK; | 910 | return m & IFMT == IFSOCK; |
| 1069 | } | 911 | } |
| 1070 | | 912 | |
| 1071 | pub fn IWHT(m: u32) bool { | 913 | pub fn ISINDEX(m: u32) bool { |
| 1072 | return m & IFMT == IFWHT; | 914 | return m & INDEX_DIR == INDEX_DIR; |
| 1073 | } | 915 | } |
| 1074 | }; | 916 | }; |
| 1075 | | 917 | |
| 1076 | pub const HOST_NAME_MAX = 255; | 918 | pub const HOST_NAME_MAX = 255; |
| 1077 | | 919 | |
| 1078 | pub const AT = struct { | 920 | pub const AT = struct { |
| 1079 | /// Magic value that specify the use of the current working directory | 921 | pub const FDCWD = -1; |
| 1080 | /// to determine the target of relative file paths in the openat() and | 922 | pub const SYMLINK_NOFOLLOW = 0x01; |
| 1081 | /// similar syscalls. | 923 | pub const SYMLINK_FOLLOW = 0x02; |
| 1082 | pub const FDCWD = -100; | 924 | pub const REMOVEDIR = 0x04; |
| 1083 | /// Check access using effective user and group ID | 925 | pub const EACCESS = 0x08; |
| 1084 | pub const EACCESS = 0x0100; | | |
| 1085 | /// Do not follow symbolic links | | |
| 1086 | pub const SYMLINK_NOFOLLOW = 0x0200; | | |
| 1087 | /// Follow symbolic link | | |
| 1088 | pub const SYMLINK_FOLLOW = 0x0400; | | |
| 1089 | /// Remove directory instead of file | | |
| 1090 | pub const REMOVEDIR = 0x0800; | | |
| 1091 | /// Fail if not under dirfd | | |
| 1092 | pub const BENEATH = 0x1000; | | |
| 1093 | }; | 926 | }; |
| 1094 | | 927 | |
| 1095 | pub const addrinfo = extern struct { | 928 | pub const addrinfo = extern struct { |
| ... | @@ -1104,259 +937,35 @@ pub const addrinfo = extern struct { | ... | @@ -1104,259 +937,35 @@ pub const addrinfo = extern struct { |
| 1104 | }; | 937 | }; |
| 1105 | | 938 | |
| 1106 | pub const IPPROTO = struct { | 939 | pub const IPPROTO = struct { |
| 1107 | /// dummy for IP | | |
| 1108 | pub const IP = 0; | 940 | pub const IP = 0; |
| 1109 | /// control message protocol | 941 | pub const HOPOPTS = 0; |
| 1110 | pub const ICMP = 1; | 942 | pub const ICMP = 1; |
| 1111 | /// tcp | 943 | pub const IGMP = 2; |
| 1112 | pub const TCP = 6; | 944 | pub const TCP = 6; |
| 1113 | /// user datagram protocol | | |
| 1114 | pub const UDP = 17; | 945 | pub const UDP = 17; |
| 1115 | /// IP6 header | | |
| 1116 | pub const IPV6 = 41; | 946 | pub const IPV6 = 41; |
| 1117 | /// raw IP packet | | |
| 1118 | pub const RAW = 255; | | |
| 1119 | /// IP6 hop-by-hop options | | |
| 1120 | pub const HOPOPTS = 0; | | |
| 1121 | /// group mgmt protocol | | |
| 1122 | pub const IGMP = 2; | | |
| 1123 | /// gateway^2 (deprecated) | | |
| 1124 | pub const GGP = 3; | | |
| 1125 | /// IPv4 encapsulation | | |
| 1126 | pub const IPV4 = 4; | | |
| 1127 | /// for compatibility | | |
| 1128 | pub const IPIP = IPV4; | | |
| 1129 | /// Stream protocol II | | |
| 1130 | pub const ST = 7; | | |
| 1131 | /// exterior gateway protocol | | |
| 1132 | pub const EGP = 8; | | |
| 1133 | /// private interior gateway | | |
| 1134 | pub const PIGP = 9; | | |
| 1135 | /// BBN RCC Monitoring | | |
| 1136 | pub const RCCMON = 10; | | |
| 1137 | /// network voice protocol | | |
| 1138 | pub const NVPII = 11; | | |
| 1139 | /// pup | | |
| 1140 | pub const PUP = 12; | | |
| 1141 | /// Argus | | |
| 1142 | pub const ARGUS = 13; | | |
| 1143 | /// EMCON | | |
| 1144 | pub const EMCON = 14; | | |
| 1145 | /// Cross Net Debugger | | |
| 1146 | pub const XNET = 15; | | |
| 1147 | /// Chaos | | |
| 1148 | pub const CHAOS = 16; | | |
| 1149 | /// Multiplexing | | |
| 1150 | pub const MUX = 18; | | |
| 1151 | /// DCN Measurement Subsystems | | |
| 1152 | pub const MEAS = 19; | | |
| 1153 | /// Host Monitoring | | |
| 1154 | pub const HMP = 20; | | |
| 1155 | /// Packet Radio Measurement | | |
| 1156 | pub const PRM = 21; | | |
| 1157 | /// xns idp | | |
| 1158 | pub const IDP = 22; | | |
| 1159 | /// Trunk-1 | | |
| 1160 | pub const TRUNK1 = 23; | | |
| 1161 | /// Trunk-2 | | |
| 1162 | pub const TRUNK2 = 24; | | |
| 1163 | /// Leaf-1 | | |
| 1164 | pub const LEAF1 = 25; | | |
| 1165 | /// Leaf-2 | | |
| 1166 | pub const LEAF2 = 26; | | |
| 1167 | /// Reliable Data | | |
| 1168 | pub const RDP = 27; | | |
| 1169 | /// Reliable Transaction | | |
| 1170 | pub const IRTP = 28; | | |
| 1171 | /// tp-4 w/ class negotiation | | |
| 1172 | pub const TP = 29; | | |
| 1173 | /// Bulk Data Transfer | | |
| 1174 | pub const BLT = 30; | | |
| 1175 | /// Network Services | | |
| 1176 | pub const NSP = 31; | | |
| 1177 | /// Merit Internodal | | |
| 1178 | pub const INP = 32; | | |
| 1179 | /// Datagram Congestion Control Protocol | | |
| 1180 | pub const DCCP = 33; | | |
| 1181 | /// Third Party Connect | | |
| 1182 | pub const @"3PC" = 34; | | |
| 1183 | /// InterDomain Policy Routing | | |
| 1184 | pub const IDPR = 35; | | |
| 1185 | /// XTP | | |
| 1186 | pub const XTP = 36; | | |
| 1187 | /// Datagram Delivery | | |
| 1188 | pub const DDP = 37; | | |
| 1189 | /// Control Message Transport | | |
| 1190 | pub const CMTP = 38; | | |
| 1191 | /// TP++ Transport | | |
| 1192 | pub const TPXX = 39; | | |
| 1193 | /// IL transport protocol | | |
| 1194 | pub const IL = 40; | | |
| 1195 | /// Source Demand Routing | | |
| 1196 | pub const SDRP = 42; | | |
| 1197 | /// IP6 routing header | | |
| 1198 | pub const ROUTING = 43; | 947 | pub const ROUTING = 43; |
| 1199 | /// IP6 fragmentation header | | |
| 1200 | pub const FRAGMENT = 44; | 948 | pub const FRAGMENT = 44; |
| 1201 | /// InterDomain Routing | | |
| 1202 | pub const IDRP = 45; | | |
| 1203 | /// resource reservation | | |
| 1204 | pub const RSVP = 46; | | |
| 1205 | /// General Routing Encap. | | |
| 1206 | pub const GRE = 47; | | |
| 1207 | /// Mobile Host Routing | | |
| 1208 | pub const MHRP = 48; | | |
| 1209 | /// BHA | | |
| 1210 | pub const BHA = 49; | | |
| 1211 | /// IP6 Encap Sec. Payload | | |
| 1212 | pub const ESP = 50; | 949 | pub const ESP = 50; |
| 1213 | /// IP6 Auth Header | | |
| 1214 | pub const AH = 51; | 950 | pub const AH = 51; |
| 1215 | /// Integ. Net Layer Security | | |
| 1216 | pub const INLSP = 52; | | |
| 1217 | /// IP with encryption | | |
| 1218 | pub const SWIPE = 53; | | |
| 1219 | /// Next Hop Resolution | | |
| 1220 | pub const NHRP = 54; | | |
| 1221 | /// IP Mobility | | |
| 1222 | pub const MOBILE = 55; | | |
| 1223 | /// Transport Layer Security | | |
| 1224 | pub const TLSP = 56; | | |
| 1225 | /// SKIP | | |
| 1226 | pub const SKIP = 57; | | |
| 1227 | /// ICMP6 | | |
| 1228 | pub const ICMPV6 = 58; | 951 | pub const ICMPV6 = 58; |
| 1229 | /// IP6 no next header | | |
| 1230 | pub const NONE = 59; | 952 | pub const NONE = 59; |
| 1231 | /// IP6 destination option | | |
| 1232 | pub const DSTOPTS = 60; | 953 | pub const DSTOPTS = 60; |
| 1233 | /// any host internal protocol | | |
| 1234 | pub const AHIP = 61; | | |
| 1235 | /// CFTP | | |
| 1236 | pub const CFTP = 62; | | |
| 1237 | /// "hello" routing protocol | | |
| 1238 | pub const HELLO = 63; | | |
| 1239 | /// SATNET/Backroom EXPAK | | |
| 1240 | pub const SATEXPAK = 64; | | |
| 1241 | /// Kryptolan | | |
| 1242 | pub const KRYPTOLAN = 65; | | |
| 1243 | /// Remote Virtual Disk | | |
| 1244 | pub const RVD = 66; | | |
| 1245 | /// Pluribus Packet Core | | |
| 1246 | pub const IPPC = 67; | | |
| 1247 | /// Any distributed FS | | |
| 1248 | pub const ADFS = 68; | | |
| 1249 | /// Satnet Monitoring | | |
| 1250 | pub const SATMON = 69; | | |
| 1251 | /// VISA Protocol | | |
| 1252 | pub const VISA = 70; | | |
| 1253 | /// Packet Core Utility | | |
| 1254 | pub const IPCV = 71; | | |
| 1255 | /// Comp. Prot. Net. Executive | | |
| 1256 | pub const CPNX = 72; | | |
| 1257 | /// Comp. Prot. HeartBeat | | |
| 1258 | pub const CPHB = 73; | | |
| 1259 | /// Wang Span Network | | |
| 1260 | pub const WSN = 74; | | |
| 1261 | /// Packet Video Protocol | | |
| 1262 | pub const PVP = 75; | | |
| 1263 | /// BackRoom SATNET Monitoring | | |
| 1264 | pub const BRSATMON = 76; | | |
| 1265 | /// Sun net disk proto (temp.) | | |
| 1266 | pub const ND = 77; | | |
| 1267 | /// WIDEBAND Monitoring | | |
| 1268 | pub const WBMON = 78; | | |
| 1269 | /// WIDEBAND EXPAK | | |
| 1270 | pub const WBEXPAK = 79; | | |
| 1271 | /// ISO cnlp | | |
| 1272 | pub const EON = 80; | | |
| 1273 | /// VMTP | | |
| 1274 | pub const VMTP = 81; | | |
| 1275 | /// Secure VMTP | | |
| 1276 | pub const SVMTP = 82; | | |
| 1277 | /// Banyon VINES | | |
| 1278 | pub const VINES = 83; | | |
| 1279 | /// TTP | | |
| 1280 | pub const TTP = 84; | | |
| 1281 | /// NSFNET-IGP | | |
| 1282 | pub const IGP = 85; | | |
| 1283 | /// dissimilar gateway prot. | | |
| 1284 | pub const DGP = 86; | | |
| 1285 | /// TCF | | |
| 1286 | pub const TCF = 87; | | |
| 1287 | /// Cisco/GXS IGRP | | |
| 1288 | pub const IGRP = 88; | | |
| 1289 | /// OSPFIGP | | |
| 1290 | pub const OSPFIGP = 89; | | |
| 1291 | /// Strite RPC protocol | | |
| 1292 | pub const SRPC = 90; | | |
| 1293 | /// Locus Address Resoloution | | |
| 1294 | pub const LARP = 91; | | |
| 1295 | /// Multicast Transport | | |
| 1296 | pub const MTP = 92; | | |
| 1297 | /// AX.25 Frames | | |
| 1298 | pub const AX25 = 93; | | |
| 1299 | /// IP encapsulated in IP | | |
| 1300 | pub const IPEIP = 94; | | |
| 1301 | /// Mobile Int.ing control | | |
| 1302 | pub const MICP = 95; | | |
| 1303 | /// Semaphore Comm. security | | |
| 1304 | pub const SCCSP = 96; | | |
| 1305 | /// Ethernet IP encapsulation | | |
| 1306 | pub const ETHERIP = 97; | 954 | pub const ETHERIP = 97; |
| 1307 | /// encapsulation header | 955 | pub const RAW = 255; |
| 1308 | pub const ENCAP = 98; | 956 | pub const MAX = 256; |
| 1309 | /// any private encr. scheme | | |
| 1310 | pub const APES = 99; | | |
| 1311 | /// GMTP | | |
| 1312 | pub const GMTP = 100; | | |
| 1313 | /// payload compression (IPComp) | | |
| 1314 | pub const IPCOMP = 108; | | |
| 1315 | /// SCTP | | |
| 1316 | pub const SCTP = 132; | | |
| 1317 | /// IPv6 Mobility Header | | |
| 1318 | pub const MH = 135; | | |
| 1319 | /// UDP-Lite | | |
| 1320 | pub const UDPLITE = 136; | | |
| 1321 | /// IP6 Host Identity Protocol | | |
| 1322 | pub const HIP = 139; | | |
| 1323 | /// IP6 Shim6 Protocol | | |
| 1324 | pub const SHIM6 = 140; | | |
| 1325 | /// Protocol Independent Mcast | | |
| 1326 | pub const PIM = 103; | | |
| 1327 | /// CARP | | |
| 1328 | pub const CARP = 112; | | |
| 1329 | /// PGM | | |
| 1330 | pub const PGM = 113; | | |
| 1331 | /// MPLS-in-IP | | |
| 1332 | pub const MPLS = 137; | | |
| 1333 | /// PFSYNC | | |
| 1334 | pub const PFSYNC = 240; | | |
| 1335 | /// Reserved | | |
| 1336 | pub const RESERVED_253 = 253; | | |
| 1337 | /// Reserved | | |
| 1338 | pub const RESERVED_254 = 254; | | |
| 1339 | }; | 957 | }; |
| 1340 | | 958 | |
| 1341 | pub const rlimit_resource = enum(c_int) { | 959 | pub const rlimit_resource = enum(c_int) { |
| 1342 | CPU = 0, | 960 | CORE = 0, |
| 1343 | FSIZE = 1, | 961 | CPU = 1, |
| 1344 | DATA = 2, | 962 | DATA = 2, |
| 1345 | STACK = 3, | 963 | FSIZE = 3, |
| 1346 | CORE = 4, | 964 | NOFILE = 4, |
| 1347 | RSS = 5, | 965 | STACK = 5, |
| 1348 | MEMLOCK = 6, | 966 | AS = 6, |
| 1349 | NPROC = 7, | 967 | NOVMON = 7, |
| 1350 | NOFILE = 8, | | |
| 1351 | SBSIZE = 9, | | |
| 1352 | VMEM = 10, | | |
| 1353 | NPTS = 11, | | |
| 1354 | SWAP = 12, | | |
| 1355 | KQUEUES = 13, | | |
| 1356 | UMTXP = 14, | | |
| 1357 | _, | 968 | _, |
| 1358 | | | |
| 1359 | pub const AS: rlimit_resource = .VMEM; | | |
| 1360 | }; | 969 | }; |
| 1361 | | 970 | |
| 1362 | pub const rlim_t = i64; | 971 | pub const rlim_t = i64; |
| ... | @@ -1393,7 +1002,7 @@ pub const cc_t = u8; | ... | @@ -1393,7 +1002,7 @@ pub const cc_t = u8; |
| 1393 | pub const speed_t = u8; | 1002 | pub const speed_t = u8; |
| 1394 | pub const tcflag_t = u32; | 1003 | pub const tcflag_t = u32; |
| 1395 | | 1004 | |
| 1396 | pub const NCCS = 32; | 1005 | pub const NCCS = 11; |
| 1397 | | 1006 | |
| 1398 | pub const termios = extern struct { | 1007 | pub const termios = extern struct { |
| 1399 | c_iflag: tcflag_t, | 1008 | c_iflag: tcflag_t, |
| ... | @@ -1405,3 +1014,5 @@ pub const termios = extern struct { | ... | @@ -1405,3 +1014,5 @@ pub const termios = extern struct { |
| 1405 | c_ospeed: speed_t, | 1014 | c_ospeed: speed_t, |
| 1406 | cc_t: [NCCS]cc_t, | 1015 | cc_t: [NCCS]cc_t, |
| 1407 | }; | 1016 | }; |
| | 1017 | |
| | 1018 | pub const MSG_NOSIGNAL = 0x0800; |