4 ms·
The comment section where gcc puts in ident info can be omitted with -fno-ident and syscall(2) is usually a very thin wrapper[0]. If you follow the musl syscall
by nwmcsween 10y ago
The comment section where gcc puts in ident info can be omitted with -fno-ident and syscall(2) is usually a very thin wrapper[0]. If you follow the musl syscall(2) it simply maps errors to errno[1] and uses the fancy count-args-in-macro[2] to call off the respective $arch/syscall_arch.h[3] syscall$n numbered functions.
[0] https://git.musl-libc.org/cgit/musl/tree/src/misc/syscall.c https://git.musl-libc.org/cgit/musl/tree/src/misc/syscall.c
[1] https://git.musl-libc.org/cgit/musl/tree/src/internal/syscall_ret.c https://git.musl-libc.org/cgit/musl/tree/src/internal/syscal...
[2] https://git.musl-libc.org/cgit/musl/tree/src/internal/syscall.h https://git.musl-libc.org/cgit/musl/tree/src/internal/syscal...
[3] https://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall_arch.h https://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall...
- justincormack 10y agoHighly recommend reading the Musl source code if you want to find out how things work. Don't bother trying to look at Glibc.
- shakna 10y agoCannot agree more. glibc's source feels like archeology: there's so much history and remnants of bygone eras. musl feels like a structured, well-engineered and specified piece of architecture. This isn't a knocj against glibc. But it was grown, not built. musl and the team's great documentation have been incredibly handy when I've been building tightly constrained applications.
- Sean1708 10y agoWhy does syscall use varags then assume that there will be 7 arguments?