Possible problems in posix namespace

I think I find some problems in the posix namespace, but I’m not sure.

  • 1 The signature for read is
    ssize_t read(int fildes, void *buf, size_t nbyte);

    The signature is correct in the linux namespace, but in
    posix namespace the signature is
    pub fn read(fd: fd_t, buf: []u8) ReadError!usize

  • 2 In the posix namespace I found API that do not belong to
    posix, like timerfd_clockid_t, signalfd and fanotify.

    The last two functions have Zig error handling.

Thanks

FWIW, the std.posix namespace is on its way out, so I don’t think these will be fixed: https://codeberg.org/ziglang/zig/issues/31694

It’s a shame that posix will be removed, because it is a well known standard.

Thanks.

just to clarify: functions that use or adapt the POSIX standard functions are different from the POSIX standard functions themselves. the latter are not going away (for one thing, if you link against libc on a POSIX platform, there they are), but the core team has decided that Zig’s adaptations in std.posix (these are the former) are not the right abstraction layer for the standard library.

4 Likes