3 ms·
I was somewhat surprised by the small number of process startup/libc initialization syscalls in the trace in original article. On Linux (Debian unstable in my
by dfox 9y ago
I was somewhat surprised by the small number of process startup/libc initialization syscalls in the trace in original article.
On Linux (Debian unstable in my case) you will get order of magnitude more, because rm is dynamically linked (although it seems that only with libc and nothing else), because of libc startup (did you know that linux has amd64-specific syscall arch_prctl(PRCTL_SET_FS), that does exactly what it sounds like?). And then because core utils rm cares about such things as whether stdin is terminal (probably because -f/-i behavior changes depending on that) and does the actual unlink in somewhat convoluted way that involves fstatat() (called twice, for some reason) and only then unlinkat(). Somewhat notably last thing that rm does is trying to lseek() stdin only to get ESPIPE...