diff --git a/src/pal/pal.h b/src/pal/pal.h index 6cec451..ad74b77 100644 --- a/src/pal/pal.h +++ b/src/pal/pal.h @@ -13,6 +13,7 @@ namespace snmalloc # include "pal_free_bsd_kernel.h" # include "pal_freebsd.h" # include "pal_linux.h" +# include "pal_netbsd.h" # include "pal_openbsd.h" # include "pal_windows.h" #endif @@ -33,6 +34,8 @@ namespace snmalloc PALFreeBSDKernel; # elif defined(__FreeBSD__) PALFBSD; +# elif defined(__NetBSD__) + PALNetBSD; # elif defined(__OpenBSD__) PALOBSD; # else diff --git a/src/pal/pal_netbsd.h b/src/pal/pal_netbsd.h new file mode 100644 index 0000000..0c7cb68 --- /dev/null +++ b/src/pal/pal_netbsd.h @@ -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 + { + 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