authorgravatar for devnexen@gmail.comDavid Carlier <devnexen@gmail.com> 2023-04-18 12:59:01+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-18 14:59:01+03:00
log2568da2f41d3403b2cd91bbb84862c86932b63e6
treeaaff799df7721fdaccb2fca583bf8004c0010dcf
parent8ba937c787efd690a8a984f9ab42cac00fb9b2bf
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std: freebsd update proposal

adding getentropy and cpuset_(get/set)affinity calls.

1 files changed, 12 insertions(+), 2 deletions(-)

lib/std/c/freebsd.zig+12-2
......@@ -5,12 +5,21 @@ const maxInt = std.math.maxInt;
55const iovec = std.os.iovec;
66const iovec_const = std.os.iovec_const;
77
8pub const CPU_SETSIZE = 256;
9pub const cpuset_t = extern struct {
10 __bits: [(CPU_SETSIZE + (@bitSizeOf(c_long) - 1)) / @bitSizeOf(c_long)]c_long,
11};
12pub const cpulevel_t = c_int;
13pub const cpuwhich_t = c_int;
14pub const id_t = i64;
15
816extern "c" fn __error() *c_int;
917pub const _errno = __error;
1018
1119pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
1220pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
1321pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
22pub extern "c" fn getentropy(buf_ptr: [*]u8, buf_len: usize) c_int;
1423
1524pub extern "c" fn pthread_getthreadid_np() c_int;
1625pub extern "c" fn pthread_set_name_np(thread: std.c.pthread_t, name: [*:0]const u8) void;
......@@ -26,6 +35,9 @@ pub extern "c" fn getpid() pid_t;
2635pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;
2736pub extern "c" fn kinfo_getvmmap(pid: pid_t, cntp: *c_int) ?[*]kinfo_vmentry;
2837
38pub extern "c" fn cpuset_getaffinity(level: cpulevel_t, which: cpuwhich_t, id: id_t, setsize: usize, mask: *cpuset_t) c_int;
39pub extern "c" fn cpuset_setaffinity(level: cpulevel_t, which: cpuwhich_t, id: id_t, setsize: usize, mask: *const cpuset_t) c_int;
40
2941pub const sf_hdtr = extern struct {
3042 headers: [*]const iovec_const,
3143 hdr_cnt: c_int,
......@@ -203,8 +215,6 @@ pub const clock_t = isize;
203215pub const socklen_t = u32;
204216pub const suseconds_t = c_long;
205217
206pub const id_t = i64;
207
208218/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
209219pub const Kevent = extern struct {
210220 /// Identifier for this event.