hare

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

commit 8f42a75a025b6bf795592fb008f32ad844664f02
parent 395d2a35ce07004d9a44a6f02f285ff06415753c
Author: Willow Barraco <contact@willowbarraco.fr>
Date:   Sat, 17 Feb 2024 09:01:39 +0100

Help reading inotify_events

With 6c1a836c, we now can't bind, or compute the size of inotify_events.

This help using rt::read on inotify_event:

let buf: [rt::INOTIFY_EVENT_MAX_SIZE]u8 = [0...];
rt::read(inotifyfile, &buf, rt::INOTIFY_EVENT_MAX_SIZE)!
let event = &buf: *[*]u8: *rt::inotify_event;

This approach is also related to this ticket:

https://todo.sr.ht/~sircmpwn/hare/863

How should we help the users in those situations?

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>

Diffstat:
Mrt/+linux/syscalls.ha | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -934,6 +934,9 @@ export fn flock(fd: int, op: int) (void | errno) = { fd: u64, op: u64))?; }; +export def NAME_MAX: size = 255z; +export def INOTIFY_EVENT_MAX_SIZE: size = size(int) + size(u32)*3 + NAME_MAX + 1z; + export fn inotify_init() (int | errno) = { return wrap_return(syscall1(SYS_inotify_init1, 0))?: int; };