180Smax.romanov@nginx.com 280Smax.romanov@nginx.com /* 380Smax.romanov@nginx.com * Copyright (C) Max Romanov 480Smax.romanov@nginx.com * Copyright (C) NGINX, Inc. 580Smax.romanov@nginx.com */ 642Smax.romanov@nginx.com 742Smax.romanov@nginx.com #ifndef _NXT_PORT_MEMORY_H_INCLUDED_ 842Smax.romanov@nginx.com #define _NXT_PORT_MEMORY_H_INCLUDED_ 942Smax.romanov@nginx.com 1080Smax.romanov@nginx.com 1142Smax.romanov@nginx.com #define PORT_MMAP_MIN_SIZE (3 * sizeof(uint32_t)) 1242Smax.romanov@nginx.com 1342Smax.romanov@nginx.com typedef struct nxt_port_mmap_header_s nxt_port_mmap_header_t; 1442Smax.romanov@nginx.com 1542Smax.romanov@nginx.com void 1642Smax.romanov@nginx.com nxt_port_mmap_destroy(nxt_port_mmap_t *port_mmap); 1742Smax.romanov@nginx.com 18*141Smax.romanov@nginx.com void nxt_port_mmaps_destroy(nxt_array_t *port_mmaps, nxt_bool_t destroy_pool); 19*141Smax.romanov@nginx.com 2042Smax.romanov@nginx.com /* 2142Smax.romanov@nginx.com * Allocates nxt_but_t structure from port's mem_pool, assigns this buf 'mem' 2242Smax.romanov@nginx.com * pointers to first available shared mem bucket(s). 'size' used as a hint to 2342Smax.romanov@nginx.com * acquire several successive buckets if possible. 2442Smax.romanov@nginx.com * 2542Smax.romanov@nginx.com * This function assumes that current thread operates the 'port' exclusively. 2642Smax.romanov@nginx.com */ 2742Smax.romanov@nginx.com nxt_buf_t * 2842Smax.romanov@nginx.com nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_t *port, size_t size); 2942Smax.romanov@nginx.com 3080Smax.romanov@nginx.com nxt_int_t nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b, 3180Smax.romanov@nginx.com size_t size); 3280Smax.romanov@nginx.com 3380Smax.romanov@nginx.com nxt_port_mmap_header_t * 3442Smax.romanov@nginx.com nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, 3542Smax.romanov@nginx.com nxt_fd_t fd); 3642Smax.romanov@nginx.com 3742Smax.romanov@nginx.com void 3842Smax.romanov@nginx.com nxt_port_mmap_write(nxt_task_t *task, nxt_port_t *port, 3942Smax.romanov@nginx.com nxt_port_send_msg_t *msg, nxt_sendbuf_coalesce_t *sb); 4042Smax.romanov@nginx.com 4142Smax.romanov@nginx.com nxt_inline void 4242Smax.romanov@nginx.com nxt_port_mmap_completion(nxt_task_t *task, nxt_work_queue_t *wq, nxt_buf_t *b) { 4342Smax.romanov@nginx.com nxt_work_queue_add(wq, b->completion_handler, task, b, b->parent); 4442Smax.romanov@nginx.com } 4542Smax.romanov@nginx.com 4642Smax.romanov@nginx.com void 4742Smax.romanov@nginx.com nxt_port_mmap_read(nxt_task_t *task, nxt_port_t *port, 4882Smax.romanov@nginx.com nxt_port_recv_msg_t *msg); 4942Smax.romanov@nginx.com 5042Smax.romanov@nginx.com enum nxt_port_method_e { 5142Smax.romanov@nginx.com NXT_PORT_METHOD_ANY = 0, 5242Smax.romanov@nginx.com NXT_PORT_METHOD_PLAIN, 5342Smax.romanov@nginx.com NXT_PORT_METHOD_MMAP 5442Smax.romanov@nginx.com }; 5542Smax.romanov@nginx.com 5642Smax.romanov@nginx.com typedef enum nxt_port_method_e nxt_port_method_t; 5742Smax.romanov@nginx.com 5842Smax.romanov@nginx.com nxt_port_method_t 5942Smax.romanov@nginx.com nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b); 6042Smax.romanov@nginx.com 6180Smax.romanov@nginx.com 6242Smax.romanov@nginx.com #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */ 63