News for hackers. Stuff that matters.
Re:liblinux: Architecture-independent access to Linux system... by zokier on Tuesday November 09, 2021 @10:05AM (#29162663)
Interesting that nolibc reproduces one of the greatest misfeatures (obviously heavily imho) of libc, the errno. At least it is sort of optional there.
Re:liblinux: Architecture-independent access to Linux system... by matheusmoreira on Tuesday November 09, 2021 @10:21AM (#29162861)
I agree. That's one thing I don't like about the kernel header. Linux system calls already have a good interface, they return error codes that consist of negated errno constants. Since we're not using the C library, we might as well do things right and remove global variables.

The kernel developers implemented nolibc.h with 3 levels of abstraction: system call entry point, function wrappers and libc interface. They set errno in the libc interface. Personally I don't see the point.

> The third level is the libc call definition.

> It exposes the lower raw sys_<name>() calls in a way that looks like what a libc usually does, takes care of specific input values, and of setting errno upon error.

Defining NOLIBC_IGNORE_ERRNO solves the problem!

Re:liblinux: Architecture-independent access to Linux system... by remram on Tuesday November 09, 2021 @11:16AM (#29163683)
If it's trying to be a drop-in replacement, it has to have the same API... You could also wonder why they spelled CREAT without an E again, with the same answer.