remove runit/runit_lib.c

function                                             old     new   delta
runsv_main                                          1770    1786     +16
svstatus_get                                         176     188     +12
sv_main                                             1180    1186      +6
runsvdir_main                                        683     689      +6
processorstart                                       385     391      +6
control                                              126     132      +6
logdir_open                                         1184    1187      +3
lock_exnb                                             14       -     -14
lock_ex                                               14       -     -14
open_write                                            17       -     -17
open_read                                             17       -     -17
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 7/0 up/down: 55/-62)             Total: -7 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko
2010-10-13 12:53:27 +02:00
parent b1db09be5a
commit 05e8605ab8
7 changed files with 63 additions and 342 deletions

View File

@@ -261,6 +261,52 @@ static char* wstrdup(const char *str)
return s;
}
static unsigned pmatch(const char *p, const char *s, unsigned len)
{
for (;;) {
char c = *p++;
if (!c) return !len;
switch (c) {
case '*':
c = *p;
if (!c) return 1;
for (;;) {
if (!len) return 0;
if (*s == c) break;
++s;
--len;
}
continue;
case '+':
c = *p++;
if (c != *s) return 0;
for (;;) {
if (!len) return 1;
if (*s != c) break;
++s;
--len;
}
continue;
/*
case '?':
if (*p == '?') {
if (*s != '?') return 0;
++p;
}
++s; --len;
continue;
*/
default:
if (!len) return 0;
if (*s != c) return 0;
++s;
--len;
continue;
}
}
return 0;
}
/*** ex fmt_ptime.[ch] ***/
/* NUL terminated */
@@ -342,7 +388,7 @@ static void processorstart(struct logdir *ld)
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");
fd = open("state", O_RDONLY|O_NDELAY);
if (fd == -1) {
if (errno != ENOENT)
bb_perror_msg_and_die(FATAL"can't %s processor %s", "open state for", ld->name);
@@ -626,7 +672,7 @@ static NOINLINE unsigned logdir_open(struct logdir *ld, const char *fn)
}
ld->fdlock = open("lock", O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600);
if ((ld->fdlock == -1)
|| (lock_exnb(ld->fdlock) == -1)
|| (flock(ld->fdlock, LOCK_EX | LOCK_NB) == -1)
) {
logdir_close(ld);
warn2("can't lock directory", (char*)fn);