Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setpgid(S) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     SETPGID(S)                UNIX System V                SETPGID(S)



     Name
          setpgid - set process group ID for job control

     Syntax
          #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 does not change.
          Upon successful completion, the process group ID of the
          process with a process ID that matches pid is set to pgid .
          As a special case, if pid is zero, the process ID of the
          calling process is used.  Also, if pgid is zero, the process
          ID of the indicated process is used.

          Otherwise, either the implementation supports the setpgid()
          function as described above or the setpgid() fails.

     Return Value
          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.

     Diagnostics
          If any of the following conditions occur, the setpgid()
          function returns -1 and sets 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

          [EINVAL]
               The value of the pgid argument is less than zero or is
               an unsupported value.

          [ENOSYS]
               The setpgid() function is not supported by this
               implementation.

          [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
          exec(S), getpid(S), setsid(S)

     Standards Conformance
          setpgid is conformant with:
          IEEE POSIX Std 1003.1-1988 with C Standard Language-
          Dependent System Support;
          and NIST FIPS 151-1.


                                             (printed 6/20/89)



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