2.9BSD/usr/man/man2/setpgrp.2j

.TH SETPGRP 2J
.UC
.SH NAME
setpgrp, getpgrp \- set/get process group
.SH SYNOPSIS
.B int getpgrp(pid)
.PP
.B setpgrp(pid, pgrp)
.PP
.B cc ... \-ljobs
.SH DESCRIPTION
The process group of the specified process is returned by
.I getpgrp.
.I Setpgrp
sets the process group of the specified process
.I pid
to the specified
.I pgrp.
If
.I pid
is zero, then the call applies to the current process.
.PP
If the invoker is not the super-user, then the affected process
must have the same effective user-id as the invoker or be a descendant
of the invoking process.
.PP
This call is used by
.IR csh (1)
to create
process groups
in implementing job control.
The TIOCGPGRP and TIOCSPGRP calls
described in
.IR tty (4)
are used to get/set the process group of the control terminal.
.PP
See
.IR intro (3J)
for a general discussion of job control.
.SH ERRORS
.I Setpgrp
will fail and the process group will not be altered if one of the following
is true:
.TP 20
[ESRCH]
The reqoested process does not exist.
.TP 20
[EPERM]
The effective user ID of the request process is diferent from that of the caller
and the process is not a descendent of the calling process.
.SH "SEE ALSO"
csh(1), getuid(2), intro(3J), tty(4)
.SH "ASSEMBLER (PDP-11)"
(setpgrp = 39.)
.br
(process id in r0)
.br
.B sys setpgrp; newgrp
.sp
(getpgrp is implemented as setpgrp(pid,-1))
.br
.B sys setgrp; -1
.br
(process group in r0)
.SH BUGS
The job control facilities are not available in standard version 7 UNIX.
These facilities are still under development and may change in future
releases of the system as better inter-process communication facilities
and support for virtual terminals become available.  The options and
specifications of these system calls and even the calls themselves
are thus subject to change.
.PP
A system call
.I setpgrp
has been implemented in other versions of UNIX which are not widely
used outside of Bell Laboratories; these implementations
have, in general, slightly different semantics.