Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

open(2)

getpid(2)

getpgrp(2)

setsid(2)

tcsetpgrp(3)

setpgrp(2)

SETPGID(2)                           SysV                           SETPGID(2)



NAME
     setpgid - set the process group ID for Job Control

SYNOPSIS
     #include <sys/types.h>

     int setpgid (process_id, process_group_id )
     pid_t process_id;
     pid_t process_group_id;


     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_id argument specifies the process whose process group ID is
     to be changed, and the process_group_id argument specifies the new
     process group ID.

     The process group ID of the process designated by the process_id argument
     is set to the value of the process_group_id argument.  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.

NOTE
     Domain/OS also supports the setpgrp(2) system call; setpgrp provides a
     subset of the functionality that the setpgid system call provides.

DIAGNOSTICS
     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 setpgid fails, errno will be set to one of the following values:

     [EINVAL]  The value of the process_group_id argument is less than or
               equal to 0 (zero), or is not a valid process ID.

     [EPERM]   The value of the process_group_id argument 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 argument is a session
               leader.

     [EPERM]   The value of the process_id argument 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 argument is valid but does
               not match the process ID of the process indicated by the
               process_id argument, and there is no process with a process
               group ID that matches the value of the process_group_id
               argument in the same session as the calling process.

     [ESRCH]   The value of the process_id argument 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 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.

SEE ALSO
     open(2) getpid(2) getpgrp(2) setsid(2) tcsetpgrp(3) setpgrp(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026