]> git.proxmox.com Git - mirror_qemu.git/commit - meson.build
9p: darwin: Implement compatibility for mknodat
authorKeno Fischer <keno@juliacomputing.com>
Sun, 27 Feb 2022 22:35:20 +0000 (17:35 -0500)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Mon, 7 Mar 2022 10:49:31 +0000 (11:49 +0100)
commit029ed1bd9defa33a80bb40cdcd003699299af8db
treed6fddd8b0a23356ec1af721f40b6eb468af2e0e5
parentb5989326f558faedd2511f29459112cced2ca8f5
9p: darwin: Implement compatibility for mknodat

Darwin does not support mknodat. However, to avoid race conditions
with later setting the permissions, we must avoid using mknod on
the full path instead. We could try to fchdir, but that would cause
problems if multiple threads try to call mknodat at the same time.
However, luckily there is a solution: Darwin includes a function
that sets the cwd for the current thread only.
This should suffice to use mknod safely.

This function (pthread_fchdir_np) is protected by a check in
meson in a patch later in this series.

Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Michael Roitzsch <reactorcontrol@icloud.com>
[Will Cohen: - Adjust coding style
             - Replace clang references with gcc
             - Note radar filed with Apple for missing syscall
             - Replace direct syscall with pthread_fchdir_np and
               adjust patch notes accordingly
             - Declare pthread_fchdir_np with
             - __attribute__((weak_import)) to allow checking for
               its presence before usage
             - Move declarations above cplusplus guard
             - Add CONFIG_PTHREAD_FCHDIR_NP to meson and check for
               presence in 9p-util
             - Rebase to apply cleanly on top of the 2022-02-10
               changes to 9pfs
             - Fix line over 90 characters formatting error]
Signed-off-by: Will Cohen <wwcohen@gmail.com>
Message-Id: <20220227223522.91937-10-wwcohen@gmail.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
hw/9pfs/9p-local.c
hw/9pfs/9p-util-darwin.c
hw/9pfs/9p-util-linux.c
hw/9pfs/9p-util.h
meson.build