More bool fixes for spawn_flag
authorAlan T. DeKok <aland@freeradius.org>
Fri, 21 Feb 2014 18:29:37 +0000 (13:29 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 21 Feb 2014 18:30:40 +0000 (13:30 -0500)
src/include/radiusd.h
src/main/listen.c
src/main/process.c
src/main/threads.c

index 059723f..303179a 100644 (file)
@@ -675,7 +675,7 @@ ssize_t             xlat_fmt_to_ref(uint8_t const **out, REQUEST *request, char const *fmt)
 void           xlat_free(void);
 
 /* threads.c */
-extern         int thread_pool_init(CONF_SECTION *cs, int *spawn_flag);
+extern         int thread_pool_init(CONF_SECTION *cs, bool *spawn_flag);
 extern         void thread_pool_stop(void);
 extern         int thread_pool_addrequest(REQUEST *, RAD_REQUEST_FUNP);
 extern         pid_t rad_fork(void);
@@ -704,7 +704,7 @@ void fr_suid_down_permanent(void);
 
 /* listen.c */
 void listen_free(rad_listen_t **head);
-int listen_init(CONF_SECTION *cs, rad_listen_t **head, int spawn_flag);
+int listen_init(CONF_SECTION *cs, rad_listen_t **head, bool spawn_flag);
 rad_listen_t *proxy_new_listener(home_server_t *home, int src_port);
 RADCLIENT *client_listener_find(rad_listen_t *listener,
                                fr_ipaddr_t const *ipaddr, int src_port);
@@ -718,7 +718,7 @@ rad_listen_t *listener_find_byipaddr(fr_ipaddr_t const *ipaddr, int port,
 int rad_status_server(REQUEST *request);
 
 /* event.c */
-int radius_event_init(CONF_SECTION *cs, int spawn_flag);
+int radius_event_init(CONF_SECTION *cs, bool spawn_flag);
 void radius_event_free(void);
 int radius_event_process(void);
 int event_new_fd(rad_listen_t *listener);
index 3842582..b30a147 100644 (file)
@@ -2927,9 +2927,9 @@ static void *recv_thread(void *arg)
  */
 int listen_init(CONF_SECTION *config, rad_listen_t **head,
 #ifdef WITH_TLS
-               int spawn_flag
+               bool spawn_flag
 #else
-               UNUSED int spawn_flag
+               UNUSED bool spawn_flag
 #endif
                )
 
index eb8ea4b..9c55a8a 100644 (file)
@@ -47,8 +47,8 @@ extern pid_t radius_pid;
 extern bool check_config;
 extern fr_cond_t *debug_condition;
 
-static int spawn_flag = 0;
-static int just_started = true;
+static bool spawn_flag = false;
+static bool just_started = true;
 time_t                         fr_start_time;
 static fr_packet_list_t *pl = NULL;
 static fr_event_list_t *el = NULL;
@@ -4150,7 +4150,7 @@ static void event_signal_handler(UNUSED fr_event_list_t *xel,
 /*
  *     Externally-visibly functions.
  */
-int radius_event_init(CONF_SECTION *cs, int have_children)
+int radius_event_init(CONF_SECTION *cs, bool have_children)
 {
        rad_listen_t *head = NULL;
 
@@ -4185,6 +4185,13 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
        }
 #endif
 
+       /*
+        *      Move all of the thread calls to this file?
+        *
+        *      It may be best for the mutexes to be in this file...
+        */
+       spawn_flag = have_children;
+
 #ifdef HAVE_PTHREAD_H
        NO_SUCH_CHILD_PID = pthread_self(); /* not a child thread */
 
@@ -4193,18 +4200,11 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
         *      we're running normally.
         */
        if (have_children && !check_config &&
-           (thread_pool_init(cs, &have_children) < 0)) {
+           (thread_pool_init(cs, &spawn_flag) < 0)) {
                fr_exit(1);
        }
 #endif
 
-       /*
-        *      Move all of the thread calls to this file?
-        *
-        *      It may be best for the mutexes to be in this file...
-        */
-       spawn_flag = have_children;
-
        if (check_config) {
                DEBUG("%s: #### Skipping IP addresses and Ports ####",
                       mainconfig.name);
index 40a8169..61e8fbb 100644 (file)
@@ -144,7 +144,7 @@ typedef struct THREAD_POOL {
        int cleanup_delay;
        int stop_flag;
 #endif /* WITH_GCD */
-       int spawn_flag;
+       bool spawn_flag;
 
 #ifdef WNOHANG
        pthread_mutex_t wait_mutex;
@@ -887,7 +887,7 @@ static int pid_cmp(void const *one, void const *two)
  *
  *     FIXME: What to do on a SIGHUP???
  */
-int thread_pool_init(UNUSED CONF_SECTION *cs, int *spawn_flag)
+int thread_pool_init(UNUSED CONF_SECTION *cs, bool *spawn_flag)
 {
 #ifndef WITH_GCD
        int             i, rcode;