From 1d2069d168956957e9b7bd883f32f16c4aa4f217 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Sun, 22 Nov 2009 09:07:19 -0800 Subject: [PATCH] Define SIZEOF_CLICK_JIFFIES_T. --- config-bsdmodule.h.in | 3 +++ config-linuxmodule.h.in | 3 +++ config-userlevel.h.in | 3 +++ include/click/glue.hh | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/config-bsdmodule.h.in b/config-bsdmodule.h.in index d28f5076b3..a3b53886df 100644 --- a/config-bsdmodule.h.in +++ b/config-bsdmodule.h.in @@ -26,6 +26,9 @@ /* Define if 'int64_t' is typedefed to 'long long' in bsdmodule. */ #undef HAVE_INT64_IS_LONG_LONG_BSDMODULE +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_INT + /* Include integer and other type definitions. */ #include diff --git a/config-linuxmodule.h.in b/config-linuxmodule.h.in index 68e54f9245..f98218b08d 100644 --- a/config-linuxmodule.h.in +++ b/config-linuxmodule.h.in @@ -92,6 +92,9 @@ /* Define to 1 if Linux defines the type 'uintptr_t'. */ #undef HAVE_UINTPTR_T_LINUXMODULE +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_LONG + /* Define if fast checksum functions require correct alignment. */ #ifndef __i386__ # define FAST_CHECKSUM_ALIGNED 1 diff --git a/config-userlevel.h.in b/config-userlevel.h.in index c241f479f5..a45b0e2f8a 100644 --- a/config-userlevel.h.in +++ b/config-userlevel.h.in @@ -165,6 +165,9 @@ /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_INT + /* The size of a `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T diff --git a/include/click/glue.hh b/include/click/glue.hh index db293f74de..f2d7b65168 100644 --- a/include/click/glue.hh +++ b/include/click/glue.hh @@ -372,6 +372,7 @@ typedef long click_jiffies_difference_t; # define CLICK_JIFFIES_MONOTONIC 1 # define CLICK_HZ HZ # define click_jiffies_less(a, b) ((click_jiffies_difference_t) ((a) - (b)) < 0) +# define HAS_LONG_CLICK_JIFFIES_T 1 #elif CLICK_BSDMODULE # define click_gettimeofday(tvp) (getmicrotime(tvp)) typedef int click_jiffies_t; @@ -390,6 +391,10 @@ CLICK_ENDDECLS # define CLICK_HZ 1000 #endif +#if SIZEOF_CLICK_JIFFIES_T != (HAS_LONG_CLICK_JIFFIES_T ? SIZEOF_LONG : SIZEOF_INT) +# error "SIZEOF_CLICK_JIFFIES_T declared incorrectly" +#endif + // TIMEVAL OPERATIONS