Add a NetBSD PAL.
Currently untested, but identical to the FreeBSD one so should work... The NetBSD man pages for `madvise` and `mmap` mention the flags that we use.
This commit is contained in:
@@ -13,6 +13,7 @@ namespace snmalloc
|
|||||||
# include "pal_free_bsd_kernel.h"
|
# include "pal_free_bsd_kernel.h"
|
||||||
# include "pal_freebsd.h"
|
# include "pal_freebsd.h"
|
||||||
# include "pal_linux.h"
|
# include "pal_linux.h"
|
||||||
|
# include "pal_netbsd.h"
|
||||||
# include "pal_openbsd.h"
|
# include "pal_openbsd.h"
|
||||||
# include "pal_windows.h"
|
# include "pal_windows.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -33,6 +34,8 @@ namespace snmalloc
|
|||||||
PALFreeBSDKernel;
|
PALFreeBSDKernel;
|
||||||
# elif defined(__FreeBSD__)
|
# elif defined(__FreeBSD__)
|
||||||
PALFBSD;
|
PALFBSD;
|
||||||
|
# elif defined(__NetBSD__)
|
||||||
|
PALNetBSD;
|
||||||
# elif defined(__OpenBSD__)
|
# elif defined(__OpenBSD__)
|
||||||
PALOBSD;
|
PALOBSD;
|
||||||
# else
|
# else
|
||||||
|
|||||||
29
src/pal/pal_netbsd.h
Normal file
29
src/pal/pal_netbsd.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
# include "pal_bsd_aligned.h"
|
||||||
|
|
||||||
|
namespace snmalloc
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* NetBSD-specific platform abstraction layer.
|
||||||
|
*
|
||||||
|
* This adds NetBSD-specific aligned allocation to the generic BSD
|
||||||
|
* implementation.
|
||||||
|
*/
|
||||||
|
class PALNetBSD : public PALBSD_Aligned<PALFBSD>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Bitmap of PalFeatures flags indicating the optional features that this
|
||||||
|
* PAL supports.
|
||||||
|
*
|
||||||
|
* The NetBSD PAL does not currently add any features beyond those of a
|
||||||
|
* generic BSD with support for arbitrary alignment from `mmap`. This
|
||||||
|
* field is declared explicitly to remind anyone modifying this class to
|
||||||
|
* add new features that they should add any required feature flags.
|
||||||
|
*/
|
||||||
|
static constexpr uint64_t pal_features = PALBSD_Aligned::pal_features;
|
||||||
|
};
|
||||||
|
} // namespace snmalloc
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user