setpgid(2) CLIX setpgid(2)
NAME
setpgid - Sets the process group ID
SYNOPSIS
#include <sys/types.h>
int setpgid(
pid_t process_id ,
pid_t process_group_id );
PARAMETERS
process_id
Specifies the process for which the process group ID is to be
changed.
process_group_id
Specifies the new process group ID.
DESCRIPTION
The setpgid() function is used either to join an existing process group or
to create a new process group within the session of the calling process.
The process group ID of a session leader will not change.
The process group ID of the process designated by process_id is set to the
value of the process_group_id parameter. If either process_id or
process_group_id is 0, the process ID or process group ID of the calling
process is used.
This function is implemented to support job control.
RETURN VALUES
Upon successful completion a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
ERRORS
When the setpgid() function fails, the following error statuses are
returned:
[EINVAL] The value of the process_group_id parameter is less than or
equal to 0, or is not a valid process ID.
[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
2/94 - Intergraph Corporation 1
setpgid(2) CLIX setpgid(2)
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] The value of process_id does not match the process ID of the
calling process or of a child process of the calling process.
[EACCES] The value of process_id matches the process ID of a child
process of the calling process and the child process has
successfully executed one of the exec() functions.
RELATED INFORMATION
Functions: getpid(2), setsid(2), setpgrp(2)
2 Intergraph Corporation - 2/94