Sample Header Ad - 728x90

When a session leader acquires a controlling terminal, how would the other existing processes in the session also acquire the controlling terminal?

1 vote
1 answer
511 views
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.
Asked by Tim (106420 rep)
May 29, 2018, 04:06 PM
Last activity: May 29, 2018, 04:42 PM