Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Aug 2017 19:49:36 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
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
Message-ID:  <201708081949.v78Jna07078154@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708081949.v78Jna07078154>