|PROCCTL(2)||FreeBSD System Calls Manual||PROCCTL(2)|
NAMEprocctl — control processes
LIBRARYStandard C Library (libc, -lc)
SYNOPSIS#include < sys/procctl.h>
procctl( idtype_t idtype, id_t id, int cmd, void *arg);
DESCRIPTIONThe 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:
- Control the process with the process ID id.
- Control processes belonging to the process group with the ID id.
The control request to perform is specified by the cmd argument. The following commands are supported:
Set process protection state. This is used to mark a process as protected from being killed if the system exhausts available memory and swap. The
arg parameter must point to an integer containing an operation and zero or more optional flags. The following operations are supported:
- Mark the selected processes as protected.
- Clear the protected state of selected processes.
The following optional flags are supported:
- Apply the requested operation to all child processes of each selected process in addition to each selected process.
- When used with PPROT_SET, mark all future child processes of each selected process as protected. Future child processes will also mark all of their future child processes.
RETURN VALUESIf an error occurs, a value of -1 is returned and errno is set to indicate the error.
ERRORSThe procctl() system call will fail if:
- [ EFAULT]
- The arg points outside the process's allocated address space.
- [ EINVAL]
cmd argument specifies an unsupported command.
The idtype argument specifies an unsupported identifier type.
- [ EPERM]
- The calling process does not have permission to perform the requested operation on any of the selected processes.
- [ ESRCH]
- No processes matched the requested idtype and id.
- [ EINVAL]
- An invalid operation or flag was passed in arg for a PROC_SPROTECT command.
HISTORYThe procctl() function appeared in FreeBSD 10.
|September 19, 2013||FreeBSD|