diff options
Diffstat (limited to '')
-rw-r--r-- | auto/modules/go | 2 | ||||
-rw-r--r-- | auto/sources | 1 | ||||
-rw-r--r-- | src/nginext/port.go | 5 | ||||
-rw-r--r-- | src/nxt_main.h | 1 | ||||
-rw-r--r-- | src/nxt_process.h | 12 | ||||
-rw-r--r-- | src/nxt_process_type.h | 23 |
6 files changed, 29 insertions, 15 deletions
diff --git a/auto/modules/go b/auto/modules/go index b771de8a..96e9e12d 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -56,7 +56,7 @@ $echo "configuring Go package ..." >> $NXT_AUTOCONF_ERR $echo -n "checking for Go ..." $echo "checking for Go ..." >> $NXT_AUTOCONF_ERR -nxt_go_test="GOPATH=`pwd` CGO_CPPFLAGS=-DNXT_CONFIGURE \ +nxt_go_test="GOPATH=`pwd` CGO_CPPFLAGS='-DNXT_CONFIGURE -I`pwd`/src'\ \"${NXT_GO}\" build -o build/nxt_go_gen.a --buildmode=c-archive nginext" diff --git a/auto/sources b/auto/sources index 5c80f756..eab4e29b 100644 --- a/auto/sources +++ b/auto/sources @@ -15,6 +15,7 @@ NXT_LIB_DEPS=" \ src/nxt_file.h \ src/nxt_mem_map.h \ src/nxt_socket.h \ + src/nxt_process_type.h \ src/nxt_process.h \ src/nxt_signal.h \ src/nxt_port.h \ diff --git a/src/nginext/port.go b/src/nginext/port.go index 26ca26d2..ee858612 100644 --- a/src/nginext/port.go +++ b/src/nginext/port.go @@ -7,6 +7,7 @@ package nginext /* #include "nxt_go_lib.h" +#include "nxt_process_type.h" */ import "C" @@ -33,7 +34,7 @@ type port struct { type port_registry struct { sync.RWMutex m map[port_key]*port - t [5]*port + t [C.NXT_PROCESS_MAX]*port } var port_registry_ port_registry @@ -65,7 +66,7 @@ func remove_by_pid(pid int) { func main_port() *port { port_registry_.RLock() - res := port_registry_.t[1] + res := port_registry_.t[C.NXT_PROCESS_MAIN] port_registry_.RUnlock() return res diff --git a/src/nxt_main.h b/src/nxt_main.h index b8ebfc93..a0be58a1 100644 --- a/src/nxt_main.h +++ b/src/nxt_main.h @@ -56,6 +56,7 @@ typedef uint16_t nxt_port_id_t; #include <nxt_timer.h> #include <nxt_fiber.h> #include <nxt_thread.h> +#include <nxt_process_type.h> #include <nxt_process.h> #include <nxt_utf8.h> #include <nxt_file_name.h> diff --git a/src/nxt_process.h b/src/nxt_process.h index bbe277f2..8b949853 100644 --- a/src/nxt_process.h +++ b/src/nxt_process.h @@ -8,18 +8,6 @@ #define _NXT_PROCESS_H_INCLUDED_ -typedef enum { - NXT_PROCESS_SINGLE = 0, - NXT_PROCESS_MAIN, - NXT_PROCESS_CONTROLLER, - NXT_PROCESS_ROUTER, - NXT_PROCESS_WORKER, - NXT_PROCESS_DISCOVERY, - - NXT_PROCESS_MAX, -} nxt_process_type_t; - - typedef pid_t nxt_pid_t; typedef uid_t nxt_uid_t; typedef gid_t nxt_gid_t; diff --git a/src/nxt_process_type.h b/src/nxt_process_type.h new file mode 100644 index 00000000..16d6dfc8 --- /dev/null +++ b/src/nxt_process_type.h @@ -0,0 +1,23 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) NGINX, Inc. + */ + +#ifndef _NXT_PROCESS_TYPE_H_INCLUDED_ +#define _NXT_PROCESS_TYPE_H_INCLUDED_ + + +typedef enum { + NXT_PROCESS_SINGLE = 0, + NXT_PROCESS_MAIN, + NXT_PROCESS_DISCOVERY, + NXT_PROCESS_CONTROLLER, + NXT_PROCESS_ROUTER, + NXT_PROCESS_WORKER, + + NXT_PROCESS_MAX, +} nxt_process_type_t; + + +#endif /* _NXT_PROCESS_TYPE_H_INCLUDED_ */ |