I think this is wrong for a number of reasons, here is an excerpt from man epoll_create1:
ERRORS
EINVAL size is not positive.
EINVAL (epoll_create1()) Invalid value specified in flags.
EMFILE The per-user limit on the number of epoll instances imposed by
/proc/sys/fs/epoll/max_user_instances was encountered. See
epoll(7) for further details.
EMFILE The per-process limit on the number of open file descriptors has
been reached.
ENFILE The system-wide limit on the total number of open files has been
reached.
ENOMEM There was insufficient memory to create the kernel object.
opt/zig-0.12/lib/std/os.zig:1:1: note: struct declared here
//! This file contains thin wrappers around OS-specific APIs, with these
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/engine/event-sources.zig:177:28: error: 'TFD_TIMER' is not marked 'pub'
const tid: os.linux.TFD_TIMER = 0;
~~~~~~~~^~~~~~~~~~
/opt/zig-0.12/lib/std/os/linux.zig:4251:1: note: declared here
const TFD_TIMER = packed struct(u32) {
The Handle abstraction floating around a lot of those function isn’t very useful and detrimental as other code tries to use it. Like much of the posix namespace, it exists is the leaky halfway abstraction between std.os.* and std.{fs,net,...}.* that should be mostly ditched.
Ok, I will mark this as solution,
but it’s strange to see epoll_create1, epoll_ctl, epoll_wait, timerfd_create inside std.posix. they all should be in std.os.linux or something like this.
So some OS facility, specific to Linux (timerfd) is in std.posix, but data structures for this facility are still in std.os.linux… it is confusing, at least.