Thanks, Ross. I had contacted the maintainer off list to ask where I should submit my patch. I may have misunderstood his reply.
I'll go ahead and resend this patch to the yocto list. ________________________________________________________ Will Page Senior Software Engineer National instruments O +1.512.683.6956 [email protected] ________________________________________ From: Burton, Ross <[email protected]> Sent: Friday, September 15, 2017 3:48 PM To: Will Page Cc: OE-core; Seebs Subject: Re: [OE-core] [pseudo][PATCH] Fix to fcntl guts to ignore flags that can be ORed into cmd Hi Will, This should go to the [email protected]<mailto:[email protected]> list really. I've CC'd the maintainer to be sure he spots it. Ross On 15 September 2017 at 23:27, Will Page <[email protected]<mailto:[email protected]>> 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 change masks out the flags from the command only for the switch statement so that it can correctly determine whether it needs to pass "lock" or "arg". When real_fcntl() is called, the original value is still passed on. This corrects an issue observed using pseudo on modern linux desktops resulting in "pseudo: unknown fcntl argument 1030, assuming long argument." diagnostics in the output. Decimal 1030 is 0x0406, which translates to O_NOCTTY | F_SETLK, and should call "rc = real_fcntl(fd, cmd, lock);", but instead falls through to the default case instead calling "rc = real_fcntl(fd, cmd, arg);". Tested the change using perftest - without this patch, the issue is trivially reproducible on my Ubuntu Xenial system, and after patching it emitted no "unknown fcntl argument" diagnostics. Signed-off-by: Will Page <[email protected]<mailto:[email protected]>> --- ports/linux/guts/fcntl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/linux/guts/fcntl.c b/ports/linux/guts/fcntl.c index 639fd24..d278a8c 100644 --- a/ports/linux/guts/fcntl.c +++ b/ports/linux/guts/fcntl.c @@ -8,6 +8,10 @@ */ long arg; int save_errno; + /* some bits can be ORed into the cmd should be explicitly ignored + * see fcntl documentation on F_SETFL */ + int o_mode_mask = (O_RDONLY | O_WRONLY | O_RDWR) | + (O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); /* we don't know whether we need lock or arg; grab both, which * should be safe enough on Linuxy systems. */ @@ -15,7 +19,7 @@ arg = va_arg(ap, long); va_end(ap); - switch (cmd) { + switch (cmd & ~(o_mode_mask)) { case F_DUPFD: #ifdef F_DUPFD_CLOEXEC case F_DUPFD_CLOEXEC: -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list [email protected]<mailto:[email protected]> http://lists.openembedded.org/mailman/listinfo/openembedded-core<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org_mailman_listinfo_openembedded-2Dcore&d=DwMFaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=-PS0OYZ7YP1crHfex64Ojw&m=GwerYyJqZysRsEI2Ua5_9TJVT-a8KZxs2fec7a3M6ig&s=_U2-_Ub2i1xoGVV3H1m1I2IuNiovYWvZUapKZG7swPY&e=> -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
