94 lines
1.9 KiB
Groff
94 lines
1.9 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g2.setpgrp @(#)setpgrp 30.2 of 12/25/85
|
|
.TH SETPGRP 2
|
|
.SH NAME
|
|
setpgrp, BSDsetpgrp \- set process group \s-1ID\s+1 (System V and 4.3BSD)
|
|
.Op c p a
|
|
.SH C SYNOPSIS
|
|
.PP
|
|
.sp
|
|
.ti -2
|
|
.B "#include <unistd.h>"
|
|
.sp
|
|
.nf
|
|
.ti -2
|
|
.IR SysV :
|
|
.br
|
|
.B "pid_t setpgrp (void);"
|
|
.PP
|
|
.ti -2
|
|
.IR BSD :
|
|
.br
|
|
Links with the \s-1BSD\s+1 version automatically:
|
|
.B "int BSDsetpgrp(int pid, int pgrp);"
|
|
.sp
|
|
Links with the \s-1BSD\s+1 version if \f2\-lbsd\fP is specified during link phase:
|
|
.B "int setpgrp(int pid, int pgrp);"
|
|
.fi
|
|
.Op
|
|
.Op f
|
|
.SH FORTRAN SYNOPSIS
|
|
.B "integer *4 function setpgrp ()"
|
|
.Op
|
|
.SH DESCRIPTION
|
|
The System V version of
|
|
.I setpgrp\^
|
|
behaves identically to
|
|
.I setsid
|
|
(2).
|
|
.PP
|
|
The
|
|
.SM BSD
|
|
version of
|
|
.I setpgrp
|
|
sets the process group of the specified process
|
|
.I pid
|
|
to the specified
|
|
.IR pgrp .
|
|
If
|
|
.I pid
|
|
is zero, then the call applies to the current process.
|
|
If
|
|
.IR pgrp
|
|
is zero and pid refers to the calling process,
|
|
.I setpgrp()
|
|
behaves identically to
|
|
.I setsid
|
|
(2).
|
|
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 member of the
|
|
same session as the calling process.
|
|
.SH "ERRORS: BSD VERSION ONLY"
|
|
.I BSDsetpgrp
|
|
will fail and the process group will not be altered if
|
|
one of the following occur:
|
|
.TP 15
|
|
.SM
|
|
\%[ESRCH]
|
|
The requested process does not exist.
|
|
.TP 15
|
|
.SM
|
|
\%[EPERM]
|
|
The effective user
|
|
.SM ID
|
|
of the requested process is different
|
|
from that of the caller and the process is not in the same session as the
|
|
calling process.
|
|
.SH SEE ALSO
|
|
exec(2), fork(2), getpgrp(2), getpid(2), intro(2), kill(2), setpgid(2),
|
|
setsid(2), signal(2).
|
|
.SH DIAGNOSTICS
|
|
The System V version of
|
|
.I setpgrp\^
|
|
returns the value of the new process group
|
|
.SM ID\*S
|
|
with no possibility of error. The
|
|
.SM BSD
|
|
version returns 0
|
|
if the operation is successful. If the
|
|
request fails, \-1 is returned and the global variable
|
|
.I errno
|
|
is set to indicate the reason.
|
|
.\" @(#)setpgrp.2 6.2 of 9/6/83
|
|
.Ee
|