GETPGRP(2)                       System Calls                       GETPGRP(2)


       getpgrp - get process group


       #include <unistd.h>

       pid_t _getpgrp (pid_t pid);
       pid_t getpgrp (void);


       getpgrp  returns  the  process  group of the current process.  _getpgrp
       returns the process group of the process specified by pid.

       Process groups are used for distribution of signals, and  by  terminals
       to  arbitrate  requests  for  their input: processes that have the same
       process group as the terminal are foreground and may read, while others
       will block with a signal if they attempt to read.

       This  call  is  thus  used by programs such as csh(1) to create process
       groups in implementing job control.  The tcgetpgrp and tcsetpgrp  calls
       are used to get/set the process group of the control terminal.


       On success, the requested process group is returned.  On failure, -1 is
       returned and errno is set.


       The getpgrp function conforms to IEEE Std 1003.1-1988 (POSIX).


       This version of getpgrp differs from past GNO (pre-v2.0.6) and Berkeley
       versions  by  not taking a pid_t pid argument.  This incompatibility is
       required by POSIX 1003.1-88.

       From the POSIX 1003.1-88 Rationale:
              4.3BSD provides a getpgrp  function  that  returns  the  process
              group  ID  for  a  specified process.  Although this function is
              used to support job control, all known job-control shells always
              specify  the calling process with this function.  Thus, the sim-
              pler System V getpgrp suffices, and the added complexity of  the
              4.3BSD getpgrp has been omitted from POSIX.1.

       The  older  version  of getpgrp which takes an argument is available as
       the non-standard function _getpgrp.


       job_control(2), setpgid(2), termios(4)


       The getpgrp function call appeared in 4.0BSD.

GNO                             16 January 1997                     GETPGRP(2)

Man(1) output converted with man2html