diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-27 22:22:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-27 22:22:17 +0000 |
commit | e2473f8c233c96fbcb295aa7a1f758a46f962f66 (patch) | |
tree | b3391183fd648f092668588cbcd81971bc43f122 | |
parent | 8c7839512039212ba88e48d856d0ac9835fdec67 (diff) | |
download | busybox-w32-e2473f8c233c96fbcb295aa7a1f758a46f962f66.tar.gz busybox-w32-e2473f8c233c96fbcb295aa7a1f758a46f962f66.tar.bz2 busybox-w32-e2473f8c233c96fbcb295aa7a1f758a46f962f66.zip |
runit/* cleanup part 2
-rw-r--r-- | runit/runit_lib.c | 28 | ||||
-rw-r--r-- | runit/runit_lib.h | 38 | ||||
-rw-r--r-- | runit/runsv.c | 8 | ||||
-rw-r--r-- | 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. | |||
34 | #include "libbb.h" | 34 | #include "libbb.h" |
35 | #include "runit_lib.h" | 35 | #include "runit_lib.h" |
36 | 36 | ||
37 | #if 0 | ||
37 | /*** buffer.c ***/ | 38 | /*** buffer.c ***/ |
38 | 39 | ||
39 | void buffer_init(buffer *s,int (*op)(int fd,char *buf,unsigned len),int fd,char *buf,unsigned len) | 40 | 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) | |||
231 | { | 232 | { |
232 | return write(fd,buf,len); | 233 | return write(fd,buf,len); |
233 | } | 234 | } |
235 | #endif | ||
234 | 236 | ||
235 | 237 | ||
236 | /*** byte_chr.c ***/ | 238 | /*** byte_chr.c ***/ |
@@ -288,12 +290,14 @@ int fd_move(int to,int from) | |||
288 | } | 290 | } |
289 | 291 | ||
290 | 292 | ||
293 | #if 0 | ||
291 | /*** fifo.c ***/ | 294 | /*** fifo.c ***/ |
292 | 295 | ||
293 | int fifo_make(const char *fn,int mode) | 296 | int fifo_make(const char *fn,int mode) |
294 | { | 297 | { |
295 | return mkfifo(fn,mode); | 298 | return mkfifo(fn, mode); |
296 | } | 299 | } |
300 | #endif | ||
297 | 301 | ||
298 | 302 | ||
299 | /*** fmt_ptime.c ***/ | 303 | /*** fmt_ptime.c ***/ |
@@ -489,7 +493,7 @@ uint64_t taia2millisec(const struct taia *t) | |||
489 | 493 | ||
490 | /* XXX: breaks tai encapsulation */ | 494 | /* XXX: breaks tai encapsulation */ |
491 | 495 | ||
492 | int taia_less(const struct taia *t,const struct taia *u) | 496 | int taia_less(const struct taia *t, const struct taia *u) |
493 | { | 497 | { |
494 | if (t->sec.x < u->sec.x) return 1; | 498 | if (t->sec.x < u->sec.x) return 1; |
495 | if (t->sec.x > u->sec.x) return 0; | 499 | if (t->sec.x > u->sec.x) return 0; |
@@ -537,7 +541,7 @@ void taia_pack(char *s, const struct taia *t) | |||
537 | 541 | ||
538 | /* XXX: breaks tai encapsulation */ | 542 | /* XXX: breaks tai encapsulation */ |
539 | 543 | ||
540 | void taia_sub(struct taia *t,const struct taia *u,const struct taia *v) | 544 | void taia_sub(struct taia *t, const struct taia *u, const struct taia *v) |
541 | { | 545 | { |
542 | unsigned long unano = u->nano; | 546 | unsigned long unano = u->nano; |
543 | unsigned long uatto = u->atto; | 547 | unsigned long uatto = u->atto; |
@@ -560,7 +564,7 @@ void taia_sub(struct taia *t,const struct taia *u,const struct taia *v) | |||
560 | 564 | ||
561 | /* XXX: breaks tai encapsulation */ | 565 | /* XXX: breaks tai encapsulation */ |
562 | 566 | ||
563 | void taia_uint(struct taia *t,unsigned s) | 567 | void taia_uint(struct taia *t, unsigned s) |
564 | { | 568 | { |
565 | t->sec.x = s; | 569 | t->sec.x = s; |
566 | t->nano = 0; | 570 | t->nano = 0; |
@@ -874,6 +878,7 @@ unsigned pmatch(const char *p, const char *s, unsigned len) { | |||
874 | } | 878 | } |
875 | 879 | ||
876 | 880 | ||
881 | #if 0 | ||
877 | /*** prot.c ***/ | 882 | /*** prot.c ***/ |
878 | 883 | ||
879 | int prot_gid(int gid) | 884 | int prot_gid(int gid) |
@@ -887,6 +892,7 @@ int prot_uid(int uid) | |||
887 | { | 892 | { |
888 | return setuid(uid); | 893 | return setuid(uid); |
889 | } | 894 | } |
895 | #endif | ||
890 | 896 | ||
891 | 897 | ||
892 | /*** readclose.c ***/ | 898 | /*** readclose.c ***/ |
@@ -910,6 +916,7 @@ int readclose(int fd,stralloc *sa,unsigned bufsize) | |||
910 | } | 916 | } |
911 | #endif | 917 | #endif |
912 | 918 | ||
919 | #if 0 | ||
913 | /*** scan_ulong.c ***/ | 920 | /*** scan_ulong.c ***/ |
914 | 921 | ||
915 | unsigned scan_ulong(const char *s,unsigned long *u) | 922 | unsigned scan_ulong(const char *s,unsigned long *u) |
@@ -924,6 +931,7 @@ unsigned scan_ulong(const char *s,unsigned long *u) | |||
924 | *u = result; | 931 | *u = result; |
925 | return pos; | 932 | return pos; |
926 | } | 933 | } |
934 | #endif | ||
927 | 935 | ||
928 | 936 | ||
929 | #ifdef UNUSED | 937 | #ifdef UNUSED |
@@ -956,23 +964,23 @@ void sig_block(int sig) | |||
956 | { | 964 | { |
957 | sigset_t ss; | 965 | sigset_t ss; |
958 | sigemptyset(&ss); | 966 | sigemptyset(&ss); |
959 | sigaddset(&ss,sig); | 967 | sigaddset(&ss, sig); |
960 | sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0); | 968 | sigprocmask(SIG_BLOCK, &ss, NULL); |
961 | } | 969 | } |
962 | 970 | ||
963 | void sig_unblock(int sig) | 971 | void sig_unblock(int sig) |
964 | { | 972 | { |
965 | sigset_t ss; | 973 | sigset_t ss; |
966 | sigemptyset(&ss); | 974 | sigemptyset(&ss); |
967 | sigaddset(&ss,sig); | 975 | sigaddset(&ss, sig); |
968 | sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0); | 976 | sigprocmask(SIG_UNBLOCK, &ss, NULL); |
969 | } | 977 | } |
970 | 978 | ||
971 | void sig_blocknone(void) | 979 | void sig_blocknone(void) |
972 | { | 980 | { |
973 | sigset_t ss; | 981 | sigset_t ss; |
974 | sigemptyset(&ss); | 982 | sigemptyset(&ss); |
975 | sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); | 983 | sigprocmask(SIG_SETMASK, &ss, NULL); |
976 | } | 984 | } |
977 | 985 | ||
978 | 986 | ||
@@ -984,7 +992,7 @@ void sig_catch(int sig,void (*f)(int)) | |||
984 | sa.sa_handler = f; | 992 | sa.sa_handler = f; |
985 | sa.sa_flags = 0; | 993 | sa.sa_flags = 0; |
986 | sigemptyset(&sa.sa_mask); | 994 | sigemptyset(&sa.sa_mask); |
987 | sigaction(sig,&sa,(struct sigaction *) 0); | 995 | sigaction(sig,&sa, NULL); |
988 | } | 996 | } |
989 | 997 | ||
990 | 998 | ||
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. | |||
27 | 27 | ||
28 | /*** buffer.h ***/ | 28 | /*** buffer.h ***/ |
29 | 29 | ||
30 | #if 0 | ||
30 | typedef struct buffer { | 31 | typedef struct buffer { |
31 | char *x; | 32 | char *x; |
32 | unsigned p; | 33 | unsigned p; |
@@ -35,17 +36,17 @@ typedef struct buffer { | |||
35 | int (*op)(int fd,char *buf,unsigned len); | 36 | int (*op)(int fd,char *buf,unsigned len); |
36 | } buffer; | 37 | } buffer; |
37 | 38 | ||
38 | #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } | 39 | //#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } |
39 | #define BUFFER_INSIZE 8192 | 40 | //#define BUFFER_INSIZE 8192 |
40 | #define BUFFER_OUTSIZE 8192 | 41 | #define BUFFER_OUTSIZE 8192 |
41 | 42 | ||
42 | extern void buffer_init(buffer *,int (*)(int fd,char *buf,unsigned len),int,char *,unsigned); | 43 | extern void buffer_init(buffer *,int (*)(int fd,char *buf,unsigned len),int,char *,unsigned); |
43 | 44 | ||
44 | extern int buffer_flush(buffer *); | 45 | extern int buffer_flush(buffer *); |
45 | extern int buffer_put(buffer *,const char *,unsigned); | 46 | //extern int buffer_put(buffer *,const char *,unsigned); |
46 | extern int buffer_putalign(buffer *,const char *,unsigned); | 47 | extern int buffer_putalign(buffer *,const char *,unsigned); |
47 | extern int buffer_putflush(buffer *,const char *,unsigned); | 48 | extern int buffer_putflush(buffer *,const char *,unsigned); |
48 | extern int buffer_puts(buffer *,const char *); | 49 | //extern int buffer_puts(buffer *,const char *); |
49 | extern int buffer_putsalign(buffer *,const char *); | 50 | extern int buffer_putsalign(buffer *,const char *); |
50 | extern int buffer_putsflush(buffer *,const char *); | 51 | extern int buffer_putsflush(buffer *,const char *); |
51 | 52 | ||
@@ -77,6 +78,7 @@ extern int buffer_unixread(int,char *,unsigned); | |||
77 | /* Actually, int buffer_unixwrite(int,const char *,unsigned), | 78 | /* Actually, int buffer_unixwrite(int,const char *,unsigned), |
78 | but that 'const' will produce warnings... oh well */ | 79 | but that 'const' will produce warnings... oh well */ |
79 | extern int buffer_unixwrite(int,char *,unsigned); | 80 | extern int buffer_unixwrite(int,char *,unsigned); |
81 | #endif | ||
80 | 82 | ||
81 | 83 | ||
82 | /*** byte.h ***/ | 84 | /*** byte.h ***/ |
@@ -102,7 +104,7 @@ extern int fd_move(int,int); | |||
102 | 104 | ||
103 | /*** fifo.h ***/ | 105 | /*** fifo.h ***/ |
104 | 106 | ||
105 | extern int fifo_make(const char *,int); | 107 | //extern int fifo_make(const char *,int); |
106 | 108 | ||
107 | 109 | ||
108 | /*** fmt.h ***/ | 110 | /*** fmt.h ***/ |
@@ -292,9 +294,9 @@ extern int openreadclose(const char *,stralloc *,unsigned); | |||
292 | 294 | ||
293 | /*** pathexec.h ***/ | 295 | /*** pathexec.h ***/ |
294 | 296 | ||
295 | extern void pathexec_run(const char *,char *const *,char *const *); | 297 | //extern void pathexec_run(const char *,char *const *,char *const *); |
296 | extern int pathexec_env(const char *,const char *); | 298 | //extern int pathexec_env(const char *,const char *); |
297 | extern void pathexec(char **); | 299 | //extern void pathexec(char **); |
298 | 300 | ||
299 | 301 | ||
300 | /*** pmatch.h ***/ | 302 | /*** pmatch.h ***/ |
@@ -304,8 +306,8 @@ extern unsigned pmatch(const char *, const char *, unsigned); | |||
304 | 306 | ||
305 | /*** prot.h ***/ | 307 | /*** prot.h ***/ |
306 | 308 | ||
307 | extern int prot_gid(int); | 309 | //extern int prot_gid(int); |
308 | extern int prot_uid(int); | 310 | //extern int prot_uid(int); |
309 | 311 | ||
310 | 312 | ||
311 | /*** readclose.h ***/ | 313 | /*** readclose.h ***/ |
@@ -345,14 +347,14 @@ extern unsigned scan_8long(const char *,unsigned long *); | |||
345 | 347 | ||
346 | /*** seek.h ***/ | 348 | /*** seek.h ***/ |
347 | 349 | ||
348 | typedef unsigned long seek_pos; | 350 | //typedef unsigned long seek_pos; |
349 | 351 | ||
350 | extern seek_pos seek_cur(int); | 352 | //extern seek_pos seek_cur(int); |
351 | 353 | ||
352 | //extern int seek_set(int,seek_pos); | 354 | //extern int seek_set(int,seek_pos); |
353 | extern int seek_end(int); | 355 | //extern int seek_end(int); |
354 | 356 | ||
355 | extern int seek_trunc(int,seek_pos); | 357 | //extern int seek_trunc(int,seek_pos); |
356 | 358 | ||
357 | //#define seek_begin(fd) (seek_set((fd),(seek_pos) 0)) | 359 | //#define seek_begin(fd) (seek_set((fd),(seek_pos) 0)) |
358 | 360 | ||
@@ -368,8 +370,8 @@ extern int seek_trunc(int,seek_pos); | |||
368 | //extern int sig_term; | 370 | //extern int sig_term; |
369 | 371 | ||
370 | extern void sig_catch(int,void (*)(int)); | 372 | extern void sig_catch(int,void (*)(int)); |
371 | #define sig_ignore(s) (sig_catch((s),SIG_IGN)) | 373 | #define sig_ignore(s) (sig_catch((s), SIG_IGN)) |
372 | #define sig_uncatch(s) (sig_catch((s),SIG_DFL)) | 374 | #define sig_uncatch(s) (sig_catch((s), SIG_DFL)) |
373 | 375 | ||
374 | extern void sig_block(int); | 376 | extern void sig_block(int); |
375 | extern void sig_unblock(int); | 377 | extern void sig_unblock(int); |
@@ -383,8 +385,8 @@ extern void sig_dfl(int); | |||
383 | 385 | ||
384 | extern unsigned str_chr(const char *,int); /* never returns NULL */ | 386 | extern unsigned str_chr(const char *,int); /* never returns NULL */ |
385 | 387 | ||
386 | #define str_diff(s,t) strcmp((s),(t)) | 388 | #define str_diff(s,t) strcmp((s), (t)) |
387 | #define str_equal(s,t) (!strcmp((s),(t))) | 389 | #define str_equal(s,t) (!strcmp((s), (t))) |
388 | 390 | ||
389 | 391 | ||
390 | /*** wait.h ***/ | 392 | /*** 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) | |||
486 | coe(svd[1].fdlock); | 486 | coe(svd[1].fdlock); |
487 | } | 487 | } |
488 | 488 | ||
489 | fifo_make("log/supervise/control"+4, 0600); | 489 | mkfifo("log/supervise/control"+4, 0600); |
490 | svd[0].fdcontrol = xopen("log/supervise/control"+4, O_RDONLY|O_NDELAY); | 490 | svd[0].fdcontrol = xopen("log/supervise/control"+4, O_RDONLY|O_NDELAY); |
491 | coe(svd[0].fdcontrol); | 491 | coe(svd[0].fdcontrol); |
492 | svd[0].fdcontrolwrite = xopen("log/supervise/control"+4, O_WRONLY|O_NDELAY); | 492 | svd[0].fdcontrolwrite = xopen("log/supervise/control"+4, O_WRONLY|O_NDELAY); |
493 | coe(svd[0].fdcontrolwrite); | 493 | coe(svd[0].fdcontrolwrite); |
494 | update_status(&svd[0]); | 494 | update_status(&svd[0]); |
495 | if (haslog) { | 495 | if (haslog) { |
496 | fifo_make("log/supervise/control", 0600); | 496 | mkfifo("log/supervise/control", 0600); |
497 | svd[1].fdcontrol = xopen("log/supervise/control", O_RDONLY|O_NDELAY); | 497 | svd[1].fdcontrol = xopen("log/supervise/control", O_RDONLY|O_NDELAY); |
498 | coe(svd[1].fdcontrol); | 498 | coe(svd[1].fdcontrol); |
499 | svd[1].fdcontrolwrite = xopen("log/supervise/control", O_WRONLY|O_NDELAY); | 499 | svd[1].fdcontrolwrite = xopen("log/supervise/control", O_WRONLY|O_NDELAY); |
500 | coe(svd[1].fdcontrolwrite); | 500 | coe(svd[1].fdcontrolwrite); |
501 | update_status(&svd[1]); | 501 | update_status(&svd[1]); |
502 | } | 502 | } |
503 | fifo_make("log/supervise/ok"+4, 0600); | 503 | mkfifo("log/supervise/ok"+4, 0600); |
504 | fd = xopen("log/supervise/ok"+4, O_RDONLY|O_NDELAY); | 504 | fd = xopen("log/supervise/ok"+4, O_RDONLY|O_NDELAY); |
505 | coe(fd); | 505 | coe(fd); |
506 | if (haslog) { | 506 | if (haslog) { |
507 | fifo_make("log/supervise/ok", 0600); | 507 | mkfifo("log/supervise/ok", 0600); |
508 | fd = xopen("log/supervise/ok", O_RDONLY|O_NDELAY); | 508 | fd = xopen("log/supervise/ok", O_RDONLY|O_NDELAY); |
509 | coe(fd); | 509 | coe(fd); |
510 | } | 510 | } |
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) | |||
69 | 69 | ||
70 | prog[0] = "runsv"; | 70 | prog[0] = "runsv"; |
71 | prog[1] = name; | 71 | prog[1] = name; |
72 | prog[2] = 0; | 72 | prog[2] = NULL; |
73 | sig_uncatch(SIGHUP); | 73 | sig_uncatch(SIGHUP); |
74 | sig_uncatch(SIGTERM); | 74 | sig_uncatch(SIGTERM); |
75 | if (pgrp) setsid(); | 75 | if (pgrp) setsid(); |