Hacker News new | ask | show | jobs
by Aransentin 592 days ago
> We try to hide some of the differences between arches when reasonably feasible. e.g. Newer architectures no longer provide an open syscall, but do provide openat. We will still expose a sys_open helper by default that calls into openat instead.

Sometimes you actually want to make sure that the exact syscall is called; e.g. you're writing a little program protected by strict seccomp rules. If the layer can magically call some other syscall under the hood this won't work anymore.

1 comments

musl does this too. glibc may also, I haven't checked in a long time. I bet rust, etc., does too. You always need to check.
Glibc definitely does this transparent mapping as well. Calling int fd = open(<path>, O_RDONLY) yields openat(AT_FDCWD, <path>, O_RDONLY) when running through strace.
This really surprised me when I was digging into Linux tracing technology and noticed no `open` syscalls on my running system. It was all `openat`. I don't know when this transition happened, but I totally missed it.