aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-29 14:51:50 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-29 14:51:50 +0100
commit5f450d88f7dc79fa13371bdef6bc6dedb1c56aa5 (patch)
tree6db193a4f4e874c361ce9a1c11c3640b18a5b97d /CMakeLists.txt
parentfd6081d60ef0102e40681fe3362c48ee472e03fa (diff)
downloadrspamd-5f450d88f7dc79fa13371bdef6bc6dedb1c56aa5.tar.gz
rspamd-5f450d88f7dc79fa13371bdef6bc6dedb1c56aa5.zip
[Feature] Add test to check shared memory support sanity
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d1f8cf94..40b4907a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1051,6 +1051,49 @@ ELSE()
MESSAGE(STATUS "atomic builtins are supported")
ENDIF()
+CHECK_C_SOURCE_RUNS("
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <unistd.h>
+#define TEST_NAME \"/test-shmem-work\"
+int
+main (int argc, char **argv)
+{
+ int fd;
+
+ fd = shm_open (TEST_NAME, O_RDWR | O_CREAT | O_EXCL, 00600);
+ if (fd == -1) {
+ return -1;
+ }
+ if (ftruncate (fd, 100) == -1) {
+ shm_unlink (TEST_NAME);
+ close (fd);
+ return -1;
+ }
+
+ if (ftruncate (fd, 200) == -1) {
+ shm_unlink (TEST_NAME);
+ close (fd);
+ return -1;
+ }
+ if (ftruncate (fd, 300) == -1) {
+ shm_unlink (TEST_NAME);
+ close (fd);
+ return -1;
+ }
+
+ close (fd);
+ shm_unlink (TEST_NAME);
+ return 0;
+}
+" HAVE_SANE_SHMEM)
+
+IF(NOT HAVE_SANE_SHMEM)
+ MESSAGE(STATUS "shmem support is NOT compatible with POSIX")
+ELSE()
+ MESSAGE(STATUS "shmem support is compatible with POSIX")
+ENDIF()
+
# Check queue.h compatibility
IF(NOT HAVE_COMPATIBLE_QUEUE_H)
INCLUDE_DIRECTORIES(compat)