Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

execve(2)

fork(2)

getpid(2)

getuid(2)

intro(2)

kill(2V)

csh(1)

signal(3)

termio(4)

SETPGRP(2V)  —  SYSTEM CALLS

NAME

setpgrp, getpgrp − set and/or return the process group of a process

SYNOPSIS

int setpgrp(pid, pgrp)
int pgrp;
int pid;

int getpgrp(pid)
int pid;

SYSTEM V SYNOPSIS

int setpgrp()

int getpgrp()

DESCRIPTION

setpgrp

setpgrp() sets the process group of the specified process, (pid) to the process group specified by pgrp. If pid is zero, then the call applies to the current (calling) process. 

If the effective user ID is not that of the super-user, then the process to be affected must have the same effective user ID as that of the caller or be a descendant of that process. 

getpgrp

getpgrp() returns the process group of the indicated process.  If pid is zero, then the call applies to the calling process. 

Process groups are used for distribution of signals, and by terminals to arbitrate requests for their input.  Processes that have the same process group as the terminal run in the foreground and may read from the terminal, while others block with a signal when they attempt to read. 

This call is thus used by programs such as csh(1) to create process groups in implementing job control.  The TIOCGPGRP and TIOCSPGRP calls described in termio(4) are used to get/set the process group of the control terminal. 

SYSTEM V DESCRIPTION

setpgrp

setpgrp() sets the process group of the calling process to match its process ID, and returns the new process group ID. 

getpgrp

getpgrp() returns the process group of the calling process. 

RETURN VALUE

setpgrp() returns 0 when the operation was successful.  If the request failed, −1 is returned and the global variable errno indicates the reason. 

ERRORS

setpgrp() fails, and the process group is not altered when one of the following occurs:

ESRCH The requested process does not exist. 

EPERM The effective user ID of the requested process is different from that of the caller and the process is not a descendent of the calling process. 

SEE ALSO

execve(2), fork(2), getpid(2), getuid(2), intro(2), kill(2V), csh(1), signal(3), termio(4)

Sun Release 4.0  —  Last change: 22 March 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026