SETPGID(2-POSIX) RISC/os Reference Manual SETPGID(2-POSIX)
NAME
setpgid - set process group ID for job control
SYNOPSIS
#include <sys/types.h>
int setpgid(pid, pgid)
pidt pid, pgid;
DESCRIPTION
The setpgid() function is used to either join an existing
process group or create a new process group within the ses-
sion of the calling process. The process group ID of a ses-
sion leader does not change. Upon successful completion,
the process group ID of the process with a process ID that
matches pid shall be set to pgid. If pid is zero, the pro-
cess ID of the calling process is used. Also, if pgid is
zero, the process ID of the indicated process is used.
RETURNS
Upon successful completion, setpgid() returns 0. Otherwise,
-1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occur, setpgid() returns
-1 and sets errno to the corresponding value:
[EACCES] The value of pid matches the process ID
of a child process of the calling pro-
cess and the child process has success-
fully executed one of the exec func-
tions.
[EINVAL] pgid is less to zero.
[EPERM] pid indicates a process that is a ses-
sion leader, or
pid 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, or
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 pgid in the same session as
the calling process.
[ESRCH] pid does not match the process ID of the
calling process or of a child process of
the calling process.
Printed 1/15/91 Page 1
SETPGID(2-POSIX) RISC/os Reference Manual SETPGID(2-POSIX)
SEE ALSO
exec(2), getpgrp(2), setpgrp(2), setsid(2), tcsetpgrp(3).
Page 2 Printed 1/15/91