1*80Smax.romanov@nginx.com 2*80Smax.romanov@nginx.com /* 3*80Smax.romanov@nginx.com * Copyright (C) Max Romanov 4*80Smax.romanov@nginx.com * Copyright (C) NGINX, Inc. 5*80Smax.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 10*80Smax.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 1842Smax.romanov@nginx.com /* 1942Smax.romanov@nginx.com * Allocates nxt_but_t structure from port's mem_pool, assigns this buf 'mem' 2042Smax.romanov@nginx.com * pointers to first available shared mem bucket(s). 'size' used as a hint to 2142Smax.romanov@nginx.com * acquire several successive buckets if possible. 2242Smax.romanov@nginx.com * 2342Smax.romanov@nginx.com * This function assumes that current thread operates the 'port' exclusively. 2442Smax.romanov@nginx.com */ 2542Smax.romanov@nginx.com nxt_buf_t * 2642Smax.romanov@nginx.com nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_t *port, size_t size); 2742Smax.romanov@nginx.com 28*80Smax.romanov@nginx.com nxt_int_t nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b, 29*80Smax.romanov@nginx.com size_t size); 30*80Smax.romanov@nginx.com 31*80Smax.romanov@nginx.com nxt_port_mmap_header_t * 3242Smax.romanov@nginx.com nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, 3342Smax.romanov@nginx.com nxt_fd_t fd); 3442Smax.romanov@nginx.com 3542Smax.romanov@nginx.com void 3642Smax.romanov@nginx.com nxt_port_mmap_write(nxt_task_t *task, nxt_port_t *port, 3742Smax.romanov@nginx.com nxt_port_send_msg_t *msg, nxt_sendbuf_coalesce_t *sb); 3842Smax.romanov@nginx.com 3942Smax.romanov@nginx.com nxt_inline void 4042Smax.romanov@nginx.com nxt_port_mmap_completion(nxt_task_t *task, nxt_work_queue_t *wq, nxt_buf_t *b) { 4142Smax.romanov@nginx.com nxt_work_queue_add(wq, b->completion_handler, task, b, b->parent); 4242Smax.romanov@nginx.com } 4342Smax.romanov@nginx.com 4442Smax.romanov@nginx.com void 4542Smax.romanov@nginx.com nxt_port_mmap_read(nxt_task_t *task, nxt_port_t *port, 4642Smax.romanov@nginx.com nxt_port_recv_msg_t *msg, size_t size); 4742Smax.romanov@nginx.com 4842Smax.romanov@nginx.com enum nxt_port_method_e { 4942Smax.romanov@nginx.com NXT_PORT_METHOD_ANY = 0, 5042Smax.romanov@nginx.com NXT_PORT_METHOD_PLAIN, 5142Smax.romanov@nginx.com NXT_PORT_METHOD_MMAP 5242Smax.romanov@nginx.com }; 5342Smax.romanov@nginx.com 5442Smax.romanov@nginx.com typedef enum nxt_port_method_e nxt_port_method_t; 5542Smax.romanov@nginx.com 5642Smax.romanov@nginx.com nxt_port_method_t 5742Smax.romanov@nginx.com nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b); 5842Smax.romanov@nginx.com 59*80Smax.romanov@nginx.com 6042Smax.romanov@nginx.com #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */ 61