1

In a process session with a controlling terminal,

  • if the controlling process closes the file descriptor of the controlling terminal, does the process session become detached from the controlling terminal, i.e. not have any controlling terminal?

  • What if a non-controlling process in the session closes the file descriptor of the controlling terminal?

Thanks.

4

2 Answers 2

3

libc manual: "… All the processes in a session inherit the controlling terminal from the session leader. A session leader that has control of a terminal is called the controlling process of that terminal. …"

According to typical "daemonize" scenario the only way to get rid of controlling terminal is to create new session. Closing file descriptors wouldn't do that.

2
0

By default the program has no file descriptor associated with a controlling terminal, so there is nothing to close. You can open it, but then closing it has nothing to do with the controlling terminal association.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .