diff --git a/include/haproxy/cfgparse.h b/include/haproxy/cfgparse.h index 3896b57ec..20d72972d 100644 --- a/include/haproxy/cfgparse.h +++ b/include/haproxy/cfgparse.h @@ -97,6 +97,8 @@ extern struct cfg_kw_list cfg_keywords; extern char *cursection; extern int non_global_section_parsed; +extern struct proxy *curproxy; + int cfg_parse_global(const char *file, int linenum, char **args, int inv); int cfg_parse_listen(const char *file, int linenum, char **args, int inv); int cfg_parse_track_sc_num(unsigned int *track_sc_num, diff --git a/include/haproxy/timeshift.h b/include/haproxy/timeshift.h new file mode 100644 index 000000000..62e58550f --- /dev/null +++ b/include/haproxy/timeshift.h @@ -0,0 +1,10 @@ +#include +#include + +#define gettimeofday(tv, tz) timeshift_gettimeofday(tv, tz) +#define clock_gettime(clk_id, tp) timeshift_clock_gettime(clk_id, tp) +#define epoll_wait(epfd, events, maxevents, timeout) timeshift_epoll_wait(epfd, events, maxevents, timeout) + +int timeshift_gettimeofday(struct timeval *tv, void *tz); +int timeshift_clock_gettime(clockid_t clk_id, struct timespec *tp); +int timeshift_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout); diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 3864a11c8..292f1626e 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -201,7 +201,6 @@ int warnif_misplaced_tcp_conn(struct proxy *proxy, const char *file, int line, c int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) { - static struct proxy *curproxy = NULL; static struct proxy *curr_defproxy = NULL; static struct proxy *last_defproxy = NULL; const char *err; diff --git a/src/cfgparse.c b/src/cfgparse.c index d5422f2c5..2948a51fa 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -101,6 +101,9 @@ struct list postparsers = LIST_HEAD_INIT(postparsers); extern struct proxy *mworker_proxy; +/* curproxy is only valid during parsing and will be NULL afterwards. */ +struct proxy *curproxy; + char *cursection = NULL; int cfg_maxpconn = 0; /* # of simultaneous connections per proxy (-N) */ int cfg_maxconn = 0; /* # of simultaneous connections, (-n) */