diff --git a/include/proto/log.h b/include/proto/log.h index e12743165..b05ab3efc 100644 --- a/include/proto/log.h +++ b/include/proto/log.h @@ -54,12 +54,6 @@ extern THREAD_LOCAL char *logline; extern THREAD_LOCAL char *logline_rfc5424; -/* - * Initializes some log data. - */ -void init_log(); - - /* Initialize/Deinitialize log buffers used for syslog messages */ int init_log_buffers(); void deinit_log_buffers(); diff --git a/include/proto/signal.h b/include/proto/signal.h index ff6976d35..ef2892a1c 100644 --- a/include/proto/signal.h +++ b/include/proto/signal.h @@ -25,7 +25,6 @@ __decl_hathreads(extern HA_SPINLOCK_T signals_lock); void signal_handler(int sig); void __signal_process_queue(); -int signal_init(); void deinit_signals(); struct sig_handler *signal_register_fct(int sig, void (*fct)(struct sig_handler *), int arg); struct sig_handler *signal_register_task(int sig, struct task *task, int reason); diff --git a/include/proto/stream.h b/include/proto/stream.h index 8c6773eeb..f44820977 100644 --- a/include/proto/stream.h +++ b/include/proto/stream.h @@ -39,9 +39,6 @@ extern struct data_cb sess_conn_cb; struct stream *stream_new(struct session *sess, enum obj_type *origin); int stream_create_from_cs(struct conn_stream *cs); -/* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int init_stream(); - /* kill a stream and set the termination flags to (one of SF_ERR_*) */ void stream_shutdown(struct stream *stream, int why); diff --git a/include/proto/task.h b/include/proto/task.h index 264899e5d..111a0cfef 100644 --- a/include/proto/task.h +++ b/include/proto/task.h @@ -553,9 +553,6 @@ void process_runnable_tasks(); */ int wake_expired_tasks(); -/* Perform minimal initializations, report 0 in case of error, 1 if OK. */ -int init_task(); - #endif /* _PROTO_TASK_H */ /* diff --git a/src/haproxy.c b/src/haproxy.c index 96715ee27..6567b4355 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1426,12 +1426,9 @@ static void init(int argc, char **argv) srandom(now_ms - getpid()); - init_log(); - signal_init(); if (init_acl() != 0) exit(1); - init_task(); - init_stream(); + /* warning, we init buffers later */ if (!init_http(&err_msg)) { ha_alert("%s. Aborting.\n", err_msg); diff --git a/src/log.c b/src/log.c index 77d58e2fe..3093ccea3 100644 --- a/src/log.c +++ b/src/log.c @@ -1581,9 +1581,8 @@ const char sess_set_cookie[8] = "NPDIRU67"; /* No set-cookie, Set-cookie found a } while(0) -/* Initializes some log data. - */ -void init_log() +/* Initializes some log data at boot */ +static void init_log() { char *tmp; int i; @@ -1656,6 +1655,8 @@ void init_log() FD_SET(0x7f, http_encode_map); } +INITCALL0(STG_PREPARE, init_log); + static int init_log_buffers_per_thread() { return init_log_buffers(); diff --git a/src/signal.c b/src/signal.c index b6ed1a60e..2484a4441 100644 --- a/src/signal.c +++ b/src/signal.c @@ -100,8 +100,8 @@ void __signal_process_queue() ha_sigmask(SIG_SETMASK, &old_sig, NULL); } -/* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int signal_init() +/* perform minimal intializations */ +static void signal_init() { int sig; @@ -121,8 +121,6 @@ int signal_init() sigdelset(&blocked_sig, SIGSEGV); for (sig = 0; sig < MAX_SIGNAL; sig++) LIST_INIT(&signal_state[sig].handlers); - - return 1; } /* @@ -273,3 +271,5 @@ void signal_unregister(int sig) signal(sig, SIG_IGN); } + +INITCALL0(STG_PREPARE, signal_init); diff --git a/src/stream.c b/src/stream.c index da59cf127..bba3f674a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -65,7 +65,7 @@ DECLARE_POOL(pool_head_stream, "stream", sizeof(struct stream)); -struct list streams; +struct list streams = LIST_HEAD_INIT(streams); __decl_spinlock(streams_lock); /* List of all use-service keywords. */ @@ -512,14 +512,6 @@ void stream_release_buffers(struct stream *s) offer_buffers(s, tasks_run_queue); } -/* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int init_stream() -{ - LIST_INIT(&streams); - - return 1; -} - void stream_process_counters(struct stream *s) { struct session *sess = s->sess; diff --git a/src/task.c b/src/task.c index aeb3e4e2c..1f09f131c 100644 --- a/src/task.c +++ b/src/task.c @@ -469,8 +469,8 @@ void process_runnable_tasks() } } -/* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int init_task() +/* perform minimal intializations */ +static void init_task() { int i; @@ -482,9 +482,10 @@ int init_task() for (i = 0; i < MAX_THREADS; i++) { LIST_INIT(&task_per_thread[i].task_list); } - return 1; } +INITCALL0(STG_PREPARE, init_task); + /* * Local variables: * c-indent-level: 8