mirror of
https://github.com/sheumann/hush.git
synced 2025-03-03 09:35:04 +00:00
runit/* cleanup part 2
This commit is contained in:
parent
8c78395120
commit
e2473f8c23
@ -34,6 +34,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
#include "runit_lib.h"
|
#include "runit_lib.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*** buffer.c ***/
|
/*** buffer.c ***/
|
||||||
|
|
||||||
void buffer_init(buffer *s,int (*op)(int fd,char *buf,unsigned len),int fd,char *buf,unsigned len)
|
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);
|
return write(fd,buf,len);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** byte_chr.c ***/
|
/*** byte_chr.c ***/
|
||||||
@ -288,12 +290,14 @@ int fd_move(int to,int from)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*** fifo.c ***/
|
/*** fifo.c ***/
|
||||||
|
|
||||||
int fifo_make(const char *fn,int mode)
|
int fifo_make(const char *fn,int mode)
|
||||||
{
|
{
|
||||||
return mkfifo(fn, mode);
|
return mkfifo(fn, mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** fmt_ptime.c ***/
|
/*** fmt_ptime.c ***/
|
||||||
@ -874,6 +878,7 @@ unsigned pmatch(const char *p, const char *s, unsigned len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*** prot.c ***/
|
/*** prot.c ***/
|
||||||
|
|
||||||
int prot_gid(int gid)
|
int prot_gid(int gid)
|
||||||
@ -887,6 +892,7 @@ int prot_uid(int uid)
|
|||||||
{
|
{
|
||||||
return setuid(uid);
|
return setuid(uid);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** readclose.c ***/
|
/*** readclose.c ***/
|
||||||
@ -910,6 +916,7 @@ int readclose(int fd,stralloc *sa,unsigned bufsize)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*** scan_ulong.c ***/
|
/*** scan_ulong.c ***/
|
||||||
|
|
||||||
unsigned scan_ulong(const char *s,unsigned long *u)
|
unsigned scan_ulong(const char *s,unsigned long *u)
|
||||||
@ -924,6 +931,7 @@ unsigned scan_ulong(const char *s,unsigned long *u)
|
|||||||
*u = result;
|
*u = result;
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef UNUSED
|
#ifdef UNUSED
|
||||||
@ -957,7 +965,7 @@ void sig_block(int sig)
|
|||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
sigemptyset(&ss);
|
sigemptyset(&ss);
|
||||||
sigaddset(&ss, sig);
|
sigaddset(&ss, sig);
|
||||||
sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0);
|
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sig_unblock(int sig)
|
void sig_unblock(int sig)
|
||||||
@ -965,14 +973,14 @@ void sig_unblock(int sig)
|
|||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
sigemptyset(&ss);
|
sigemptyset(&ss);
|
||||||
sigaddset(&ss, sig);
|
sigaddset(&ss, sig);
|
||||||
sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0);
|
sigprocmask(SIG_UNBLOCK, &ss, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sig_blocknone(void)
|
void sig_blocknone(void)
|
||||||
{
|
{
|
||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
sigemptyset(&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_handler = f;
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sigaction(sig,&sa,(struct sigaction *) 0);
|
sigaction(sig,&sa, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
/*** buffer.h ***/
|
/*** buffer.h ***/
|
||||||
|
|
||||||
|
#if 0
|
||||||
typedef struct buffer {
|
typedef struct buffer {
|
||||||
char *x;
|
char *x;
|
||||||
unsigned p;
|
unsigned p;
|
||||||
@ -35,17 +36,17 @@ typedef struct buffer {
|
|||||||
int (*op)(int fd,char *buf,unsigned len);
|
int (*op)(int fd,char *buf,unsigned len);
|
||||||
} buffer;
|
} buffer;
|
||||||
|
|
||||||
#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
|
//#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
|
||||||
#define BUFFER_INSIZE 8192
|
//#define BUFFER_INSIZE 8192
|
||||||
#define BUFFER_OUTSIZE 8192
|
#define BUFFER_OUTSIZE 8192
|
||||||
|
|
||||||
extern void buffer_init(buffer *,int (*)(int fd,char *buf,unsigned len),int,char *,unsigned);
|
extern void buffer_init(buffer *,int (*)(int fd,char *buf,unsigned len),int,char *,unsigned);
|
||||||
|
|
||||||
extern int buffer_flush(buffer *);
|
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_putalign(buffer *,const char *,unsigned);
|
||||||
extern int buffer_putflush(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_putsalign(buffer *,const char *);
|
||||||
extern int buffer_putsflush(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),
|
/* Actually, int buffer_unixwrite(int,const char *,unsigned),
|
||||||
but that 'const' will produce warnings... oh well */
|
but that 'const' will produce warnings... oh well */
|
||||||
extern int buffer_unixwrite(int,char *,unsigned);
|
extern int buffer_unixwrite(int,char *,unsigned);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** byte.h ***/
|
/*** byte.h ***/
|
||||||
@ -102,7 +104,7 @@ extern int fd_move(int,int);
|
|||||||
|
|
||||||
/*** fifo.h ***/
|
/*** fifo.h ***/
|
||||||
|
|
||||||
extern int fifo_make(const char *,int);
|
//extern int fifo_make(const char *,int);
|
||||||
|
|
||||||
|
|
||||||
/*** fmt.h ***/
|
/*** fmt.h ***/
|
||||||
@ -292,9 +294,9 @@ extern int openreadclose(const char *,stralloc *,unsigned);
|
|||||||
|
|
||||||
/*** pathexec.h ***/
|
/*** pathexec.h ***/
|
||||||
|
|
||||||
extern void pathexec_run(const char *,char *const *,char *const *);
|
//extern void pathexec_run(const char *,char *const *,char *const *);
|
||||||
extern int pathexec_env(const char *,const char *);
|
//extern int pathexec_env(const char *,const char *);
|
||||||
extern void pathexec(char **);
|
//extern void pathexec(char **);
|
||||||
|
|
||||||
|
|
||||||
/*** pmatch.h ***/
|
/*** pmatch.h ***/
|
||||||
@ -304,8 +306,8 @@ extern unsigned pmatch(const char *, const char *, unsigned);
|
|||||||
|
|
||||||
/*** prot.h ***/
|
/*** prot.h ***/
|
||||||
|
|
||||||
extern int prot_gid(int);
|
//extern int prot_gid(int);
|
||||||
extern int prot_uid(int);
|
//extern int prot_uid(int);
|
||||||
|
|
||||||
|
|
||||||
/*** readclose.h ***/
|
/*** readclose.h ***/
|
||||||
@ -345,14 +347,14 @@ extern unsigned scan_8long(const char *,unsigned long *);
|
|||||||
|
|
||||||
/*** seek.h ***/
|
/*** 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_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))
|
//#define seek_begin(fd) (seek_set((fd),(seek_pos) 0))
|
||||||
|
|
||||||
|
@ -486,25 +486,25 @@ int runsv_main(int argc, char **argv)
|
|||||||
coe(svd[1].fdlock);
|
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);
|
svd[0].fdcontrol = xopen("log/supervise/control"+4, O_RDONLY|O_NDELAY);
|
||||||
coe(svd[0].fdcontrol);
|
coe(svd[0].fdcontrol);
|
||||||
svd[0].fdcontrolwrite = xopen("log/supervise/control"+4, O_WRONLY|O_NDELAY);
|
svd[0].fdcontrolwrite = xopen("log/supervise/control"+4, O_WRONLY|O_NDELAY);
|
||||||
coe(svd[0].fdcontrolwrite);
|
coe(svd[0].fdcontrolwrite);
|
||||||
update_status(&svd[0]);
|
update_status(&svd[0]);
|
||||||
if (haslog) {
|
if (haslog) {
|
||||||
fifo_make("log/supervise/control", 0600);
|
mkfifo("log/supervise/control", 0600);
|
||||||
svd[1].fdcontrol = xopen("log/supervise/control", O_RDONLY|O_NDELAY);
|
svd[1].fdcontrol = xopen("log/supervise/control", O_RDONLY|O_NDELAY);
|
||||||
coe(svd[1].fdcontrol);
|
coe(svd[1].fdcontrol);
|
||||||
svd[1].fdcontrolwrite = xopen("log/supervise/control", O_WRONLY|O_NDELAY);
|
svd[1].fdcontrolwrite = xopen("log/supervise/control", O_WRONLY|O_NDELAY);
|
||||||
coe(svd[1].fdcontrolwrite);
|
coe(svd[1].fdcontrolwrite);
|
||||||
update_status(&svd[1]);
|
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);
|
fd = xopen("log/supervise/ok"+4, O_RDONLY|O_NDELAY);
|
||||||
coe(fd);
|
coe(fd);
|
||||||
if (haslog) {
|
if (haslog) {
|
||||||
fifo_make("log/supervise/ok", 0600);
|
mkfifo("log/supervise/ok", 0600);
|
||||||
fd = xopen("log/supervise/ok", O_RDONLY|O_NDELAY);
|
fd = xopen("log/supervise/ok", O_RDONLY|O_NDELAY);
|
||||||
coe(fd);
|
coe(fd);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ static void runsv(int no, char *name)
|
|||||||
|
|
||||||
prog[0] = "runsv";
|
prog[0] = "runsv";
|
||||||
prog[1] = name;
|
prog[1] = name;
|
||||||
prog[2] = 0;
|
prog[2] = NULL;
|
||||||
sig_uncatch(SIGHUP);
|
sig_uncatch(SIGHUP);
|
||||||
sig_uncatch(SIGTERM);
|
sig_uncatch(SIGTERM);
|
||||||
if (pgrp) setsid();
|
if (pgrp) setsid();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user