summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-09-05 19:28:29 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-09-05 19:28:29 +0200
commite09bff33412c150a2c4c80ca7e2d5c6b76f10c9f (patch)
tree0d9530a372348a58acb2a3ff8b515fa21cb506ca
parent8d789e419732e860cf89883c0565ff496b3291ee (diff)
downloadbusybox-w32-e09bff33412c150a2c4c80ca7e2d5c6b76f10c9f.tar.gz
busybox-w32-e09bff33412c150a2c4c80ca7e2d5c6b76f10c9f.tar.bz2
busybox-w32-e09bff33412c150a2c4c80ca7e2d5c6b76f10c9f.zip
runit_lib: remove/inline a few more things
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-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 ad0811294..b08d42300 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -29,7 +29,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29/* Dependencies on runit_lib.c removed */ 29/* Dependencies on runit_lib.c removed */
30 30
31#include "libbb.h" 31#include "libbb.h"
32#include <dirent.h>
33 32
34/* 33/*
35Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit. 34Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index ec18b5edd..8182a909a 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
198 198
199int lock_ex(int fd) 199int lock_ex(int fd)
200{ 200{
201 return flock(fd,LOCK_EX); 201 return flock(fd, LOCK_EX);
202} 202}
203 203
204int lock_exnb(int fd) 204int lock_exnb(int fd)
205{ 205{
206 return flock(fd,LOCK_EX | LOCK_NB); 206 return flock(fd, LOCK_EX | LOCK_NB);
207} 207}
208 208
209#ifdef UNUSED
209int open_append(const char *fn) 210int open_append(const char *fn)
210{ 211{
211 return open(fn, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600); 212 return open(fn, O_WRONLY | O_NDELAY | O_APPEND | O_CREAT, 0600);
212} 213}
213 214
214int open_read(const char *fn) 215int open_trunc(const char *fn)
215{ 216{
216 return open(fn, O_RDONLY|O_NDELAY); 217 return open(fn, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
217} 218}
219#endif
218 220
219int open_trunc(const char *fn) 221int open_read(const char *fn)
220{ 222{
221 return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644); 223 return open(fn, O_RDONLY|O_NDELAY);
222} 224}
223 225
224int open_write(const char *fn) 226int open_write(const char *fn)
@@ -226,7 +228,7 @@ int open_write(const char *fn)
226 return open(fn, O_WRONLY|O_NDELAY); 228 return open(fn, O_WRONLY|O_NDELAY);
227} 229}
228 230
229unsigned pmatch(const char *p, const char *s, unsigned len) 231unsigned FAST_FUNC pmatch(const char *p, const char *s, unsigned len)
230{ 232{
231 for (;;) { 233 for (;;) {
232 char c = *p++; 234 char c = *p++;
diff --git a/runit/runit_lib.h b/runit/runit_lib.h
index 88d1c9f22..d8304aca6 100644
--- a/runit/runit_lib.h
+++ b/runit/runit_lib.h
@@ -66,18 +66,18 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
66//extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *); 66//extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *);
67 67
68extern int lock_ex(int); 68extern int lock_ex(int);
69extern int lock_un(int); 69//extern int lock_un(int);
70extern int lock_exnb(int); 70extern int lock_exnb(int);
71 71
72extern int open_read(const char *); 72extern int open_read(const char *);
73extern int open_excl(const char *);
74extern int open_append(const char *);
75extern int open_trunc(const char *);
76extern int open_write(const char *); 73extern int open_write(const char *);
74//extern int open_excl(const char *);
75//extern int open_append(const char *);
76//extern int open_trunc(const char *);
77 77
78extern unsigned pmatch(const char *, const char *, unsigned); 78extern unsigned FAST_FUNC pmatch(const char *, const char *, unsigned);
79 79
80#define str_diff(s,t) strcmp((s), (t)) 80//#define str_diff(s,t) strcmp((s), (t))
81#define str_equal(s,t) (!strcmp((s), (t))) 81#define str_equal(s,t) (!strcmp((s), (t)))
82 82
83/* 83/*
diff --git a/runit/runsv.c b/runit/runsv.c
index 5b221e90a..6bb6ec886 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -151,7 +151,8 @@ static char *bb_stpcpy(char *p, const char *to_add)
151 151
152static int open_trunc_or_warn(const char *name) 152static int open_trunc_or_warn(const char *name)
153{ 153{
154 int fd = open_trunc(name); 154 /* Why O_NDELAY? */
155 int fd = open(name, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
155 if (fd < 0) 156 if (fd < 0)
156 bb_perror_msg("%s: warning: cannot open %s", 157 bb_perror_msg("%s: warning: cannot open %s",
157 dir, name); 158 dir, name);