From 6bf0aed8dda76d317a41f23bfccd6c5b041fb5c4 Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Mon, 13 Mar 2023 20:00:09 +0000 Subject: [PATCH] Make wait objects private to sesman.c --- sesman/sesman.c | 19 +++++++++++++------ sesman/sesman.h | 13 +++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/sesman/sesman.c b/sesman/sesman.c index 688e4867..2c8f8411 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -74,9 +74,9 @@ struct sesman_startup_params struct config_sesman *g_cfg; unsigned char g_fixedkey[8] = { 23, 82, 107, 6, 35, 78, 88, 7 }; -tintptr g_term_event = 0; -tintptr g_sigchld_event = 0; -tintptr g_reload_event = 0; +static tintptr g_term_event = 0; +static tintptr g_sigchld_event = 0; +static tintptr g_reload_event = 0; static struct trans *g_list_trans; @@ -322,6 +322,15 @@ sesman_close_all(unsigned int flags) return 0; } +/******************************************************************************/ +void +sesman_delete_wait_objects(void) +{ + g_delete_wait_obj(g_reload_event); + g_delete_wait_obj(g_sigchld_event); + g_delete_wait_obj(g_term_event); +} + /******************************************************************************/ static int sesman_data_in(struct trans *self) @@ -965,9 +974,7 @@ main(int argc, char **argv) g_file_delete(pid_file); } - g_delete_wait_obj(g_reload_event); - g_delete_wait_obj(g_sigchld_event); - g_delete_wait_obj(g_term_event); + sesman_delete_wait_objects(); if (!daemon) { diff --git a/sesman/sesman.h b/sesman/sesman.h index 7d1a2efa..e46fe239 100644 --- a/sesman/sesman.h +++ b/sesman/sesman.h @@ -45,9 +45,6 @@ struct sesman_con /* Globals */ extern struct config_sesman *g_cfg; extern unsigned char g_fixedkey[8]; -extern tintptr g_term_event; -extern tintptr g_sigchld_event; -extern tintptr g_reload_event; /** * Set the peername of a connection @@ -58,7 +55,7 @@ extern tintptr g_reload_event; int sesman_set_connection_peername(struct sesman_con *sc, const char *name); -/* +/** * Close all file descriptors used by sesman. * * This is generally used after forking, to make sure the @@ -75,6 +72,14 @@ sesman_set_connection_peername(struct sesman_con *sc, const char *name); int sesman_close_all(unsigned int flags); +/** + * Delete sesman wait objects. + * + * Call after forking so we don't break sesman's wait objects + */ +void +sesman_delete_wait_objects(void); + /* * Remove the listening transport *