zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 3f259d35502ed5a8bdb6bbc22f9adb39d610b006 (tree)
parent b22155d352b2f9499596f50b42b86032bcbf168d
Author: David CARLIER <devnexen@gmail.com>
Date:   Sat, 15 Apr 2023 18:15:37 +0100

std: adding netbsd's pthread to cpu affinity api

Diffstat:
Mlib/std/c/netbsd.zig | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig @@ -121,9 +121,21 @@ pub const pthread_attr_t = extern struct { }; pub const sem_t = ?*opaque {}; +pub const cpuset_t = opaque {}; +pub const cpuid_t = c_ulong; pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8, arg: ?*anyopaque) E; pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E; +pub extern "c" fn pthread_setaffinity_np(thread: std.c.pthread_t, size: usize, set: ?*cpuset_t) c_int; +pub extern "c" fn pthread_getaffinity_np(thread: std.c.pthread_t, size: usize, set: ?*cpuset_t) c_int; + +pub extern "c" fn cpuset_create() ?*cpuset_t; +pub extern "c" fn cpuset_destroy(set: ?*cpuset_t) void; +pub extern "c" fn cpuset_zero(set: ?*cpuset_t) void; +pub extern "c" fn cpuset_set(cpu: cpuid_t, set: ?*cpuset_t) c_int; +pub extern "c" fn cpuset_clr(cpu: cpuid_t, set: ?*cpuset_t) c_int; +pub extern "c" fn cpuset_isset(cpu: cpuid_t, set: ?*const cpuset_t) c_int; +pub extern "c" fn cpuset_size(set: ?*cpuset_t) usize; pub const blkcnt_t = i64; pub const blksize_t = i32;