diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-06-04 11:42:01 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-06-04 11:42:19 +0200 |
commit | 7bd73747fff54cf51642dbbf042c621e59a2c005 (patch) | |
tree | 562676064b6eb20b25e6e1fb422d08d54b82e82f | |
parent | 57968a8ab19b45b5d128656f6bed2581aee2ef22 (diff) |
timer: add time management functions
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r-- | netsniff-ng.c | 1 | ||||
-rw-r--r-- | netsniff-ng/Makefile | 1 | ||||
-rw-r--r-- | timer.c | 13 | ||||
-rw-r--r-- | timer.h | 9 | ||||
-rw-r--r-- | trafgen.c | 1 | ||||
-rw-r--r-- | trafgen/Makefile | 1 | ||||
-rw-r--r-- | xutils.c | 10 | ||||
-rw-r--r-- | xutils.h | 2 |
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 @@ -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; +} @@ -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 */ @@ -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 @@ -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; -} @@ -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 */ |