# 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.
# 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 \
OPTIONS_OBJS += src/i386-linux-vsys.o
endif
-ifneq ($(USE_REGPARM),)
-OPTIONS_CFLAGS += -DCONFIG_REGPARM=3
-endif
-
ifneq ($(USE_DL),)
OPTIONS_LDFLAGS += -ldl
endif
/* 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;
* 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;
* 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;
* 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;
* 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
#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);
}
* 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;
* 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;
* 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
#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);
}
* 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;
* 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;
* 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
/* 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);
* 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);
/* 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
* 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);
}
* 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);
}
/* 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
/* 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);
* 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);
* 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);
/* 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);
* 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);
/* 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.
#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);
}
* 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;
* 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;
* 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);
}
* 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);
}
/* 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
}
/* 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);
}
/* 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 */
#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.
*/
/*
* 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;
* 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);
* 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;
* 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;
}
/*
* 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;
/*
* 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;
* 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;
}
/* 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;
/* 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);
/* 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) ?
/* 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) ?
/* 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) ?
/* 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) ?
* 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)
* 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))
* 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;
* 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;
*/
#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 */
* 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;
* 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;
* 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;
/*
* 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;
* 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;
* 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);
* 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);
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 */
* 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;
/*
* 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;
* 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;
* 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]);
* 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;
* 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]);
* "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;
* 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;
* 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]);
* 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;
* 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]);
/*
* 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;
* 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;
* 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]);
* 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;
* 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)
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]);
/*
* 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;
* 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;
* 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]);
* 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;
}
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]);
/*
* 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;
* 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;
* 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]);
* 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;
/*
* 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);
* 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);
}
* 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);
}
* 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);
}
* 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);
}
* 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;
* 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);
}
/*
* 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);
}
* 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);
}
* 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);
}
* 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);
}
* 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) */