public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Pavel Emelyanov <xemul@parallels.com>
Subject: Re: [RFC] tty: Add get- ioctls to fetch tty status
Date: Thu, 13 Sep 2012 20:41:00 +0400	[thread overview]
Message-ID: <20120913164100.GN19956@moon> (raw)
In-Reply-To: <20120913172507.5039e3c6@pyramind.ukuu.org.uk>

On Thu, Sep 13, 2012 at 05:25:07PM +0100, Alan Cox wrote:
> On Thu, 13 Sep 2012 16:54:01 +0400
> Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> 
> > On Thu, Sep 13, 2012 at 01:51:31PM +0100, Alan Cox wrote:
> > > > +static int pty_get_lock(struct tty_struct *tty, int __user *arg)
> > > > +{
> > > > +	int locked = test_bit(TTY_PTY_LOCK, &tty->flags);
> > > > +	if (put_user(locked, arg))
> > > > +		return -EFAULT;
> > > 
> > > Now explain exactly how this doesn't race with another thread chanigng
> > > the lock setting ?
> > 
> > It's the same as to set/clear this bit, isn't it? Please correct me
> > if I'm wrong.
> 
> So by the time you've finished the test bit and returned it to user space
> the answer may have changed?

Yes. Btw, as far as I see the same applies to lock bit on its own. One
process may lock it while another process may unlock it right after that.

> > > The other comment I have is that it might be better put these in now
> > > there are sysfs patches for the tty layer bouncing about to provide the
> > > needed infrastructure ?
> > 
> > Alan, could you please point me where these patches are living, so I would
> > take a look and check them out
> 
> linux-serial or check tty-next as I think Greg has now merged the test
> patch.

Ah, thanks a lot, Alan, I'll take a look! 

	Cyrill

  reply	other threads:[~2012-09-13 16:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  9:56 [RFC] tty: Add get- ioctls to fetch tty status Cyrill Gorcunov
2012-09-13 11:46 ` Jiri Slaby
2012-09-13 11:51   ` Cyrill Gorcunov
2012-09-13 12:51 ` Alan Cox
2012-09-13 12:54   ` Cyrill Gorcunov
2012-09-13 16:25     ` Alan Cox
2012-09-13 16:41       ` Cyrill Gorcunov [this message]
2012-09-22 18:06       ` Cyrill Gorcunov
2012-09-22 20:07         ` Greg Kroah-Hartman
2012-09-22 20:11           ` Cyrill Gorcunov
2012-09-22 21:52             ` Cyrill Gorcunov
2012-09-23  1:09               ` Greg Kroah-Hartman
2012-09-23  6:40                 ` Cyrill Gorcunov
2012-09-23 14:46                   ` H. Peter Anvin
2012-09-23 15:21                     ` Cyrill Gorcunov
2012-09-24 14:14                     ` Cyrill Gorcunov
2012-09-27 14:05                       ` Cyrill Gorcunov
2012-09-27 14:14                         ` Alan Cox
2012-09-27 14:14                           ` Cyrill Gorcunov
2012-09-27 14:17                             ` H. Peter Anvin
2012-09-27 14:21                               ` Cyrill Gorcunov
2012-09-27 14:43                                 ` H. Peter Anvin
2012-09-27 14:48                                   ` Cyrill Gorcunov
2012-09-27 15:05                                     ` H. Peter Anvin
2012-09-27 15:13                                 ` Alan Cox
2012-09-27 15:23                                   ` Cyrill Gorcunov
2012-09-27 16:00                                     ` Alan Cox
2012-09-27 16:06                                       ` Cyrill Gorcunov
2012-09-27 15:47                                   ` Cyrill Gorcunov
2012-09-22 23:15           ` Alan Cox
2012-09-23  1:43         ` Eric W. Biederman
2012-09-23  6:40           ` Cyrill Gorcunov
2012-09-23 14:44             ` H. Peter Anvin
2012-09-23 15:22               ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120913164100.GN19956@moon \
    --to=gorcunov@openvz.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox