aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2020-12-29 14:59:31 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2020-12-29 14:59:37 +0000
commit89e3d5671ba13dceca272d5b159c9bd805f3f504 (patch)
treee630f32278463736fbffbcadb1af3c8aaab85604 /contrib
parenta7972b49044f58665fbd7e2aee0516a3cf0aa1ce (diff)
downloadsrc-89e3d5671ba13dceca272d5b159c9bd805f3f504.tar.gz
src-89e3d5671ba13dceca272d5b159c9bd805f3f504.zip
bsnmpclient(3): make it thread-safe
Reviewed By: harti Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27336
Diffstat (limited to 'contrib')
-rw-r--r--contrib/bsnmp/lib/asn1.c2
-rw-r--r--contrib/bsnmp/lib/snmpclient.c4
-rw-r--r--contrib/bsnmp/lib/snmpclient.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/contrib/bsnmp/lib/asn1.c b/contrib/bsnmp/lib/asn1.c
index f1f9267c0226..a03dac70c529 100644
--- a/contrib/bsnmp/lib/asn1.c
+++ b/contrib/bsnmp/lib/asn1.c
@@ -1019,7 +1019,7 @@ asn_oid2str_r(const struct asn_oid *oid, char *buf)
char *
asn_oid2str(const struct asn_oid *oid)
{
- static char str[ASN_OIDSTRLEN];
+ __thread static char str[ASN_OIDSTRLEN];
return (asn_oid2str_r(oid, str));
}
diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c
index c22d8e125a14..e49105918416 100644
--- a/contrib/bsnmp/lib/snmpclient.c
+++ b/contrib/bsnmp/lib/snmpclient.c
@@ -71,7 +71,7 @@
#define DEBUG_PARSE 0
/* global context */
-struct snmp_client snmp_client;
+__thread struct snmp_client snmp_client;
/* List of all outstanding requests */
struct sent_pdu {
@@ -86,7 +86,7 @@ struct sent_pdu {
};
LIST_HEAD(sent_pdu_list, sent_pdu);
-static struct sent_pdu_list sent_pdus;
+__thread static struct sent_pdu_list sent_pdus;
/*
* Prototype table entry. All C-structure produced by the table function must
diff --git a/contrib/bsnmp/lib/snmpclient.h b/contrib/bsnmp/lib/snmpclient.h
index a19bdb2ea653..1bc3780de038 100644
--- a/contrib/bsnmp/lib/snmpclient.h
+++ b/contrib/bsnmp/lib/snmpclient.h
@@ -114,7 +114,7 @@ struct snmp_client {
};
/* the global context */
-extern struct snmp_client snmp_client;
+extern __thread struct snmp_client snmp_client;
/* initizialies a snmp_client structure */
void snmp_client_init(struct snmp_client *);