[PATCH] Make F_RDLCK/F_WRLCK atomic
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 8 Oct 2022 15:53:16 +0000 (16:53 +0100)
committerHelmut Grohne <helmut@subdivi.de>
Sat, 8 Oct 2022 15:53:16 +0000 (16:53 +0100)
commitcf5c5c7806130bd86dc910af25eb99a1bc6d1411
tree830caf7bee1720813b20fc8ff71bd7e31c8e6031
parent571c468a35dbdec89bfeb0a97533f733ce6e6779
[PATCH] Make F_RDLCK/F_WRLCK atomic

lockf(LOCK_EX) would for instance drop any existing shared lock before taking
the exclusive lock. F_RDLCK/F_WRLCK need atomic changes, so introduce and use
__LOCK_ATOM

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* misc/sys/file.h (__LOCK_ATOMIC): New macro.
* sysdeps/mach/hurd/fcntl.c (__libc_fcntl): Use __LOCK_ATOMIC along LOCK_SH and
LOCK_EX.

XXX: Adding to misc/sys/file.h is questionable

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name tg-WRLCK-upgrade.diff
misc/sys/file.h
sysdeps/mach/hurd/f_setlk.c