From owner-svn-src-stable-11@freebsd.org Tue Aug 8 19:49:37 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AE58DCC912; Tue, 8 Aug 2017 19:49:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC1227119F; Tue, 8 Aug 2017 19:49:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78Jna6M078155; Tue, 8 Aug 2017 19:49:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Jna07078154; Tue, 8 Aug 2017 19:49:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708081949.v78Jna07078154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 19:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322274 - stable/11/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Commit-Revision: 322274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 19:49:37 -0000 Author: markj Date: Tue Aug 8 19:49:35 2017 New Revision: 322274 URL: https://svnweb.freebsd.org/changeset/base/322274 Log: MFC r321843, r321843: Let lockstat use ksyms(4)'s mmap interface. Modified: stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Tue Aug 8 19:47:11 2017 (r322273) +++ stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Tue Aug 8 19:49:35 2017 (r322274) @@ -175,10 +175,6 @@ symtab_init(void) int fd; int i; int strindex = -1; -#ifndef illumos - void *ksyms; - size_t sz; -#endif #ifndef illumos if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) { @@ -194,33 +190,9 @@ symtab_init(void) return (-1); #endif -#ifdef illumos (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); -#else - /* - * XXX - libelf needs to be fixed so it will work with - * non 'ordinary' files like /dev/ksyms. The following - * is a work around for now. - */ - if (elf_version(EV_CURRENT) == EV_NONE) { - close(fd); - return (-1); - } - if (ioctl(fd, KIOCGSIZE, &sz) < 0) { - close(fd); - return (-1); - } - if (ioctl(fd, KIOCGADDR, &ksyms) < 0) { - close(fd); - return (-1); - } - if ((elf = elf_memory(ksyms, sz)) == NULL) { - close(fd); - return (-1); - } -#endif for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) { Shdr *shdr = elf_getshdr(scn);