xref: /unit/src/nxt_port_memory.h (revision 42:def41906e4a5)
1 
2 #ifndef _NXT_PORT_MEMORY_H_INCLUDED_
3 #define _NXT_PORT_MEMORY_H_INCLUDED_
4 
5 #define PORT_MMAP_MIN_SIZE (3 * sizeof(uint32_t))
6 
7 typedef struct nxt_port_mmap_header_s nxt_port_mmap_header_t;
8 
9 void
10 nxt_port_mmap_destroy(nxt_port_mmap_t *port_mmap);
11 
12 /*
13  * Allocates nxt_but_t structure from port's mem_pool, assigns this buf 'mem'
14  * pointers to first available shared mem bucket(s). 'size' used as a hint to
15  * acquire several successive buckets if possible.
16  *
17  * This function assumes that current thread operates the 'port' exclusively.
18  */
19 nxt_buf_t *
20 nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_t *port, size_t size);
21 
22 nxt_port_mmap_t *
23 nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process,
24     nxt_fd_t fd);
25 
26 void
27 nxt_port_mmap_write(nxt_task_t *task, nxt_port_t *port,
28     nxt_port_send_msg_t *msg, nxt_sendbuf_coalesce_t *sb);
29 
30 nxt_inline void
31 nxt_port_mmap_completion(nxt_task_t *task, nxt_work_queue_t *wq, nxt_buf_t *b) {
32     nxt_work_queue_add(wq, b->completion_handler, task, b, b->parent);
33 }
34 
35 void
36 nxt_port_mmap_read(nxt_task_t *task, nxt_port_t *port,
37     nxt_port_recv_msg_t *msg, size_t size);
38 
39 enum nxt_port_method_e {
40     NXT_PORT_METHOD_ANY = 0,
41     NXT_PORT_METHOD_PLAIN,
42     NXT_PORT_METHOD_MMAP
43 };
44 
45 typedef enum nxt_port_method_e nxt_port_method_t;
46 
47 nxt_port_method_t
48 nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b);
49 
50 #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */
51