The prototype of prctl is
int prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5);
in the man page whereas in the header it is declared as a variadic function:
extern int prctl (int __option, ...) __THROW;
unsigned long?Just pass what you have to pass and write 0 casted to unsigned long in the rest of arguments or skip them entirely. As prctl is declared as variadic function it will handle this situation accordingly.
const char* name = "The user";
if (prctl(PR_SET_NAME, (unsigned long) name,
(unsigned long)0, (unsigned long)0, (unsigned long)0) == -1)
{
// handle error
perror("prctl failed");
return -1;
}
or
const char* name = "The user";
if (prctl(PR_SET_NAME, (unsigned long) name) == -1)
{
// handle error
perror("prctl failed");
return -1;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With