[CRIU] Re: [PATCH 2/3] tty: Mark living peers in tty_active_pairs
bitmap
Cyrill Gorcunov
gorcunov at openvz.org
Tue Sep 18 11:07:23 EDT 2012
On Tue, Sep 18, 2012 at 07:03:38PM +0400, Cyrill Gorcunov wrote:
> On Tue, Sep 18, 2012 at 06:59:49PM +0400, Cyrill Gorcunov wrote:
> > On Tue, Sep 18, 2012 at 06:55:36PM +0400, Pavel Emelyanov wrote:
> > > > + /*
> > > > + * Now trace the paired/unpaired ttys. For example
> > > > + * the task might have slave peer assigned but no
> > > > + * master peer. Such "detached" master peers are
> > > > + * not yet supported by our tool and better to
> > > > + * inform a user about such situatio,
> > > > + */
> > > > + if (!hangup || major == TTYAUX_MAJOR)
> > >
> > > Can this _ever_ be false?
> >
> > Sure -- you just need a slave peer which is alive (ie hangup == false).
> > The setting bit on master peer is for correspondence between master/slave
> > peers.
>
> Oh, sorry misread your "false" question. But same answer -- if slave
> peer is dead the hangup = true and we don't mark this peer, at verifucation
> stage we're only concerned if there alive slave peer without master.
Darn, sorry for confusion. Here is cleaned up version. Thanks!
-------------- next part --------------
>From ffce25403ba80744d76a58c7c078080dc32530b1 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Tue, 18 Sep 2012 16:05:39 +0400
Subject: [PATCH] tty: Mark living peers in tty_active_pairs bitmap
Will need it to verify that live tty pairs exist.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
tty.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tty.c b/tty.c
index 6f23a1a..9e405d4 100644
--- a/tty.c
+++ b/tty.c
@@ -91,6 +91,7 @@ static LIST_HEAD(all_ttys);
*/
#define MAX_TTYS 1024
static DECLARE_BITMAP(tty_bitmap, (MAX_TTYS << 1));
+static DECLARE_BITMAP(tty_active_pairs, (MAX_TTYS << 1));
/*
* /dev/ptmx is a shared resource between all tasks
@@ -923,6 +924,15 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i
if (hangup)
return pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
+ /*
+ * Now trace the paired/unpaired ttys. For example
+ * the task might have slave peer assigned but no
+ * master peer. Such "detached" master peers are
+ * not yet supported by our tool and better to
+ * inform a user about such situatio,
+ */
+ tty_test_and_set(id, tty_active_pairs);
+
if (pty_get_flags(lfd, major, index, &info))
goto out;
--
1.7.7.6
More information about the CRIU
mailing list