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;...@@ -5,12 +5,21 @@ const maxInt = std.math.maxInt;
5const iovec = std.os.iovec;5const iovec = std.os.iovec;
6const iovec_const = std.os.iovec_const;6const 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
8extern "c" fn __error() *c_int;16extern "c" fn __error() *c_int;
9pub const _errno = __error;17pub const _errno = __error;
1018
11pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;19pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
12pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;20pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
13pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;21pub 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
15pub extern "c" fn pthread_getthreadid_np() c_int;24pub extern "c" fn pthread_getthreadid_np() c_int;
16pub extern "c" fn pthread_set_name_np(thread: std.c.pthread_t, name: [*:0]const u8) void;25pub 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;...@@ -26,6 +35,9 @@ pub extern "c" fn getpid() pid_t;
26pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;35pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;
27pub extern "c" fn kinfo_getvmmap(pid: pid_t, cntp: *c_int) ?[*]kinfo_vmentry;36pub 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
29pub const sf_hdtr = extern struct {41pub const sf_hdtr = extern struct {
30 headers: [*]const iovec_const,42 headers: [*]const iovec_const,
31 hdr_cnt: c_int,43 hdr_cnt: c_int,
...@@ -203,8 +215,6 @@ pub const clock_t = isize;...@@ -203,8 +215,6 @@ pub const clock_t = isize;
203pub const socklen_t = u32;215pub const socklen_t = u32;
204pub const suseconds_t = c_long;216pub const suseconds_t = c_long;
205217
206pub const id_t = i64;
207
208/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.218/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
209pub const Kevent = extern struct {219pub const Kevent = extern struct {
210 /// Identifier for this event.220 /// Identifier for this event.