summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_buf.h
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-05-12 20:32:41 +0300
committerMax Romanov <max.romanov@nginx.com>2017-05-12 20:32:41 +0300
commitf7b4bdfd892a0b479dc946896435a3ba7f9615dd (patch)
treea6f0c4ebaeed2d9f0fcb1c07178b52a684a53280 /src/nxt_buf.h
parent1782c771fab999b37a8c04ed72760e3528205be7 (diff)
downloadunit-f7b4bdfd892a0b479dc946896435a3ba7f9615dd.tar.gz
unit-f7b4bdfd892a0b479dc946896435a3ba7f9615dd.tar.bz2
Using shared memory to send data via nxt_port.
Usage: b = nxt_port_mmap_get_buf(task, port, size); b->mem.free = nxt_cpymem(b->mem.free, data, size); nxt_port_socket_write(task, port, NXT_PORT_MSG_DATA, -1, 0, b);
Diffstat (limited to 'src/nxt_buf.h')
-rw-r--r--src/nxt_buf.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/nxt_buf.h b/src/nxt_buf.h
index 85ab3602..c5ac5c20 100644
--- a/src/nxt_buf.h
+++ b/src/nxt_buf.h
@@ -67,7 +67,7 @@ typedef struct {
struct nxt_buf_s {
void *data;
nxt_work_handler_t completion_handler;
- nxt_buf_t *parent;
+ void *parent;
/*
* The next link, flags, and nxt_buf_mem_t should
@@ -85,11 +85,13 @@ struct nxt_buf_s {
uint8_t is_file; /* 1 bit */
uint16_t is_mmap:1;
+ uint16_t is_port_mmap:1;
uint16_t is_sync:1;
uint16_t is_nobuf:1;
uint16_t is_flush:1;
uint16_t is_last:1;
+ uint16_t is_port_mmap_sent:1;
nxt_buf_mem_t mem;
@@ -103,10 +105,11 @@ struct nxt_buf_s {
};
-#define NXT_BUF_MEM_SIZE offsetof(nxt_buf_t, file)
-#define NXT_BUF_SYNC_SIZE NXT_BUF_MEM_SIZE
-#define NXT_BUF_MMAP_SIZE sizeof(nxt_buf_t)
-#define NXT_BUF_FILE_SIZE sizeof(nxt_buf_t)
+#define NXT_BUF_MEM_SIZE offsetof(nxt_buf_t, file)
+#define NXT_BUF_SYNC_SIZE NXT_BUF_MEM_SIZE
+#define NXT_BUF_FILE_SIZE sizeof(nxt_buf_t)
+#define NXT_BUF_MMAP_SIZE NXT_BUF_FILE_SIZE
+#define NXT_BUF_PORT_MMAP_SIZE NXT_BUF_MEM_SIZE
#define NXT_BUF_SYNC_NOBUF 1
@@ -146,6 +149,19 @@ nxt_buf_clear_mmap(b) \
#define \
+nxt_buf_is_port_mmap(b) \
+ ((b)->is_port_mmap)
+
+#define \
+nxt_buf_set_port_mmap(b) \
+ (b)->is_port_mmap = 1
+
+#define \
+nxt_buf_clear_port_mmap(b) \
+ (b)->is_port_mmap = 0
+
+
+#define \
nxt_buf_is_sync(b) \
((b)->is_sync)