Timeline for What is the purpose of the controlling terminal?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 13, 2022 at 15:43 | comment | added | Li-Guangda | @axk The kernel documentation specifies that the first non-kernel process, called init or "PID 1", is started with /dev/console connected to standard output, standard error, and standard input. So any output to /dev/console will display on your screen and keyboard input will go into it also. Controlling terminal just plays a role in handling signals. So if bash is invoked as pid 1, it can still read/write normally but can not handle any signals. (login program prepares for a controlling terminal for bash) | |
| May 2, 2021 at 13:29 | comment | added | axk | I wonder how when you start bash as init it's still able to receive input from the tty and write output to it. If tty was synonymous to controlling terminal it won't be possible because at this point there's no controlling terminal. Or is it a special tty? | |
| Mar 8, 2019 at 19:41 | comment | added | Sergiy Kolodyazhnyy | "a random process cannot attach a terminal as controlling terminal, only session leader process can". Technically, a privileged process with CAP_SYS_ADMIN capability can use ioctl() to do that, see stackoverflow.com/a/30693006/3701431 | |
| Jan 13, 2019 at 2:57 | comment | added | 炸鱼薯条德里克 | This job control stuff can be implemented purely in userland, controlling terminal, or the whole terminal subsystem, seems to be an old thing since the time we only have terminal device instead of LCD screen and keyboard. | |
| Nov 15, 2017 at 5:13 | history | edited | Bruce | CC BY-SA 3.0 | added 81 characters in body |
| Nov 15, 2017 at 3:00 | comment | added | Bruce | Thank you @JdeBP, you are right. I've modified my answer. | |
| Nov 15, 2017 at 2:58 | history | edited | Bruce | CC BY-SA 3.0 | added 187 characters in body |
| Nov 14, 2017 at 20:26 | comment | added | JdeBP | Your first point is wrong, and is contradicted by your second. Foreground and background processes do not have their controlling terminals removed. | |
| Nov 14, 2017 at 20:12 | history | answered | Bruce | CC BY-SA 3.0 |