runit_lib: remove/inline a few more things

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2010-09-05 19:28:29 +02:00
parent 8d789e4197
commit e09bff3341
4 changed files with 20 additions and 18 deletions

View File

@ -29,7 +29,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* Dependencies on runit_lib.c removed */ /* Dependencies on runit_lib.c removed */
#include "libbb.h" #include "libbb.h"
#include <dirent.h>
/* /*
Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit. Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.

View File

@ -206,27 +206,29 @@ 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) 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)
{
return open(fn, O_RDONLY|O_NDELAY);
}
int open_trunc(const char *fn) int open_trunc(const char *fn)
{ {
return open(fn, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644); return open(fn, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
} }
#endif
int open_read(const char *fn)
{
return open(fn, O_RDONLY|O_NDELAY);
}
int open_write(const char *fn) int open_write(const char *fn)
{ {
return open(fn, O_WRONLY|O_NDELAY); 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 (;;) { for (;;) {
char c = *p++; char c = *p++;

View File

@ -66,18 +66,18 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
//extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *); //extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *);
extern int lock_ex(int); extern int lock_ex(int);
extern int lock_un(int); //extern int lock_un(int);
extern int lock_exnb(int); extern int lock_exnb(int);
extern int open_read(const char *); 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_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))) #define str_equal(s,t) (!strcmp((s), (t)))
/* /*

View File

@ -151,7 +151,8 @@ static char *bb_stpcpy(char *p, const char *to_add)
static int open_trunc_or_warn(const char *name) 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) if (fd < 0)
bb_perror_msg("%s: warning: cannot open %s", bb_perror_msg("%s: warning: cannot open %s",
dir, name); dir, name);