From owner-dev-commits-src-main@freebsd.org Tue Dec 29 19:05:10 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F39B4C89EC; Tue, 29 Dec 2020 19:05:10 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D53lB33Cpz3G9T; Tue, 29 Dec 2020 19:05:10 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qk1-x72c.google.com with SMTP id 19so12153148qkm.8; Tue, 29 Dec 2020 11:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sZZa9gM8BHkPqrtQeJX6v8p3VrxTzc+sXTgLUe7aslc=; b=qVhbYvf18xYVfui6GEAk9r2peAA5N2/IsHBYNIqwCWxTptgFTzx8SV5crXJ2ZWnMoO A72kLsnFi4dv6v9vLYPQkDxsXI6KVl6Vr0vGE+vFueOYjz0TJ9znPRf9rBL6fPvOnexv yaNEeQl585V9uubtorN9WQttp2O0AitAfUYiwJteu1nHyjKu/hOzpIfIP9mgopZhVB0h R5u/XME260rv42zgr+RosuSNFmXha8PwdWnlYXbGCTzZsGFF1qAIdW6uAjwK5Jk4eudZ PCKWthQ5N8krXQFJnwEHtQP2uFQiGLuBof1zX6j5rMwpFAFsfrgIqgKMnY0wEuIP9uzT XUEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sZZa9gM8BHkPqrtQeJX6v8p3VrxTzc+sXTgLUe7aslc=; b=P7zQjcoFjl4al+9fT7Haj9muTFjuSxY7dpiRsgNNjVbImgy/J53JQUvPMsg/U0WO33 wzVTT/fqkpGfWLRA6F1ppStzmYCyWFB3OfJww5TzCHGP1/GkcUTdrUQRLZBfRa13ZjYO 96VaDD2qQ8OtMjT7zrc+EgEhpEbo4u+lFEVlwI5RH3yHGXGsIZsqdj1e8lxkoRIMXF9P vsDUFL73nMRfvLmEU7ubNGPdz2AIoLLoHMaEilLvjWRiuiOI+3Q/SD+b4Q0RXDGULJJR C9kgyr9m/XgQN7kauzoBGjiCzIFihIkr09ZpZvZg5g0GoL/qhG7qQrYN3li8M5g47F5i hSaw== X-Gm-Message-State: AOAM531ZEGdbS+i/GEOMVDkMo9s+TxTYTIPPz6FXK0wlAdCedAHrDzuf XCd6h/9HzaLF3rNkupYNgvg8aOn5Y196yA8N1+A77H8VCuOGZg== X-Google-Smtp-Source: ABdhPJxH7OcYBiDhokgg4gC/TWPEdRH8aJG/1DmfX5KL9WhBikZmkLFB8XULbF191G+Qw31SnaadHxwb3p5wIf9D9+E= X-Received: by 2002:a05:620a:4047:: with SMTP id i7mr49576911qko.3.1609268709241; Tue, 29 Dec 2020 11:05:09 -0800 (PST) MIME-Version: 1.0 References: <202012291500.0BTF0vGw034594@gitrepo.freebsd.org> In-Reply-To: <202012291500.0BTF0vGw034594@gitrepo.freebsd.org> From: Ryan Libby Date: Tue, 29 Dec 2020 11:04:58 -0800 Message-ID: Subject: Re: git: 89e3d5671ba1 - main - bsnmpclient(3): make it thread-safe To: Edward Tomasz Napierala Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4D53lB33Cpz3G9T X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2020 19:05:10 -0000 On Tue, Dec 29, 2020 at 7:01 AM Edward Tomasz Napierala wrote: > > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=89e3d5671ba13dceca272d5b159c9bd805f3f504 > > commit 89e3d5671ba13dceca272d5b159c9bd805f3f504 > Author: Edward Tomasz Napierala > AuthorDate: 2020-12-29 14:59:31 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2020-12-29 14:59:37 +0000 > > bsnmpclient(3): make it thread-safe > > Reviewed By: harti > Sponsored by: NetApp, Inc. > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D27336 > --- > contrib/bsnmp/lib/asn1.c | 2 +- > contrib/bsnmp/lib/snmpclient.c | 4 ++-- > contrib/bsnmp/lib/snmpclient.h | 2 +- > 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]; gcc does not accept this spelling. It insists on `static __thread` instead. --- asn1.o --- /usr/src/freebsd/contrib/bsnmp/lib/asn1.c: In function 'asn_oid2str': /usr/src/freebsd/contrib/bsnmp/lib/asn1.c:1022:2: error: '__thread' before 'static' 1022 | __thread static char str[ASN_OIDSTRLEN]; | ^~~~~~~~ https://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html > > 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; Same here. > > /* > * 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 *);