Hello,

On Mon, 8 Apr 2024 at 10:20, Matheus Afonso Martins Moreira via Gcc
<gcc@gcc.gnu.org> wrote:
>
> I'd like to add GCC builtins for generating Linux system call
> code for all architectures supported by Linux.
>
> They would look like this:
>
>     __builtin_linux_system_call(long n, ...)
>     __builtin_linux_system_call_1(long n, long _1)
>     __builtin_linux_system_call_2(long n, long _1, long _2)
>     /* More definitions, all the way up to 6 arguments */

What's the advantage of the _1, _2 etc. forms? The compiler knows how
many arguments you're passing, why can't there just be one built-in
handling all cases?



>
>   + It doesn't make sense for libraries to support it
>
>         There are libraries out there that provide
>         system call functionality. The various libcs do.
>         However they usually don't support the full set
>         of Linux system calls. Using certain system calls
>         could invalidate global state in these libraries
>         which leads to them not being supported. Clone is
>         the quintessential example. So I think libraries
>         are not the proper place for this functionality.

Your proposal doesn't seem to actually address the problem. If using
the clone syscall causes problems for glibc by not giving glibc a
chance to set up TLS etc for the new thread, how does making it easier
to use the clone syscall help?

Reply via email to