Re: [RFC] tty: Add get- ioctls to fetch tty status

From: Cyrill Gorcunov
Date: Sat Sep 22 2012 - 16:11:43 EST


On Sat, Sep 22, 2012 at 01:07:31PM -0700, Greg Kroah-Hartman wrote:
> > drivers/tty/pty.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 44 insertions(+), 1 deletion(-)
> >
> > Index: tty.git/drivers/tty/pty.c
> > ===================================================================
> > --- tty.git.orig/drivers/tty/pty.c
> > +++ tty.git/drivers/tty/pty.c
> > @@ -283,6 +283,46 @@ done:
> > return 0;
> > }
> >
> > +static ssize_t pty_show_state(struct device *dev,
> > + struct device_attribute *attr,
> > + char *buf)
> > +{
> > + struct tty_struct *tty = dev_get_drvdata(dev);
> > + int locked, exclusive, packet;
> > +
> > + tty_lock(tty);
> > + locked = test_bit(TTY_PTY_LOCK, &tty->flags);
> > + exclusive = test_bit(TTY_EXCLUSIVE, &tty->flags);
> > + packet = tty->packet;
> > + tty_unlock(tty);
> > +
> > + return snprintf(buf, PAGE_SIZE, "locked: %d exclusive: %d packet: %d\n",
> > + locked, exclusive, packet);
> > +}
>
> Sysfs is one value per file, you have three values here, please make 3
> files.
>
> And document them in Documentation/ABI/.

Hmm, sure Greg, I'll update. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/