diff options
author | Igor Sysoev <igor@sysoev.ru> | 2018-01-11 17:13:58 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2018-01-11 17:13:58 +0300 |
commit | c105988e5102eefd91fa8336848e926ebbb42a5b (patch) | |
tree | d18b439278ed314ed37cb41f04cdef6d4062d7d2 /auto/shmem | |
parent | f7bc2e1560c2bbbd899b22a54837f09ccb582609 (diff) | |
download | unit-c105988e5102eefd91fa8336848e926ebbb42a5b.tar.gz unit-c105988e5102eefd91fa8336848e926ebbb42a5b.tar.bz2 |
Fixed DragonFly BSD shared memory implementation.
Diffstat (limited to '')
-rw-r--r-- | auto/shmem | 49 |
1 files changed, 48 insertions, 1 deletions
@@ -3,6 +3,8 @@ # Copyright (C) NGINX, Inc. +NXT_SHM_PREFIX="/" + # FreeBSD, Solaris, MacOSX nxt_feature="shm_open()" @@ -12,10 +14,12 @@ nxt_feature_incs= nxt_feature_libs= nxt_feature_test="#include <sys/mman.h> #include <fcntl.h> + #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> int main() { + int ret; static char name[] = \"/unit.configure\"; shm_unlink(name); @@ -25,8 +29,10 @@ nxt_feature_test="#include <sys/mman.h> if (fd == -1) return 1; + ret = (access(name, F_OK) == 0); shm_unlink(name); - return 0; + + return ret; }" . auto/feature @@ -45,6 +51,40 @@ if [ $nxt_found = no ]; then fi +if [ $nxt_found = no ]; then + + # DragonFly has no separate namespace for shm_open(). + + nxt_feature="shm_open() in /tmp directory" + nxt_feature_libs= + nxt_feature_test="#include <sys/mman.h> + #include <fcntl.h> + #include <sys/stat.h> + #include <sys/types.h> + + int main() { + static char name[] = \"/tmp/unit.configure\"; + + shm_unlink(name); + + int fd = shm_open(name, O_CREAT | O_EXCL | O_RDWR, + S_IRUSR | S_IWUSR); + if (fd == -1) + return 1; + + shm_unlink(name); + return 0; + }" + . auto/feature + + if [ $nxt_found = yes ]; then + NXT_SHM_PREFIX="/tmp/" + fi +fi + +nxt_shm_open_found=$nxt_found + + # Linux nxt_feature="memfd_create()" @@ -67,3 +107,10 @@ nxt_feature_test="#include <linux/memfd.h> }" . auto/feature + +if [ "$nxt_shm_open_found$nxt_found" = nono ]; then + $echo + $echo $0: error: no shared memory implementation found. + $echo + exit 1; +fi |