From nobody Sat Feb 25 01:18:34 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 4PNpmp3PvQz3v9mP; Sat, 25 Feb 2023 01:18:34 +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 4PNpmp2HQZz3Cjv; Sat, 25 Feb 2023 01:18:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677287914; 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=CkoCsAZwOF3FyGr6fhHjn2LHe6IQwFZabQ76wnRodWA=; b=qBrVhKNoRIGSSFZG0bJgUvJYfQB+EQzPaIqwmV1Xs2zR528W2OyfS9lQccdKBuRBDJ8wO7 z4JlMa1/IwSVKyNcYZsWeyLX7sEgw+zAXuMl0V0M7NOkhQllnunrrIb7gvB2YU0QCAQDnq feMPzo8LtehSA0X0yjNcSM55opZCuISVDfhQzj2EMcdkelOUhbv/0cdaPGSgYP1QSxBrGi gUYMK1bLn6ZhiBdBooGXyBtEoCdAX4FLu019TzIFnmHwtb0T4OGINSx0u35fzL/mrZBeJ8 4buuQxkz+ntZ2m5cRRLiC4GcOhPOX19cw9sNCaZxc66xKv6iMQ1oOUsBCnHylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677287914; 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=CkoCsAZwOF3FyGr6fhHjn2LHe6IQwFZabQ76wnRodWA=; b=CeZ4jtBe+C8/X++gP1rlmNgyg/YsIsrsV79tws5OTDefmQl/iTh5RdEEZzgQ4LQV0wM2S+ Hj8Q83kymGRqNZeKQWQjHLfw/NIucCYNu7dZu0d8+VUgFjY69JpIc28N5e/nm5e01z4HTH MDbqM+bahH/jZcgcQEZdslpokgjRwOdpJFV8z5pmDN3lJarqBilikYzPNKkVkkP6SHJ7XJ onFNGufkpF+5dh+a8LdoynG1BWZfx/OGyxIre43hER8ge91qJ/X82XECBRSJ22At3dzBMQ m+9i9QFg1mqkhrujRRI+1xVuvzjt5VwxYMpyQ/nF4pk/jeRm8fTueA4K88LZTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677287914; a=rsa-sha256; cv=none; b=TtW/dZZ2oDVff2dMUWFUxZCeEbd2BdGfl4mzWVp4vXHmO375LBjp+Y8D0WRmFwnfW2iskp 5Hm+CrVtiaMdNdnLlopklDhdrdAYzd1ziiW+ULMoUi2Ji9AHmfnE3xG6Z6bxZAnLAIKX81 Pd9jOlmQG1rzaCvVvSjUieaq7exEvnghX9tLZwX5OrilQkQTV6KA64jgveBEjOhkHpoBQf +kDcpAx7BVdlSvv5jRbJeEyrJjmRR8B/BNGv2EnQ9woZhjEV0lwbrD5yaUGqilWVBI7ugF qpxROfUW9J1DfkcnoILJv+cznezWpnRb/McBt2Nw9M01kpfFauJHxHn9MkjWDg== 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 4PNpmp15RHzlMl; Sat, 25 Feb 2023 01:18:34 +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 31P1IYbJ020043; Sat, 25 Feb 2023 01:18:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31P1IYjY020042; Sat, 25 Feb 2023 01:18:34 GMT (envelope-from git) Date: Sat, 25 Feb 2023 01:18:34 GMT Message-Id: <202302250118.31P1IYjY020042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 49e3972afc11 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 49e3972afc1112f95863a04cea7a4401b78dfd1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=49e3972afc1112f95863a04cea7a4401b78dfd1f commit 49e3972afc1112f95863a04cea7a4401b78dfd1f Author: Mark Johnston AuthorDate: 2023-02-25 01:15:21 +0000 Commit: Mark Johnston CommitDate: 2023-02-25 01:16:51 +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 --- 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; } }