← Back to context

Comment by marcosdumay

2 years ago

I'm pretty sure if you just repackage the syscalls into a basic module of your language, you will get more stability than by linking to the libc.

I guess people don't do it because the difference is minimal and they use a lot of other features from the C runtime too.

EDIT: Ops. Not on BSD! The entire thread is about BSD and here I am mindlessly talking about Linux.

Only on systems where the syscall ABI is stable, like on Linux. Others, like macOS and Windows[0], can and will change theirs between releases. OpenBSD even goes one step further and actively prevents code other than libc from performing syscalls[1]

[0] I seem to remember that this changed in a recent Windows version, but I couldn't immediately find a source.

[1] msyscall(2) or, if you don't have an OpenBSD system at hand, https://man.openbsd.org/msyscall