[CRIU] [PATCH 7/9] tty: Implement support of current tty
Cyrill Gorcunov
gorcunov at gmail.com
Fri Mar 13 12:15:43 PDT 2015
On Fri, Mar 13, 2015 at 09:56:01PM +0300, Pavel Emelyanov wrote:
> On 03/13/2015 04:52 PM, Cyrill Gorcunov wrote:
> > On Fri, Mar 13, 2015 at 02:41:06PM +0300, Pavel Emelyanov wrote:
> >>> @@ -1025,6 +1026,21 @@ int prepare_fds(struct pstree_item *me)
> >>> break;
> >>> }
> >>>
> >>> + for (state = 0; state < ARRAY_SIZE(states); state++) {
> >>> + if (!states[state].required) {
> >>> + pr_debug("Skipping %s fd stage\n", states[state].name);
> >>> + continue;
> >>> + }
> >>> +
> >>> + /*
> >>> + * Opening current TTYs require session to be already set up,
> >>> + * thus slave peers already handled now it's time for cttys,
> >>
> >> IOW the /dev/tty should only be ->open-ed after the respective tty's ->post_open?
> >
> > yes, only when session is restored. did I miss something on file handling?
>
> No. Why do we restore session in the tty's post_open()? Can we move it to
> regular open?
I fear we can't, the session should be restored by a task which has appropriate
sid in task, iow we might have a situation where pty peers belong to not a session
leader task. That's why we lookup for task which has sid needed and then we give it
"fake" file descriptor so that once everything is "opened" (ie pty peers are
present) we open slave peer and setup session.
More information about the CRIU
mailing list