summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--auto/os/conf20
-rw-r--r--auto/os/test2
-rw-r--r--auto/shmem49
-rwxr-xr-xconfigure2
-rw-r--r--src/go/unit/nxt_go_port_memory.c3
-rw-r--r--src/nxt_port_memory.c2
6 files changed, 74 insertions, 4 deletions
diff --git a/auto/os/conf b/auto/os/conf
index 71c15b77..67db5df1 100644
--- a/auto/os/conf
+++ b/auto/os/conf
@@ -167,6 +167,26 @@ case "$NXT_SYSTEM" in
NXT_LIBS="$NXT_PTHREAD"
;;
+ DragonFly)
+ nxt_have=NXT_DRAGONFLY . auto/have
+
+ NXT_STATIC_LINK="ar -r -c"
+ NXT_SHARED_LINK="\$(CC) -shared"
+ NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
+ NXT_MODULE_LINK="\$(CC) -shared"
+
+ # "-Wl,-E" exports symbols of executable file.
+ NXT_EXEC_LINK="\$(CC) -Wl,-E"
+ NXT_SHARED_LOCAL_EXEC_LINK=
+
+ NXT_LIB_STATIC="libnxt.a"
+ NXT_LIB_SHARED="libnxt.so"
+ NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
+
+ NXT_LIBM="-lm"
+ NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
+ ;;
+
AIX)
nxt_have=NXT_AIX . auto/have
diff --git a/auto/os/test b/auto/os/test
index 0332fcfa..41c11b19 100644
--- a/auto/os/test
+++ b/auto/os/test
@@ -16,7 +16,7 @@ case "$NXT_SYSTEM" in
CC=${CC:-cc}
;;
- FreeBSD | NetBSD | OpenBSD)
+ FreeBSD | NetBSD | OpenBSD | DragonFly)
NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
echo=echo
diff --git a/auto/shmem b/auto/shmem
index 3eae6936..1f0d2907 100644
--- a/auto/shmem
+++ b/auto/shmem
@@ -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
diff --git a/configure b/configure
index 3608130d..435dfa92 100755
--- a/configure
+++ b/configure
@@ -145,6 +145,8 @@ cat << END >> $NXT_AUTO_CONFIG_H
#define NXT_DEBUG $nxt_debug
#endif
+#define NXT_SHM_PREFIX "$NXT_SHM_PREFIX"
+
END
. auto/test_build
diff --git a/src/go/unit/nxt_go_port_memory.c b/src/go/unit/nxt_go_port_memory.c
index a919d6cd..7a226672 100644
--- a/src/go/unit/nxt_go_port_memory.c
+++ b/src/go/unit/nxt_go_port_memory.c
@@ -49,7 +49,8 @@ nxt_go_new_port_mmap(nxt_go_process_t *process, nxt_port_id_t id,
return NULL;
}
- name_len = snprintf(name, sizeof(name) - 1, "/unit.go.%p", name);
+ name_len = snprintf(name, sizeof(name) - 1,
+ NXT_SHM_PREFIX "unit.go.%p", name);
#if (NXT_HAVE_MEMFD_CREATE)
diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c
index 7be4347a..b3bfb7e2 100644
--- a/src/nxt_port_memory.c
+++ b/src/nxt_port_memory.c
@@ -280,7 +280,7 @@ nxt_port_new_port_mmap(nxt_task_t *task, nxt_process_t *process,
return NULL;
}
- p = nxt_sprintf(name, name + sizeof(name), "/unit.%PI.%uxD",
+ p = nxt_sprintf(name, name + sizeof(name), NXT_SHM_PREFIX "unit.%PI.%uxD",
nxt_pid, nxt_random(&task->thread->random));
*p = '\0';