hare

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

commit bcb5b4b04e5dcf9ff56da84d1546f0d60cefc8ab
parent c9c76d9a3540d454b1a331d0550e92c0408886ce
Author: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Date:   Mon,  8 Nov 2021 15:45:11 +0100

rt: Add socketpair() syscall (both linux and freebsd)

Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>

Diffstat:
Mrt/+freebsd/syscalls.ha | 10++++++++++
Mrt/+linux/syscalls.ha | 10++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/rt/+freebsd/syscalls.ha b/rt/+freebsd/syscalls.ha @@ -374,6 +374,16 @@ export fn socket(domain: int, type_: int, protocol: int) (int | errno) = { domain: u64, type_: u64, protocol: u64))?: int; }; +export fn socketpair( + domain: int, + type_: int, + protocol: int, + sv: *[*]int, +) (int | errno) = { + return wrap_return(syscall4(SYS_socketpair, domain: u64, + type_: u64, protocol: u64, sv: uintptr : u64))?: int; +}; + export fn connect(sockfd: int, addr: *const sockaddr, addrlen: u32) (int | errno) = { return wrap_return(syscall3(SYS_connect, sockfd: u64, addr: uintptr: u64, addrlen: u64))?: int; diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -506,6 +506,16 @@ export fn socket(domain: int, type_: int, protocol: int) (int | errno) = { domain: u64, type_: u64, protocol: u64))?: int; }; +export fn socketpair( + domain: int, + type_: int, + protocol: int, + sv: *[2]int +) (int | errno) = { + return wrap_return(syscall4(SYS_socketpair, domain: u64, + type_: u64, protocol: u64, sv: uintptr : u64))?: int; +}; + export fn connect(sockfd: int, addr: *const sockaddr, addrlen: u32) (int | errno) = { return wrap_return(syscall3(SYS_connect, sockfd: u64, addr: uintptr: u64, addrlen: u64))?: int;