Featured post
unix - Controlling terminal & a new session -
how can process (in case session leader) controlling terminal?
what in program:
1. fork; 2. parent -> while(1) or smth. similar; 3. child -> setsid(); exec "man ps";
i beleived nothing in output. (child session leader , therefore has no relation old tty) got , don't understand why. man ouputs. not interactive. when press ctrl-z becomes interactive when press 'q' quites , returnes prog(parent). questions are:
- please explain happens @ beginning (why have press ctrl-z, read above)
- why man output in shell?
- how can man without tty connected (i checked ps, man , pager have "?" in tty column)
- and finally: how can new session leader acquire controlling terminal. there wayes besides
open(/dev/tty)
?
q. 1. 3.: child process keep access stdin, stdout etc., after setsid(). need close them explicitly (or reopen using eg. open("/dev/null",o_rdwr);
).
q 4.:
when session-leader without controlling-terminal opens terminal-device-file , flag o_noctty clear on open, terminal becomes controlling-terminal assigned session-leader if terminal not assigned session
http://uw714doc.sco.com/en/sdk_sysprog/_the_controlling-terminal_and_pr.html
- Get link
- X
- Other Apps
Comments
Post a Comment