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.
This commit is contained in:
David CARLIER
2022-03-29 13:58:00 +01:00
committed by David Chisnall
parent ee70f952d1
commit ede7dbb3ef

View File

@@ -5,6 +5,16 @@
# include <fcntl.h>
/**
* 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<PALNetBSD>
class PALNetBSD : public PALBSD_Aligned<PALNetBSD, _sys_writev, _sys_fsync>
{
public:
/**