-
Cyrill Gorcunov authored
The dumping of tty peers is somewhat tricky. And it became more complex once we allowed to migrate/inherit sessions. It's being found (in screen c/r) that we've a problem in looking up of session leaders while dumping tty. Let me explain with more details. Here is an example of screen session PID GID SID 20567 20567 20567 SCREEN 20568 20568 20568 pts/3 \_ /bin/bash The screen opens master peer (ptmx) and then provides bash the slave peer (pts/3) where bash sets up a session leader on it. Thus we get interesting scenario -- our pstree construction is done in lazy fashion, we run parasite code to fetch sid/pgid of a process tree item only when we're really dumping the task. Thus when we start dumping ptmx peer (which belongs to SCREEN) we've not yet constructed the process tree item for children (ie /bin/bash) and the lookup function in tty code (which walks over all process items in a tree) simply fails to find sid of child, because we've not yet dumped it. Thus, to resolve such situation we verify tty sids at late stage of dumping. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
f0606bc8