runit/* cleanup part 2
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index ee69429..181d438 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -34,6 +34,7 @@
#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 @@
{
return write(fd,buf,len);
}
+#endif
/*** byte_chr.c ***/
@@ -288,12 +290,14 @@
}
+#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 @@
/* 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 @@
/* 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 @@
/* 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 @@
}
+#if 0
/*** prot.c ***/
int prot_gid(int gid)
@@ -887,6 +892,7 @@
{
return setuid(uid);
}
+#endif
/*** readclose.c ***/
@@ -910,6 +916,7 @@
}
#endif
+#if 0
/*** scan_ulong.c ***/
unsigned scan_ulong(const char *s,unsigned long *u)
@@ -924,6 +931,7 @@
*u = result;
return pos;
}
+#endif
#ifdef UNUSED
@@ -956,23 +964,23 @@
{
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 @@
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 f594f8f..ea4b331 100644
--- a/runit/runit_lib.h
+++ b/runit/runit_lib.h
@@ -27,6 +27,7 @@
/*** buffer.h ***/
+#if 0
typedef struct buffer {
char *x;
unsigned p;
@@ -35,17 +36,17 @@
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 @@
/* 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 @@
/*** fifo.h ***/
-extern int fifo_make(const char *,int);
+//extern int fifo_make(const char *,int);
/*** fmt.h ***/
@@ -292,9 +294,9 @@
/*** 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 @@
/*** 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 @@
/*** 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 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 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 24a51f2..018a80e 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -486,25 +486,25 @@
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 41581a8..22f2a05 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -69,7 +69,7 @@
prog[0] = "runsv";
prog[1] = name;
- prog[2] = 0;
+ prog[2] = NULL;
sig_uncatch(SIGHUP);
sig_uncatch(SIGTERM);
if (pgrp) setsid();