runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit a604bba3aae48efa317aa6f9154c122ebcd6d73c
parent 5a03548da54fc0b898de414ca6009cf2bd548089
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Sun,  6 Oct 2024 17:10:07 +0200

-Werror=missing-variable-declarations

Diffstat:
Mbuild.ninja | 1+
Msrc/buffer_1.c | 2+-
Msrc/buffer_2.c | 2+-
Msrc/chpst.c | 50+++++++++++++++++++++++++-------------------------
Msrc/runit-init.c | 2+-
Msrc/runit.c | 8++++----
Msrc/runsv.c | 16++++++++--------
Msrc/runsvchdir.c | 4++--
Msrc/runsvdir.c | 28++++++++++++++--------------
Msrc/sv.c | 40++++++++++++++++++++--------------------
Msrc/svlogd.c | 66+++++++++++++++++++++++++++++++++---------------------------------
Msrc/utmpset.c | 2+-
12 files changed, 111 insertions(+), 110 deletions(-)

diff --git a/build.ninja b/build.ninja @@ -9,6 +9,7 @@ CCFLAGS = $$CCFLAGS $ -DVERSION='"TODO..."' $ -std=c11 $ -D_POSIX_C_SOURCE $ + -Werror=missing-variable-declarations $ subninja src/librunit.ninja subninja src/runsv.ninja diff --git a/src/buffer_1.c b/src/buffer_1.c @@ -2,6 +2,6 @@ #include "buffer.h" -char buffer_1_space[BUFFER_OUTSIZE]; +static char buffer_1_space[BUFFER_OUTSIZE]; static buffer it = BUFFER_INIT(buffer_unixwrite,1,buffer_1_space,sizeof buffer_1_space); buffer *buffer_1 = &it; diff --git a/src/buffer_2.c b/src/buffer_2.c @@ -2,6 +2,6 @@ #include "buffer.h" -char buffer_2_space[256]; +static char buffer_2_space[256]; static buffer it = BUFFER_INIT(buffer_unixwrite,2,buffer_2_space,sizeof buffer_2_space); buffer *buffer_2 = &it; diff --git a/src/chpst.c b/src/chpst.c @@ -25,7 +25,7 @@ #define FATAL "chpst: fatal: " #define WARNING "chpst: warning: " -const char *progname; +static const char *progname; static stralloc sa; void fatal(const char *m) { strerr_die3sys(111, FATAL, m, ": "); } @@ -39,30 +39,30 @@ void warn(const char *m) { strerr_warn2(WARNING, m, 0); } void die_nomem() { strerr_die2x(111, FATAL, "out of memory."); } void usage() { strerr_die4x(100, "usage: ", progname, USAGE_MAIN, "\n"); } -char *set_user =0; -char *env_user =0; -const char *argv0 =0; -const char *env_dir =0; -unsigned int verbose =0; -unsigned int pgrp =0; -unsigned int nostdin =0; -unsigned int nostdout =0; -unsigned int nostderr =0; -long limitd =-2; -long limits =-2; -long limitl =-2; -long limita =-2; -long limito =-2; -long limitp =-2; -long limitf =-2; -long limitc =-2; -long limitr =-2; -long limitt =-2; -long nicelvl =0; -const char *lock =0; -const char *root =0; -const char *pwd =0; -unsigned int lockdelay; +static char *set_user =0; +static char *env_user =0; +static const char *argv0 =0; +static const char *env_dir =0; +static unsigned int verbose =0; +static unsigned int pgrp =0; +static unsigned int nostdin =0; +static unsigned int nostdout =0; +static unsigned int nostderr =0; +static long limitd =-2; +static long limits =-2; +static long limitl =-2; +static long limita =-2; +static long limito =-2; +static long limitp =-2; +static long limitf =-2; +static long limitc =-2; +static long limitr =-2; +static long limitt =-2; +static long nicelvl =0; +static const char *lock =0; +static const char *root =0; +static const char *pwd =0; +static unsigned int lockdelay; void suidgid(char *user, unsigned int ext) { struct uidgid ugid; diff --git a/src/runit-init.c b/src/runit-init.c @@ -13,7 +13,7 @@ #define FATAL "init: fatal: " /* #define WARNING "init: warning: " */ -const char *progname; +static const char *progname; void usage(void) { strerr_die4x(0, "usage: ", progname, USAGE, "\n"); } diff --git a/src/runit.c b/src/runit.c @@ -22,14 +22,14 @@ #define WARNING "- runit: warning: " #define FATAL "- runit: fatal: " -const char * const stage[3] ={ +static const char * const stage[3] ={ "/etc/runit/1", "/etc/runit/2", "/etc/runit/3" }; -int selfpipe[2]; -int sigc =0; -int sigi =0; +static int selfpipe[2]; +static int sigc =0; +static int sigi =0; void sig_cont_handler (void) { sigc++; diff --git a/src/runsv.c b/src/runsv.c @@ -23,8 +23,8 @@ #define USAGE " dir" -char *progname; -int selfpipe[2]; +static char *progname; +static int selfpipe[2]; /* state */ #define S_DOWN 0 @@ -51,13 +51,13 @@ struct svdir { int fdcontrolwrite; int islog; }; -struct svdir svd[2]; +static struct svdir svd[2]; -int sigterm =0; -int haslog =0; -int pidchanged =1; -int logpipe[2]; -char *dir; +static int sigterm =0; +static int haslog =0; +static int pidchanged =1; +static int logpipe[2]; +static char *dir; void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); } diff --git a/src/runsvchdir.c b/src/runsvchdir.c @@ -9,8 +9,8 @@ #define USAGE " dir" #define SVDIR "/etc/runit/runsvdir" -char *progname; -char *new; +static char *progname; +static char *new; void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); } diff --git a/src/runsvdir.c b/src/runsvdir.c @@ -24,25 +24,25 @@ #define MAXSERVICES 1000 -char *progname; -char *svdir; -unsigned long dev =0; -unsigned long ino =0; -struct { +static char *progname; +static char *svdir; +static unsigned long dev =0; +static unsigned long ino =0; +static struct { unsigned long dev; unsigned long ino; int pid; int isgone; } sv[MAXSERVICES]; -int svnum =0; -int check =1; -char *rplog =0; -int rploglen; -int logpipe[2]; -struct pollfd io[1]; -struct taia stamplog; -int exitsoon =0; -int pgrp =0; +static int svnum =0; +static int check =1; +static char *rplog =0; +static int rploglen; +static int logpipe[2]; +static struct pollfd io[1]; +static struct taia stamplog; +static int exitsoon =0; +static int pgrp =0; void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); } void fatal(char *m1, char *m2) { diff --git a/src/sv.c b/src/sv.c @@ -27,28 +27,28 @@ #define TIMEOUT "timeout: " #define KILL "kill: " -char *progname; -char *action; -char *acts; -char *varservice ="/var/service/"; -char **service; -char **servicex; -unsigned int services; -unsigned int rc =0; -unsigned int lsb; -unsigned int verbose =0; -unsigned long wait =7; -unsigned int kll =0; -unsigned int islog =0; -struct taia tstart, tnow, tdiff; -struct tai tstatus; +static char *progname; +static char *action; +static char *acts; +static char *varservice ="/var/service/"; +static char **service; +static char **servicex; +static unsigned int services; +static unsigned int rc =0; +static unsigned int lsb; +static unsigned int verbose =0; +static unsigned long wait =7; +static unsigned int kll =0; +static unsigned int islog =0; +static struct taia tstart, tnow, tdiff; +static struct tai tstatus; -int (*act)(char*) =0; -int (*cbk)(char*) =0; +static int (*act)(char*) =0; +static int (*cbk)(char*) =0; -int curdir, fd, r; -char svstatus[20]; -char sulong[FMT_ULONG]; +static int curdir, fd, r; +static char svstatus[20]; +static char sulong[FMT_ULONG]; void usage() { if (!lsb) strerr_die4x(100, "usage: ", progname, USAGE, "\n"); diff --git a/src/svlogd.c b/src/svlogd.c @@ -42,38 +42,38 @@ #define PAUSE "svlogd: pausing: " #define INFO "svlogd: info: " -const char *progname; - -unsigned int verbose =0; -unsigned int timestamp =0; -unsigned long linemax =1000; -unsigned long buflen =1024; -unsigned long linelen; - -const char *replace =""; -char repl =0; - -const char **fndir; -int fdwdir; -struct stat st; -stralloc sa; -int wstat; -struct taia now; -struct taia trotate; - -char *databuf; -buffer data; -char *line; -char stamp[FMT_PTIME]; -unsigned int exitasap =0; -unsigned int rotateasap =0; -unsigned int reopenasap =0; -unsigned int linecomplete =1; -unsigned int tmaxflag =0; -int fdudp =-1; -struct pollfd in; - -struct logdir { +static const char *progname; + +static unsigned int verbose =0; +static unsigned int timestamp =0; +static unsigned long linemax =1000; +static unsigned long buflen =1024; +static unsigned long linelen; + +static const char *replace =""; +static char repl =0; + +static const char **fndir; +static int fdwdir; +static struct stat st; +static stralloc sa; +static int wstat; +static struct taia now; +static struct taia trotate; + +static char *databuf; +static buffer data; +static char *line; +static char stamp[FMT_PTIME]; +static unsigned int exitasap =0; +static unsigned int rotateasap =0; +static unsigned int reopenasap =0; +static unsigned int linecomplete =1; +static unsigned int tmaxflag =0; +static int fdudp =-1; +static struct pollfd in; + +static struct logdir { int fddir; char *btmp; buffer b; @@ -96,7 +96,7 @@ struct logdir { unsigned int udponly; stralloc prefix; } *dir; -unsigned int dirn =0; +static unsigned int dirn =0; void usage() { strerr_die4x(111, "usage: ", progname, USAGE, "\n"); } void die_nomem() { strerr_die2x(111, FATAL, "out of memory."); } diff --git a/src/utmpset.c b/src/utmpset.c @@ -17,7 +17,7 @@ #define FATAL "utmpset: fatal: " #define WARNING "utmpset: warning: " -const char *progname; +static const char *progname; void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }