Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Terminal access control

&pagelevel(5)&pagelevel

If a process is in the foreground process group of its controlling terminal, it will be allowed to read from this terminal, as described in the section “Input processing and reading data” . For those implementations that support job control, any attempt by a process in a background process group to read from its controlling terminal will cause its process group to be sent a SIGTTIN signal unless one of the following special cases applies:

  • The reading process is ignoring or blocking the SIGTTIN signal.

  • The process group of the reading process is orphaned.

In the above cases, the read() function returns -1, with errno set to EIO, and no signal is sent. The default action of the SIGTTIN signal is to stop the process to which it is sent (see also signal.h).

If a process is in the foreground process group of its controlling terminal, then write operations are allowed as described in the section “Writing data and output processing”. Attempts by a process in a background process group to write to its controlling terminal will cause the process group to be sent a SIGTTOU signal unless one of the following special cases apply:

  • If TOSTOP is not set, or if TOSTOP is set and the process is ignoring or blocking theSIGTTOU signal, then the process is allowed to write to the terminal and the SIGTTOU signal is not sent.

  • If TOSTOP is set and the process group of the writing process is orphaned, and the writing process is not blocking SIGTTOU, the write() function returns -1, with errno set to EIO, and no signal is sent.

Certain function calls that set terminal parameters are treated in the same way as the write() function, except that TOSTOP is ignored; that is, the effect is identical to that of an attempt to write to the terminal when TOSTOP is set (see also section “Local modes”, tcdrain(), tcflow(), tcflush(), tcsendbreak() and tcsetattr()).