From nobody Sun Mar 05 17:24:38 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PV7qp5RZBz3wjbt; Sun, 5 Mar 2023 17:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PV7qp2bt4z3LTS; Sun, 5 Mar 2023 17:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678037078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9gH5DRYLZkolYQeu6pBAOZy60N+wcITUOxEkjTApS/4=; b=GYySl9Mvaj6TE894WG2sPBa4sIEHCGWJpnz1GBn7kYZdNkDc9lmM6RuTe2Gn+EuZrCE5ca 4kZE530uEjyiYFCe5J37QaO8nvYvRop1Nc8z2vuG/3+sWAkvgV2NmwnRES8+Eoz7zIXFuY e9bokQcWUG0Ahnv5IbfZgpq+5NUy9xIdIz0P4a4e3x/XJrFK0yglcU5b19ONEC/04OoUZY oeS5efuYIMZpiJ94qrhPLPfCfiVMVDwNl/2eCCrNRWeFVut2897VNJ4GEi0cJKVp6usMcj UbzudTKSRyU3H0jyqnyDFOVxrEUDFOz03WIlRccbdrO74tKzi/K3nkKAf6TwuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678037078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9gH5DRYLZkolYQeu6pBAOZy60N+wcITUOxEkjTApS/4=; b=ZzWJUNBEEvHLLja4ntFjjaVgjsrW3lUQ4OIBjzF0OuH9WOLug1ugzJ3qdHcdUrkeE0tfDc EG1CZuiqDAp0B6gze9n8Dlo9zE6yvvGhpLREXo0npXce02Br4agCtusnc4UMDVQhr6eiZE KrERtgI9R0uTk/1DzwmUgLQCPh79zmp2KSUhrY8LVSDCSP2AB+bfKbQDPhg/lMSzfkillS ZpF1/xkcLP2SWSgUvHPJyrizkBO1Tvo7mSaOEzjIcbIdZqME8q9QHx6gjJl7p3r4bHVSQX u4KU08OdncL0NC0G9Upq+8yOQsbO38FbfCKxxcsqE5sc6x5Ze8rJHxChSEYC+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678037078; a=rsa-sha256; cv=none; b=W95aRcICX0Zz/j5Y1EpTbTEC7E7gSq+jTqhZHCfAdr5SvHBaxFdIrBZWAMcsu8x9h3yLg0 tYNoM7YsVbVy55QQ49dRvNgcc1qQdOxmeOT5iZ+4kaeQJgZwqbU99dl3bu+2AUhgVThJ5y K2ZOwjP9ok1AiLictJGtLyBjxbk6UNL3eK1VItqzbIrlDkaKsrAS7w+8qItkoBcNwe8W1u CGLxFivYDNQr5s5vaWbSAH4QVb4arOFwSaMEZmTW3lvd1QLWHID33Ky9XXANFMpWB1llNe FLOx/WQta41SvlAMriLobNeKGzeBCoGcMLxp+ERpRSRjMPDV9CUEgH4p6x6NEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PV7qp1jm9zTQM; Sun, 5 Mar 2023 17:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 325HOcRE043327; Sun, 5 Mar 2023 17:24:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 325HOcpK043326; Sun, 5 Mar 2023 17:24:38 GMT (envelope-from git) Date: Sun, 5 Mar 2023 17:24:38 GMT Message-Id: <202303051724.325HOcpK043326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1a0e3257ca9d - stable/13 - lockstat: Use gelf.h instead of playing games with the preprocessor List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a0e3257ca9d321a822aa787c48ef922f2b60345 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a0e3257ca9d321a822aa787c48ef922f2b60345 commit 1a0e3257ca9d321a822aa787c48ef922f2b60345 Author: Mark Johnston AuthorDate: 2023-02-25 01:15:21 +0000 Commit: Mark Johnston CommitDate: 2023-03-05 17:24:26 +0000 lockstat: Use gelf.h instead of playing games with the preprocessor This reverts a portion of 1477dd823ee ("Merge OpenZFS support in to HEAD."). No functional change intended. MFC after: 1 week (cherry picked from commit 49e3972afc1112f95863a04cea7a4401b78dfd1f) --- cddl/contrib/opensolaris/cmd/lockstat/sym.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c index b5366c566857..7516e7d435f4 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifdef illumos #include @@ -54,7 +55,6 @@ #endif #include - typedef struct syment { uintptr_t addr; char *name; @@ -73,11 +73,6 @@ static char maxsymname[64]; #endif #endif -#define __sElfN(x) typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x -__sElfN(Sym); -__sElfN(Shdr); -#define elf_getshdr __elfN(getshdr) - static void add_symbol(char *name, uintptr_t addr, size_t size) { @@ -174,7 +169,7 @@ symtab_init(void) { Elf *elf; Elf_Scn *scn = NULL; - Sym *symtab, *symp, *lastsym; + GElf_Sym *symtab, *symp, *lastsym; char *strtab; uint_t cnt; int fd; @@ -198,13 +193,13 @@ symtab_init(void) (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); - for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) { - Shdr *shdr = elf_getshdr(scn); - if (shdr->sh_type == SHT_SYMTAB) { - symtab = (Sym *)elf_getdata(scn, NULL)->d_buf; - nsyms = shdr->sh_size / shdr->sh_entsize; - strindex = shdr->sh_link; + GElf_Shdr shdr; + (void) gelf_getshdr(scn, &shdr); + if (shdr.sh_type == SHT_SYMTAB) { + symtab = (GElf_Sym *)elf_getdata(scn, NULL)->d_buf; + nsyms = shdr.sh_size / shdr.sh_entsize; + strindex = shdr.sh_link; } }