diff options
Diffstat (limited to '')
-rw-r--r-- | auto/shmem | 23 | ||||
-rw-r--r-- | src/go/unit/nxt_go_port_memory.c | 12 | ||||
-rw-r--r-- | src/nxt_port_memory.c | 12 |
3 files changed, 47 insertions, 0 deletions
@@ -85,6 +85,29 @@ fi nxt_shm_open_found=$nxt_found +# FreeBSD 8.0 + +nxt_feature="shm_open(SHM_ANON)" +nxt_feature_name=NXT_HAVE_SHM_OPEN_ANON +nxt_feature_libs= +nxt_feature_test="#include <sys/mman.h> + #include <fcntl.h> + #include <sys/stat.h> + + int main() { + int fd = shm_open(SHM_ANON, O_RDWR, S_IRUSR | S_IWUSR); + if (fd == -1) + return 1; + + return 0; + }" +. auto/feature + +if [ "$nxt_shm_open_found" = no ]; then + nxt_shm_open_found=$nxt_found +fi + + # Linux nxt_feature="memfd_create()" diff --git a/src/go/unit/nxt_go_port_memory.c b/src/go/unit/nxt_go_port_memory.c index 7a226672..89530fe8 100644 --- a/src/go/unit/nxt_go_port_memory.c +++ b/src/go/unit/nxt_go_port_memory.c @@ -64,6 +64,18 @@ nxt_go_new_port_mmap(nxt_go_process_t *process, nxt_port_id_t id, nxt_go_debug("memfd_create(%s): %d", name, fd); +#elif (NXT_HAVE_SHM_OPEN_ANON) + + fd = shm_open(SHM_ANON, O_RDWR, S_IRUSR | S_IWUSR); + + nxt_go_debug("shm_open(SHM_ANON): %d", fd); + + if (nxt_slow_path(fd == -1)) { + nxt_go_warn("shm_open(SHM_ANON) failed %d", errno); + + goto remove_fail; + } + #elif (NXT_HAVE_SHM_OPEN) /* Just in case. */ diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c index f660b1b4..208c8b13 100644 --- a/src/nxt_port_memory.c +++ b/src/nxt_port_memory.c @@ -297,6 +297,18 @@ nxt_port_new_port_mmap(nxt_task_t *task, nxt_process_t *process, nxt_debug(task, "memfd_create(%s): %FD", name, fd); +#elif (NXT_HAVE_SHM_OPEN_ANON) + + fd = shm_open(SHM_ANON, O_RDWR, S_IRUSR | S_IWUSR); + + nxt_debug(task, "shm_open(SHM_ANON): %FD", fd); + + if (nxt_slow_path(fd == -1)) { + nxt_alert(task, "shm_open(SHM_ANON) failed %E", nxt_errno); + + goto remove_fail; + } + #elif (NXT_HAVE_SHM_OPEN) /* Just in case. */ |