[OE-core] [pseudo][PATCH] Fix to fcntl guts to ignore flags that can be ORed into cmd

Will Page will.page at ni.com
Mon Sep 18 15:15:27 UTC 2017


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 at 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.



More information about the Openembedded-core mailing list