hare

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

commit 62c7f5218df795c0b7936eab3a567322e4b84f5e
parent 6c27da4aeec62b58aa0e10f6982c23841507c489
Author: Stacy Harper <contact@stacyharper.net>
Date:   Sat, 14 Jan 2023 17:49:55 +0100

Add flock syscalls wrappers

Signed-off-by: Stacy Harper <contact@stacyharper.net>

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

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -872,3 +872,8 @@ export fn fallocate(fd: int, mode: int, off: i64, ln: i64) (void | errno) = { export fn posix_fallocate(fd: int, off: i64, ln: i64) (void | errno) = { fallocate(fd, 0, off, ln)?; }; + +export fn flock(fd: int, op: int) (int | errno) = { + return wrap_return(syscall2(SYS_flock, + fd: u64, op: u64))?: int; +}; diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha @@ -837,3 +837,8 @@ export def SPLICE_F_GIFT: uint = 8; export def SEEK_SET: int = 0; export def SEEK_CUR: int = 1; export def SEEK_END: int = 2; + +// Flock operations +export def LOCK_SH: int = 1; +export def LOCK_EX: int = 2; +export def LOCK_UN: int = 4;