]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move time.h from common/ to haproxy/
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2020 09:05:15 +0000 (11:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:56 +0000 (10:18 +0200)
This one is included almost everywhere and used to rely on a few other
.h that are not needed (unistd, stdlib, standard.h). It could possibly
make sense to split it into multiple parts to distinguish operations
performed on timers and the internal time accounting, but at this point
it does not appear much important.

46 files changed:
contrib/mod_defender/defender.c
contrib/modsecurity/modsec_wrapper.c
include/haproxy/time.h [moved from include/common/time.h with 98% similarity]
include/proto/activity.h
include/proto/backend.h
include/proto/channel.h
include/proto/fd.h
include/proto/freq_ctr.h
include/proto/peers.h
include/proto/proxy.h
include/proto/server.h
include/proto/stick_table.h
src/backend.c
src/calltrace.c
src/cfgparse.c
src/checks.c
src/cli.c
src/dns.c
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/flt_spoe.c
src/flt_trace.c
src/freq_ctr.c
src/frontend.c
src/haproxy.c
src/hlua_fcn.c
src/listener.c
src/log.c
src/peers.c
src/proto_sockpair.c
src/proto_uxst.c
src/proxy.c
src/queue.c
src/raw_sock.c
src/server.c
src/sink.c
src/ssl_sock.c
src/stats.c
src/stick_table.c
src/stream_interface.c
src/task.c
src/tcp_rules.c
src/time.c

index b552a7c717e636329e6299571da1a46f374fdfd4..f3b9055118c158bff6b4f39416801c7c55d607bd 100644 (file)
@@ -21,7 +21,7 @@
 #include <haproxy/api.h>
 #include <common/standard.h>
 #include <common/chunk.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <proto/spoe.h>
 
index 7ae831e5c2728bdefc93cc77c5fce87c24921a45..056da542acd34f3cb9e211542deb5af796b00a14 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 #include <types/stream.h>
similarity index 98%
rename from include/common/time.h
rename to include/haproxy/time.h
index d6863d42c89d44a0cbb39e50b223d3dc5131d1f5..4f1dc854543827bcc0af44f991250366913c2990 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * include/common/time.h
+ * include/haproxy/time.h
  * Time calculation functions and macros.
  *
- * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _COMMON_TIME_H
-#define _COMMON_TIME_H
+#ifndef _HAPROXY_TIME_H
+#define _HAPROXY_TIME_H
 
-#include <stdlib.h>
-#include <unistd.h>
 #include <sys/time.h>
+#include <time.h>
 #include <haproxy/api.h>
 #include <haproxy/thread.h>
-#include <common/standard.h>
 
 /* eternity when exprimed in timeval */
 #ifndef TV_ETERNITY
@@ -82,16 +80,6 @@ int tv_ms_cmp(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 */
-static inline struct timeval *tv_now(struct timeval *tv)
-{
-       gettimeofday(tv, NULL);
-       return tv;
-}
-
 /* tv_udpate_date: sets <date> to system time, and sets <now> to something as
  * close as possible to real time, following a monotonic function. The main
  * principle consists in detecting backwards and forwards time jumps and adjust
@@ -104,6 +92,16 @@ void tv_update_date(int max_wait, int interrupted);
 
 char *timeofday_as_iso_us(int pad);
 
+/**** general purpose functions and macros *******************************/
+
+
+/* tv_now: sets <tv> to the current time */
+static inline struct timeval *tv_now(struct timeval *tv)
+{
+       gettimeofday(tv, NULL);
+       return tv;
+}
+
 /*
  * sets a struct timeval to its highest value so that it can never happen
  * note that only tv_usec is necessary to detect it since a tv_usec > 999999
@@ -602,7 +600,7 @@ static inline void tv_leaving_poll(int timeout, int interrupted)
        ti->prev_mono_time = now_mono_time();
 }
 
-#endif /* _COMMON_TIME_H */
+#endif /* _HAPROXY_TIME_H */
 
 /*
  * Local variables:
index 9d5044a08be834a0382baea62083eed74402a54e..9ca9a4294eb57c8cf5825032d7b554e2e3501c8b 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <haproxy/atomic.h>
 #include <haproxy/api.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/activity.h>
 #include <proto/freq_ctr.h>
 
index 516049286f728ea2b09541b14a56afaf066e7e23..f702be9c20aeaf1e4eddbdf5fe642ec5364717e0 100644 (file)
@@ -23,7 +23,7 @@
 #define _PROTO_BACKEND_H
 
 #include <haproxy/api.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/backend.h>
 #include <types/proxy.h>
index 16954bac05ee8e46c84d34ae390f0e72f8cac62a..eaaa36bcce0d359e15c87831d7cd62dd96cd15b6 100644 (file)
@@ -31,7 +31,7 @@
 #include <common/chunk.h>
 #include <common/htx.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/channel.h>
 #include <types/global.h>
index 9426e1447df7d52c8ffcd7b4e1f85947970fb323..f882b54a771d8973b27895b24245db4afb18e30a 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <haproxy/api.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/fd.h>
 #include <proto/activity.h>
 
index 80529bf23ca48eecd283c210c18b96777d26843f..896a4694e4f33ad5fe327ff698a1c40ea5da09cd 100644 (file)
@@ -25,7 +25,7 @@
 #include <haproxy/atomic.h>
 #include <haproxy/api.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/freq_ctr.h>
 
 
index fbe6cf6a66d9a95f59416bba2422fe4d93a93f69..02fc67d69d5255673ceda51839fb297650825b61 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <proto/connection.h>
 #include <types/stream.h>
 #include <types/peers.h>
index 630a0112e850fd17ac7f75104fb6964d8b2dfd5d..066e8076a834b3fa1220a0c21e015d73bc5af91f 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/applet.h>
 #include <types/global.h>
 #include <types/proxy.h>
index e184310fc0055845717119f94fe8161d5b3821ff..d15808953fcdd42f97bb4b9a0c7bf583ba7a70a5 100644 (file)
@@ -25,7 +25,7 @@
 #include <unistd.h>
 
 #include <haproxy/api.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/applet.h>
 #include <types/dns.h>
 #include <types/proxy.h>
index 986c7755f7e6ca1161bd066caa1d01f2a1b0b44f..dcc29546b7383fcfef962404c0acc2af17bc4e57 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <haproxy/errors.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <types/stick_table.h>
 #include <types/dict.h>
 
index c876003f9d05575e4c926129c3827344640fe021..ff6c37d2bdd760ec31534d69099b7fecbb7aa96c 100644 (file)
@@ -24,7 +24,7 @@
 #include <haproxy/hash.h>
 #include <common/htx.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/namespace.h>
 
 #include <types/global.h>
index a4f3bbe9f254b43d158eee3c7ecda7d5d2f615dd..2208ca11bc606832e598845d20c92f7f75cfd26b 100644 (file)
@@ -48,7 +48,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <haproxy/api.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 static FILE *log;
 static int level;
index f4de78a9b49dc6af1462da44366cc28240543927..a1917fa238a60829499765b28ef22171e02f51b1 100644 (file)
@@ -39,7 +39,7 @@
 #include <haproxy/errors.h>
 #include <common/memory.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/uri_auth.h>
 #include <common/namespace.h>
 #include <haproxy/thread.h>
index 92f1e4a2010f75545666ea3040d82cf1164ecfa3..6744e2d3c40bdd6477aa60a497b10d892c4e4be1 100644 (file)
@@ -35,7 +35,7 @@
 #include <common/chunk.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/thread.h>
 #include <common/http.h>
 #include <common/h1.h>
index 4b9c31f97587e7d537732d478e87ad82f3b01383..6c7bc3f525c54a8352d48de024cefefbe1a9133a 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -32,7 +32,7 @@
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/uri_auth.h>
 #include <haproxy/version.h>
 #include <haproxy/base64.h>
index b11622c263fef7a4e04bf06b2a88ac8868c4685e..73258c0eccd08a803622102604e43f7788fe4704 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -22,7 +22,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/ticks.h>
 #include <common/net_helper.h>
 
index 132d4876a14038727dde15ed1fc026062e88c2c9..8378383af867d46b27c8169ad4b9cfc2e7342ffc 100644 (file)
@@ -18,7 +18,7 @@
 #include <haproxy/thread-t.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index e440f154472c4b09095c35a27798795a60485fe0..359acf9532aebf3d3855693648562618a3704244 100644 (file)
@@ -21,7 +21,7 @@
 #include <haproxy/api.h>
 #include <haproxy/thread-t.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index 5b14d51fd3cef9b1132ecf2a00ad4d057ce6ce83..efc2ecf760ee7347df8fc56bd98e49cdd0f67bc2 100644 (file)
@@ -20,7 +20,7 @@
 #include <haproxy/api.h>
 #include <haproxy/thread-t.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index c3c52f0db27bcc43f6d45d71487799dc3bc5e5b9..7239732d83bdb27557dcafc7070cd86f5d3c328d 100644 (file)
@@ -20,7 +20,7 @@
 #include <haproxy/api.h>
 #include <haproxy/thread-t.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index 3b02bed40d82973b5d8c95dcf44afa721220d8d5..9168f59aa9d06636ba9a480e95194876ea506ffb 100644 (file)
@@ -17,7 +17,7 @@
 #include <haproxy/api.h>
 #include <haproxy/thread-t.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index 7021e556d5a1be468cb19bc9d054afcd96c3587d..930c2ecbf6a547d2ce71728fff9a130021fc4673 100644 (file)
@@ -16,7 +16,7 @@
 #include <common/cfgparse.h>
 #include <haproxy/thread.h>
 #include <common/memory.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/arg.h>
 #include <types/global.h>
index fdc74a7eb52f26dd3128d87f20d31164d2fd16af..69862aec7cc0d3c360362b8d127b9348da5266c4 100644 (file)
@@ -15,7 +15,7 @@
 #include <haproxy/api.h>
 #include <common/htx.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/channel.h>
 #include <types/filters.h>
index 56ac97d2aa9b121ea0da2840507c6600e7e224e4..16201560db944ac3d59f7ffb11d7e2df0e13743c 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <haproxy/api.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <proto/freq_ctr.h>
 
 /* Read a frequency counter taking history into account for missing time in
index ce5c3d76233ab10916cf0d6bf51d69872821f1d0..b111e6ad51f1e3efbc5f01549a85a683ca3d5d02 100644 (file)
@@ -25,7 +25,7 @@
 #include <haproxy/api.h>
 #include <common/chunk.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 
index 67e423783a79bb6ace4e8f93ab1ec5d74e4d23cb..a2ceeec575e6a45bdde3befad0cf5e437ecea0cb 100644 (file)
@@ -92,7 +92,7 @@
 #include <haproxy/openssl-compat.h>
 #include <common/regex.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/uri_auth.h>
 #include <haproxy/version.h>
 #include <haproxy/thread.h>
index a91406603197af2c1f2206d03f9b9c1bbc572e8b..da975c0752286b5414787c5f1cf114ec01db2bcc 100644 (file)
@@ -19,7 +19,7 @@
 #include <lualib.h>
 
 #include <common/net_helper.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/uri_auth.h>
 
 #include <types/cli.h>
index 3315d60e78a0ef3b547f119bb2c933bd7f3ee1b9..8de3b37e94a1254839b20cfcf9d836b5c558082c 100644 (file)
@@ -23,7 +23,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/global.h>
 #include <types/protocol.h>
index a8bf820aada78d1b2da94a702aabcebcb0bfe96c..d4f49226c87da3568ec1e42e4af5c05d69f436a2 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -26,7 +26,7 @@
 
 #include <haproxy/api.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/version.h>
 
 #include <types/cli.h>
index 6d5a5de61fa8553f780363e8246a9bc724da390f..5f4dce3cbd3b5322b852dcf3e79caf61bcb83afe 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <haproxy/api.h>
 #include <common/net_helper.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/standard.h>
 #include <haproxy/thread.h>
 
index b6277247f4e908b1ec5993aa7f9de0db8bf0c69b..1c13518002ede141d5194bf020b20baf36c43531 100644 (file)
@@ -30,7 +30,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/version.h>
 
 #include <types/global.h>
index ae68a8d1d9fbf94398d18dbb9ca524abd9fbc9eb..99e4eff05893f813a6515c5c634c8c195b424ec6 100644 (file)
@@ -30,7 +30,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/version.h>
 
 #include <types/global.h>
index b5bc5ae9dacd2e0d46bf320b68e907baf6ba6533..5e29ec95c34f1077380e53165b3e4e6fed968a56 100644 (file)
@@ -21,7 +21,7 @@
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
 #include <common/memory.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <import/eb32tree.h>
 #include <import/ebistree.h>
index f2407ed671290108da93d58452ddf87fa8118fc0..e354e0a4844368979048bd0361091dd46418914b 100644 (file)
@@ -71,7 +71,7 @@
 
 #include <haproxy/api.h>
 #include <common/memory.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/thread.h>
 #include <import/eb32tree.h>
 
index 3612442c16623dc4b2f15a4617346da7a428fa45..1d930d80f4f255907d5662876ded920c3ccded41 100644 (file)
@@ -26,7 +26,7 @@
 #include <common/buffer.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <proto/connection.h>
 #include <proto/fd.h>
index bdf2c994db781ce606a1931a88a14da5393cc186..d06c46502e31dd457dff3d82cc9dd6c9bdad0121 100644 (file)
@@ -20,7 +20,7 @@
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
 #include <common/namespace.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/applet.h>
 #include <types/cli.h>
index 9ed75aca9b610e09db348516a79d984ad1876545..b5ecdde9a338e8f9bfa7fd8165a5787110783997 100644 (file)
@@ -22,7 +22,7 @@
 #include <common/cfgparse.h>
 #include <import/ist.h>
 #include <haproxy/list.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <proto/cli.h>
 #include <proto/log.h>
 #include <proto/ring.h>
index 0b0b4b9f12d2679aa7a33aa3dad8dfed46ec69b3..729f26c7ac895915b6085ab145ac79d49136f6fd 100644 (file)
@@ -50,7 +50,7 @@
 #include <haproxy/openssl-compat.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/base64.h>
 
 #include <import/ebpttree.h>
index e7a1e76f64987a41f54e2e6a8cb1e28e733fdfae..c0d0eb0732518081bbd1de3546ee0ce29702302a 100644 (file)
@@ -33,7 +33,7 @@
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <common/uri_auth.h>
 #include <haproxy/version.h>
 #include <haproxy/base64.h>
index dc2ef4f82f2184a9a57e72bbc04a69c057c519f8..0fb0927ba5f491652e755992e728d0bd6bcd6790 100644 (file)
@@ -20,7 +20,7 @@
 #include <haproxy/list.h>
 #include <common/net_helper.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <import/ebmbtree.h>
 #include <import/ebsttree.h>
index 91f844b9714beab02d2d15105ee0b0e5ff424273..89f37ee13f236e5f3c0282b2cda0d275b41284b4 100644 (file)
@@ -23,7 +23,7 @@
 #include <common/buffer.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <proto/applet.h>
 #include <proto/channel.h>
index 55a54a47125b23143d5eab10cb1cefc5dade01d3..452530ef33dda8849e6dc8400144599f7b97dccc 100644 (file)
@@ -16,7 +16,7 @@
 #include <common/memory.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <import/eb32sctree.h>
 #include <import/eb32tree.h>
 
index 194301874f02c35c123aec3578fa0752decffa5d..f79d2a3f7893ac95da71d227a548abd438b18c97 100644 (file)
@@ -14,7 +14,7 @@
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 
 #include <types/arg.h>
 #include <types/capture.h>
index 86c2469878ddfeb9d4442ebd50e241d1252180a1..a6aaf4033987777d989c0e7e4940f6676ae45568 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <haproxy/api.h>
 #include <common/standard.h>
-#include <common/time.h>
+#include <haproxy/time.h>
 #include <haproxy/thread-t.h>
 
 THREAD_LOCAL unsigned int   ms_left_scaled;  /* milliseconds left for current second (0..2^32-1) */