TCSETPGRP(3)               POSIX Programmer's Manual              TCSETPGRP(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       tcsetpgrp -- set the foreground process group ID

SSYYNNOOPPSSIISS
       #include <unistd.h>

       int tcsetpgrp(int _f_i_l_d_e_s, pid_t _p_g_i_d___i_d);

DDEESSCCRRIIPPTTIIOONN
       If the process has a controlling terminal, _t_c_s_e_t_p_g_r_p() shall set the
       foreground process group ID associated with the terminal to _p_g_i_d___i_d.
       The application shall ensure that the file associated with _f_i_l_d_e_s is
       the controlling terminal of the calling process and the controlling
       terminal is currently associated with the session of the calling
       process. The application shall ensure that the value of _p_g_i_d___i_d matches
       a process group ID of a process in the same session as the calling
       process.

       Attempts to use _t_c_s_e_t_p_g_r_p() from a process which is a member of a
       background process group on a _f_i_l_d_e_s associated with its controlling
       terminal shall cause the process group to be sent a SIGTTOU signal. If
       the calling thread is blocking SIGTTOU signals or the process is
       ignoring SIGTTOU signals, the process shall be allowed to perform the
       operation, and no signal is sent.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
       returned and _e_r_r_n_o set to indicate the error.

EERRRROORRSS
       The _t_c_s_e_t_p_g_r_p() function shall fail if:

       EEBBAADDFF  The _f_i_l_d_e_s argument is not a valid file descriptor.

       EEIINNVVAALL This implementation does not support the value in the _p_g_i_d___i_d
              argument.

       EEIIOO    The process group of the writing process is orphaned, the
              calling thread is not blocking SIGTTOU, and the process is not
              ignoring SIGTTOU.

       EENNOOTTTTYY The calling process does not have a controlling terminal, or the
              file is not the controlling terminal, or the controlling
              terminal is no longer associated with the session of the calling
              process.

       EEPPEERRMM  The value of _p_g_i_d___i_d is a value supported by the implementation,
              but does not match the process group ID of a process in the same
              session as the calling process.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _t_c_g_e_t_p_g_r_p()

       The Base Definitions volume of POSIX.1-2008, <<ssyyss__ttyyppeess..hh>>, <<uunniissttdd..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                         TCSETPGRP(3)
