hare

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

commit 87f4c645f4c969a179c6dd6da5bf877191c7dfdb
parent d7f7075927ae26c06724ec1eb62ad778a2f2b3e7
Author: Sebastian <sebastian@sebsite.pw>
Date:   Fri, 12 May 2023 21:20:37 -0400

rt: implement shutdown

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mrt/+freebsd/syscalls.ha | 5+++++
Mrt/+freebsd/types.ha | 4++++
Mrt/+linux/syscalls.ha | 5+++++
Mrt/+linux/types.ha | 4++++
4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/rt/+freebsd/syscalls.ha b/rt/+freebsd/syscalls.ha @@ -555,3 +555,8 @@ export fn sigaction( return wrap_return(syscall3(SYS_sigaction, signum: u64, act: uintptr: u64, old: uintptr: u64))?: int; }; + +export fn shutdown(sockfd: int, how: int) (void | errno) = { + wrap_return(syscall2(SYS_shutdown, + sockfd: u64, how: u64))?; +}; diff --git a/rt/+freebsd/types.ha b/rt/+freebsd/types.ha @@ -466,3 +466,7 @@ export def RLIMIT_NPTS: int = 11; export def RLIMIT_SWAP: int = 12; export def RLIMIT_KQUEUES: int = 13; export def RLIMIT_UMTXP: int = 14; + +export def SHUT_RD: int = 0; +export def SHUT_WR: int = 1; +export def SHUT_RDWR: int = 2; diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -960,3 +960,8 @@ export fn setrlimit(resource: int, rlim: *const rlimit) (void | errno) = { wrap_return(syscall2(SYS_setrlimit, resource: u64, rlim: uintptr: u64))?; }; + +export fn shutdown(sockfd: int, how: int) (void | errno) = { + wrap_return(syscall2(SYS_shutdown, + sockfd: u64, how: u64))?; +}; diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha @@ -902,3 +902,7 @@ export def RLIMIT_NICE: int = 13; export def RLIMIT_RTPRIO: int = 14; export def RLIMIT_RTTIME: int = 15; export def RLIMIT_NLIMITS: int = 16; + +export def SHUT_RD: int = 0; +export def SHUT_WR: int = 1; +export def SHUT_RDWR: int = 2;