From e2473f8c233c96fbcb295aa7a1f758a46f962f66 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 27 Jan 2007 22:22:17 +0000 Subject: runit/* cleanup part 2 --- runit/runit_lib.c | 28 ++++++++++++++++++---------- runit/runit_lib.h | 38 ++++++++++++++++++++------------------ runit/runsv.c | 8 ++++---- runit/runsvdir.c | 2 +- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/runit/runit_lib.c b/runit/runit_lib.c index ee69429b2..181d43836 100644 --- a/runit/runit_lib.c +++ b/runit/runit_lib.c @@ -34,6 +34,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "libbb.h" #include "runit_lib.h" +#if 0 /*** buffer.c ***/ void buffer_init(buffer *s,int (*op)(int fd,char *buf,unsigned len),int fd,char *buf,unsigned len) @@ -231,6 +232,7 @@ int buffer_unixwrite(int fd,char *buf,unsigned len) { return write(fd,buf,len); } +#endif /*** byte_chr.c ***/ @@ -288,12 +290,14 @@ int fd_move(int to,int from) } +#if 0 /*** fifo.c ***/ int fifo_make(const char *fn,int mode) { - return mkfifo(fn,mode); + return mkfifo(fn, mode); } +#endif /*** fmt_ptime.c ***/ @@ -489,7 +493,7 @@ uint64_t taia2millisec(const struct taia *t) /* XXX: breaks tai encapsulation */ -int taia_less(const struct taia *t,const struct taia *u) +int taia_less(const struct taia *t, const struct taia *u) { if (t->sec.x < u->sec.x) return 1; if (t->sec.x > u->sec.x) return 0; @@ -537,7 +541,7 @@ void taia_pack(char *s, const struct taia *t) /* XXX: breaks tai encapsulation */ -void taia_sub(struct taia *t,const struct taia *u,const struct taia *v) +void taia_sub(struct taia *t, const struct taia *u, const struct taia *v) { unsigned long unano = u->nano; unsigned long uatto = u->atto; @@ -560,7 +564,7 @@ void taia_sub(struct taia *t,const struct taia *u,const struct taia *v) /* XXX: breaks tai encapsulation */ -void taia_uint(struct taia *t,unsigned s) +void taia_uint(struct taia *t, unsigned s) { t->sec.x = s; t->nano = 0; @@ -874,6 +878,7 @@ unsigned pmatch(const char *p, const char *s, unsigned len) { } +#if 0 /*** prot.c ***/ int prot_gid(int gid) @@ -887,6 +892,7 @@ int prot_uid(int uid) { return setuid(uid); } +#endif /*** readclose.c ***/ @@ -910,6 +916,7 @@ int readclose(int fd,stralloc *sa,unsigned bufsize) } #endif +#if 0 /*** scan_ulong.c ***/ unsigned scan_ulong(const char *s,unsigned long *u) @@ -924,6 +931,7 @@ unsigned scan_ulong(const char *s,unsigned long *u) *u = result; return pos; } +#endif #ifdef UNUSED @@ -956,23 +964,23 @@ void sig_block(int sig) { sigset_t ss; sigemptyset(&ss); - sigaddset(&ss,sig); - sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0); + sigaddset(&ss, sig); + sigprocmask(SIG_BLOCK, &ss, NULL); } void sig_unblock(int sig) { sigset_t ss; sigemptyset(&ss); - sigaddset(&ss,sig); - sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0); + sigaddset(&ss, sig); + sigprocmask(SIG_UNBLOCK, &ss, NULL); } void sig_blocknone(void) { sigset_t ss; sigemptyset(&ss); - sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); + sigprocmask(SIG_SETMASK, &ss, NULL); } @@ -984,7 +992,7 @@ void sig_catch(int sig,void (*f)(int)) sa.sa_handler = f; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); - sigaction(sig,&sa,(struct sigaction *) 0); + sigaction(sig,&sa, NULL); } diff --git a/runit/runit_lib.h b/runit/runit_lib.h index f594f8f69..ea4b33123 100644 --- a/runit/runit_lib.h +++ b/runit/runit_lib.h @@ -27,6 +27,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*** buffer.h ***/ +#if 0 typedef struct buffer { char *x; unsigned p; @@ -35,17 +36,17 @@ typedef struct buffer { int (*op)(int fd,char *buf,unsigned len); } buffer; -#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } -#define BUFFER_INSIZE 8192 +//#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } +//#define BUFFER_INSIZE 8192 #define BUFFER_OUTSIZE 8192 extern void buffer_init(buffer *,int (*)(int fd,char *buf,unsigned len),int,char *,unsigned); extern int buffer_flush(buffer *); -extern int buffer_put(buffer *,const char *,unsigned); +//extern int buffer_put(buffer *,const char *,unsigned); extern int buffer_putalign(buffer *,const char *,unsigned); extern int buffer_putflush(buffer *,const char *,unsigned); -extern int buffer_puts(buffer *,const char *); +//extern int buffer_puts(buffer *,const char *); extern int buffer_putsalign(buffer *,const char *); extern int buffer_putsflush(buffer *,const char *); @@ -77,6 +78,7 @@ extern int buffer_unixread(int,char *,unsigned); /* Actually, int buffer_unixwrite(int,const char *,unsigned), but that 'const' will produce warnings... oh well */ extern int buffer_unixwrite(int,char *,unsigned); +#endif /*** byte.h ***/ @@ -102,7 +104,7 @@ extern int fd_move(int,int); /*** fifo.h ***/ -extern int fifo_make(const char *,int); +//extern int fifo_make(const char *,int); /*** fmt.h ***/ @@ -292,9 +294,9 @@ extern int openreadclose(const char *,stralloc *,unsigned); /*** pathexec.h ***/ -extern void pathexec_run(const char *,char *const *,char *const *); -extern int pathexec_env(const char *,const char *); -extern void pathexec(char **); +//extern void pathexec_run(const char *,char *const *,char *const *); +//extern int pathexec_env(const char *,const char *); +//extern void pathexec(char **); /*** pmatch.h ***/ @@ -304,8 +306,8 @@ extern unsigned pmatch(const char *, const char *, unsigned); /*** prot.h ***/ -extern int prot_gid(int); -extern int prot_uid(int); +//extern int prot_gid(int); +//extern int prot_uid(int); /*** readclose.h ***/ @@ -345,14 +347,14 @@ extern unsigned scan_8long(const char *,unsigned long *); /*** seek.h ***/ -typedef unsigned long seek_pos; +//typedef unsigned long seek_pos; -extern seek_pos seek_cur(int); +//extern seek_pos seek_cur(int); //extern int seek_set(int,seek_pos); -extern int seek_end(int); +//extern int seek_end(int); -extern int seek_trunc(int,seek_pos); +//extern int seek_trunc(int,seek_pos); //#define seek_begin(fd) (seek_set((fd),(seek_pos) 0)) @@ -368,8 +370,8 @@ extern int seek_trunc(int,seek_pos); //extern int sig_term; extern void sig_catch(int,void (*)(int)); -#define sig_ignore(s) (sig_catch((s),SIG_IGN)) -#define sig_uncatch(s) (sig_catch((s),SIG_DFL)) +#define sig_ignore(s) (sig_catch((s), SIG_IGN)) +#define sig_uncatch(s) (sig_catch((s), SIG_DFL)) extern void sig_block(int); extern void sig_unblock(int); @@ -383,8 +385,8 @@ extern void sig_dfl(int); extern unsigned str_chr(const char *,int); /* never returns NULL */ -#define str_diff(s,t) strcmp((s),(t)) -#define str_equal(s,t) (!strcmp((s),(t))) +#define str_diff(s,t) strcmp((s), (t)) +#define str_equal(s,t) (!strcmp((s), (t))) /*** wait.h ***/ diff --git a/runit/runsv.c b/runit/runsv.c index 24a51f2b1..018a80eeb 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -486,25 +486,25 @@ int runsv_main(int argc, char **argv) coe(svd[1].fdlock); } - fifo_make("log/supervise/control"+4, 0600); + mkfifo("log/supervise/control"+4, 0600); svd[0].fdcontrol = xopen("log/supervise/control"+4, O_RDONLY|O_NDELAY); coe(svd[0].fdcontrol); svd[0].fdcontrolwrite = xopen("log/supervise/control"+4, O_WRONLY|O_NDELAY); coe(svd[0].fdcontrolwrite); update_status(&svd[0]); if (haslog) { - fifo_make("log/supervise/control", 0600); + mkfifo("log/supervise/control", 0600); svd[1].fdcontrol = xopen("log/supervise/control", O_RDONLY|O_NDELAY); coe(svd[1].fdcontrol); svd[1].fdcontrolwrite = xopen("log/supervise/control", O_WRONLY|O_NDELAY); coe(svd[1].fdcontrolwrite); update_status(&svd[1]); } - fifo_make("log/supervise/ok"+4, 0600); + mkfifo("log/supervise/ok"+4, 0600); fd = xopen("log/supervise/ok"+4, O_RDONLY|O_NDELAY); coe(fd); if (haslog) { - fifo_make("log/supervise/ok", 0600); + mkfifo("log/supervise/ok", 0600); fd = xopen("log/supervise/ok", O_RDONLY|O_NDELAY); coe(fd); } diff --git a/runit/runsvdir.c b/runit/runsvdir.c index 41581a8c8..22f2a0505 100644 --- a/runit/runsvdir.c +++ b/runit/runsvdir.c @@ -69,7 +69,7 @@ static void runsv(int no, char *name) prog[0] = "runsv"; prog[1] = name; - prog[2] = 0; + prog[2] = NULL; sig_uncatch(SIGHUP); sig_uncatch(SIGTERM); if (pgrp) setsid(); -- cgit v1.2.3