Thread (31 messages) 31 messages, 6 authors, 2016-11-22

Re: [glibc PATCH] fcntl: put F_OFD_* constants under #ifdef __USE_FILE_OFFSET64

From: Jeff Layton <hidden>
Date: 2016-08-23 11:36:54

On Tue, 2016-08-23 at 13:03 +0200, Cyril Hrubis wrote:
Hi!
quoted
quoted
So yeah, I think what I proposed before would probably be fine.
But now
that Michael pushed the issue, it's dawned on me that we may be
able to
get away with supporting it better if we turn the compatability
mechanism on its head and use F_OFD_*32 constants in the non-LFS
case.
That's rather confusing to programmers, though.

We then have:

F_OFD_SETLK     always 64-bit
F_SETLK         32-bit or 64-bit
F_SETLK64       always 64-bit (not recommended)
F_OFD_SETLK32   always 32-bit
It's even worse, the F_OFD_SETLK32 in the proposed patch behaves
exactly
as F_SETLK so it's 32-bit or 64-bit depending on sizeof(long) in the
kernel, that is because the compat fcntl64 converts struct flock from
userspace to kernel struct flock and just call sys_fcntl() with the
cmd
it has. So in the end if you call fcntl with F_OFD_SETLK32 on 64bit
kernel it expects flock64.
To be clear, that approach was NAK'ed by Christoph (and I think that's
a good thing, actually -- one more nail in the non-LFS coffin). I think
what we want merged into glibc is this patch that I sent late on
Thursday:

    [glibc PATCHv2] fcntl: don't define OFD lock constants for 32-bit builds with small file offsets

We'll also need your patch to the fcntl(2) manpage as well, but that's
a separate problem.

-- 
Jeff Layton [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help