diff --git a/include/common/buffer.h b/include/common/buffer.h index 1c7963fd4..ac480566d 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -47,7 +47,6 @@ extern struct list buffer_wq; __decl_hathreads(extern HA_SPINLOCK_T buffer_wq_lock); int init_buffer(); -void deinit_buffer(); void buffer_dump(FILE *o, struct buffer *b, int from, int to); /*****************************************************************/ diff --git a/include/common/chunk.h b/include/common/chunk.h index ffcb93c8f..ebd194a2d 100644 --- a/include/common/chunk.h +++ b/include/common/chunk.h @@ -47,7 +47,6 @@ int chunk_strcasecmp(const struct buffer *chk, const char *str); struct buffer *get_trash_chunk(void); struct buffer *alloc_trash_chunk(void); int init_trash_buffers(int first); -void deinit_trash_buffers(void); /* * free a trash chunk allocated by alloc_trash_chunk(). NOP on NULL. diff --git a/include/common/memory.h b/include/common/memory.h index 5bed60294..f0f6e1381 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -161,6 +161,7 @@ void pool_gc(struct pool_head *pool_ctx); * This should be called only under extreme circumstances. */ void *pool_destroy(struct pool_head *pool); +void pool_destroy_all(); /* returns the pool index for pool , or -1 if this pool has no index */ static inline ssize_t pool_get_index(const struct pool_head *pool) diff --git a/include/proto/signal.h b/include/proto/signal.h index 0806d0422..ff6976d35 100644 --- a/include/proto/signal.h +++ b/include/proto/signal.h @@ -20,7 +20,6 @@ extern int signal_queue_len; extern struct signal_descriptor signal_state[]; -extern struct pool_head *pool_head_sig_handlers; __decl_hathreads(extern HA_SPINLOCK_T signals_lock); diff --git a/src/buffer.c b/src/buffer.c index e55c5bdd2..c4d614051 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -54,11 +54,6 @@ int init_buffer() return 1; } -void deinit_buffer() -{ - pool_destroy(pool_head_buffer); -} - /* * Dumps part or all of a buffer. */ diff --git a/src/chunk.c b/src/chunk.c index fa3fb71df..e052322bc 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -101,14 +101,6 @@ int init_trash_buffers(int first) return 1; } -/* - * free the trash buffers - */ -void deinit_trash_buffers(void) -{ - pool_destroy(pool_head_trash); -} - /* * Allocate a trash chunk from the reentrant pool. The buffer starts at the * end of the chunk. This chunk must be freed using free_trash_chunk(). This diff --git a/src/dns.c b/src/dns.c index 10ccf873f..2a53c038c 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1839,9 +1839,6 @@ static void dns_deinit(void) LIST_DEL(&srvrq->list); free(srvrq); } - - pool_destroy(dns_answer_item_pool); - pool_destroy(dns_resolution_pool); } /* Finalizes the DNS configuration by allocating required resources and checking diff --git a/src/filters.c b/src/filters.c index 7b5700d49..d29a0c08e 100644 --- a/src/filters.c +++ b/src/filters.c @@ -1192,13 +1192,6 @@ static struct cfg_kw_list cfg_kws = {ILH, { INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws); -__attribute__((destructor)) -static void -__filters_deinit(void) -{ - pool_destroy(pool_head_filter); -} - REGISTER_POST_CHECK(flt_init_all); REGISTER_PER_THREAD_INIT(flt_init_all_per_thread); REGISTER_PER_THREAD_DEINIT(flt_deinit_all_per_thread); diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 8d630815b..bd351be18 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -4676,11 +4676,3 @@ static struct action_kw_list http_res_action_kws = { { }, { }; INITCALL1(STG_REGISTER, http_res_keywords_register, &http_res_action_kws); - -__attribute__((destructor)) -static void -__spoe_deinit(void) -{ - pool_destroy(pool_head_spoe_ctx); - pool_destroy(pool_head_spoe_appctx); -} diff --git a/src/haproxy.c b/src/haproxy.c index 6ec9bcc84..96715ee27 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2500,7 +2500,6 @@ void deinit(void) cfg_unregister_sections(); deinit_log_buffers(); - deinit_trash_buffers(); protocol_unbind_all(); @@ -2534,20 +2533,7 @@ void deinit(void) } vars_prune(&global.vars, NULL, NULL); - - deinit_buffer(); - - pool_destroy(pool_head_stream); - pool_destroy(pool_head_session); - pool_destroy(pool_head_connection); - pool_destroy(pool_head_connstream); - pool_destroy(pool_head_requri); - pool_destroy(pool_head_task); - pool_destroy(pool_head_capture); - pool_destroy(pool_head_pendconn); - pool_destroy(pool_head_sig_handlers); - pool_destroy(pool_head_hdr_idx); - pool_destroy(pool_head_http_txn); + pool_destroy_all(); deinit_pollers(); } /* end deinit() */ diff --git a/src/memory.c b/src/memory.c index 587702a2e..6d2eacd61 100644 --- a/src/memory.c +++ b/src/memory.c @@ -436,6 +436,15 @@ void *pool_destroy(struct pool_head *pool) return NULL; } +/* This destroys all pools on exit. It is *not* thread safe. */ +void pool_destroy_all() +{ + struct pool_head *entry, *back; + + list_for_each_entry_safe(entry, back, &pools, list) + pool_destroy(entry); +} + /* This function dumps memory usage information into the trash buffer. */ void dump_pools_to_trash() { diff --git a/src/mux_h1.c b/src/mux_h1.c index a845a2416..bade571a7 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1826,14 +1826,6 @@ static struct mux_proto_list mux_proto_htx = INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_htx); -static void __h1_deinit(void) -{ - pool_destroy(pool_head_h1c); - pool_destroy(pool_head_h1s); -} - -REGISTER_POST_DEINIT(__h1_deinit); - /* * Local variables: * c-indent-level: 8 diff --git a/src/mux_h2.c b/src/mux_h2.c index a30de3d04..197179221 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3845,11 +3845,3 @@ static struct cfg_kw_list cfg_kws = {ILH, { }}; INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws); - -static void __h2_deinit(void) -{ - pool_destroy(pool_head_h2s); - pool_destroy(pool_head_h2c); -} - -REGISTER_POST_DEINIT(__h2_deinit); diff --git a/src/signal.c b/src/signal.c index 4ee55024f..b6ed1a60e 100644 --- a/src/signal.c +++ b/src/signal.c @@ -32,7 +32,7 @@ struct signal_descriptor signal_state[MAX_SIGNAL]; sigset_t blocked_sig; int signal_pending = 0; /* non-zero if t least one signal remains unprocessed */ -DECLARE_POOL(pool_head_sig_handlers, "sig_handlers", sizeof(struct sig_handler)); +DECLARE_STATIC_POOL(pool_head_sig_handlers, "sig_handlers", sizeof(struct sig_handler)); /* Common signal handler, used by all signals. Received signals are queued. * Signal number zero has a specific status, as it cannot be delivered by the