From d382d81c3d3065fbe054c6bfdd2495e495452155 Mon Sep 17 00:00:00 2001
From: Donald Buczek <buczek@molgen.mpg.de>
Date: Sun, 20 Mar 2022 20:18:57 +0100
Subject: [PATCH] mxqd: Declare all functions as static

---
 mxqd.c | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/mxqd.c b/mxqd.c
index 493b956e..a4c35a61 100644
--- a/mxqd.c
+++ b/mxqd.c
@@ -64,8 +64,8 @@ static int global_sigrestart_cnt=0;
 
 static sigset_t all_signals;
 
-int mxq_redirect_output(char *stdout_fname, char *stderr_fname);
-void server_free(struct mxq_server *server);
+static int mxq_redirect_output(char *stdout_fname, char *stderr_fname);
+static void server_free(struct mxq_server *server);
 
 static void print_usage(void)
 {
@@ -157,7 +157,7 @@ static void cpuset_clear_running(cpu_set_t *running,cpu_set_t *job) {
 }
 
 /**********************************************************************/
-int setup_cronolog(char *cronolog, char *logdir, char *rellink, char *relformat)
+static int setup_cronolog(char *cronolog, char *logdir, char *rellink, char *relformat)
 {
     int res;
     int pipe_fd[2];
@@ -221,7 +221,7 @@ int setup_cronolog(char *cronolog, char *logdir, char *rellink, char *relformat)
 }
 
 
-int setup_stdin(char *fname)
+static int setup_stdin(char *fname)
 {
     int fh;
     int res;
@@ -247,7 +247,7 @@ int setup_stdin(char *fname)
     return 1;
 }
 
-int write_pid_to_file(char *fname)
+static int write_pid_to_file(char *fname)
 {
     int fd;
     int res;
@@ -265,7 +265,7 @@ int write_pid_to_file(char *fname)
     return 0;
 }
 
-int server_update_daemon_statistics(struct mxq_server *server)
+static int server_update_daemon_statistics(struct mxq_server *server)
 {
     struct mxq_daemon *daemon;
 
@@ -400,7 +400,7 @@ static int expression_is_valid(char *expr) {
         return 1;
 }
 
-int server_init(struct mxq_server *server, int argc, char *argv[])
+static int server_init(struct mxq_server *server, int argc, char *argv[])
 {
     assert(server);
 
@@ -1007,7 +1007,7 @@ static int init_child_process(struct mxq_group_list *glist, struct mxq_job *job)
 
 /**********************************************************************/
 
-int mxq_redirect_open(char *fname)
+static int mxq_redirect_open(char *fname)
 {
     int fh;
     int res;
@@ -1036,7 +1036,7 @@ int mxq_redirect_open(char *fname)
 
 }
 
-int mxq_redirect(char *fname, int fd)
+static int mxq_redirect(char *fname, int fd)
 {
     int fh;
     int res;
@@ -1052,7 +1052,7 @@ int mxq_redirect(char *fname, int fd)
     return 0;
 }
 
-int mxq_redirect_output(char *stdout_fname, char *stderr_fname)
+static int mxq_redirect_output(char *stdout_fname, char *stderr_fname)
 {
     int res;
 
@@ -1077,7 +1077,7 @@ int mxq_redirect_output(char *stdout_fname, char *stderr_fname)
     return 0;
 }
 
-int mxq_redirect_input(char *stdin_fname)
+static int mxq_redirect_input(char *stdin_fname)
 {
     int fh;
     int res;
@@ -1096,7 +1096,7 @@ int mxq_redirect_input(char *stdin_fname)
     return 1;
 }
 
-int user_process(struct mxq_group_list *glist, struct mxq_job *job)
+static int user_process(struct mxq_group_list *glist, struct mxq_job *job)
 {
     int res;
     char **argv;
@@ -1166,7 +1166,7 @@ static int is_reaper(pid_t pid) {
         return 0;
 }
 
-int reaper_process(struct mxq_server *server,struct mxq_group_list *glist, struct mxq_job *job) {
+static int reaper_process(struct mxq_server *server,struct mxq_group_list *glist, struct mxq_job *job) {
     pid_t pid;
     struct rusage rusage;
     int status = 0;
@@ -1282,7 +1282,7 @@ int reaper_process(struct mxq_server *server,struct mxq_group_list *glist, struc
     return(0);
 }
 
-unsigned long start_job(struct mxq_group_list *glist)
+static unsigned long start_job(struct mxq_group_list *glist)
 {
     struct mxq_server *server;
     struct mxq_job_list *jlist;
@@ -1436,7 +1436,7 @@ static int can_start_job_for_user(struct mxq_user_list *user, unsigned long df_s
     return 0;
 }
 
-unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start, unsigned long df_scratch)
+static unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start, unsigned long df_scratch)
 {
     struct mxq_server *server;
     struct mxq_group_list *glist;
@@ -1508,7 +1508,7 @@ static void move_user_to_end(struct mxq_server *server, struct mxq_user_list *us
     user->next = NULL;
 }
 
-long start_user_with_least_running_global_slot_count(struct mxq_server *server)
+static long start_user_with_least_running_global_slot_count(struct mxq_server *server)
 {
     unsigned long slots_free = server->slots - server->slots_running;
     if (!server->user_cnt || !slots_free)
@@ -1551,7 +1551,7 @@ long start_user_with_least_running_global_slot_count(struct mxq_server *server)
 
 /**********************************************************************/
 
-void server_dump(struct mxq_server *server)
+static void server_dump(struct mxq_server *server)
 {
     struct mxq_user_list  *ulist;
     struct mxq_group_list *glist;
@@ -1613,7 +1613,7 @@ void server_dump(struct mxq_server *server)
     mx_log_info("====================== SERVER DUMP END ======================");
 }
 
-void server_free(struct mxq_server *server)
+static void server_free(struct mxq_server *server)
 {
     struct mxq_user_list  *ulist, *unext;
     struct mxq_group_list *glist, *gnext;
@@ -1648,7 +1648,7 @@ void server_free(struct mxq_server *server)
     mx_log_finish();
 }
 
-void server_close(struct mxq_server *server)
+static void server_close(struct mxq_server *server)
 {
     if (server->pidfilename)
         unlink(server->pidfilename);
@@ -1801,7 +1801,7 @@ static void killstate_event(struct ppidcache *ppidcache, struct mxq_job_list *jl
     }
 }
 
-int killall(struct mxq_server *server)
+static int killall(struct mxq_server *server)
 {
     struct mxq_user_list  *ulist;
     struct mxq_group_list *glist;
@@ -1825,7 +1825,7 @@ int killall(struct mxq_server *server)
     return 0;
 }
 
-int killall_over_time(struct ppidcache *ppidcache, struct mxq_server *server)
+static int killall_over_time(struct ppidcache *ppidcache, struct mxq_server *server)
 {
     struct mxq_user_list  *ulist;
     struct mxq_group_list *glist;
@@ -1868,7 +1868,7 @@ int killall_over_time(struct ppidcache *ppidcache, struct mxq_server *server)
     return 0;
 }
 
-int killall_over_memory(struct ppidcache *ppidcache, struct mxq_server *server)
+static int killall_over_memory(struct ppidcache *ppidcache, struct mxq_server *server)
 {
     struct mxq_user_list  *ulist;
     struct mxq_group_list *glist;
@@ -1935,7 +1935,7 @@ int killall_over_memory(struct ppidcache *ppidcache, struct mxq_server *server)
     return 0;
 }
 
-int killall_cancelled(struct ppidcache *ppidcache, struct mxq_server *server)
+static int killall_cancelled(struct ppidcache *ppidcache, struct mxq_server *server)
 {
     struct mxq_user_list  *ulist;
     struct mxq_group_list *glist;
@@ -2397,7 +2397,7 @@ static int load_running_jobs(struct mxq_server *server)
     return job_cnt;
 }
 
-int catchall(struct mxq_server *server)
+static int catchall(struct mxq_server *server)
 {
     struct mxq_job_list *jlist;
     struct mxq_job *job;
@@ -2489,7 +2489,7 @@ int catchall(struct mxq_server *server)
     return cnt;
 }
 
-int load_running_groups(struct mxq_server *server)
+static int load_running_groups(struct mxq_server *server)
 {
     struct mxq_group_list *glist;
     struct mxq_group *grps;
@@ -2578,7 +2578,7 @@ static void server_umount_stale_job_mountdirs(struct mxq_server *server) {
     free(namelist);
 }
 
-int recover_from_previous_crash(struct mxq_server *server)
+static int recover_from_previous_crash(struct mxq_server *server)
 {
     assert(server);
     assert(server->mysql);