summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-04 11:42:01 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-04 11:42:19 +0200
commit7bd73747fff54cf51642dbbf042c621e59a2c005 (patch)
tree562676064b6eb20b25e6e1fb422d08d54b82e82f
parent57968a8ab19b45b5d128656f6bed2581aee2ef22 (diff)
timer: add time management functions
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--netsniff-ng.c1
-rw-r--r--netsniff-ng/Makefile1
-rw-r--r--timer.c13
-rw-r--r--timer.h9
-rw-r--r--trafgen.c1
-rw-r--r--trafgen/Makefile1
-rw-r--r--xutils.c10
-rw-r--r--xutils.h2
8 files changed, 26 insertions, 12 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index 65875d8..ed488aa 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -42,6 +42,7 @@
#include "geoip.h"
#include "lockme.h"
#include "tprintf.h"
+#include "timer.h"
#include "dissector.h"
#include "xmalloc.h"
diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile
index cbe8f64..4621179 100644
--- a/netsniff-ng/Makefile
+++ b/netsniff-ng/Makefile
@@ -57,6 +57,7 @@ netsniff-ng-objs = dissector.o \
ring.o \
tprintf.o \
tstamping.o \
+ timer.o \
geoip.o \
mac80211.o \
netsniff-ng.o
diff --git a/timer.c b/timer.c
new file mode 100644
index 0000000..8941ab7
--- /dev/null
+++ b/timer.c
@@ -0,0 +1,13 @@
+#include <sys/time.h>
+
+#include "timer.h"
+
+void set_itimer_interval_value(struct itimerval *itimer, unsigned long sec,
+ unsigned long usec)
+{
+ itimer->it_interval.tv_sec = sec;
+ itimer->it_interval.tv_usec = usec;
+
+ itimer->it_value.tv_sec = sec;
+ itimer->it_value.tv_usec = usec;
+}
diff --git a/timer.h b/timer.h
new file mode 100644
index 0000000..8e869c8
--- /dev/null
+++ b/timer.h
@@ -0,0 +1,9 @@
+#ifndef TIMER_H
+#define TIMER_H
+
+#include <sys/time.h>
+
+extern void set_itimer_interval_value(struct itimerval *itimer, unsigned long sec,
+ unsigned long usec);
+
+#endif /* TIMER_H */
diff --git a/trafgen.c b/trafgen.c
index 41d04bd..fc15e20 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -48,6 +48,7 @@
#include "built_in.h"
#include "trafgen_conf.h"
#include "tprintf.h"
+#include "timer.h"
#include "ring_tx.h"
#include "csum.h"
diff --git a/trafgen/Makefile b/trafgen/Makefile
index 5aeb424..9555ca0 100644
--- a/trafgen/Makefile
+++ b/trafgen/Makefile
@@ -16,6 +16,7 @@ trafgen-objs = xmalloc.o \
mac80211.o \
ring_tx.o \
ring.o \
+ timer.o \
trafgen_lexer.yy.o \
trafgen_parser.tab.o \
trafgen.o
diff --git a/xutils.c b/xutils.c
index 35f9092..56b4c59 100644
--- a/xutils.c
+++ b/xutils.c
@@ -71,13 +71,3 @@ int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events)
return epoll_ctl(fd_epoll, action, fd_toadd, &ev);
}
-
-void set_itimer_interval_value(struct itimerval *itimer, unsigned long sec,
- unsigned long usec)
-{
- itimer->it_interval.tv_sec = sec;
- itimer->it_interval.tv_usec = usec;
-
- itimer->it_value.tv_sec = sec;
- itimer->it_value.tv_usec = usec;
-}
diff --git a/xutils.h b/xutils.h
index dd30fad..2e0e251 100644
--- a/xutils.h
+++ b/xutils.h
@@ -27,7 +27,5 @@
extern void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events);
extern int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events);
-extern void set_itimer_interval_value(struct itimerval *itimer, unsigned long sec,
- unsigned long usec);
#endif /* XSYS_H */