From d3ed3bf1084d8d0e5029a6204188b798b9ff58bf Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 20 Apr 2025 16:45:59 -0700 Subject: [PATCH] add inotify_init --- mod.zig | 8 +++++++- test.zig | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mod.zig b/mod.zig index cfb98f41314155fcab26bb6908619e1c7dc3df82..962680714d1de07a567ddb487b43e339b2c4c22c 100644 --- a/mod.zig +++ b/mod.zig @@ -1299,7 +1299,13 @@ pub const ioprio_get = @compileError("TODO: ioprio_get"); // inotify_init // int inotify_init(void); // asmlinkage long sys_inotify_init(void); -pub const inotify_init = @compileError("TODO: inotify_init"); +pub fn inotify_init() errno.Error!c_int { + const r = syscall0(.inotify_init); + return switch (_errno(r)) { + .ok => @intCast(r), + _ => |c| errno.errorFromInt(@intFromEnum(c)), + }; +} // inotify_add_watch // int inotify_add_watch(int fd, const char *pathname, uint32_t mask); diff --git a/test.zig b/test.zig index 3516b1d765694169033fa1726d9d0da75c66a48b..7d233287eb69601dd7c0a0b81903ec49a361a667 100644 --- a/test.zig +++ b/test.zig @@ -23,4 +23,5 @@ test { _ = &linux.vhangup; _ = &linux.sync; _ = &linux.gettid; + _ = &linux.inotify_init; } -- 2.54.0