All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK
@ 2016-09-30 23:39 Felix Janda
  2016-10-01  2:38 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Janda @ 2016-09-30 23:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio

The F_EXLCK and F_SHLCK fcntl lock constants are obsolete synonyms for
F_WRLCK and F_RDLCK. Include <linux/fcntl.h> to fix compilation with
the musl c library, which does not expose these constants.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0815f30..3d1f694 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -107,6 +107,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <linux/if_bridge.h>
 #endif
 #include <linux/audit.h>
+#include <linux/fcntl.h>
 #include "linux_loop.h"
 #include "uname.h"
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK
  2016-09-30 23:39 [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK Felix Janda
@ 2016-10-01  2:38 ` Peter Maydell
  2016-10-01  3:20   ` Felix Janda
  2016-10-01 11:47   ` Felix Janda
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2016-10-01  2:38 UTC (permalink / raw)
  To: Felix Janda; +Cc: QEMU Developers, Riku Voipio

On 30 September 2016 at 16:39, Felix Janda <felix.janda@posteo.de> wrote:
> The F_EXLCK and F_SHLCK fcntl lock constants are obsolete synonyms for
> F_WRLCK and F_RDLCK.

This seems unlikely, since on for instance Alpha F_EXLCK is
16, F_SHLCK is 32, F_RDLCK is 1 and F_WRLCK is 2, so they're
all distinct:
http://lxr.free-electrons.com/source/arch/alpha/include/uapi/asm/fcntl.h#L52

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK
  2016-10-01  2:38 ` Peter Maydell
@ 2016-10-01  3:20   ` Felix Janda
  2016-10-01 11:47   ` Felix Janda
  1 sibling, 0 replies; 4+ messages in thread
From: Felix Janda @ 2016-10-01  3:20 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Riku Voipio

Peter Maydell wrote:
> On 30 September 2016 at 16:39, Felix Janda <felix.janda@posteo.de> wrote:
> > The F_EXLCK and F_SHLCK fcntl lock constants are obsolete synonyms for
> > F_WRLCK and F_RDLCK.
> 
> This seems unlikely, since on for instance Alpha F_EXLCK is
> 16, F_SHLCK is 32, F_RDLCK is 1 and F_WRLCK is 2, so they're
> all distinct:
> http://lxr.free-electrons.com/source/arch/alpha/include/uapi/asm/fcntl.h#L52

Except for headers, the only use of F_EXLCK in the kernel is in
fs/cifs/file.c, where it has the same effect as F_WRLCK (except
for a debug message). Similarly for F_SHLCK and F_RDLCK.

Thanks,
Felix

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK
  2016-10-01  2:38 ` Peter Maydell
  2016-10-01  3:20   ` Felix Janda
@ 2016-10-01 11:47   ` Felix Janda
  1 sibling, 0 replies; 4+ messages in thread
From: Felix Janda @ 2016-10-01 11:47 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Riku Voipio

Peter Maydell wrote:
> On 30 September 2016 at 16:39, Felix Janda <felix.janda@posteo.de> wrote:
> > The F_EXLCK and F_SHLCK fcntl lock constants are obsolete synonyms for
> > F_WRLCK and F_RDLCK.
> 
> This seems unlikely, since on for instance Alpha F_EXLCK is
> 16, F_SHLCK is 32, F_RDLCK is 1 and F_WRLCK is 2, so they're
> all distinct:
> http://lxr.free-electrons.com/source/arch/alpha/include/uapi/asm/fcntl.h#L52

I've now looked at linux-1.0, linux-2.0 and linux-2.4. In all of them,
the constants are used in fs/locks.c. In linux-1.0, F_SHLCK has almost
the same effect as F_RDLCK, except that F_SHLCK accepts also files with
write but without read permission. Similarly for F_EXLCK. In linux-2.0
when F_EXLCK or F_SHLCK are used, the flag F_BROKEN gets set. Finally,
in linux-2.4 they just lead to EINVAL.

So I guess that the commit message should more accurately say that the
constants were used in the past for a broken flock implementation.

With this closer look at the history of these constants, it is also not
clear to me whether qemu should care at all about translating them.

Felix

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-01 11:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 23:39 [Qemu-devel] [PATCH] linux-user: include <linux/fcntl.h> for F_EXLCK and F_SHLCK Felix Janda
2016-10-01  2:38 ` Peter Maydell
2016-10-01  3:20   ` Felix Janda
2016-10-01 11:47   ` Felix Janda

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.