xref: /unit/src/nxt_port_memory.h (revision 2126:8542c8141a13)
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;
14365Smax.romanov@nginx.com typedef struct nxt_port_mmap_handler_s nxt_port_mmap_handler_t;
1542Smax.romanov@nginx.com 
16365Smax.romanov@nginx.com void nxt_port_mmaps_destroy(nxt_port_mmaps_t *port_mmaps, nxt_bool_t free_elts);
17141Smax.romanov@nginx.com 
1842Smax.romanov@nginx.com /*
191546Smax.romanov@nginx.com  * Allocates nxt_but_t structure from task's thread engine mem_pool, assigns
201546Smax.romanov@nginx.com  * this buf 'mem' pointers to first available shared mem bucket(s). 'size'
211546Smax.romanov@nginx.com  * used as a hint to acquire several successive buckets if possible.
2242Smax.romanov@nginx.com  */
2342Smax.romanov@nginx.com nxt_buf_t *
241546Smax.romanov@nginx.com nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_mmaps_t *mmaps, size_t size);
2542Smax.romanov@nginx.com 
2680Smax.romanov@nginx.com nxt_int_t nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b,
27206Smax.romanov@nginx.com     size_t size, size_t min_size);
2880Smax.romanov@nginx.com 
29365Smax.romanov@nginx.com nxt_port_mmap_handler_t *
3042Smax.romanov@nginx.com nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process,
3142Smax.romanov@nginx.com     nxt_fd_t fd);
3242Smax.romanov@nginx.com 
3342Smax.romanov@nginx.com void
3442Smax.romanov@nginx.com nxt_port_mmap_write(nxt_task_t *task, nxt_port_t *port,
351125Smax.romanov@nginx.com     nxt_port_send_msg_t *msg, nxt_sendbuf_coalesce_t *sb, void *mmsg_buf);
3642Smax.romanov@nginx.com 
3742Smax.romanov@nginx.com void
38423Smax.romanov@nginx.com nxt_port_mmap_read(nxt_task_t *task, nxt_port_recv_msg_t *msg);
3942Smax.romanov@nginx.com 
4042Smax.romanov@nginx.com enum nxt_port_method_e {
4142Smax.romanov@nginx.com     NXT_PORT_METHOD_ANY = 0,
4242Smax.romanov@nginx.com     NXT_PORT_METHOD_PLAIN,
4342Smax.romanov@nginx.com     NXT_PORT_METHOD_MMAP
4442Smax.romanov@nginx.com };
4542Smax.romanov@nginx.com 
4642Smax.romanov@nginx.com typedef enum nxt_port_method_e nxt_port_method_t;
4742Smax.romanov@nginx.com 
4842Smax.romanov@nginx.com nxt_port_method_t
4942Smax.romanov@nginx.com nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b);
5042Smax.romanov@nginx.com 
511526Smax.romanov@nginx.com nxt_int_t nxt_shm_open(nxt_task_t *task, size_t size);
5280Smax.romanov@nginx.com 
53*1662Smax.romanov@nginx.com void nxt_process_broadcast_shm_ack(nxt_task_t *task, nxt_process_t *process);
54*1662Smax.romanov@nginx.com 
5542Smax.romanov@nginx.com #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */
56