int prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
Is there a reason why a more idiomatic void * to struct wasn't used for the args? int prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
Is there a reason why a more idiomatic void * to struct wasn't used for the args?Here 'unsigned long' is just a convenient stand-in for "generic register-sized argument".
A "void * pointing to struct" requires a copy from user space. If a particular prctl() does need a struct, it can certainly stuff a pointer into one of those 'unsigned long' parameters (in the kernel environment, a pointer can be converted to and from an unsigned long without concern).
That wouldn't be register-sized on x86 would it?
Edit: but of course you meant OS with system, not hardware architecture :)
Therefore, Linux-only code (including the Linux kernel itself) commonly uses "long" or "unsigned long" to mean "register-sized" and "large enough to fit a pointer"; portable code normally uses "size_t" or "uintptr_t" for that.
Depending on option, the args can be pointers to structure.
It’s also worth noting that most older Linux system calls do not follow that pattern in general, so I don’t know that I would consider void* idiomatic for system calls until recently.