authorgravatar for 51252236+xdBronch@users.noreply.github.comxdBronch <51252236+xdBronch@users.noreply.github.com> 2023-12-02 05:41:26-05:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-12-08 15:58:08+02:00
loge9bd10cfda23252fb4188033a2edddd0c94d7fa3
tree21042c9f7b16cedaab51ae56f0636cac6e598302
parent56deb5b0545c049f7445003d12e50a052088b994

add getName helper to inotify_event


1 files changed, 8 insertions(+), 0 deletions(-)

lib/std/os/linux.zig+8
...@@ -3615,6 +3615,14 @@ pub const inotify_event = extern struct {...@@ -3615,6 +3615,14 @@ pub const inotify_event = extern struct {
3615 cookie: u32,3615 cookie: u32,
3616 len: u32,3616 len: u32,
3617 //name: [?]u8,3617 //name: [?]u8,
3618
3619 // if an event is returned for a directory or file inside the directory being watched
3620 // returns the name of said directory/file
3621 // returns `null` if the directory/file is the one being watched
3622 pub fn getName(self: *const inotify_event) ?[:0]const u8 {
3623 if (self.len == 0) return null;
3624 return std.mem.sliceTo(@as([*:0]const u8, @ptrCast(self)) + @sizeOf(inotify_event), 0);
3625 }
3618};3626};
36193627
3620pub const dirent64 = extern struct {3628pub const dirent64 = extern struct {