]> git.ipfire.org Git - thirdparty/qemu.git/commit - util/oslib-posix.c
util: use fcntl() for qemu_write_pidfile() locking
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 31 Aug 2018 14:53:13 +0000 (16:53 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Oct 2018 16:47:55 +0000 (18:47 +0200)
commit35f7f3fb5c65dcdf8315bbfd40a3c1d015663d77
treeee28c68a11a4449e7c8df1799a3b317c767c3546
parent9e6bdef224f700c057462a7d5e9b4a2770e04569
util: use fcntl() for qemu_write_pidfile() locking

Daniel Berrangé suggested to use fcntl() locks rather than lockf().

'man lockf':

   On Linux, lockf() is just an interface on top of fcntl(2) locking.
   Many other systems implement lockf() in this way, but note that
   POSIX.1 leaves the relationship between lockf() and fcntl(2) locks
   unspecified.  A portable application should probably avoid mixing
   calls to these interfaces.

IOW, if its just a shim around fcntl() on many systems, it is clearer
if we just use fcntl() directly, as we then know how fcntl() locks will
behave if they're on a network filesystem like NFS.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180831145314.14736-3-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/oslib-posix.c