setpgid(2) — System Calls
OSF
NAME
setpgid, setpgrp − Sets the process group ID
SYNOPSIS
#include <sys/types.h> int setpgid (
pid_t process_id,
pid_t process_group_id );
PARAMETERS
process_idSpecifies the process whose 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 the process_id parameter is set to the value of the process_group_id parameter. If process_id is 0 (zero), the process ID of the calling process is used. If process_group_id is 0 (zero), the process group ID of the indicated process is used.
This function is implemented to support job control.
NOTES
The setpgrp() function is supported by OSF/1 for binary compatibility only.
AES Support Level:
Full use (setpgid())
RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
If the setpgid() function fails, errno may be set to one of the following values:
[EINVAL]The value of the process_group_id parameter is less than or equal to 0 (zero), or is not a valid process ID.
[EPERM]The value of the process_group_id parameter is a valid process ID, but that process is not in the same session as the calling process.
[EPERM]The process indicated by the process_id parameter is a session leader.
[EPERM]The value of the process_id parameter 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.
[EPERM]The value of the process_group_id parameter is valid but does not match the process ID of the process indicated by the process_id parameter, and there is no process with a process group ID that matches the value of the process_group_id parameter in the same session as the calling process.
[ESRCH]The value of the process_id parameter does not match the process ID of the calling process or of a child process of the calling process.
[EACCES]The value of the process_id parameter 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)