Index: src/OFSecureData.h ================================================================== --- src/OFSecureData.h +++ src/OFSecureData.h @@ -30,10 +30,20 @@ */ @interface OFSecureData: OFData { size_t _mappingSize; } + +#ifdef OF_HAVE_CLASS_PROPERTIES +@property (class, readonly, nonatomic, getter=isSecure) bool secure; +#endif + +/*! + * @brief Whether OFSecureData is secure, meaning preventing the data from + * being swapped out is supported. + */ ++ (bool)isSecure; /*! * @brief Creates a new, autoreleased OFSecureData with count items of item * size 1, all set to zero. * Index: src/OFSecureData.m ================================================================== --- src/OFSecureData.m +++ src/OFSecureData.m @@ -30,10 +30,19 @@ #import "OFInvalidArgumentException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" @implementation OFSecureData ++ (bool)isSecure +{ +#if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) + return true; +#else + return false; +#endif +} + + (instancetype)dataWithCount: (size_t)count { return [[[self alloc] initWithCount: count] autorelease]; }