Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setpgid(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(S)

getpid(S)

setsid(S)


 setpgid(S)                     6 January 1993                     setpgid(S)


 Name

    setpgid - set process group ID for job control

 Syntax


    cc  . . .  -lc


    #include  <sys/types.h>

    int setpgid (pid, pgid)
    pid_t pid, pgid;


 Description

    If the constant POSIXJOBCONTROL is defined, the setpgid routine 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, processes
    with a process ID that match the argument pid have their process group
    IDs set to the argument pgid. As a special case, if pid is zero, the pro-
    cess ID of the calling process is used.  Also, if pgid is zero, the pro-
    cess ID of the indicated process is used.

    If POSIXJOBCONTROL is not defined, the setpgid routine may not work as
    described above and it may fail instead.

 Return value

    Upon successful completion, the setpgid routine returns a value of zero.
    If the routine fails, a value of -1 is returned and errno is set to indi-
    cate the appropriate error.

 Diagnostics

    If one of the following conditions occurs, the setpgid routine fails and
    errno is set 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
                has successfully executed one of the exec(S) routines.

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

    [ENOSYS]    The setpgid routine is not supported by this implementation.

    [EPERM]     The process specified by the pid argument is a session
                leader.
                The value of the pid argument is valid but matches the pro-
                cess ID of a child process of the calling process but the
                child process is not in the same session as the calling pro-
                cess.
                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 nor of a child process of the calling
                process.


 See also

    exec(S), getpid(S), setsid(S)

 Standards conformance

    setpgid conforms with:
    X/Open Portability Guide, Issue 3, 1989;
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.


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