aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-17 18:58:16 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-17 18:58:16 +0000
commit8a00f44bf4675076adfe312b71a6ff3670feef7d (patch)
treebd51123a09a6e587b98dfa156ca7bf0ba55b2325
parenta5342b4541c9c6b350ca015b94c7fd00d125e088 (diff)
downloadbusybox-w32-8a00f44bf4675076adfe312b71a6ff3670feef7d.tar.gz
busybox-w32-8a00f44bf4675076adfe312b71a6ff3670feef7d.tar.bz2
busybox-w32-8a00f44bf4675076adfe312b71a6ff3670feef7d.zip
runit: add runsv, runsvdir and sv. Oh yes.
It even seems to work. +11K. :(
-rw-r--r--include/applets.h3
-rw-r--r--include/usage.h16
-rw-r--r--runit/Config.in22
-rw-r--r--runit/Kbuild5
-rw-r--r--runit/runit_lib.c23
-rw-r--r--runit/runit_lib.h12
6 files changed, 64 insertions, 17 deletions
diff --git a/include/applets.h b/include/applets.h
index c4c75a83f..78fa68861 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -246,6 +246,8 @@ USE_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER))
246USE_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 246USE_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
247USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts)) 247USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts))
248USE_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER)) 248USE_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER))
249USE_RUNSV(APPLET(runsv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
250USE_RUNSVDIR(APPLET(runsvdir, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
249USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 251USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
250USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER)) 252USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER))
251USE_SEQ(APPLET(seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 253USE_SEQ(APPLET(seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
@@ -270,6 +272,7 @@ USE_STTY(APPLET(stty, _BB_DIR_BIN, _BB_SUID_NEVER))
270USE_SU(APPLET(su, _BB_DIR_BIN, _BB_SUID_ALWAYS)) 272USE_SU(APPLET(su, _BB_DIR_BIN, _BB_SUID_ALWAYS))
271USE_SULOGIN(APPLET(sulogin, _BB_DIR_SBIN, _BB_SUID_NEVER)) 273USE_SULOGIN(APPLET(sulogin, _BB_DIR_SBIN, _BB_SUID_NEVER))
272USE_SUM(APPLET(sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 274USE_SUM(APPLET(sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
275USE_SV(APPLET(sv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
273USE_SVLOGD(APPLET(svlogd, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 276USE_SVLOGD(APPLET(svlogd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
274USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff)) 277USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff))
275USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon)) 278USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon))
diff --git a/include/usage.h b/include/usage.h
index f1b4b351a..77986fea7 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -2571,6 +2571,16 @@ USE_FEATURE_MDEV_CONFIG( \
2571 "$ runlevel /var/run/utmp\n" \ 2571 "$ runlevel /var/run/utmp\n" \
2572 "N 2" 2572 "N 2"
2573 2573
2574#define runsv_trivial_usage \
2575 "dir"
2576#define runsv_full_usage \
2577 "Start and monitor a service and optionally an appendant log service."
2578
2579#define runsvdir_trivial_usage \
2580 "[-P] dir"
2581#define runsvdir_full_usage \
2582 "Start a runsv process for each subdirectory."
2583
2574#define rx_trivial_usage \ 2584#define rx_trivial_usage \
2575 "FILE" 2585 "FILE"
2576#define rx_full_usage \ 2586#define rx_full_usage \
@@ -2844,6 +2854,12 @@ USE_FEATURE_START_STOP_DAEMON_FANCY( \
2844 "\t-r\tuse BSD sum algorithm (1K blocks)\n" \ 2854 "\t-r\tuse BSD sum algorithm (1K blocks)\n" \
2845 "\t-s\tuse System V sum algorithm (512byte blocks)" 2855 "\t-s\tuse System V sum algorithm (512byte blocks)"
2846 2856
2857#define sv_trivial_usage \
2858 "[-v] [-w sec] command service..."
2859#define sv_full_usage \
2860 "Report the current status and control the state of services " \
2861 "monitored by the runsv supervisor."
2862
2847#define svlogd_trivial_usage \ 2863#define svlogd_trivial_usage \
2848 "[-ttv] [-r c] [-R abc] [-l len] [-b buflen] dir..." 2864 "[-ttv] [-r c] [-R abc] [-l len] [-b buflen] dir..."
2849#define svlogd_full_usage \ 2865#define svlogd_full_usage \
diff --git a/runit/Config.in b/runit/Config.in
index c849c074c..8a7deea72 100644
--- a/runit/Config.in
+++ b/runit/Config.in
@@ -5,6 +5,28 @@
5 5
6menu "Runit Utilities" 6menu "Runit Utilities"
7 7
8config RUNSV
9 bool "runsv"
10 default n
11 help
12 runsv starts and monitors a service and optionally an appendant log
13 service.
14
15config RUNSVDIR
16 bool "runsvdir"
17 default n
18 help
19 runsvdir starts a runsv process for each subdirectory, or symlink to
20 a directory, in the services directory dir, up to a limit of 1000
21 subdirectories, and restarts a runsv process if it terminates.
22
23config SV
24 bool "sv"
25 default n
26 help
27 sv reports the current status and controls the state of services
28 monitored by the runsv supervisor.
29
8config SVLOGD 30config SVLOGD
9 bool "svlogd" 31 bool "svlogd"
10 default n 32 default n
diff --git a/runit/Kbuild b/runit/Kbuild
index 730035632..ad1706cb6 100644
--- a/runit/Kbuild
+++ b/runit/Kbuild
@@ -5,5 +5,8 @@
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under the GPL v2, see the file LICENSE in this tarball.
6 6
7lib-y:= 7lib-y:=
8lib-$(CONFIG_CHPST) += chpst.o 8lib-$(CONFIG_RUNSV) += runsv.o runit_lib.o
9lib-$(CONFIG_RUNSVDIR) += runsvdir.o runit_lib.o
10lib-$(CONFIG_SV) += sv.o runit_lib.o
9lib-$(CONFIG_SVLOGD) += svlogd.o runit_lib.o 11lib-$(CONFIG_SVLOGD) += svlogd.o runit_lib.o
12lib-$(CONFIG_CHPST) += chpst.o
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index 322bef858..c95d641f1 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -519,6 +519,7 @@ void taia_uint(struct taia *t,unsigned s)
519 519
520 520
521/*** stralloc_cat.c ***/ 521/*** stralloc_cat.c ***/
522#if 0
522 523
523int stralloc_cat(stralloc *sato,const stralloc *safrom) 524int stralloc_cat(stralloc *sato,const stralloc *safrom)
524{ 525{
@@ -577,6 +578,7 @@ int stralloc_copys(stralloc *sa,const char *s)
577 578
578GEN_ALLOC_append(stralloc,char,s,len,a,i,n,x,30,stralloc_readyplus,stralloc_append) 579GEN_ALLOC_append(stralloc,char,s,len,a,i,n,x,30,stralloc_readyplus,stralloc_append)
579 580
581#endif /* stralloc */
580 582
581/*** iopause.c ***/ 583/*** iopause.c ***/
582 584
@@ -643,7 +645,7 @@ int ndelay_on(int fd)
643 645
644int open_append(const char *fn) 646int open_append(const char *fn)
645{ 647{
646 return open(fn,O_WRONLY | O_NDELAY | O_APPEND | O_CREAT,0600); 648 return open(fn, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600);
647} 649}
648 650
649 651
@@ -651,7 +653,7 @@ int open_append(const char *fn)
651 653
652int open_read(const char *fn) 654int open_read(const char *fn)
653{ 655{
654 return open(fn,O_RDONLY | O_NDELAY); 656 return open(fn, O_RDONLY|O_NDELAY);
655} 657}
656 658
657 659
@@ -667,12 +669,12 @@ int open_trunc(const char *fn)
667 669
668int open_write(const char *fn) 670int open_write(const char *fn)
669{ 671{
670 return open(fn,O_WRONLY | O_NDELAY); 672 return open(fn, O_WRONLY|O_NDELAY);
671} 673}
672 674
673 675
674/*** openreadclose.c ***/ 676/*** openreadclose.c ***/
675 677#if 0
676int openreadclose(const char *fn,stralloc *sa,unsigned bufsize) 678int openreadclose(const char *fn,stralloc *sa,unsigned bufsize)
677{ 679{
678 int fd; 680 int fd;
@@ -684,10 +686,11 @@ int openreadclose(const char *fn,stralloc *sa,unsigned bufsize)
684 if (readclose(fd,sa,bufsize) == -1) return -1; 686 if (readclose(fd,sa,bufsize) == -1) return -1;
685 return 1; 687 return 1;
686} 688}
689#endif
687 690
688 691
689/*** pathexec_env.c ***/ 692/*** pathexec_env.c ***/
690 693#if 0
691static stralloc plus; 694static stralloc plus;
692static stralloc tmp; 695static stralloc tmp;
693 696
@@ -748,10 +751,10 @@ void pathexec(char **argv)
748 pathexec_run(*argv,argv,e); 751 pathexec_run(*argv,argv,e);
749 free(e); 752 free(e);
750} 753}
751 754#endif
752 755
753/*** pathexec_run.c ***/ 756/*** pathexec_run.c ***/
754 757#if 0
755static stralloc tmp; 758static stralloc tmp;
756 759
757void pathexec_run(const char *file,char *const *argv,char *const *envp) 760void pathexec_run(const char *file,char *const *argv,char *const *envp)
@@ -792,7 +795,7 @@ void pathexec_run(const char *file,char *const *argv,char *const *envp)
792 path += 1; 795 path += 1;
793 } 796 }
794} 797}
795 798#endif
796 799
797/*** pmatch.c ***/ 800/*** pmatch.c ***/
798 801
@@ -853,7 +856,7 @@ int prot_uid(int uid)
853 856
854 857
855/*** readclose.c ***/ 858/*** readclose.c ***/
856 859#if 0
857int readclose_append(int fd,stralloc *sa,unsigned bufsize) 860int readclose_append(int fd,stralloc *sa,unsigned bufsize)
858{ 861{
859 int r; 862 int r;
@@ -871,7 +874,7 @@ int readclose(int fd,stralloc *sa,unsigned bufsize)
871 if (!stralloc_copys(sa,"")) { close(fd); return -1; } 874 if (!stralloc_copys(sa,"")) { close(fd); return -1; }
872 return readclose_append(fd,sa,bufsize); 875 return readclose_append(fd,sa,bufsize);
873} 876}
874 877#endif
875 878
876/*** scan_ulong.c ***/ 879/*** scan_ulong.c ***/
877 880
diff --git a/runit/runit_lib.h b/runit/runit_lib.h
index d306164ea..1f911919d 100644
--- a/runit/runit_lib.h
+++ b/runit/runit_lib.h
@@ -233,7 +233,7 @@ int ta_append(ta *x,const type *i) \
233 233
234 234
235/*** stralloc.h ***/ 235/*** stralloc.h ***/
236 236#if 0
237GEN_ALLOC_typedef(stralloc,char,s,len,a) 237GEN_ALLOC_typedef(stralloc,char,s,len,a)
238 238
239extern int stralloc_ready(stralloc *,unsigned); 239extern int stralloc_ready(stralloc *,unsigned);
@@ -256,7 +256,7 @@ extern int stralloc_catlong0(stralloc *,long,unsigned);
256#define stralloc_catuint0(sa,i,n) (stralloc_catulong0((sa),(i),(n))) 256#define stralloc_catuint0(sa,i,n) (stralloc_catulong0((sa),(i),(n)))
257#define stralloc_catint0(sa,i,n) (stralloc_catlong0((sa),(i),(n))) 257#define stralloc_catint0(sa,i,n) (stralloc_catlong0((sa),(i),(n)))
258#define stralloc_catint(sa,i) (stralloc_catlong0((sa),(i),0)) 258#define stralloc_catint(sa,i) (stralloc_catlong0((sa),(i),0))
259 259#endif
260 260
261/*** iopause.h ***/ 261/*** iopause.h ***/
262 262
@@ -290,9 +290,9 @@ extern int open_write(const char *);
290 290
291 291
292/*** openreadclose.h ***/ 292/*** openreadclose.h ***/
293 293#if 0
294extern int openreadclose(const char *,stralloc *,unsigned); 294extern int openreadclose(const char *,stralloc *,unsigned);
295 295#endif
296 296
297/*** pathexec.h ***/ 297/*** pathexec.h ***/
298 298
@@ -313,10 +313,10 @@ extern int prot_uid(int);
313 313
314 314
315/*** readclose.h ***/ 315/*** readclose.h ***/
316 316#if 0
317extern int readclose_append(int,stralloc *,unsigned); 317extern int readclose_append(int,stralloc *,unsigned);
318extern int readclose(int,stralloc *,unsigned); 318extern int readclose(int,stralloc *,unsigned);
319 319#endif
320 320
321/*** scan.h ***/ 321/*** scan.h ***/
322 322