When a session leader acquires a controlling terminal, how would the other existing processes in the session also acquire the controlling terminal?
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
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.
linux session controlling-terminal
add a comment |Â
up vote
-1
down vote
favorite
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.
linux session controlling-terminal
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
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.
linux session controlling-terminal
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.
linux session controlling-terminal
asked May 29 at 16:06
Tim
22.6k61222401
22.6k61222401
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Any new child the session leader creates after it acquired a controlling terminal will also have that controlling terminal. A controlling terminal is something that is inherited from the parent.
In other words: existing children are not affected.
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Any new child the session leader creates after it acquired a controlling terminal will also have that controlling terminal. A controlling terminal is something that is inherited from the parent.
In other words: existing children are not affected.
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
add a comment |Â
up vote
0
down vote
Any new child the session leader creates after it acquired a controlling terminal will also have that controlling terminal. A controlling terminal is something that is inherited from the parent.
In other words: existing children are not affected.
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Any new child the session leader creates after it acquired a controlling terminal will also have that controlling terminal. A controlling terminal is something that is inherited from the parent.
In other words: existing children are not affected.
Any new child the session leader creates after it acquired a controlling terminal will also have that controlling terminal. A controlling terminal is something that is inherited from the parent.
In other words: existing children are not affected.
edited May 29 at 16:42
answered May 29 at 16:20
schily
8,63821435
8,63821435
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
add a comment |Â
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
Thanks. But I was asking about the already existing children instead of any future children, when the leader acquires a controlling terminal.
â Tim
May 29 at 16:33
OK, I enhanced the answer.
â schily
May 29 at 16:50
OK, I enhanced the answer.
â schily
May 29 at 16:50
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
Thanks. What do you mean by " existing children are not affected"? The other processes in the same session are not necessarily children of the session leader. How could the other processes learn that the session has a controlling terminal and also open the controlling terminal as a file descriptor?
â Tim
Jun 1 at 19:17
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446738%2fwhen-a-session-leader-acquires-a-controlling-terminal-how-would-the-other-exist%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password