summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorKeno Fischer2022-02-27 23:35:20 +0100
committerChristian Schoenebeck2022-03-07 11:49:31 +0100
commit029ed1bd9defa33a80bb40cdcd003699299af8db (patch)
treed6fddd8b0a23356ec1af721f40b6eb468af2e0e5 /meson.build
parent9p: darwin: Compatibility for f/l*xattr (diff)
downloadqemu-029ed1bd9defa33a80bb40cdcd003699299af8db.tar.gz
qemu-029ed1bd9defa33a80bb40cdcd003699299af8db.tar.xz
qemu-029ed1bd9defa33a80bb40cdcd003699299af8db.zip
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>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build1
1 files changed, 1 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 038502714a..40598630e6 100644
--- a/meson.build
+++ b/meson.build
@@ -1622,6 +1622,7 @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate'
config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign'))
config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll'))
config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
+config_host_data.set('CONFIG_PTHREAD_FCHDIR_NP', cc.has_function('pthread_fchdir_np'))
config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwait', dependencies: threads))
config_host_data.set('CONFIG_SENDFILE', cc.has_function('sendfile'))
config_host_data.set('CONFIG_SETNS', cc.has_function('setns') and cc.has_function('unshare'))