Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 2017 06:32:05 +0000 (UTC)
From:      Baptiste Daroussin <bapt@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: r323666 - stable/11/usr.bin/netstat
Message-ID:  <201709170632.v8H6W50x094737@repo.freebsd.org>

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



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