*: mode tcp/udpsvd to networking, delete ipsvd/*
*/Config.in: fixes to text
svlogd: make it NOMMU capable
function old new delta
processorstart 378 420 +42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 42/0) Total: 42 bytes
text data bss dec hex filename
797153 662 7420 805235 c4973 busybox_old
797196 662 7420 805278 c499e busybox_unstripped
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 4458bd7..db3d4c5 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -206,17 +206,22 @@
bin2hex(s, (char*)pack, 12);
}
-static unsigned processorstart(struct logdir *ld)
+static void processorstart(struct logdir *ld)
{
+ char sv_ch;
int pid;
- if (!ld->processor) return 0;
+ if (!ld->processor) return;
if (ld->ppid) {
warnx("processor already running", ld->name);
- return 0;
+ return;
}
- while ((pid = fork()) == -1)
- pause2cannot("fork for processor", ld->name);
+
+ /* vfork'ed child trashes this byte, save... */
+ sv_ch = ld->fnsave[26];
+
+ while ((pid = vfork()) == -1)
+ pause2cannot("vfork for processor", ld->name);
if (!pid) {
char *prog[4];
int fd;
@@ -235,7 +240,7 @@
bb_error_msg(INFO"processing: %s/%s", ld->name, ld->fnsave);
fd = xopen(ld->fnsave, O_RDONLY|O_NDELAY);
xmove_fd(fd, 0);
- ld->fnsave[26] = 't';
+ ld->fnsave[26] = 't'; /* <- that's why we need sv_ch! */
fd = xopen(ld->fnsave, O_WRONLY|O_NDELAY|O_TRUNC|O_CREAT);
xmove_fd(fd, 1);
fd = open_read("state");
@@ -257,8 +262,8 @@
execv("/bin/sh", prog);
bb_perror_msg_and_die(FATAL"cannot %s processor %s", "run", ld->name);
}
+ ld->fnsave[26] = sv_ch; /* ...restore */
ld->ppid = pid;
- return 1;
}
static unsigned processorstop(struct logdir *ld)