hare

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

commit 5482ec029bbf25bae1db03fe5520dadf934afd45
parent 46eb0f7b83a239a19445edbc2155c02609052461
Author: Sebastian <sebastian@sebsite.pw>
Date:   Mon, 10 Oct 2022 17:26:39 -0400

rt+linux: add splice

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

Diffstat:
Mrt/+linux/syscalls.ha | 14++++++++++++++
Mrt/+linux/types.ha | 5+++++
2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -843,3 +843,17 @@ export fn memfd_create(name: *const char, flags: uint) (int | errno) = { return wrap_return(syscall2(SYS_memfd_create, name: uintptr: u64, flags: u64))?: int; }; + +export fn splice( + fd_in: int, + off_in: nullable *u64, + fd_out: int, + off_out: nullable *u64, + ln: size, + flags: uint, +) (size | errno) = { + return wrap_return(syscall6(SYS_splice, + fd_in: u64, off_in: uintptr: u64, + fd_out: u64, off_out: uintptr: u64, + ln: u64, flags: u64))?: size; +}; diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha @@ -831,3 +831,8 @@ export def STDERR_FILENO: int = 2; export def MFD_CLOEXEC: uint = 1; export def MFD_ALLOW_SEALING: uint = 2; export def MFD_HUGETLB: uint = 4; + +export def SPLICE_F_MOVE: uint = 1; +export def SPLICE_F_NONBLOCK: uint = 2; +export def SPLICE_F_MORE: uint = 4; +export def SPLICE_F_GIFT: uint = 8;