summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_port.h
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-08-02 13:10:48 +0300
committerMax Romanov <max.romanov@nginx.com>2017-08-02 13:10:48 +0300
commit3812ffd336414904affc43d29229b04a2d6d8ae6 (patch)
treef12fca86a5e4280bd75234776cac80c9b9902d0b /src/nxt_port.h
parenta7ef8481fcda2f2dc5b0b84a93e66bce62c83918 (diff)
downloadunit-3812ffd336414904affc43d29229b04a2d6d8ae6.tar.gz
unit-3812ffd336414904affc43d29229b04a2d6d8ae6.tar.bz2
Added bit flags to type parameter of nxt_port_socket_write().
NXT_PORT_MSG_LAST - mark message as last; NXT_PORT_MSG_CLOSE_FD - close fd right after send; Type constants altered to include last flag for single buffer messages. Last sign is critical for coming port RPC layer. Handlers unregistered on last message. Create sync buffer is not convenient, extra parameter is better.
Diffstat (limited to '')
-rw-r--r--src/nxt_port.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/nxt_port.h b/src/nxt_port.h
index c057007f..27c00132 100644
--- a/src/nxt_port.h
+++ b/src/nxt_port.h
@@ -9,15 +9,30 @@
typedef enum {
- NXT_PORT_MSG_QUIT = 0,
- NXT_PORT_MSG_NEW_PORT,
- NXT_PORT_MSG_CHANGE_FILE,
- NXT_PORT_MSG_MMAP,
- NXT_PORT_MSG_DATA,
- NXT_PORT_MSG_REMOVE_PID,
- NXT_PORT_MSG_READY,
+ NXT_PORT_MSG_LAST = 0x100,
+ NXT_PORT_MSG_CLOSE_FD = 0x200,
+
+ NXT_PORT_MSG_MASK = 0xFF,
+
+ _NXT_PORT_MSG_QUIT = 0,
+ _NXT_PORT_MSG_NEW_PORT,
+ _NXT_PORT_MSG_CHANGE_FILE,
+ _NXT_PORT_MSG_MMAP,
+ _NXT_PORT_MSG_DATA,
+ _NXT_PORT_MSG_REMOVE_PID,
+ _NXT_PORT_MSG_READY,
NXT_PORT_MSG_MAX,
+
+ NXT_PORT_MSG_QUIT = _NXT_PORT_MSG_QUIT | NXT_PORT_MSG_LAST,
+ NXT_PORT_MSG_NEW_PORT = _NXT_PORT_MSG_NEW_PORT | NXT_PORT_MSG_LAST,
+ NXT_PORT_MSG_CHANGE_FILE = _NXT_PORT_MSG_CHANGE_FILE | NXT_PORT_MSG_LAST,
+ NXT_PORT_MSG_MMAP = _NXT_PORT_MSG_MMAP | NXT_PORT_MSG_LAST |
+ NXT_PORT_MSG_CLOSE_FD,
+ NXT_PORT_MSG_DATA = _NXT_PORT_MSG_DATA,
+ NXT_PORT_MSG_DATA_LAST = _NXT_PORT_MSG_DATA | NXT_PORT_MSG_LAST,
+ NXT_PORT_MSG_REMOVE_PID = _NXT_PORT_MSG_REMOVE_PID | NXT_PORT_MSG_LAST,
+ NXT_PORT_MSG_READY = _NXT_PORT_MSG_READY | NXT_PORT_MSG_LAST,
} nxt_port_msg_type_t;
@@ -27,7 +42,7 @@ typedef struct {
nxt_pid_t pid;
nxt_port_id_t reply_port;
- nxt_port_msg_type_t type:8;
+ uint8_t type;
uint8_t last; /* 1 bit */
/* Message data send using mmap, next chunk is a nxt_port_mmap_msg_t. */
@@ -40,6 +55,7 @@ typedef struct {
nxt_buf_t *buf;
size_t share;
nxt_fd_t fd;
+ nxt_bool_t close_fd;
nxt_port_msg_t port_msg;
nxt_work_t work;