3 ms·
> The getpid command has a pretty self-explanatory name, but I wondered what the parameters that were passed to the function were. Does anyone know what's goin
by jwilk 9y ago
> The getpid command has a pretty self-explanatory name, but I wondered what the parameters that were passed to the function were.
Does anyone know what's going on here? It looks like all syscalls are shown to have 3 arguments, even when they wouldn't need that many... Except close() which is shown to have only one.
- zwp 9y agoThis appears to be an artifact of dtruss(1). Syscalls that aren't special-cased are assumed to have 3 arguments: https://github.com/joyent/dtruss-osx/blob/c3b23e279187056e76c8ad02057d98b67f760290/dtruss#L237 https://github.com/joyent/dtruss-osx/blob/c3b23e279187056e76... There are special cases for 0..6 arguments (including one for close(2)) so I guess getpid(2) slipped through the cracks.
- cat199 9y agonot sure how much macos retains of this, but bsd derivatives essentially convert userland libc 'syscalls' into to a call to a single lower level 'syscall' function which passes data to/from the kernel using a macro / integer list to determine which actual functionality is desired.. https://www.freebsd.org/cgi/man.cgi?query=syscall&sektion=2 https://www.freebsd.org/cgi/man.cgi?query=syscall&sektion=2