DragonFly support (userland).

- Close to OpenBSD as there is no malloc*size api nor arbritrary
 alignment support.
- Like FreeBSD, MAP_NORESERVE never had been implemented even tough
 still present in the header but not mentioned in the man page,
FreeBSD has reserved the value for another later usage seems
 DragonFly has just out of sync header.
This commit is contained in:
David Carlier
2020-10-02 18:15:28 +01:00
committed by Matthew Parkinson
parent 923705e514
commit 49b9856ed0
3 changed files with 36 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
#endif
#if !defined(OPEN_ENCLAVE) || defined(OPEN_ENCLAVE_SIMULATION)
# include "pal_apple.h"
# include "pal_dragonfly.h"
# include "pal_freebsd.h"
# include "pal_freebsd_kernel.h"
# include "pal_haiku.h"
@@ -43,6 +44,8 @@ namespace snmalloc
PALOpenBSD;
# elif defined(__sun)
PALSolaris;
# elif defined(__DragonFly__)
PALDragonfly;
# else
# error Unsupported platform
# endif

30
src/pal/pal_dragonfly.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
#if defined(__DragonFly__) && !defined(_KERNEL)
# include "pal_bsd.h"
namespace snmalloc
{
/**
* DragonflyBSD-specific platform abstraction layer.
*
* This adds DragonFlyBSD-specific aligned allocation to the BSD
* implementation.
*/
class PALDragonfly : public PALBSD<PALDragonfly>
{
public:
/**
* Bitmap of PalFeatures flags indicating the optional features that this
* PAL supports.
*
* The DragonflyBSD PAL does not currently add any features beyond
* of those of the BSD Pal.
* Like FreeBSD, MAP_NORESERVE is implicit.
* 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 = PALPOSIX::pal_features;
};
} // namespace snmalloc
#endif