unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

SETPGID(2V)                                                        SETPGID(2V)



NAME
       setpgid - set process group ID for job control

SYNOPSIS
       #include <&lt;sys/types.h>&gt;

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

DESCRIPTION
       setpgid()  is used to either join an existing process group or create a
       new process group within  the  session  of  the  calling  process  (see
       NOTES).   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 process indicated by pid is used.

RETURN VALUES
       setpgid() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

ERRORS
       EACCES         The  value  of  pid  matches  the  process ID of a child
                      process of the calling process and the child process has
                      successfully executed one of the exec() functions.

       EINVAL         The  value  of pgid is less than zero or is greater than
                      MAXPID,  the  maximum   process   ID   as   defined   in
                      <&lt;sys/param.h>&gt;.

       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  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          pid does not match the PID of the calling process or the
                      PID of a child of the calling process.

SEE ALSO
       getpgrp(2V), execve(2V), setsid(2V), tcgetpgrp(3V)

NOTES
       For  setpgid()  to behave as described above, {_POSIX_JOB_CONTROL} must
       be in effect (see  sysconf(2V)).   {_POSIX_JOB_CONTROL}  is  always  in
       effect  on SunOS systems, but for portability, applications should call
       sysconf() to determine whether {_POSIX_JOB_CONTROL} is  in  effect  for
       the current system.



                                21 January 1990                    SETPGID(2V)