BUG/MINOR: threads: Add missing THREAD_LOCAL on static here and there
diff --git a/src/checks.c b/src/checks.c
index 8411fef..c9e655d 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -2380,7 +2380,7 @@
*/
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;
diff --git a/src/cli.c b/src/cli.c
index 97e3086..9ca8e1f 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -81,7 +81,7 @@
"";
-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 = {
diff --git a/src/proto_http.c b/src/proto_http.c
index 390de89..ca99188 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -267,7 +267,7 @@
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
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 200f642..d5345ee 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -116,8 +116,8 @@
/* 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 @@
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 @@
}
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);
diff --git a/src/raw_sock.c b/src/raw_sock.c
index 5bef5f7..ad02101 100644
--- a/src/raw_sock.c
+++ b/src/raw_sock.c
@@ -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;
diff --git a/src/standard.c b/src/standard.c
index 77641b4..34d4148 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -837,7 +837,7 @@
*/
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 @@
*/
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 @@
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;
diff --git a/src/stats.c b/src/stats.c
index f688319..1e4d6ff 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -218,9 +218,9 @@
};
/* 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];