mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: Christoph Hellwig <hch@infradead.org>, Alan Cox <alan@redhat.com>,
	Eric Paris <eparis@redhat.com>,
	linux-kernel@vger.kernel.org, aviro@redhat.com,
	drepper@redhat.com, sds@tycho.nsa.gov
Subject: Re: [RFC] correct flags to f_mode conversion in __dentry_open
Date: Thu, 22 May 2008 12:10:33 +1000 (EST)	[thread overview]
Message-ID: <Xine.LNX.4.64.0805221210050.32056@us.intercode.com.au> (raw)
In-Reply-To: <483461DA.3060304@gmail.com>

On Wed, 21 May 2008, Michael Kerrisk wrote:

> Christoph Hellwig wrote:
> > On Sat, Mar 15, 2008 at 05:59:52PM -0400, Alan Cox wrote:
> >>> does 11 really mean and should it really always be mapped to (FMODE_READ
> >>> | FMODE_WRITE) or should it continue to get mapped to 'no permission?'
> >> We've always mapped 3 to "no permission" to read or write. It's a linuxism
> > 
> > I've tripped over this recently aswell.  It would for sure be useful
> > to add a sumbolic O_FOO constant for this magic value '3' and document
> > it in the manpage.
> 
> Late follow-up to this thread
> (http://thread.gmane.org/gmane.linux.kernel/653123):
> I propose to add the following text to the open(2) man page.
> 
>        Unlike the other values that can be specified  in  flags,
>        the access mode values O_RDONLY, O_WRONLY, and O_RDWR, do
>        not specify individual bits.  Rather, they define the low
>        order  two bits of flags, and are defined respectively as
>        0, 1, and 2.  In other words, the combination O_RDONLY  |
>        O_WRONLY  is a logical error, and certainly does not have
>        the same meaning as O_RDWR.  Linux reserves the  special,
>        non-standard  access mode 3 (binary 11) in flags to mean:
>        check for read and  write  permission  on  the  file  and
>        return  a  descriptor  that  can't be used for reading or
>        writing.  This non-standard access mode is used  by  some
>        Linux  drivers  to return a descriptor that is only to be
>        used for device-specific ioctl(2) operations.
> 
> Seem okay?

Looks good to me.  We definitely need this documented.



- James
-- 
James Morris
<jmorris@namei.org>

      reply	other threads:[~2008-05-22  2:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 18:25 Eric Paris
2008-03-12 18:34 ` Al Viro
2008-03-12 18:41   ` Eric Paris
2008-03-12 18:47 ` Andreas Schwab
2008-03-15 21:59 ` Alan Cox
2008-03-15 22:00   ` Alexander Viro
2008-03-17 10:45   ` Christoph Hellwig
2008-05-21 17:54     ` Michael Kerrisk
2008-05-22  2:10       ` James Morris [this message]

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=Xine.LNX.4.64.0805221210050.32056@us.intercode.com.au \
    --to=jmorris@namei.org \
    --cc=alan@redhat.com \
    --cc=aviro@redhat.com \
    --cc=drepper@redhat.com \
    --cc=eparis@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=sds@tycho.nsa.gov \
    /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

Powered by JetHome