/* Dependencies on runit_lib.c removed */
#include "libbb.h"
-#include <dirent.h>
/*
Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.
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)
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++;
//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)))
/*
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);