xref: /unit/src/nxt_port_memory.h (revision 365)
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;
14*365Smax.romanov@nginx.com typedef struct nxt_port_mmap_handler_s nxt_port_mmap_handler_t;
1542Smax.romanov@nginx.com 
16*365Smax.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 /*
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 
2880Smax.romanov@nginx.com nxt_int_t nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b,
29206Smax.romanov@nginx.com     size_t size, size_t min_size);
3080Smax.romanov@nginx.com 
31*365Smax.romanov@nginx.com nxt_port_mmap_handler_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 void
4042Smax.romanov@nginx.com nxt_port_mmap_read(nxt_task_t *task, nxt_port_t *port,
4182Smax.romanov@nginx.com     nxt_port_recv_msg_t *msg);
4242Smax.romanov@nginx.com 
4342Smax.romanov@nginx.com enum nxt_port_method_e {
4442Smax.romanov@nginx.com     NXT_PORT_METHOD_ANY = 0,
4542Smax.romanov@nginx.com     NXT_PORT_METHOD_PLAIN,
4642Smax.romanov@nginx.com     NXT_PORT_METHOD_MMAP
4742Smax.romanov@nginx.com };
4842Smax.romanov@nginx.com 
4942Smax.romanov@nginx.com typedef enum nxt_port_method_e nxt_port_method_t;
5042Smax.romanov@nginx.com 
5142Smax.romanov@nginx.com nxt_port_method_t
5242Smax.romanov@nginx.com nxt_port_mmap_get_method(nxt_task_t *task, nxt_port_t *port, nxt_buf_t *b);
5342Smax.romanov@nginx.com 
5480Smax.romanov@nginx.com 
5542Smax.romanov@nginx.com #endif /* _NXT_PORT_MEMORY_H_INCLUDED_ */
56