hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 30f2d9d88e860d721184c5b284dfab9a59661ff2
parent 2eeabebfada1cca06ba60f2f8b904fd47dbf7c57
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sat, 28 Jan 2023 23:42:03 -0500

rt+linux: add sched_getaffinity and sched_setaffinity

Diffstat:
Mrt/+linux/+aarch64.ha | 4++++
Mrt/+linux/+riscv64.ha | 4++++
Mrt/+linux/+x86_64.ha | 4++++
Mrt/+linux/syscalls.ha | 18++++++++++++++++++
4 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/rt/+linux/+aarch64.ha b/rt/+linux/+aarch64.ha @@ -49,3 +49,7 @@ export type epoll_event = struct { events: u32, data: epoll_data, }; + +export type cpu_set = struct { + __bits: [16]u64, +}; diff --git a/rt/+linux/+riscv64.ha b/rt/+linux/+riscv64.ha @@ -47,3 +47,7 @@ export type epoll_event = struct { events: u32, data: epoll_data, }; + +export type cpu_set = struct { + __bits: [16]u64, +}; diff --git a/rt/+linux/+x86_64.ha b/rt/+linux/+x86_64.ha @@ -47,3 +47,7 @@ export type epoll_event = struct @packed { events: u32, data: epoll_data, }; + +export type cpu_set = struct { + __bits: [16]u64, +}; diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -932,3 +932,21 @@ export fn shmat(id: int, addr: *const void, flag: int) *void = { return syscall3(SYS_shmat, id: u64, addr: uintptr: u64, flag: u64): uintptr: *void; }; + +export fn sched_getaffinity( + pid: int, + cpusetsize: size, + mask: *cpu_set, +) (void | errno) = { + wrap_return(syscall3(SYS_sched_getaffinity, + pid: u64, cpusetsize: u64, mask: uintptr: u64))?; +}; + +export fn sched_setaffinity( + pid: int, + cpusetsize: size, + mask: *const cpu_set, +) (void | errno) = { + wrap_return(syscall3(SYS_sched_setaffinity, + pid: u64, cpusetsize: u64, mask: uintptr: u64))?; +};