svn commit: r322274 - stable/11/cddl/contrib/opensolaris/cmd/lockstat

Mark Johnston markj at FreeBSD.org
Tue Aug 8 19:49:37 UTC 2017


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);


More information about the svn-src-all mailing list