svn commit: r323666 - stable/11/usr.bin/netstat

Baptiste Daroussin bapt at FreeBSD.org
Sun Sep 17 06:32:06 UTC 2017


Author: bapt
Date: Sun Sep 17 06:32:05 2017
New Revision: 323666
URL: https://svnweb.freebsd.org/changeset/base/323666

Log:
  MFC r323016:
  
  Don't call kresolv_list() if using netstat on live kernel
  
  kresolve_list() is calling many kldsym(2). Removing that call on when collecting
  stats for the running kernel improves the startup time and CPU usage.
  
  Submitted by:	Nikita Kozlov (nikita.kozlov at blade-group.com)
  Reviewed by:	cem
  Sponsored by:	blade
  Differential Revision:	https://reviews.freebsd.org/D12151

Modified:
  stable/11/usr.bin/netstat/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/netstat/main.c
==============================================================================
--- stable/11/usr.bin/netstat/main.c	Sun Sep 17 04:15:12 2017	(r323665)
+++ stable/11/usr.bin/netstat/main.c	Sun Sep 17 06:32:05 2017	(r323666)
@@ -422,13 +422,12 @@ main(int argc, char *argv[])
 	if (!live) {
 		if (setgid(getgid()) != 0)
 			xo_err(-1, "setgid");
+		/* Load all necessary kvm symbols */
+		kresolve_list(nl);
 	}
 
 	if (xflag && Tflag)
 		xo_errx(1, "-x and -T are incompatible, pick one.");
-
-	/* Load all necessary kvm symbols */
-	kresolve_list(nl);
 
 	if (Bflag) {
 		if (!live)


More information about the svn-src-all mailing list