Suppose there is a session with multiple processes in it and without a controlling terminal.
When the session leader creates a connection to a controlling terminal,
how would the other processes in the same session learn that the session has a controlling terminal and
how could they also make use of the controlling terminal?
The reason that I have this question is the following. Usually a process calls setsid()
to start a new session and become its leader, and calls open()
to connect to a controlling terminal. Then the session leader goes on to fork()
child processes, and the children will inherit the file descriptor to the controlling terminal.
I then wonder what if a session already has multiple processes and but has no controlling terminal, and then the leader creates a connection to a controlling terminal, and then what about the other processes in the session.
Thanks.