authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:17:11-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:17:11-07:00
log1d4e6e6c735170b4a70c14cb155f683fbe46001c
treefb42ee74c326b2cdf3cb828ce2ee5866666124b3
parentf96f57930c65bedc00fb484a90b3c3932387982e

Revert "std.c: add essential freebsd's capsicum api subset."

This reverts commit 6ae19fa48d7853430ba45f2de90550cd48cf5b4c.

1 files changed, 3 insertions(+), 36 deletions(-)

lib/std/c/freebsd.zig+3-36
...@@ -476,43 +476,10 @@ pub const sockaddr = extern struct {...@@ -476,43 +476,10 @@ pub const sockaddr = extern struct {
476476
477pub const CAP_RIGHTS_VERSION = 0;477pub const CAP_RIGHTS_VERSION = 0;
478478
479pub const cap_rights_t = extern struct {479pub const cap_rights = extern struct {
480 cr_rights: [CAP_RIGHTS_VERSION + 2]u64,480 rights: [CAP_RIGHTS_VERSION + 2]u64,
481};481};
482482
483pub 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
507pub extern "c" fn __cap_rights_init(version: c_int, rights: ?*cap_rights_t, ...) ?*cap_rights_t;
508pub extern "c" fn __cap_rights_set(rights: ?*cap_rights_t, ...) ?*cap_rights_t;
509pub extern "c" fn __cap_rights_clear(rights: ?*cap_rights_t, ...) ?*cap_rights_t;
510pub extern "c" fn __cap_rights_merge(dst: ?*cap_rights_t, src: ?*const cap_rights_t) ?*cap_rights_t;
511pub extern "c" fn __cap_rights_remove(dst: ?*cap_rights_t, src: ?*const cap_rights_t) ?*cap_rights_t;
512pub extern "c" fn __cap_rights_contains(dst: ?*const cap_rights_t, src: ?*const cap_rights_t) bool;
513pub extern "c" fn __cap_rights_is_set(rights: ?*const cap_rights_t, ...) bool;
514pub extern "c" fn __cap_rights_is_valid(rights: ?*const cap_rights_t) bool;
515
516pub const kinfo_file = extern struct {483pub 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_rights585 /// 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.