setpgid(2) DG/UX 4.30 setpgid(2)
NAME
setpgid - Set process group ID for job control.
SYNOPSIS
#include <sys/types.h>
int setpgid (pid, pgid)
pid_t pid, pgid;
DESCRIPTION
If {_POSIX_JOB_CONTROL} is defined:
The setpgid() function is used to either join an
existing process group or create a new process group
within the session of the calling process. The process
group ID of a session leader shall not change. Upon
successful completion, the process group ID of the
process with a process ID that matches pid shall be set
to pgid. As a special case, if pid is zero, the
process ID of the calling process shall be used. Also,
if pgid is zero, the process ID of the indicated
process shall be used.
Otherwise:
Either the implementation shall support the setpgid()
function as described above or the setpgid() function
shall fail.
RETURNS
Upon successful completion, the setpgid() function returns a
value of zero. Otherwise, a value of -1 is returned and
errno is set to indicate the error.
ERRORS
If any of the following conditions occur, the setpgid()
function shall return -1 and set errno to the corresponding
value:
[EACCES]
The value of the pid argument 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 the pgid argument is less than zero or is
not a value supported by the implementation.
[ENOSYS]
The setpgid() function is not supported by this
implementation.
Licensed material--property of copyright holder(s) Page 1
setpgid(2) DG/UX 4.30 setpgid(2)
[EPERM]
The process indicated by the pid argument is a session
leader.
The value of the pid argument 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 the pgid argument does not match the
process ID of the process indicated by the pid argument
and there is no process with a process group ID that
matches the value of the pgid argument in the same
session as the calling process.
[ESRCH]
The value of the pid argument does not match the
process ID of the calling process or of a child process
of the calling process.
SEE ALSO
getpgrp(2), setsid(2), tcsetpgrp(3), exec(2)
COPYRIGHTS
Portions of this text are reprinted from IEEE Std 1003.1-
1988, Portable Operating System Interface for Computer
Environment, copyright © 1988 by the Institute of Electrical
and Electronics Engineers, Inc., with the permission of the
IEEE Standards Department. To purchase IEEE Standards, call
800/678-IEEE.
In the event of a discrepancy between the electronic and the
original printed version, the original version takes
precedence.
STANDARDS
The setpgid() always behaves as if _POSIX_JOB_CONTROL were
defined, regardless of whether or not it is defined.
Licensed material--property of copyright holder(s) Page 2