All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Page <will.page@ni.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Alexander Kanavin <alexander.kanavin@intel.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [pseudo][PATCH] Fix to fcntl guts to ignore flags that can be ORed into cmd
Date: Mon, 18 Sep 2017 08:15:27 -0700	[thread overview]
Message-ID: <20170918151527.GA29455@canismajor> (raw)
In-Reply-To: <1505741066.18640.112.camel@linuxfoundation.org>

On Mon, Sep 18, 2017 at 02:24:26PM +0100, Richard Purdie wrote:
> On Fri, 2017-09-15 at 18:10 -0500, Seebs wrote:
> > On Fri, 15 Sep 2017 15:27:00 -0700
> > Will Page <Will.Page@ni.com> wrote:
> > 
> > > 
> > > The fcntl guts switch on "cmd" parameter to identify the fcntl
> > > command being issued, but isn't aware of the file creation flags
> > > that
> > > can be ORed in.
> > This is true. I was, in fact, not aware of those flags. Looks
> > reasonable.
> 
> I tried adding this to a test build along with AlexK's epoll patch. It
> resulted in:
> 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__autobuilder.yocto.io_builders_nightly-2Dworld_builds_475_steps_BuildImages_logs_stdio&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=-PS0OYZ7YP1crHfex64Ojw&m=xLMg1sihnYcY8mm3vbgoq_awtDy2SclWmfP3SxUNhq0&s=qFv8uK99a-cleN6VLJ7XYfBiLHrcTKtPo63E8FmGuX0&e= 
> 
> Any ideas why?
> 
> Cheers,
> 
> Richard

The problem is mine.  I sent you the wrong revision of the patch.
+	int o_mode_mask = (O_RDONLY | O_WRONLY | O_RDWR) |
+		(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);

In the first rev of my patch (which I accidentally sent in place of my
intended changes), I included the O_ACCMODE flags because it looked like
the documentation said they should also be ignored, but that's not
actually true.  The documentation says they will be ignored in the
"arg" parameter for F_SETFL commands, not in the "cmd" parameter.

After additional research, I found that my problem case actually relates
to some "new", linux-specific extensions to fcntl:

#ifdef __USE_GNU
# define F_SETLEASE        1024        /* Set a lease.  */
# define F_GETLEASE        1025        /* Enquire what lease is active.
  */
# define F_NOTIFY        1026        /* Request notifications on a
directory.  */
# define F_SETPIPE_SZ        1031        /* Set pipe page size array.
  */
# define F_GETPIPE_SZ        1032        /* Set pipe page size array.
  */
#endif
#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030        /* Duplicate file descriptor with
                                   close-on-exit set.  */
#endif

https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h.html

Consequently, a few new cases are needed in the switch statement, with
similar ifdef guards to the F_*LK64 cases.

I'll submit V2 of my patch shortly.


  reply	other threads:[~2017-09-18 15:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 22:27 [pseudo][PATCH] Fix to fcntl guts to ignore flags that can be ORed into cmd Will Page
2017-09-15 22:30 ` ✗ patchtest: failure for " Patchwork
2017-09-15 22:48 ` [pseudo][PATCH] " Burton, Ross
2017-09-16  2:22   ` Will Page
2017-09-16 17:59     ` Seebs
2017-09-15 23:10 ` Seebs
2017-09-18 13:24   ` Richard Purdie
2017-09-18 15:15     ` Will Page [this message]
2017-09-18 15:39     ` Will Page
  -- strict thread matches above, loose matches on Subject: below --
2017-09-16  2:33 Will Page

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=20170918151527.GA29455@canismajor \
    --to=will.page@ni.com \
    --cc=alexander.kanavin@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.