mirror of
https://github.com/sheumann/hush.git
synced 2024-11-19 23:31:39 +00:00
runit_lib: remove/inline a few more things
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
8d789e4197
commit
e09bff3341
@ -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.
|
||||||
|
@ -198,27 +198,29 @@ void iopause(iopause_fd *x, unsigned len, struct taia *deadline, struct taia *st
|
|||||||
|
|
||||||
int lock_ex(int fd)
|
int lock_ex(int fd)
|
||||||
{
|
{
|
||||||
return flock(fd,LOCK_EX);
|
return flock(fd, LOCK_EX);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lock_exnb(int fd)
|
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)
|
||||||
@ -226,7 +228,7 @@ 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++;
|
||||||
|
@ -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)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user