summaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-16 18:50:56 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-16 18:50:56 +0000
commite755e827f7c8ecb21787a4369d7afdeda54d112b (patch)
tree007b1506e69ffcc25bc6ba3b0e6686d806a34264 /runit
parented6ac53104d811ee88c71aff45c7cad666aaee46 (diff)
downloadbusybox-w32-1_7_1.tar.gz
busybox-w32-1_7_1.tar.bz2
busybox-w32-1_7_1.zip
apply post 1.7.0 patches, set version to 1.7.11_7_1
Diffstat (limited to 'runit')
-rw-r--r--runit/runsv.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index baef6e13f..b35c26630 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -33,6 +33,34 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#include "libbb.h" 33#include "libbb.h"
34#include "runit_lib.h" 34#include "runit_lib.h"
35 35
36#if ENABLE_MONOTONIC_SYSCALL
37#include <sys/syscall.h>
38
39/* libc has incredibly messy way of doing this,
40 * typically requiring -lrt. We just skip all this mess */
41static void gettimeofday_ns(struct timespec *ts)
42{
43 syscall(__NR_clock_gettime, CLOCK_REALTIME, ts);
44}
45#else
46static void gettimeofday_ns(struct timespec *ts)
47{
48 if (sizeof(struct timeval) == sizeof(struct timespec)
49 && sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec)
50 ) {
51 /* Cheat */
52 gettimeofday((void*)ts, NULL);
53 ts->tv_nsec *= 1000;
54 } else {
55 extern void BUG_need_to_implement_gettimeofday_ns(void);
56 BUG_need_to_implement_gettimeofday_ns();
57 }
58}
59#endif
60
61/* Compare possibly overflowing unsigned counters */
62#define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0)
63
36static int selfpipe[2]; 64static int selfpipe[2];
37 65
38/* state */ 66/* state */
@@ -126,14 +154,6 @@ static int rename_or_warn(const char *old, const char *new)
126 return 0; 154 return 0;
127} 155}
128 156
129#define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0)
130
131#include <sys/syscall.h>
132static void gettimeofday_ns(struct timespec *ts)
133{
134 syscall(__NR_clock_gettime, CLOCK_REALTIME, ts);
135}
136
137static void update_status(struct svdir *s) 157static void update_status(struct svdir *s)
138{ 158{
139 ssize_t sz; 159 ssize_t sz;