3 ms·
The author of liblinux commented about it a couple days ago on HN [1] The part most relevant to this discussion: > I stopped developing this because I discove
by wongarsu 5y ago
The author of liblinux commented about it a couple days ago on HN [1]
The part most relevant to this discussion:
> I stopped developing this because I discovered the Linux itself has a better solution that they use for their own tools:
> https://github.com/torvalds/linux/blob/master/tools/include/nolibc/nolibc.h https://github.com/torvalds/linux/blob/master/tools/include/...
1: https://news.ycombinator.com/item?id=29106179 https://news.ycombinator.com/item?id=29106179
- zokier 5y agoInteresting that nolibc reproduces one of the greatest misfeatures (obviously heavily imho) of libc, the errno. At least it is sort of optional there.
- matheusmoreira 5y agoI 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!
- remram 5y agoIf 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.
- deleted 5y ago[deleted]