Manual page for SETPGID(2V)
setpgid - set process group ID for job control
SYNOPSIS
#include <sys/types.h>
int setpgid (pid, pgid)
pid_t pid, pgid;
DESCRIPTION
setpgid()
is used to either join an existing process group
or create a new process group within the session of the calling
process
(see
NOTES).
The process group
ID
of a session leader does not change.
Upon successful completion, the process group
ID
of the process with a process
ID
that matches
pid
is set to
pgid.
As a special case, if
pid
is zero, the process
ID
of the calling process is used.
Also, if
pgid
is zero, the process
ID
of the process indicated by
pid
is used.
RETURN VALUES
setpgid()
returns:
- 0
-
on success.
- -1
-
on failure and sets
errno
to indicate the error.
ERRORS
- EACCES
-
The value of
pid
matches the process
ID
of a child process of the calling process and the child
process has successfully executed one of the
exec()
functions.
- EINVAL
-
The value of
pgid
is less than zero or is greater than
MAXPID,
the maximum process
ID
as defined in
<sys/param.h>.
- EPERM
-
The process indicated by
pid
is a session leader.
The value of
pid
is valid but matches the process
ID
of a child process of the calling process and the child process is
not in the same session as the calling process.
The value of
pgid
does not match the process
ID
of the process indicated by
pid
and there is no process with a process group
ID
that matches the value of
pgid
in the same session as the
calling process.
- ESRCH
-
pid
does not match the
PID
of the calling process or the
PID
of a child of the calling
process.
SEE ALSO
getpgrp.2v
execve.2v
setsid.2v
tcgetpgrp.3v
NOTES
For
setpgid()
to behave as described above,
{_POSIX_JOB_CONTROL}
must be in effect (see
sysconf.2v
{_POSIX_JOB_CONTROL}
is always in effect
on SunOS systems, but for portability, applications should call
sysconf()
to determine whether
{_POSIX_JOB_CONTROL}
is in effect for the current system.
Created by unroff & hp-tools.
© somebody (See intro for details). All Rights Reserved.
Last modified 11/5/97