BUILD: remove obsolete support for -mregparm / USE_REGPARM

This used to be a minor optimization on ix86 where registers are scarce
and the calling convention not very efficient, but this platform is not
relevant enough anymore to warrant all this dirt in the code for the sake
of saving 1 or 2% of performance. Modern platforms don't use this at all
since their calling convention already defaults to using several registers
so better get rid of this once for all.
This commit is contained in:
Willy Tarreau 2020-02-25 07:38:05 +01:00
parent 1d48ba91d7
commit 03e7853581
27 changed files with 147 additions and 183 deletions

View File

@ -27,7 +27,6 @@
# USE_PRIVATE_CACHE : disable shared memory cache of ssl sessions.
# USE_THREAD : enable threads support.
# USE_PTHREAD_PSHARED : enable pthread process shared mutex on sslcache.
# USE_REGPARM : enable regparm optimization. Recommended on x86.
# USE_STATIC_PCRE : enable static libpcre. Recommended.
# USE_STATIC_PCRE2 : enable static libpcre2.
# USE_TPROXY : enable transparent proxy. Automatic.
@ -288,7 +287,7 @@ LDFLAGS = $(ARCH_FLAGS) -g
# the reported build options.
use_opts = USE_EPOLL USE_KQUEUE USE_MY_EPOLL USE_MY_SPLICE USE_NETFILTER \
USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_POLL \
USE_PRIVATE_CACHE USE_THREAD USE_PTHREAD_PSHARED USE_REGPARM \
USE_PRIVATE_CACHE USE_THREAD USE_PTHREAD_PSHARED \
USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY \
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_VSYSCALL \
USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4 \
@ -505,10 +504,6 @@ ifneq ($(USE_VSYSCALL),)
OPTIONS_OBJS += src/i386-linux-vsys.o
endif
ifneq ($(USE_REGPARM),)
OPTIONS_CFLAGS += -DCONFIG_REGPARM=3
endif
ifneq ($(USE_DL),)
OPTIONS_LDFLAGS += -ldl
endif

View File

