summaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-05 19:28:29 +0200
committerDenys Vlasenko2010-09-05 19:28:29 +0200
commite09bff33412c150a2c4c80ca7e2d5c6b76f10c9f (patch)
tree0d9530a372348a58acb2a3ff8b515fa21cb506ca /runit
parent8d789e419732e860cf89883c0565ff496b3291ee (diff)
downloadbusybox-e09bff33412c150a2c4c80ca7e2d5c6b76f10c9f.zip
busybox-e09bff33412c150a2c4c80ca7e2d5c6b76f10c9f.tar.gz
runit_lib: remove/inline a few more things
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'runit')
-rw-r--r--runit/chpst.c1
-rw-r--r--runit/runit_lib.c18
-rw-r--r--runit/runit_lib.h12
-rw-r--r--runit/runsv.c3
4 files changed, 18 insertions, 16 deletions
diff --git a/runit/chpst.c b/runit/chpst.c
index ad08112..b08d423 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -29,7 +29,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* Dependencies on runit_lib.c removed */
#include "libbb.h"
-#include <dirent.h>
/*
Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index ec18b5e..8182a90 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -198,27 +198,29 @@ void iopause(iopause_fd *x, unsigned len, struct taia *deadline, struct taia *st
int lock_ex(int fd)
{
- return flock(fd,LOCK_EX);
+ return flock(fd, LOCK_EX);
}
int lock_exnb(int fd)
{
- return flock(fd,LOCK_EX | LOCK_NB);
+ return flock(fd, LOCK_EX | LOCK_NB);
}
+#ifdef UNUSED
int open_append(const char *fn)
{
- return open(fn, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600);
+ return open(fn, O_WRONLY | O_NDELAY | O_APPEND | O_CREAT, 0600);
}
-int open_read(const char *fn)
+int open_trunc(const char *fn)
{
- return open(fn, O_RDONLY|O_NDELAY);
+ return open(fn, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
}
+#endif
-int open_trunc(const char *fn)
+int open_read(const char *fn)
{
- return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644);
+ return open(fn, O_RDONLY|O_NDELAY);
}
int open_write(const char *fn)
@@ -226,7 +228,7 @@ int open_write(const char *fn)
return open(fn, O_WRONLY|O_NDELAY);
}
-unsigned pmatch(const char *p, const char *s, unsigned len)
+unsigned FAST_FUNC pmatch(const char *p, const char *s, unsigned len)
{
for (;;) {
char c = *p++;
diff --git a/runit/runit_lib.h b/runit/runit_lib.h
index 88d1c9f..d8304ac 100644
--- a/runit/runit_lib.h
+++ b/runit/runit_lib.h
@@ -66,18 +66,18 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
//extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *);
extern int lock_ex(int);
-extern int lock_un(int);
+//extern int lock_un(int);
extern int lock_exnb(int);
extern int open_read(const char *);
-extern int open_excl(const char *);
-extern int open_append(const char *);
-extern int open_trunc(const char *);
extern int open_write(const char *);
+//extern int open_excl(const char *);
+//extern int open_append(const char *);
+//extern int open_trunc(const char *);
-extern unsigned pmatch(const char *, const char *, unsigned);
+extern unsigned FAST_FUNC pmatch(const char *, const char *, unsigned);
-#define str_diff(s,t) strcmp((s), (t))
+//#define str_diff(s,t) strcmp((s), (t))
#define str_equal(s,t) (!strcmp((s), (t)))
/*
diff --git a/runit/runsv.c b/runit/runsv.c
index 5b221e9..6bb6ec8 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -151,7 +151,8 @@ static char *bb_stpcpy(char *p, const char *to_add)
static int open_trunc_or_warn(const char *name)
{
- int fd = open_trunc(name);
+ /* Why O_NDELAY? */
+ int fd = open(name, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
if (fd < 0)
bb_perror_msg("%s: warning: cannot open %s",
dir, name);