procctl(2) control processes

LIBRARY

Lb libc

SYNOPSIS

In sys/procctl.h Ft int Fn procctl idtype_t idtype id_t id int cmd void *arg

DESCRIPTION

The Fn procctl system call provides for control over processes. The Fa idtype and Fa id arguments specify the set of processes to control. If multiple processes match the identifier, 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_PID
Control the process with the process ID Fa id .
P_PGID
Control processes belonging to the process group with the ID Fa id .

The control request to perform is specified by the Fa cmd argument. The following commands are supported:

PROC_SPROTECT
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 Fa arg parameter must point to an integer containing an operation and zero or more optional flags. The following operations are supported:

PPROT_SET
Mark the selected processes as protected.
PPROT_CLEAR
Clear the protected state of selected processes.

The following optional flags are supported:

PPROT_DESCEND
Apply the requested operation to all child processes of each selected process in addition to each selected process.
PPROT_INHERIT
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 VALUES

If an error occurs, a value of -1 is returned and errno is set to indicate the error.

ERRORS

The Fn procctl system call will fail if:

Bq Er EFAULT
The Fa arg points outside the process's allocated address space.
Bq Er EINVAL
The Fa cmd argument specifies an unsupported command.

The Fa idtype argument specifies an unsupported identifier type.

Bq Er EPERM
The calling process does not have permission to perform the requested operation on any of the selected processes.
Bq Er ESRCH
No processes matched the requested Fa idtype and Fa id .
Bq Er EINVAL
An invalid operation or flag was passed in Fa arg for a PROC_SPROTECT command.

HISTORY

The Fn procctl function appeared in Fx 10 .