nxt_unit.c (2139:99d792169ffb) nxt_unit.c (2142:0729b05c45d4)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include "nxt_main.h"
7#include "nxt_port_memory_int.h"
8#include "nxt_socket_msg.h"

--- 3799 unchanged lines hidden (view full) ---

3808 return NULL;
3809}
3810
3811
3812static int
3813nxt_unit_shm_open(nxt_unit_ctx_t *ctx, size_t size)
3814{
3815 int fd;
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include "nxt_main.h"
7#include "nxt_port_memory_int.h"
8#include "nxt_socket_msg.h"

--- 3799 unchanged lines hidden (view full) ---

3808 return NULL;
3809}
3810
3811
3812static int
3813nxt_unit_shm_open(nxt_unit_ctx_t *ctx, size_t size)
3814{
3815 int fd;
3816 nxt_unit_impl_t *lib;
3817
3816
3818 lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);
3819
3820#if (NXT_HAVE_MEMFD_CREATE || NXT_HAVE_SHM_OPEN)
3821 char name[64];
3817#if (NXT_HAVE_MEMFD_CREATE || NXT_HAVE_SHM_OPEN)
3818 char name[64];
3819 nxt_unit_impl_t *lib;
3822
3820
3821 lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);
3823 snprintf(name, sizeof(name), NXT_SHM_PREFIX "unit.%d.%p",
3824 lib->pid, (void *) (uintptr_t) pthread_self());
3825#endif
3826
3827#if (NXT_HAVE_MEMFD_CREATE)
3828
3829 fd = syscall(SYS_memfd_create, name, MFD_CLOEXEC);
3830 if (nxt_slow_path(fd == -1)) {

--- 2959 unchanged lines hidden ---
3822 snprintf(name, sizeof(name), NXT_SHM_PREFIX "unit.%d.%p",
3823 lib->pid, (void *) (uintptr_t) pthread_self());
3824#endif
3825
3826#if (NXT_HAVE_MEMFD_CREATE)
3827
3828 fd = syscall(SYS_memfd_create, name, MFD_CLOEXEC);
3829 if (nxt_slow_path(fd == -1)) {

--- 2959 unchanged lines hidden ---