Standard C Library (libc, -lc)
#include
<sys/procctl.h>
int
procctl(idtype_t
idtype, id_t id,
int cmd,
void *arg);
The
procctl()
system call provides for control over processes. The
idtype and id arguments specify
the set of processes to control. If multiple processes match the identifier,
procctl will make a “best effort” to
control as many of the selected processes as possible. An error is only
returned if no selected processes successfully complete the request. The
following identifier types are supported:
P_PIDP_PGIDThe control request to perform is specified by the cmd argument. The following commands are supported:
PROC_SPROTECTPPROT_SETPPROT_CLEARThe following optional flags are supported:
PPROT_DESCENDPPROT_INHERITPPROT_SET, mark all future
child processes of each selected process as protected. Future child
processes will also mark all of their future child processes.If an error occurs, a value of -1 is returned and errno is set to indicate the error.
The procctl() system call will fail
if:
EFAULT]EINVAL]The idtype argument specifies an unsupported identifier type.
EPERM]ESRCH]EINVAL]PROC_SPROTECT command.The procctl() function appeared in
FreeBSD 10.