unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

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

TCGETPGRP(3V)                                                    TCGETPGRP(3V)



NAME
       tcgetpgrp, tcsetpgrp - get, set foreground process group ID

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

       pid_t tcgetpgrp(fd)
       int fd;

       int tcsetpgrp(fd, pgrp_id)
       int fd;
       pid_t pgrp_id;

DESCRIPTION
       tcgetpgrp() returns the value of the process group ID of the foreground
       process group associated with the terminal (see NOTES).  tcgetpgrp() is
       allowed  from a process that is a member of a background process group;
       however, the information may be subsequently changed by a process  that
       is a member of a foreground process group.

       If  the  process has a controlling terminal, tcsetpgrp() sets the fore-
       ground process group ID associated with the terminal to  pgrp_id.   The
       file  associated  with  fd must be the controlling terminal and must be
       currently associated with the session  of  the  calling  process.   The
       value of pgrp_id must match a process group ID of a process in the same
       session as the calling process.

RETURN VALUES
       On success, tcgetpgrp() returns the process group ID of the  foreground
       process  group associated with the terminal.  On failure, it returns -1
       and sets errno to indicate the error.

       tcsetpgrp() returns:

       0      on success.

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

ERRORS
       If any of the following conditions occur, tcgetpgrp() sets errno to:

       EBADF          fd is not a valid file descriptor.

       ENOSYS         tcgetpgrp() is not supported in this implementation.

       ENOTTY         The calling process does not have a  controlling  termi-
                      nal.

                      The file is not the controlling terminal.

       If any of the following conditions occur, tcsetpgrp() sets errno to:

       EBADF          fd is not a valid file descriptor.

       EINVAL         The value of pgrp_id is not a valid process group ID.

       ENOTTY         The  calling  process does not have a controlling termi-
                      nal.

                      The file is not the controlling terminal.

                      The controlling terminal is no  longer  associated  with
                      the session of the calling process.

       EPERM          The  value  of  pgrp_id is a valid process group ID, but
                      does not match the process group ID of a process in  the
                      same session as the calling process.

SEE ALSO
       setpgid(2V), setsid(2V)

NOTES
       For   tcgetpgrp()   and  tcsetpgrp()  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.

       If  {_POSIX_JOB_CONTROL}  is not defined on a system conforming to IEEE
       Std 1003.1-1988 either tcgetpgrp() and tcsetpgrp() behave as  described
       above, or tcgetpgrp() and tcsetpgrp() fail.



                                21 January 1990                  TCGETPGRP(3V)