1 2 /* 3 * Copyright (C) Max Romanov 4 * Copyright (C) NGINX, Inc. 5 */ 6 7 #ifndef _NXT_PORT_MEMORY_H_INCLUDED_ 8 #define _NXT_PORT_MEMORY_H_INCLUDED_ 9 10 11 #define PORT_MMAP_MIN_SIZE (3 * sizeof(uint32_t)) 12 13 typedef struct nxt_port_mmap_header_s nxt_port_mmap_header_t; 14 15 void nxt_port_mmaps_destroy(nxt_port_mmaps_t *port_mmaps, nxt_bool_t free); 16 17 /* 18 * Allocates nxt_but_t structure from port's mem_pool, assigns this buf 'mem' 19 * pointers to first available shared mem bucket(s). 'size' used as a hint to 20 * acquire several successive buckets if possible. 21 * 22 * This function assumes that current thread operates the 'port' exclusively. 23 */ 24 nxt_buf_t * 25 nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_t *port, size_t size); 26 27 nxt_int_t nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b, 28 size_t size, size_t min_size); 29 30 nxt_port_mmap_header_t * 31 nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, 32 nxt_fd_t fd); 33 34 void 35 nxt_port_mmap_write(nxt_task_t *task, nxt_port_t *port, 36 nxt_port_send_msg_t *msg, nxt_sendbuf_coalesce_t *sb); 37 38 void 39 nxt_port_mmap_read(nxt_task_t *task, nxt_port_t *port, 40 nxt_port_recv_msg_t *msg); 41 42 enum nxt_port_method_e { 43 NXT_PORT_METHOD_ANY = 0, 44 NXT_PORT_METHOD_PLAIN, 45 NXT_PORT_METHOD_MMAP 46 }; 47 48 typedef enum nxt_port_method_e nxt_port_method_t; 49 50 nxt_port_method_t 51 nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b); 52 53 54 #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */ 55