[PATCH v2] Add public function syscall_no_errno

Rich Felker dalias@libc.org
Mon Feb 12 14:44:39 GMT 2024


On Mon, Feb 12, 2024 at 03:24:52PM +0100, Florian Weimer wrote:
> * Askar Safin:
> 
> > +@code{syscall_no_errno} is Linux-specific GNU extension. It does the same
> > +as @code{syscall}, but does not interpret return value, returned by Linux
> > +kernel, and doesn't set @code{errno}. This makes @code{syscall_no_errno}
> > +suitable for performing Linux syscalls, which never fail, such as
> > +@code{SYS_getuid}.
> 
> Are there really any system calls which return a value in the range
> -4095 to -1, and it's still considered a success?

Yes, there are a very small number of such syscalls -- getuid and
getgid are the only relevant ones AFAICT -- but the author of this
proposal is missing the point. They want to avoid using libc, but then
have a libc function to make their raw syscalls for them, rather than
just doing that themselves. And apparently this function is supposed
to have an undocumented contract that you can call it from contexts
where calling other libc functions might not be valid..? Or not? It
was never really clarified.

They also seem to be under the mistaken impression that you can just
add arbitrary pet functions to libc as long as you follow some
procedures for doing it the right way, rather than understanding that
the maintainer's job is to say no, and that functions don't go in libc
unless there's some sort of consensus that they belong there.

Rich


More information about the Libc-alpha mailing list