| ... | @@ -476,43 +476,10 @@ pub const sockaddr = extern struct { | ... | @@ -476,43 +476,10 @@ pub const sockaddr = extern struct { |
| 476 | | 476 | |
| 477 | pub const CAP_RIGHTS_VERSION = 0; | 477 | pub const CAP_RIGHTS_VERSION = 0; |
| 478 | | 478 | |
| 479 | pub const cap_rights_t = extern struct { | 479 | pub const cap_rights = extern struct { |
| 480 | cr_rights: [CAP_RIGHTS_VERSION + 2]u64, | 480 | rights: [CAP_RIGHTS_VERSION + 2]u64, |
| 481 | }; | 481 | }; |
| 482 | | 482 | |
| 483 | pub const CAP = struct { | | |
| 484 | pub fn RIGHT(idx: u6, bit: u64) u64 { | | |
| 485 | return (@as(u64, @intCast(1)) << (57 + idx)) | bit; | | |
| 486 | } | | |
| 487 | pub const READ = CAP.RIGHT(0, 0x0000000000000001); | | |
| 488 | pub const WRITE = CAP.RIGHT(0, 0x0000000000000002); | | |
| 489 | pub const SEEK_TELL = CAP.RIGHT(0, 0x0000000000000004); | | |
| 490 | pub const SEEK = CAP.SEEK_TELL | 0x0000000000000008; | | |
| 491 | pub const PREAD = CAP.SEEK | CAP.READ; | | |
| 492 | pub const PWRITE = CAP.SEEK | CAP.WRITE; | | |
| 493 | pub const MMAP = CAP.RIGHT(0, 0x0000000000000010); | | |
| 494 | pub const MMAP_R = CAP.MMAP | CAP.SEEK | CAP.READ; | | |
| 495 | pub const MMAP_W = CAP.MMAP | CAP.SEEK | CAP.WRITE; | | |
| 496 | pub const MMAP_X = CAP.MMAP | CAP.SEEK | 0x0000000000000020; | | |
| 497 | pub const MMAP_RW = CAP.MMAP_R | CAP.MMAP_W; | | |
| 498 | pub const MMAP_RX = CAP.MMAP_R | CAP.MMAP_X; | | |
| 499 | pub const MMAP_WX = CAP.MMAP_W | CAP.MMAP_X; | | |
| 500 | pub const MMAP_RWX = CAP.MMAP_R | CAP.MMAP_W | CAP.MMAP_X; | | |
| 501 | pub const CREATE = CAP.RIGHT(0, 0x0000000000000040); | | |
| 502 | pub const FEXECVE = CAP.RIGHT(0, 0x0000000000000080); | | |
| 503 | pub const FSYNC = CAP.RIGHT(0, 0x0000000000000100); | | |
| 504 | pub const FTRUNCATE = CAP.RIGHT(0, 0x0000000000000200); | | |
| 505 | }; | | |
| 506 | | | |
| 507 | pub extern "c" fn __cap_rights_init(version: c_int, rights: ?*cap_rights_t, ...) ?*cap_rights_t; | | |
| 508 | pub extern "c" fn __cap_rights_set(rights: ?*cap_rights_t, ...) ?*cap_rights_t; | | |
| 509 | pub extern "c" fn __cap_rights_clear(rights: ?*cap_rights_t, ...) ?*cap_rights_t; | | |
| 510 | pub extern "c" fn __cap_rights_merge(dst: ?*cap_rights_t, src: ?*const cap_rights_t) ?*cap_rights_t; | | |
| 511 | pub extern "c" fn __cap_rights_remove(dst: ?*cap_rights_t, src: ?*const cap_rights_t) ?*cap_rights_t; | | |
| 512 | pub extern "c" fn __cap_rights_contains(dst: ?*const cap_rights_t, src: ?*const cap_rights_t) bool; | | |
| 513 | pub extern "c" fn __cap_rights_is_set(rights: ?*const cap_rights_t, ...) bool; | | |
| 514 | pub extern "c" fn __cap_rights_is_valid(rights: ?*const cap_rights_t) bool; | | |
| 515 | | | |
| 516 | pub const kinfo_file = extern struct { | 483 | pub const kinfo_file = extern struct { |
| 517 | /// Size of this record. | 484 | /// Size of this record. |
| 518 | /// A zero value is for the sentinel record at the end of an array. | 485 | /// A zero value is for the sentinel record at the end of an array. |
| ... | @@ -614,7 +581,7 @@ pub const kinfo_file = extern struct { | ... | @@ -614,7 +581,7 @@ pub const kinfo_file = extern struct { |
| 614 | // Reserved for future use. | 581 | // Reserved for future use. |
| 615 | _spare: c_int, | 582 | _spare: c_int, |
| 616 | /// Capability rights. | 583 | /// Capability rights. |
| 617 | cap_rights: cap_rights_t, | 584 | cap_rights: cap_rights, |
| 618 | /// Reserved for future cap_rights | 585 | /// Reserved for future cap_rights |
| 619 | _cap_spare: u64, | 586 | _cap_spare: u64, |
| 620 | /// Path to file, if any. | 587 | /// Path to file, if any. |