@ -26,7 +26,7 @@
/* This function is used to build a tree of duplicates by adding a new node to
* a subtree of at least 2 entries.
*/
REGPRM1 struct eb32sc_node *eb32sc_insert_dup(struct eb_node *sub, struct eb_node *new, unsigned long scope)
struct eb32sc_node *eb32sc_insert_dup(struct eb_node *sub, struct eb_node *new, unsigned long scope)
{
struct eb32sc_node *eb32;
struct eb_node *head = sub;
@ -104,7 +104,7 @@ REGPRM1 struct eb32sc_node *eb32sc_insert_dup(struct eb_node *sub, struct eb_nod
* new->key needs be set with the key. The eb32sc_node is returned. This
* implementation does NOT support unique trees.
*/
REGPRM2 struct eb32sc_node *eb32sc_insert(struct eb_root *root, struct eb32sc_node *new, unsigned long scope)
struct eb32sc_node *eb32sc_insert(struct eb_root *root, struct eb32sc_node *new, unsigned long scope)
{
struct eb32sc_node *old;
unsigned int side;
@ -236,7 +236,7 @@ REGPRM2 struct eb32sc_node *eb32sc_insert(struct eb_root *root, struct eb32sc_no
* Find the first occurrence of the lowest key in the tree <root>, which is
* equal to or greater than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct eb32sc_node *eb32sc_lookup_ge(struct eb_root *root, u32 x, unsigned long scope)
struct eb32sc_node *eb32sc_lookup_ge(struct eb_root *root, u32 x, unsigned long scope)
{
struct eb32sc_node *node;
eb_troot_t *troot;
@ -304,7 +304,7 @@ REGPRM2 struct eb32sc_node *eb32sc_lookup_ge(struct eb_root *root, u32 x, unsign
* equal to or greater than <x>, matching scope <scope>. If not found, it loops
* back to the beginning of the tree. NULL is returned is no key matches.
*/
REGPRM2 struct eb32sc_node *eb32sc_lookup_ge_or_first(struct eb_root *root, u32 x, unsigned long scope)
struct eb32sc_node *eb32sc_lookup_ge_or_first(struct eb_root *root, u32 x, unsigned long scope)
{
struct eb32sc_node *eb32;
eb_troot_t *troot;

View File

@ -56,9 +56,9 @@ struct eb32sc_node {
* The following functions are not inlined by default. They are declared
* in eb32sctree.c, which simply relies on their inline version.
*/
REGPRM2 struct eb32sc_node *eb32sc_lookup_ge(struct eb_root *root, u32 x, unsigned long scope);
REGPRM2 struct eb32sc_node *eb32sc_lookup_ge_or_first(struct eb_root *root, u32 x, unsigned long scope);
REGPRM2 struct eb32sc_node *eb32sc_insert(struct eb_root *root, struct eb32sc_node *new, unsigned long scope);
struct eb32sc_node *eb32sc_lookup_ge(struct eb_root *root, u32 x, unsigned long scope);
struct eb32sc_node *eb32sc_lookup_ge_or_first(struct eb_root *root, u32 x, unsigned long scope);
struct eb32sc_node *eb32sc_insert(struct eb_root *root, struct eb32sc_node *new, unsigned long scope);
void eb32sc_delete(struct eb32sc_node *node);
/* Walks down left starting at root pointer <start>, and follow the leftmost

View File

@ -22,22 +22,22 @@
#include "eb32tree.h"
REGPRM2 struct eb32_node *eb32_insert(struct eb_root *root, struct eb32_node *new)
struct eb32_node *eb32_insert(struct eb_root *root, struct eb32_node *new)
{
return __eb32_insert(root, new);
}
REGPRM2 struct eb32_node *eb32i_insert(struct eb_root *root, struct eb32_node *new)
struct eb32_node *eb32i_insert(struct eb_root *root, struct eb32_node *new)
{
return __eb32i_insert(root, new);
}
REGPRM2 struct eb32_node *eb32_lookup(struct eb_root *root, u32 x)
struct eb32_node *eb32_lookup(struct eb_root *root, u32 x)
{
return __eb32_lookup(root, x);
}
REGPRM2 struct eb32_node *eb32i_lookup(struct eb_root *root, s32 x)
struct eb32_node *eb32i_lookup(struct eb_root *root, s32 x)
{
return __eb32i_lookup(root, x);
}
@ -46,7 +46,7 @@ REGPRM2 struct eb32_node *eb32i_lookup(struct eb_root *root, s32 x)
* Find the last occurrence of the highest key in the tree <root>, which is
* equal to or less than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct eb32_node *eb32_lookup_le(struct eb_root *root, u32 x)
struct eb32_node *eb32_lookup_le(struct eb_root *root, u32 x)
{
struct eb32_node *node;
eb_troot_t *troot;
@ -134,7 +134,7 @@ REGPRM2 struct eb32_node *eb32_lookup_le(struct eb_root *root, u32 x)
* Find the first occurrence of the lowest key in the tree <root>, which is
* equal to or greater than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct eb32_node *eb32_lookup_ge(struct eb_root *root, u32 x)
struct eb32_node *eb32_lookup_ge(struct eb_root *root, u32 x)
{
struct eb32_node *node;
eb_troot_t *troot;

View File

@ -110,12 +110,12 @@ static inline void eb32_delete(struct eb32_node *eb32)
* The following functions are not inlined by default. They are declared
* in eb32tree.c, which simply relies on their inline version.
*/
REGPRM2 struct eb32_node *eb32_lookup(struct eb_root *root, u32 x);
REGPRM2 struct eb32_node *eb32i_lookup(struct eb_root *root, s32 x);
REGPRM2 struct eb32_node *eb32_lookup_le(struct eb_root *root, u32 x);
REGPRM2 struct eb32_node *eb32_lookup_ge(struct eb_root *root, u32 x);
REGPRM2 struct eb32_node *eb32_insert(struct eb_root *root, struct eb32_node *new);
REGPRM2 struct eb32_node *eb32i_insert(struct eb_root *root, struct eb32_node *new);
struct eb32_node *eb32_lookup(struct eb_root *root, u32 x);
struct eb32_node *eb32i_lookup(struct eb_root *root, s32 x);
struct eb32_node *eb32_lookup_le(struct eb_root *root, u32 x);
struct eb32_node *eb32_lookup_ge(struct eb_root *root, u32 x);
struct eb32_node *eb32_insert(struct eb_root *root, struct eb32_node *new);
struct eb32_node *eb32i_insert(struct eb_root *root, struct eb32_node *new);
/*
* The following functions are less likely to be used directly, because their

View File

@ -22,22 +22,22 @@
#include "eb64tree.h"
REGPRM2 struct eb64_node *eb64_insert(struct eb_root *root, struct eb64_node *new)
struct eb64_node *eb64_insert(struct eb_root *root, struct eb64_node *new)
{
return __eb64_insert(root, new);
}
REGPRM2 struct eb64_node *eb64i_insert(struct eb_root *root, struct eb64_node *new)
struct eb64_node *eb64i_insert(struct eb_root *root, struct eb64_node *new)
{
return __eb64i_insert(root, new);
}
REGPRM2 struct eb64_node *eb64_lookup(struct eb_root *root, u64 x)
struct eb64_node *eb64_lookup(struct eb_root *root, u64 x)
{
return __eb64_lookup(root, x);
}
REGPRM2 struct eb64_node *eb64i_lookup(struct eb_root *root, s64 x)
struct eb64_node *eb64i_lookup(struct eb_root *root, s64 x)
{
return __eb64i_lookup(root, x);
}
@ -46,7 +46,7 @@ REGPRM2 struct eb64_node *eb64i_lookup(struct eb_root *root, s64 x)
* Find the last occurrence of the highest key in the tree <root>, which is
* equal to or less than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct eb64_node *eb64_lookup_le(struct eb_root *root, u64 x)
struct eb64_node *eb64_lookup_le(struct eb_root *root, u64 x)
{
struct eb64_node *node;
eb_troot_t *troot;
@ -134,7 +134,7 @@ REGPRM2 struct eb64_node *eb64_lookup_le(struct eb_root *root, u64 x)
* Find the first occurrence of the lowest key in the tree <root>, which is
* equal to or greater than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct eb64_node *eb64_lookup_ge(struct eb_root *root, u64 x)
struct eb64_node *eb64_lookup_ge(struct eb_root *root, u64 x)
{
struct eb64_node *node;
eb_troot_t *troot;

View File

@ -110,12 +110,12 @@ static inline void eb64_delete(struct eb64_node *eb64)
* The following functions are not inlined by default. They are declared
* in eb64tree.c, which simply relies on their inline version.
*/
REGPRM2 struct eb64_node *eb64_lookup(struct eb_root *root, u64 x);
REGPRM2 struct eb64_node *eb64i_lookup(struct eb_root *root, s64 x);
REGPRM2 struct eb64_node *eb64_lookup_le(struct eb_root *root, u64 x);
REGPRM2 struct eb64_node *eb64_lookup_ge(struct eb_root *root, u64 x);
REGPRM2 struct eb64_node *eb64_insert(struct eb_root *root, struct eb64_node *new);
REGPRM2 struct eb64_node *eb64i_insert(struct eb_root *root, struct eb64_node *new);
struct eb64_node *eb64_lookup(struct eb_root *root, u64 x);
struct eb64_node *eb64i_lookup(struct eb_root *root, s64 x);
struct eb64_node *eb64_lookup_le(struct eb_root *root, u64 x);
struct eb64_node *eb64_lookup_ge(struct eb_root *root, u64 x);
struct eb64_node *eb64_insert(struct eb_root *root, struct eb64_node *new);
struct eb64_node *eb64i_insert(struct eb_root *root, struct eb64_node *new);
/*
* The following functions are less likely to be used directly, because their

View File

@ -26,7 +26,7 @@
/* Find the first occurrence of a key of <len> bytes in the tree <root>.
* If none can be found, return NULL.
*/
REGPRM3 struct ebpt_node *
struct ebpt_node *
ebim_lookup(struct eb_root *root, const void *x, unsigned int len)
{
return __ebim_lookup(root, x, len);
@ -37,7 +37,7 @@ ebim_lookup(struct eb_root *root, const void *x, unsigned int len)
* If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
* len is specified in bytes.
*/
REGPRM3 struct ebpt_node *
struct ebpt_node *
ebim_insert(struct eb_root *root, struct ebpt_node *new, unsigned int len)
{
return __ebim_insert(root, new, len);

View File

@ -32,8 +32,8 @@
/* The following functions are not inlined by default. They are declared
* in ebimtree.c, which simply relies on their inline version.
*/
REGPRM3 struct ebpt_node *ebim_lookup(struct eb_root *root, const void *x, unsigned int len);
REGPRM3 struct ebpt_node *ebim_insert(struct eb_root *root, struct ebpt_node *new, unsigned int len);
struct ebpt_node *ebim_lookup(struct eb_root *root, const void *x, unsigned int len);
struct ebpt_node *ebim_insert(struct eb_root *root, struct ebpt_node *new, unsigned int len);
/* Find the first occurrence of a key of a least <len> bytes matching <x> in the
* tree <root>. The caller is responsible for ensuring that <len> will not exceed

View File

@ -26,7 +26,7 @@
* It's the caller's reponsibility to use this function only on trees which
* only contain zero-terminated strings. If none can be found, return NULL.
*/
REGPRM2 struct ebpt_node *ebis_lookup(struct eb_root *root, const char *x)
struct ebpt_node *ebis_lookup(struct eb_root *root, const char *x)
{
return __ebis_lookup(root, x);
}
@ -36,7 +36,7 @@ REGPRM2 struct ebpt_node *ebis_lookup(struct eb_root *root, const char *x)
* returned. If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
* caller is responsible for properly terminating the key with a zero.
*/
REGPRM2 struct ebpt_node *ebis_insert(struct eb_root *root, struct ebpt_node *new)
struct ebpt_node *ebis_insert(struct eb_root *root, struct ebpt_node *new)
{
return __ebis_insert(root, new);
}

View File

@ -35,8 +35,8 @@
/* The following functions are not inlined by default. They are declared
* in ebistree.c, which simply relies on their inline version.
*/
REGPRM2 struct ebpt_node *ebis_lookup(struct eb_root *root, const char *x);
REGPRM2 struct ebpt_node *ebis_insert(struct eb_root *root, struct ebpt_node *new);
struct ebpt_node *ebis_lookup(struct eb_root *root, const char *x);
struct ebpt_node *ebis_insert(struct eb_root *root, struct ebpt_node *new);
/* Find the first occurrence of a length <len> string <x> in the tree <root>.
* It's the caller's reponsibility to use this function only on trees which

View File

@ -25,7 +25,7 @@
/* Find the first occurrence of a key of <len> bytes in the tree <root>.
* If none can be found, return NULL.
*/
REGPRM3 struct ebmb_node *
struct ebmb_node *
ebmb_lookup(struct eb_root *root, const void *x, unsigned int len)
{
return __ebmb_lookup(root, x, len);
@ -36,7 +36,7 @@ ebmb_lookup(struct eb_root *root, const void *x, unsigned int len)
* If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
* len is specified in bytes.
*/
REGPRM3 struct ebmb_node *
struct ebmb_node *
ebmb_insert(struct eb_root *root, struct ebmb_node *new, unsigned int len)
{
return __ebmb_insert(root, new, len);
@ -46,7 +46,7 @@ ebmb_insert(struct eb_root *root, struct ebmb_node *new, unsigned int len)
* tree <root>. It's the caller's responsibility to ensure that key <x> is at
* least as long as the keys in the tree. If none can be found, return NULL.
*/
REGPRM2 struct ebmb_node *
struct ebmb_node *
ebmb_lookup_longest(struct eb_root *root, const void *x)
{
return __ebmb_lookup_longest(root, x);
@ -55,7 +55,7 @@ ebmb_lookup_longest(struct eb_root *root, const void *x)
/* Find the first occurrence of a prefix matching a key <x> of <pfx> BITS in the
* tree <root>. If none can be found, return NULL.
*/
REGPRM3 struct ebmb_node *
struct ebmb_node *
ebmb_lookup_prefix(struct eb_root *root, const void *x, unsigned int pfx)
{
return __ebmb_lookup_prefix(root, x, pfx);
@ -70,7 +70,7 @@ ebmb_lookup_prefix(struct eb_root *root, const void *x, unsigned int pfx)
* If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
* len is specified in bytes.
*/
REGPRM3 struct ebmb_node *
struct ebmb_node *
ebmb_insert_prefix(struct eb_root *root, struct ebmb_node *new, unsigned int len)
{
return __ebmb_insert_prefix(root, new, len);

View File

@ -107,11 +107,11 @@ static forceinline void ebmb_delete(struct ebmb_node *ebmb)
/* The following functions are not inlined by default. They are declared
* in ebmbtree.c, which simply relies on their inline version.
*/
REGPRM3 struct ebmb_node *ebmb_lookup(struct eb_root *root, const void *x, unsigned int len);
REGPRM3 struct ebmb_node *ebmb_insert(struct eb_root *root, struct ebmb_node *new, unsigned int len);
REGPRM2 struct ebmb_node *ebmb_lookup_longest(struct eb_root *root, const void *x);
REGPRM3 struct ebmb_node *ebmb_lookup_prefix(struct eb_root *root, const void *x, unsigned int pfx);
REGPRM3 struct ebmb_node *ebmb_insert_prefix(struct eb_root *root, struct ebmb_node *new, unsigned int len);
struct ebmb_node *ebmb_lookup(struct eb_root *root, const void *x, unsigned int len);
struct ebmb_node *ebmb_insert(struct eb_root *root, struct ebmb_node *new, unsigned int len);
struct ebmb_node *ebmb_lookup_longest(struct eb_root *root, const void *x);
struct ebmb_node *ebmb_lookup_prefix(struct eb_root *root, const void *x, unsigned int pfx);
struct ebmb_node *ebmb_insert_prefix(struct eb_root *root, struct ebmb_node *new, unsigned int len);
/* The following functions are less likely to be used directly, because their
* code is larger. The non-inlined version is preferred.

View File

@ -22,12 +22,12 @@
#include "ebpttree.h"
REGPRM2 struct ebpt_node *ebpt_insert(struct eb_root *root, struct ebpt_node *new)
struct ebpt_node *ebpt_insert(struct eb_root *root, struct ebpt_node *new)
{
return __ebpt_insert(root, new);
}
REGPRM2 struct ebpt_node *ebpt_lookup(struct eb_root *root, void *x)
struct ebpt_node *ebpt_lookup(struct eb_root *root, void *x)
{
return __ebpt_lookup(root, x);
}
@ -36,7 +36,7 @@ REGPRM2 struct ebpt_node *ebpt_lookup(struct eb_root *root, void *x)
* Find the last occurrence of the highest key in the tree <root>, which is
* equal to or less than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct ebpt_node *ebpt_lookup_le(struct eb_root *root, void *x)
struct ebpt_node *ebpt_lookup_le(struct eb_root *root, void *x)
{
struct ebpt_node *node;
eb_troot_t *troot;
@ -124,7 +124,7 @@ REGPRM2 struct ebpt_node *ebpt_lookup_le(struct eb_root *root, void *x)
* Find the first occurrence of the lowest key in the tree <root>, which is
* equal to or greater than <x>. NULL is returned is no key matches.
*/
REGPRM2 struct ebpt_node *ebpt_lookup_ge(struct eb_root *root, void *x)
struct ebpt_node *ebpt_lookup_ge(struct eb_root *root, void *x)
{
struct ebpt_node *node;
eb_troot_t *troot;

View File

@ -26,7 +26,7 @@
* It's the caller's reponsibility to use this function only on trees which
* only contain zero-terminated strings. If none can be found, return NULL.
*/
REGPRM2 struct ebmb_node *ebst_lookup(struct eb_root *root, const char *x)
struct ebmb_node *ebst_lookup(struct eb_root *root, const char *x)
{
return __ebst_lookup(root, x);
}
@ -36,7 +36,7 @@ REGPRM2 struct ebmb_node *ebst_lookup(struct eb_root *root, const char *x)
* returned. If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
* caller is responsible for properly terminating the key with a zero.
*/
REGPRM2 struct ebmb_node *ebst_insert(struct eb_root *root, struct ebmb_node *new)
struct ebmb_node *ebst_insert(struct eb_root *root, struct ebmb_node *new)
{
return __ebst_insert(root, new);
}

View File

@ -29,8 +29,8 @@
/* The following functions are not inlined by default. They are declared
* in ebsttree.c, which simply relies on their inline version.
*/
REGPRM2 struct ebmb_node *ebst_lookup(struct eb_root *root, const char *x);
REGPRM2 struct ebmb_node *ebst_insert(struct eb_root *root, struct ebmb_node *new);
struct ebmb_node *ebst_lookup(struct eb_root *root, const char *x);
struct ebmb_node *ebst_insert(struct eb_root *root, struct ebmb_node *new);
/* Find the first occurrence of a length <len> string <x> in the tree <root>.
* It's the caller's reponsibility to use this function only on trees which

View File

@ -26,7 +26,7 @@ void eb_delete(struct eb_node *node)
}
/* used by insertion primitives */
REGPRM1 struct eb_node *eb_insert_dup(struct eb_node *sub, struct eb_node *new)
struct eb_node *eb_insert_dup(struct eb_node *sub, struct eb_node *new)
{
return __eb_insert_dup(sub, new);
}

View File

@ -911,7 +911,7 @@ static forceinline int get_bit(const unsigned char *a, unsigned int pos)
/* These functions are declared in ebtree.c */
void eb_delete(struct eb_node *node);
REGPRM1 struct eb_node *eb_insert_dup(struct eb_node *sub, struct eb_node *new);
struct eb_node *eb_insert_dup(struct eb_node *sub, struct eb_node *new);
#endif /* _EB_TREE_H */

View File

@ -35,37 +35,6 @@
#endif
/* Support passing function parameters in registers. For this, the
* CONFIG_REGPARM macro has to be set to the maximal number of registers
* allowed. Some functions have intentionally received a regparm lower than
* their parameter count, it is in order to avoid register clobbering where
* they are called.
*/
#ifndef REGPRM1
#if CONFIG_REGPARM >= 1 && __GNUC__ >= 3
#define REGPRM1 __attribute__((regparm(1)))
#else
#define REGPRM1
#endif
#endif
#ifndef REGPRM2
#if CONFIG_REGPARM >= 2 && __GNUC__ >= 3
#define REGPRM2 __attribute__((regparm(2)))
#else
#define REGPRM2 REGPRM1
#endif
#endif
#ifndef REGPRM3
#if CONFIG_REGPARM >= 3 && __GNUC__ >= 3
#define REGPRM3 __attribute__((regparm(3)))
#else
#define REGPRM3 REGPRM2
#endif
#endif
/* By default, gcc does not inline large chunks of code, but we want it to
* respect our choices.
*/

View File

@ -69,25 +69,25 @@ extern THREAD_LOCAL struct timeval after_poll; /* system date after leavin
/*
* adds <ms> ms to <from>, set the result to <tv> and returns a pointer <tv>
*/
REGPRM3 struct timeval *tv_ms_add(struct timeval *tv, const struct timeval *from, int ms);
struct timeval *tv_ms_add(struct timeval *tv, const struct timeval *from, int ms);
/*
* compares <tv1> and <tv2> modulo 1ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2
* Must not be used when either argument is eternity. Use tv_ms_cmp2() for that.
*/
REGPRM2 int tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2);
int tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2);
/*
* compares <tv1> and <tv2> modulo 1 ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2,
* assuming that TV_ETERNITY is greater than everything.
*/
REGPRM2 int tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2);
int tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2);
/**** general purpose functions and macros *******************************/
/* tv_now: sets <tv> to the current time */
REGPRM1 static inline struct timeval *tv_now(struct timeval *tv)
static inline struct timeval *tv_now(struct timeval *tv)
{
gettimeofday(tv, NULL);
return tv;
@ -101,7 +101,7 @@ REGPRM1 static inline struct timeval *tv_now(struct timeval *tv)
* value in <interrupted> (a non-zero value means that we have not expired the
* timeout).
*/
REGPRM2 void tv_update_date(int max_wait, int interrupted);
void tv_update_date(int max_wait, int interrupted);
char *timeofday_as_iso_us(int pad);
@ -110,7 +110,7 @@ char *timeofday_as_iso_us(int pad);
* note that only tv_usec is necessary to detect it since a tv_usec > 999999
* is normally not possible.
*/
REGPRM1 static inline struct timeval *tv_eternity(struct timeval *tv)
static inline struct timeval *tv_eternity(struct timeval *tv)
{
tv->tv_sec = (typeof(tv->tv_sec))TV_ETERNITY;
tv->tv_usec = (typeof(tv->tv_usec))TV_ETERNITY;
@ -121,7 +121,7 @@ REGPRM1 static inline struct timeval *tv_eternity(struct timeval *tv)
* sets a struct timeval to 0
*
*/
REGPRM1 static inline struct timeval *tv_zero(struct timeval *tv) {
static inline struct timeval *tv_zero(struct timeval *tv) {
tv->tv_sec = tv->tv_usec = 0;
return tv;
}
@ -144,7 +144,7 @@ REGPRM1 static inline struct timeval *tv_zero(struct timeval *tv) {
/*
* Converts a struct timeval to a number of milliseconds.
*/
REGPRM1 static inline unsigned long __tv_to_ms(const struct timeval *tv)
static inline unsigned long __tv_to_ms(const struct timeval *tv)
{
unsigned long ret;
@ -156,7 +156,7 @@ REGPRM1 static inline unsigned long __tv_to_ms(const struct timeval *tv)
/*
* Converts a struct timeval to a number of milliseconds.
*/
REGPRM2 static inline struct timeval * __tv_from_ms(struct timeval *tv, unsigned long ms)
static inline struct timeval * __tv_from_ms(struct timeval *tv, unsigned long ms)
{
tv->tv_sec = ms / 1000;
tv->tv_usec = (ms % 1000) * 1000;
@ -170,7 +170,7 @@ REGPRM2 static inline struct timeval * __tv_from_ms(struct timeval *tv, unsigned
* which is almost twice as low as a direct usec to ms conversion. This version
* also has the benefit of returning 1024 for 1000000.
*/
REGPRM1 static inline unsigned int __usec_to_1024th(unsigned int usec)
static inline unsigned int __usec_to_1024th(unsigned int usec)
{
return (usec * 1073 + 742516) >> 20;
}
@ -180,7 +180,7 @@ REGPRM1 static inline unsigned int __usec_to_1024th(unsigned int usec)
/* tv_cmp: compares <tv1> and <tv2> : returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2. */
REGPRM2 static inline int __tv_cmp(const struct timeval *tv1, const struct timeval *tv2)
static inline int __tv_cmp(const struct timeval *tv1, const struct timeval *tv2)
{
if ((unsigned)tv1->tv_sec < (unsigned)tv2->tv_sec)
return -1;
@ -196,7 +196,7 @@ REGPRM2 static inline int __tv_cmp(const struct timeval *tv1, const struct timev
/* tv_iseq: compares <tv1> and <tv2> : returns 1 if tv1 == tv2, otherwise 0 */
#define tv_iseq __tv_iseq
REGPRM2 static inline int __tv_iseq(const struct timeval *tv1, const struct timeval *tv2)
static inline int __tv_iseq(const struct timeval *tv1, const struct timeval *tv2)
{
return ((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) &&
((unsigned)tv1->tv_usec == (unsigned)tv2->tv_usec);
@ -204,8 +204,8 @@ REGPRM2 static inline int __tv_iseq(const struct timeval *tv1, const struct time
/* tv_isgt: compares <tv1> and <tv2> : returns 1 if tv1 > tv2, otherwise 0 */
#define tv_isgt _tv_isgt
REGPRM2 int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline int __tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2);
static inline int __tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
{
return
((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) ?
@ -215,7 +215,7 @@ REGPRM2 static inline int __tv_isgt(const struct timeval *tv1, const struct time
/* tv_isge: compares <tv1> and <tv2> : returns 1 if tv1 >= tv2, otherwise 0 */
#define tv_isge __tv_isge
REGPRM2 static inline int __tv_isge(const struct timeval *tv1, const struct timeval *tv2)
static inline int __tv_isge(const struct timeval *tv1, const struct timeval *tv2)
{
return
((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) ?
@ -225,7 +225,7 @@ REGPRM2 static inline int __tv_isge(const struct timeval *tv1, const struct time
/* tv_islt: compares <tv1> and <tv2> : returns 1 if tv1 < tv2, otherwise 0 */
#define tv_islt __tv_islt
REGPRM2 static inline int __tv_islt(const struct timeval *tv1, const struct timeval *tv2)
static inline int __tv_islt(const struct timeval *tv1, const struct timeval *tv2)
{
return
((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) ?
@ -235,8 +235,8 @@ REGPRM2 static inline int __tv_islt(const struct timeval *tv1, const struct time
/* tv_isle: compares <tv1> and <tv2> : returns 1 if tv1 <= tv2, otherwise 0 */
#define tv_isle _tv_isle
REGPRM2 int _tv_isle(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline int __tv_isle(const struct timeval *tv1, const struct timeval *tv2)
int _tv_isle(const struct timeval *tv1, const struct timeval *tv2);
static inline int __tv_isle(const struct timeval *tv1, const struct timeval *tv2)
{
return
((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) ?
@ -249,8 +249,8 @@ REGPRM2 static inline int __tv_isle(const struct timeval *tv1, const struct time
* Must not be used when either argument is eternity. Use tv_ms_cmp2() for that.
*/
#define tv_ms_cmp _tv_ms_cmp
REGPRM2 int _tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline int __tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2);
static inline int __tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2)
{
if ((unsigned)tv1->tv_sec == (unsigned)tv2->tv_sec) {
if ((unsigned)tv2->tv_usec >= (unsigned)tv1->tv_usec + 1000)
@ -277,8 +277,8 @@ REGPRM2 static inline int __tv_ms_cmp(const struct timeval *tv1, const struct ti
* assuming that TV_ETERNITY is greater than everything.
*/
#define tv_ms_cmp2 _tv_ms_cmp2
REGPRM2 int _tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline int __tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2);
static inline int __tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2)
{
if (tv_iseternity(tv1))
if (tv_iseternity(tv2))
@ -297,8 +297,8 @@ REGPRM2 static inline int __tv_ms_cmp2(const struct timeval *tv1, const struct t
* occurrences of (tv_ms_cmp2(tv,now) <= 0).
*/
#define tv_ms_le2 _tv_ms_le2
REGPRM2 int _tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline int __tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2);
static inline int __tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2)
{
if (likely((unsigned)tv1->tv_sec > (unsigned)tv2->tv_sec + 1))
return 0;
@ -329,8 +329,8 @@ REGPRM2 static inline int __tv_ms_le2(const struct timeval *tv1, const struct ti
* Must not be used when either argument is eternity.
*/
#define tv_ms_elapsed __tv_ms_elapsed
REGPRM2 unsigned long _tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline unsigned long __tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2);
static inline unsigned long __tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2)
{
unsigned long ret;
@ -346,8 +346,8 @@ REGPRM2 static inline unsigned long __tv_ms_elapsed(const struct timeval *tv1, c
*/
#define tv_ms_remain __tv_ms_remain
REGPRM2 unsigned long _tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline unsigned long __tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2);
static inline unsigned long __tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2)
{
if (tv_ms_cmp(tv1, tv2) >= 0)
return 0; /* event elapsed */
@ -361,8 +361,8 @@ REGPRM2 static inline unsigned long __tv_ms_remain(const struct timeval *tv1, co
* Returns TIME_ETERNITY if tv2 is eternity.
*/
#define tv_ms_remain2 _tv_ms_remain2
REGPRM2 unsigned long _tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2);
REGPRM2 static inline unsigned long __tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2);
static inline unsigned long __tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2)
{
if (tv_iseternity(tv2))
return TIME_ETERNITY;
@ -374,8 +374,8 @@ REGPRM2 static inline unsigned long __tv_ms_remain2(const struct timeval *tv1, c
* adds <inc> to <from>, set the result to <tv> and returns a pointer <tv>
*/
#define tv_add _tv_add
REGPRM3 struct timeval *_tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc);
REGPRM3 static inline struct timeval *__tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
struct timeval *_tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc);
static inline struct timeval *__tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
{
tv->tv_usec = from->tv_usec + inc->tv_usec;
tv->tv_sec = from->tv_sec + inc->tv_sec;
@ -392,8 +392,8 @@ REGPRM3 static inline struct timeval *__tv_add(struct timeval *tv, const struct
* return 1, otherwise return 0. It is meant to be used in if conditions.
*/
#define tv_add_ifset _tv_add_ifset
REGPRM3 int _tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc);
REGPRM3 static inline int __tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
int _tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc);
static inline int __tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
{
if (tv_iseternity(inc))
return 0;
@ -409,7 +409,7 @@ REGPRM3 static inline int __tv_add_ifset(struct timeval *tv, const struct timeva
/*
* adds <inc> to <tv> and returns a pointer <tv>
*/
REGPRM2 static inline struct timeval *__tv_add2(struct timeval *tv, const struct timeval *inc)
static inline struct timeval *__tv_add2(struct timeval *tv, const struct timeval *inc)
{
tv->tv_usec += inc->tv_usec;
tv->tv_sec += inc->tv_sec;
@ -426,8 +426,8 @@ REGPRM2 static inline struct timeval *__tv_add2(struct timeval *tv, const struct
* 0 is returned. The result is stored into tv.
*/
#define tv_remain _tv_remain
REGPRM3 struct timeval *_tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv);
REGPRM3 static inline struct timeval *__tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
struct timeval *_tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv);
static inline struct timeval *__tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
{
tv->tv_usec = tv2->tv_usec - tv1->tv_usec;
tv->tv_sec = tv2->tv_sec - tv1->tv_sec;
@ -453,8 +453,8 @@ REGPRM3 static inline struct timeval *__tv_remain(const struct timeval *tv1, con
* eternity.
*/
#define tv_remain2 _tv_remain2
REGPRM3 struct timeval *_tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv);
REGPRM3 static inline struct timeval *__tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
struct timeval *_tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv);
static inline struct timeval *__tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
{
if (tv_iseternity(tv2))
return tv_eternity(tv);
@ -466,8 +466,8 @@ REGPRM3 static inline struct timeval *__tv_remain2(const struct timeval *tv1, co
* adds <ms> ms to <from>, set the result to <tv> and returns a pointer <tv>
*/
#define tv_ms_add _tv_ms_add
REGPRM3 struct timeval *_tv_ms_add(struct timeval *tv, const struct timeval *from, int ms);
REGPRM3 static inline struct timeval *__tv_ms_add(struct timeval *tv, const struct timeval *from, int ms)
struct timeval *_tv_ms_add(struct timeval *tv, const struct timeval *from, int ms);
static inline struct timeval *__tv_ms_add(struct timeval *tv, const struct timeval *from, int ms)
{
tv->tv_usec = from->tv_usec + (ms % 1000) * 1000;
tv->tv_sec = from->tv_sec + (ms / 1000);

View File

@ -167,12 +167,12 @@ struct fdinfo {
struct poller {
void *private; /* any private data for the poller */
void REGPRM1 (*clo)(const int fd); /* mark <fd> as closed */
void REGPRM3 (*poll)(struct poller *p, int exp, int wake); /* the poller itself */
int REGPRM1 (*init)(struct poller *p); /* poller initialization */
void REGPRM1 (*term)(struct poller *p); /* termination of this poller */
int REGPRM1 (*test)(struct poller *p); /* pre-init check of the poller */
int REGPRM1 (*fork)(struct poller *p); /* post-fork re-opening */
void (*clo)(const int fd); /* mark <fd> as closed */
void (*poll)(struct poller *p, int exp, int wake); /* the poller itself */
int (*init)(struct poller *p); /* poller initialization */
void (*term)(struct poller *p); /* termination of this poller */
int (*test)(struct poller *p); /* pre-init check of the poller */
int (*fork)(struct poller *p); /* post-fork re-opening */
const char *name; /* poller name */
unsigned int flags; /* HAP_POLL_F_* */
int pref; /* try pollers with higher preference first */

View File

@ -45,7 +45,7 @@ static int epoll_fd[MAX_THREADS]; // per-thread epoll_fd
* send us events even though this process closed the fd (see man 7 epoll,
* "Questions and answers", Q 6).
*/
REGPRM1 static void __fd_clo(int fd)
static void __fd_clo(int fd)
{
if (unlikely(fdtab[fd].cloned)) {
unsigned long m = polled_mask[fd].poll_recv | polled_mask[fd].poll_send;
@ -134,7 +134,7 @@ static void _update_fd(int fd)
/*
* Linux epoll() poller
*/
REGPRM3 static void _do_poll(struct poller *p, int exp, int wake)
static void _do_poll(struct poller *p, int exp, int wake)
{
int status;
int fd;
@ -283,7 +283,7 @@ static void deinit_epoll_per_thread()
* Returns 0 in case of failure, non-zero in case of success. If it fails, it
* disables the poller by setting its pref to 0.
*/
REGPRM1 static int _do_init(struct poller *p)
static int _do_init(struct poller *p)
{
p->private = NULL;
@ -305,7 +305,7 @@ REGPRM1 static int _do_init(struct poller *p)
* Termination of the epoll() poller.
* Memory is released and the poller is marked as unselectable.
*/
REGPRM1 static void _do_term(struct poller *p)
static void _do_term(struct poller *p)
{
if (epoll_fd[tid] >= 0) {
close(epoll_fd[tid]);
@ -320,7 +320,7 @@ REGPRM1 static void _do_term(struct poller *p)
* Check that the poller works.
* Returns 1 if OK, otherwise 0.
*/
REGPRM1 static int _do_test(struct poller *p)
static int _do_test(struct poller *p)
{
int fd;
@ -337,7 +337,7 @@ REGPRM1 static int _do_test(struct poller *p)
* epoll_fd. Some side effects were encountered because of this, such
* as epoll_wait() returning an FD which was previously deleted.
*/
REGPRM1 static int _do_fork(struct poller *p)
static int _do_fork(struct poller *p)
{
if (epoll_fd[tid] >= 0)
close(epoll_fd[tid]);

View File

@ -114,7 +114,7 @@ static void _update_fd(int fd)
* "src/fd.c" for more information.
*/
REGPRM3 static void _do_poll(struct poller *p, int exp, int wake)
static void _do_poll(struct poller *p, int exp, int wake)
{
int i;
int wait_time;
@ -330,7 +330,7 @@ static void deinit_evports_per_thread()
* Initialisation of the event ports poller.
* Returns 0 in case of failure, non-zero in case of success.
*/
REGPRM1 static int _do_init(struct poller *p)
static int _do_init(struct poller *p)
{
p->private = NULL;
@ -352,7 +352,7 @@ fail:
* Termination of the event ports poller.
* All resources are released and the poller is marked as inoperative.
*/
REGPRM1 static void _do_term(struct poller *p)
static void _do_term(struct poller *p)
{
if (evports_fd[tid] != -1) {
close(evports_fd[tid]);
@ -372,7 +372,7 @@ REGPRM1 static void _do_term(struct poller *p)
* the poller to function correctly.
* Returns 1 on success, otherwise 0.
*/
REGPRM1 static int _do_test(struct poller *p)
static int _do_test(struct poller *p)
{
int fd;
@ -389,7 +389,7 @@ REGPRM1 static int _do_test(struct poller *p)
* otherwise 0. If this function fails, "_do_term()" must be called to
* clean up the poller.
*/
REGPRM1 static int _do_fork(struct poller *p)
static int _do_fork(struct poller *p)
{
if (evports_fd[tid] != -1) {
close(evports_fd[tid]);

View File

@ -89,7 +89,7 @@ static int _update_fd(int fd, int start)
/*
* kqueue() poller
*/
REGPRM3 static void _do_poll(struct poller *p, int exp, int wake)
static void _do_poll(struct poller *p, int exp, int wake)
{
int status;
int count, fd, wait_time;
@ -261,7 +261,7 @@ static void deinit_kqueue_per_thread()
* Returns 0 in case of failure, non-zero in case of success. If it fails, it
* disables the poller by setting its pref to 0.
*/
REGPRM1 static int _do_init(struct poller *p)
static int _do_init(struct poller *p)
{
p->private = NULL;
@ -294,7 +294,7 @@ fail_alloc:
* Termination of the kqueue() poller.
* Memory is released and the poller is marked as unselectable.
*/
REGPRM1 static void _do_term(struct poller *p)
static void _do_term(struct poller *p)
{
if (kqueue_fd[tid] >= 0) {
close(kqueue_fd[tid]);
@ -313,7 +313,7 @@ REGPRM1 static void _do_term(struct poller *p)
* Check that the poller works.
* Returns 1 if OK, otherwise 0.
*/
REGPRM1 static int _do_test(struct poller *p)
static int _do_test(struct poller *p)
{
int fd;
@ -329,7 +329,7 @@ REGPRM1 static int _do_test(struct poller *p)
* otherwise 0. Note that some pollers need to be reopened after a fork()
* (such as kqueue), and some others may fail to do so in a chroot.
*/
REGPRM1 static int _do_fork(struct poller *p)
static int _do_fork(struct poller *p)
{
kqueue_fd[tid] = kqueue();
if (kqueue_fd[tid] < 0)

View File

@ -41,7 +41,7 @@ static unsigned int *fd_evts[2];
static THREAD_LOCAL int nbfd = 0;
static THREAD_LOCAL struct pollfd *poll_events = NULL;
REGPRM1 static void __fd_clo(int fd)
static void __fd_clo(int fd)
{
hap_fd_clr(fd, fd_evts[DIR_RD]);
hap_fd_clr(fd, fd_evts[DIR_WR]);
@ -98,7 +98,7 @@ static void _update_fd(int fd, int *max_add_fd)
/*
* Poll() poller
*/
REGPRM3 static void _do_poll(struct poller *p, int exp, int wake)
static void _do_poll(struct poller *p, int exp, int wake)
{
int status;
int fd;
@ -265,7 +265,7 @@ static void deinit_poll_per_thread()
* Returns 0 in case of failure, non-zero in case of success. If it fails, it
* disables the poller by setting its pref to 0.
*/
REGPRM1 static int _do_init(struct poller *p)
static int _do_init(struct poller *p)
{
__label__ fail_swevt, fail_srevt;
int fd_evts_bytes;
@ -295,7 +295,7 @@ REGPRM1 static int _do_init(struct poller *p)
* Termination of the poll() poller.
* Memory is released and the poller is marked as unselectable.
*/
REGPRM1 static void _do_term(struct poller *p)
static void _do_term(struct poller *p)
{
free(fd_evts[DIR_WR]);
free(fd_evts[DIR_RD]);
@ -307,7 +307,7 @@ REGPRM1 static void _do_term(struct poller *p)
* Check that the poller works.
* Returns 1 if OK, otherwise 0.
*/
REGPRM1 static int _do_test(struct poller *p)
static int _do_test(struct poller *p)
{
return 1;
}

View File

@ -32,7 +32,7 @@ static unsigned int *fd_evts[2];
static THREAD_LOCAL fd_set *tmp_evts[2];
/* Immediately remove the entry upon close() */
REGPRM1 static void __fd_clo(int fd)
static void __fd_clo(int fd)
{
hap_fd_clr(fd, fd_evts[DIR_RD]);
hap_fd_clr(fd, fd_evts[DIR_WR]);
@ -89,7 +89,7 @@ static void _update_fd(int fd, int *max_add_fd)
/*
* Select() poller
*/
REGPRM3 static void _do_poll(struct poller *p, int exp, int wake)
static void _do_poll(struct poller *p, int exp, int wake)
{
int status;
int fd, i;
@ -247,7 +247,7 @@ static void deinit_select_per_thread()
* Returns 0 in case of failure, non-zero in case of success. If it fails, it
* disables the poller by setting its pref to 0.
*/
REGPRM1 static int _do_init(struct poller *p)
static int _do_init(struct poller *p)
{
__label__ fail_swevt, fail_srevt, fail_revt;
int fd_set_bytes;
@ -283,7 +283,7 @@ REGPRM1 static int _do_init(struct poller *p)
* Termination of the select() poller.
* Memory is released and the poller is marked as unselectable.
*/
REGPRM1 static void _do_term(struct poller *p)
static void _do_term(struct poller *p)
{
free(fd_evts[DIR_WR]);
free(fd_evts[DIR_RD]);
@ -295,7 +295,7 @@ REGPRM1 static void _do_term(struct poller *p)
* Check that the poller works.
* Returns 1 if OK, otherwise 0.
*/
REGPRM1 static int _do_test(struct poller *p)
static int _do_test(struct poller *p)
{
if (global.maxsock > FD_SETSIZE)
return 0;

View File

@ -38,7 +38,7 @@ static THREAD_LOCAL char iso_time_str[28]; /* ISO time representation of
/*
* adds <ms> ms to <from>, set the result to <tv> and returns a pointer <tv>
*/
REGPRM3 struct timeval *_tv_ms_add(struct timeval *tv, const struct timeval *from, int ms)
struct timeval *_tv_ms_add(struct timeval *tv, const struct timeval *from, int ms)
{
tv->tv_usec = from->tv_usec + (ms % 1000) * 1000;
tv->tv_sec = from->tv_sec + (ms / 1000);
@ -53,7 +53,7 @@ REGPRM3 struct timeval *_tv_ms_add(struct timeval *tv, const struct timeval *fro
* compares <tv1> and <tv2> modulo 1ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2
* Must not be used when either argument is eternity. Use tv_ms_cmp2() for that.
*/
REGPRM2 int _tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_ms_cmp(tv1, tv2);
}
@ -62,7 +62,7 @@ REGPRM2 int _tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2)
* compares <tv1> and <tv2> modulo 1 ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2,
* assuming that TV_ETERNITY is greater than everything.
*/
REGPRM2 int _tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_ms_cmp2(tv1, tv2);
}
@ -73,7 +73,7 @@ REGPRM2 int _tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2)
* TV_ETERNITY, and always assumes that tv2 != TV_ETERNITY. Designed to replace
* occurrences of (tv_ms_cmp2(tv,now) <= 0).
*/
REGPRM2 int _tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2)
int _tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_ms_le2(tv1, tv2);
}
@ -83,7 +83,7 @@ REGPRM2 int _tv_ms_le2(const struct timeval *tv1, const struct timeval *tv2)
* if tv2 is passed, 0 is returned.
* Must not be used when either argument is eternity.
*/
REGPRM2 unsigned long _tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_remain(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_ms_remain(tv1, tv2);
}
@ -93,7 +93,7 @@ REGPRM2 unsigned long _tv_ms_remain(const struct timeval *tv1, const struct time
* if tv2 is passed, 0 is returned.
* Returns TIME_ETERNITY if tv2 is eternity.
*/
REGPRM2 unsigned long _tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_remain2(const struct timeval *tv1, const struct timeval *tv2)
{
if (tv_iseternity(tv2))
return TIME_ETERNITY;
@ -105,7 +105,7 @@ REGPRM2 unsigned long _tv_ms_remain2(const struct timeval *tv1, const struct tim
* Returns the time in ms elapsed between tv1 and tv2, assuming that tv1<=tv2.
* Must not be used when either argument is eternity.
*/
REGPRM2 unsigned long _tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2)
unsigned long _tv_ms_elapsed(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_ms_elapsed(tv1, tv2);
}
@ -113,7 +113,7 @@ REGPRM2 unsigned long _tv_ms_elapsed(const struct timeval *tv1, const struct tim
/*
* adds <inc> to <from>, set the result to <tv> and returns a pointer <tv>
*/
REGPRM3 struct timeval *_tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
struct timeval *_tv_add(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
{
return __tv_add(tv, from, inc);
}
@ -122,7 +122,7 @@ REGPRM3 struct timeval *_tv_add(struct timeval *tv, const struct timeval *from,
* If <inc> is set, then add it to <from> and set the result to <tv>, then
* return 1, otherwise return 0. It is meant to be used in if conditions.
*/
REGPRM3 int _tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
int _tv_add_ifset(struct timeval *tv, const struct timeval *from, const struct timeval *inc)
{
return __tv_add_ifset(tv, from, inc);
}
@ -131,7 +131,7 @@ REGPRM3 int _tv_add_ifset(struct timeval *tv, const struct timeval *from, const
* Computes the remaining time between tv1=now and event=tv2. if tv2 is passed,
* 0 is returned. The result is stored into tv.
*/
REGPRM3 struct timeval *_tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
struct timeval *_tv_remain(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
{
return __tv_remain(tv1, tv2, tv);
}
@ -141,19 +141,19 @@ REGPRM3 struct timeval *_tv_remain(const struct timeval *tv1, const struct timev
* 0 is returned. The result is stored into tv. Returns ETERNITY if tv2 is
* eternity.
*/
REGPRM3 struct timeval *_tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
struct timeval *_tv_remain2(const struct timeval *tv1, const struct timeval *tv2, struct timeval *tv)
{
return __tv_remain2(tv1, tv2, tv);
}
/* tv_isle: compares <tv1> and <tv2> : returns 1 if tv1 <= tv2, otherwise 0 */
REGPRM2 int _tv_isle(const struct timeval *tv1, const struct timeval *tv2)
int _tv_isle(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_isle(tv1, tv2);
}
/* tv_isgt: compares <tv1> and <tv2> : returns 1 if tv1 > tv2, otherwise 0 */
REGPRM2 int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
{
return __tv_isgt(tv1, tv2);
}
@ -175,7 +175,7 @@ REGPRM2 int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
* microsecond adjustment. We cannot use a timeval for this since it's never
* clearly specified whether a timeval may hold negative values or not.
*/
REGPRM2 void tv_update_date(int max_wait, int interrupted)
void tv_update_date(int max_wait, int interrupted)
{
struct timeval adjusted, deadline, tmp_now, tmp_adj;
unsigned int curr_sec_ms; /* millisecond of current second (0..999) */