From 64f649f9903e226421869376bc72a8513581d7d0 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 24 Dec 2019 18:04:09 +0300 Subject: Adding "limits/shm" configuration validation and parsing. --- src/nxt_unit.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nxt_unit.h') diff --git a/src/nxt_unit.h b/src/nxt_unit.h index 3471a758..6948b253 100644 --- a/src/nxt_unit.h +++ b/src/nxt_unit.h @@ -155,6 +155,7 @@ struct nxt_unit_init_s { int max_pending_requests; uint32_t request_data_size; + uint32_t shm_limit; nxt_unit_callbacks_t callbacks; -- cgit From df7caf465072e171f88358b9e69c65b76d8efd25 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 24 Dec 2019 18:04:13 +0300 Subject: Introducing port messages to notify about out of shared memory. - OOSM (out of shared memory). Sent by application process to router when application reaches the limit of allocated shared memory and needs more. - SHM_ACK. Sent by router to application when the application's shared memory is released and the OOSM flag is enabled for the segment. This implements blocking mode (the library waits for SHM_ACK in case of out of shared memory condition and retries allocating the required memory amount) and non-blocking mode (the library notifies the application that it's out of shared memory and returns control to the application module that sets up the output queue and puts SHM_ACK in the main message loop). --- src/nxt_unit.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nxt_unit.h') diff --git a/src/nxt_unit.h b/src/nxt_unit.h index 6948b253..c8aaa124 100644 --- a/src/nxt_unit.h +++ b/src/nxt_unit.h @@ -137,6 +137,9 @@ struct nxt_unit_callbacks_s { /* Gracefully quit the application. Optional. */ void (*quit)(nxt_unit_ctx_t *); + /* Shared memory release acknowledgement. */ + void (*shm_ack_handler)(nxt_unit_ctx_t *); + /* Send data and control to process pid using port id. Optional. */ ssize_t (*port_send)(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id, const void *buf, size_t buf_size, @@ -323,6 +326,9 @@ uint32_t nxt_unit_buf_min(void); int nxt_unit_response_write(nxt_unit_request_info_t *req, const void *start, size_t size); +ssize_t nxt_unit_response_write_nb(nxt_unit_request_info_t *req, + const void *start, size_t size, size_t min_size); + int nxt_unit_response_write_cb(nxt_unit_request_info_t *req, nxt_unit_read_info_t *read_info); -- cgit