]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: threads: Add missing THREAD_LOCAL on static here and there
authorChristopher Faulet <cfaulet@haproxy.com>
Sun, 29 Oct 2017 19:14:08 +0000 (20:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:33 +0000 (13:58 +0100)
src/checks.c
src/cli.c
src/proto_http.c
src/proto_tcp.c
src/raw_sock.c
src/standard.c
src/stats.c

index 8411fefae3b301ae47e52c9ed9632a8597936f6f..c9e655dbe463ae4a393b0ab754dd484c594be621 100644 (file)
@@ -2380,7 +2380,7 @@ static int start_checks()
  */
 static int httpchk_expect(struct server *s, int done)
 {
-       static char status_msg[] = "HTTP status check returned code <000>";
+       static THREAD_LOCAL char status_msg[] = "HTTP status check returned code <000>";
        char status_code[] = "000";
        char *contentptr;
        int crlf;
index 97e3086e6056cba913420dfa31f937439e5948a8..9ca8e1fcf743a733a97f2bfc9db4ecd4715e461b 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -81,7 +81,7 @@ static const char stats_permission_denied_msg[] =
        "";
 
 
-static char *dynamic_usage_msg = NULL;
+static THREAD_LOCAL char *dynamic_usage_msg = NULL;
 
 /* List head of cli keywords */
 static struct cli_kw_list cli_keywords = {
index 390de89ec85a53eeec0b9c2e9573c1ef3c42750a..ca991889699f176b1379cc50d857791818de75b8 100644 (file)
@@ -267,7 +267,7 @@ struct action_kw_list http_res_keywords = {
 struct chunk http_err_chunks[HTTP_ERR_SIZE];
 
 /* this struct is used between calls to smp_fetch_hdr() or smp_fetch_cookie() */
-static struct hdr_ctx static_hdr_ctx;
+static THREAD_LOCAL struct hdr_ctx static_hdr_ctx;
 
 #define FD_SETS_ARE_BITFIELDS
 #ifdef FD_SETS_ARE_BITFIELDS
index 200f642cca885d6bec864735425b95fd37985196..d5345ee3c32c2881645e036565992f33bab184cc 100644 (file)
@@ -116,8 +116,8 @@ static struct protocol proto_tcpv6 = {
 
 /* Default TCP parameters, got by opening a temporary TCP socket. */
 #ifdef TCP_MAXSEG
-static int default_tcp_maxseg = -1;
-static int default_tcp6_maxseg = -1;
+static THREAD_LOCAL int default_tcp_maxseg = -1;
+static THREAD_LOCAL int default_tcp6_maxseg = -1;
 #endif
 
 /* Binds ipv4/ipv6 address <local> to socket <fd>, unless <flags> is set, in which
@@ -138,8 +138,8 @@ int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct so
        struct sockaddr_storage bind_addr;
        int foreign_ok = 0;
        int ret;
-       static int ip_transp_working = 1;
-       static int ip6_transp_working = 1;
+       static THREAD_LOCAL int ip_transp_working = 1;
+       static THREAD_LOCAL int ip6_transp_working = 1;
 
        switch (local->ss_family) {
        case AF_INET:
@@ -433,7 +433,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
                }
                else {
 #ifdef IP_BIND_ADDRESS_NO_PORT
-                       static int bind_address_no_port = 1;
+                       static THREAD_LOCAL int bind_address_no_port = 1;
                        setsockopt(fd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, (const void *) &bind_address_no_port, sizeof(int));
 #endif
                        ret = tcp_bind_socket(fd, flags, &src->source_addr, &conn->addr.from);
index 5bef5f797d4ffd7762a1b6e5d75c4f0062d4a28d..ad0210105688bc02ce170e21ae9bd2ac565e2b85 100644 (file)
@@ -69,7 +69,7 @@
 int raw_sock_to_pipe(struct connection *conn, struct pipe *pipe, unsigned int count)
 {
 #ifndef ASSUME_SPLICE_WORKS
-       static int splice_detects_close;
+       static THREAD_LOCAL int splice_detects_close;
 #endif
        int ret;
        int retval = 0;
index 77641b4271492620d02fad725eb46b187593ed62..34d4148d492b9d12a47fe52677ad9abffc45b882 100644 (file)
@@ -837,7 +837,7 @@ struct sockaddr_storage *str2ip2(const char *str, struct sockaddr_storage *sa, i
  */
 struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int *high, char **err, const char *pfx, char **fqdn, int resolve)
 {
-       static struct sockaddr_storage ss;
+       static THREAD_LOCAL struct sockaddr_storage ss;
        struct sockaddr_storage *ret = NULL;
        char *back, *str2;
        char *port1, *port2;
@@ -2493,7 +2493,7 @@ int buf2ip6(const char *buf, size_t len, struct in6_addr *dst)
  */
 const char *quote_arg(const char *ptr)
 {
-       static char val[32];
+       static THREAD_LOCAL char val[32];
        int i;
 
        if (!ptr || !*ptr)
@@ -2764,7 +2764,7 @@ static int my_tm_diff(const struct tm *a, const struct tm *b)
 const char *get_gmt_offset(time_t t, struct tm *tm)
 {
        /* Cache offsets from GMT (depending on whether DST is active or not) */
-       static char gmt_offsets[2][5+1] = { "", "" };
+       static THREAD_LOCAL char gmt_offsets[2][5+1] = { "", "" };
 
        char *gmt_offset;
        struct tm tm_gmt;
index f688319339efbeec3b1583007babba31ea5dcecb..1e4d6ffa4739c9f5a59bf2393873bf54f1e21403 100644 (file)
@@ -218,9 +218,9 @@ const char *stat_field_names[ST_F_TOTAL_FIELDS] = {
 };
 
 /* one line of info */
-static struct field info[INF_TOTAL_FIELDS];
+static THREAD_LOCAL struct field info[INF_TOTAL_FIELDS];
 /* one line of stats */
-static struct field stats[ST_F_TOTAL_FIELDS];
+static THREAD_LOCAL struct field stats[ST_F_TOTAL_FIELDS];