DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

proctl(S)


proctl -- controls active processes or process groups

Syntax

cc . . . -lc

#include <sys/proctl.h>

int proctl(pid, command, arg) int pid, command; char *arg;

Description

proctl performs a variety of functions on active processes or process groups. It has the same form as the ioctl(S) system call, except that a process ID (pid) is substituted for a file descriptor as the first parameter.

command is an integer mnemonic, specifying the action to be taken, and arg is a pointer to a data structure which defines the parameters associated with the command if necessary.

If pid is greater than zero (0), the command affects the process whose process ID is equal to pid. pid may be 1.

If pid is zero, the command is sent to all processes, except processes 0 and 1 whose process group ID is equal to the process group ID of the sender.

If pid is -1 and the effective user ID of the sender is not the super user, the command is sent to all processes, except processes 0 and 1 whose real user ID is equal to the effective user ID of the sender.

If pid is -1 and the effective user ID of the sender is super user, the command is sent to all processes except processes 0 and 1.

If pid is negative but not -1, a signal is sent to all processes whose process group ID is equal to the absolute value of pid.

proctl fails if one or more of the following are true:


[EFAULT]
arg is not a valid address.

[EINVAL]
command or arg is not valid.

[ENOMEM]
The program has requested more memory than is available.

[EPERM]
The user ID of the sending process is not super user, and its real or effective user ID does not match the real or effective user ID of the receiving process.

[ESRCH]
No process can be found to match the specified pid.

Memory restrictions

exec(S) may fail when the required physical memory is larger than the available swap space. This restriction may be lifted using one of the following proctl commands:

PRHUGEX
Allows programs to be executed by this process even if they exceed the available swap space. Such programs must still fit in the available physical memory and the caller's effective user ID must be super user. Such HUGE processes are locked in memory to prevent them from being swapped. Processes that are marked HUGE with this system call but are not greater than the size of the swapper behave normally but can expand into a HUGE, locked process.

PRNORMEX
Makes a process unable to exec(S) HUGE programs. This call may be executed by any user. If an attempt is made to classify a process as normal using the PRNORMEX call when the process is already too big to swap, the proctl call fails, returning EINVAL.

For example, you can use the following code to allow a process to be executed even if it exceeds the available memory swapping space:

   if (argc < 2) {
   

fputs ("usage: runbig command arg ...\n", stderr); exit(2);

} argv[argc] = 0;

if (proctl(getpid(), PRHUGEX, (char *) 0) < 0) {

perror ("runbig"); exit(1);

}

Return value

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

See also

exec(S), ioctl(S), kill(S)

Standards conformance

proctl is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003