cposixtermios

What signals does clearing the ISIG flag in termios struct disable?


The Open Group's man page for termios.h specifies nothing:

ISIG

Enable signals.

The OpenBSD's man page for termios.h specfies:

ISIG /* enable signals INTR, QUIT, [D]SUSP */

While the Linux's man page for termios.h specifies:

ISIG

When any of the characters INTR, QUIT, SUSP, or DSUSP are received, generate the corresponding signal.

OpenBSD and Linux ignores the SIGINT, SIGSTSP, SIGCONT, and SIGQUIT signals, but does POSIX document this behavior? Or is it implementation-defined?


Solution

  • According to https://pubs.opengroup.org/onlinepubs/9699919799/toc.htm:

    11.1.9 Special Characters

    INTR

    Special character on input, which is recognized if the ISIG flag is set. Generates a SIGINT signal which is sent to all processes in the foreground process group for which the terminal is the controlling terminal. If ISIG is set, the INTR character shall be discarded when processed.

    QUIT

    Special character on input, which is recognized if the ISIG flag is set. Generates a SIGQUIT signal which is sent to all processes in the foreground process group for which the terminal is the controlling terminal. If ISIG is set, the QUIT character shall be discarded when processed.

    ...

    SUSP

    If the ISIG flag is set, receipt of the SUSP character shall cause a SIGTSTP signal to be sent to all processes in the foreground process group for which the terminal is the controlling terminal, and the SUSP character shall be discarded when processed.

    Further on it reads:

    If IEXTEN is set, implementation-defined functions shall be recognized from the input data. It is implementation-defined how IEXTEN being set interacts with ICANON, ISIG, IXON, or IXOFF. If IEXTEN is not set, implementation-defined functions shall not be recognized and the corresponding input characters are processed as described for ICANON, ISIG, IXON, and IXOFF.

    Regarding DSUSP one can read in Advanced Programming in the UNIX Environment (W. Richard Stevens, Stephan A. Rago), 3rd edition:

    18.3 Special Input Characters

    ...

    DSUSP

    The delayed-suspend job-control character. This character is recognized on input in extended mode (IEXTEN) if job control is supported and if the ISIG flag is set.

    Finally, it may be worth mentioning that this only disables the special characters used to generate the corresponding signals, the signals can still be sent using the kill function.