From ede7dbb3ef4b668a4476a54aab84b60d1d852a71 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 29 Mar 2022 13:58:00 +0100 Subject: [PATCH] Following up using writev/fsync direct syscalls to avoid pthread interpositions (#499) As these calls carries a pthread cancellation check and due to pthread allocation libc init timing, we directly access their syscalls instead. --- src/pal/pal_netbsd.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pal/pal_netbsd.h b/src/pal/pal_netbsd.h index 377c1cc..7539470 100644 --- a/src/pal/pal_netbsd.h +++ b/src/pal/pal_netbsd.h @@ -5,6 +5,16 @@ # include +/** + * We skip the pthread cancellation checkpoints by reaching directly + * the following syscalls so we avoid the possible pthread + * allocation initialization timing issues. + * @{ + */ +extern "C" ssize_t _sys_writev(int fd, const struct iovec* iov, int iovcnt); +extern "C" int _sys_fsync(int fd); +/// @} + namespace snmalloc { /** @@ -13,7 +23,7 @@ namespace snmalloc * This adds NetBSD-specific aligned allocation to the generic BSD * implementation. */ - class PALNetBSD : public PALBSD_Aligned + class PALNetBSD : public PALBSD_Aligned { public: /**