logoalt Hacker News

rocqua • yesterday at 12:32 PM • 1 reply • view on HN

I'd love to learn more about the syscalls that took 3 or 4 attempts.


Replies

toast0 • yesterday at 9:46 PM

Well, from a quick look, Linux has dup/dup2/dup3 and clone/clone2/clone3 . I don't see anything that took 4, but there are things like accept/acccept4 and where the second one takes four arguments and wait4 which takes 4 arguments, but wait3 was already obsolete before Linux or FreeBSD started numbering syscalls. (I'm lazy and only looking on systems I have)

It's not some Linux specific issue either. FreeBSD has three versions of statfs/fstatsfs/truncate/ftruncate.

A lot of the file related syscalls also have a XXXXat (ex: open/openat) variant taking a directory reference instead of using cwd.