summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/systat.h
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2001-03-23 03:58:25 +0000
committertmm <tmm@FreeBSD.org>2001-03-23 03:58:25 +0000
commitd6fecac748fdca2de8bbfd045bceab19277abab1 (patch)
tree62457bf2e3ef9a2f6fe6f055b531080c23af45c2 /usr.bin/systat/systat.h
parent76ba4861cd1cb43f58cdf0c32eafb5669114b1f0 (diff)
downloadFreeBSD-src-d6fecac748fdca2de8bbfd045bceab19277abab1.zip
FreeBSD-src-d6fecac748fdca2de8bbfd045bceab19277abab1.tar.gz
Get rid of setgid kmem for systat, and while being there, fix some bugs
and compiler warnings. The data for network statistics are still obtained via the kvm interface if systat was started with the needed privileges, otherwise sysctls are used. The reason for this is that with really many open sockets, the sysctl method is probably slower, but it systat -netstat is probably not really usable in either mode under these conditions. Approved by: rwatson
Diffstat (limited to 'usr.bin/systat/systat.h')
-rw-r--r--usr.bin/systat/systat.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h
index d8045d8..d4ea835 100644
--- a/usr.bin/systat/systat.h
+++ b/usr.bin/systat/systat.h
@@ -49,12 +49,20 @@ struct cmdtab {
char c_flags; /* see below */
};
+/*
+ * If we are started with privileges, use a kmem interface for netstat handling,
+ * otherwise use sysctl.
+ * In case of many open sockets, the sysctl handling might become slow.
+ */
+extern int use_kvm;
+
#define CF_INIT 0x1 /* been initialized */
#define CF_LOADAV 0x2 /* display w/ load average */
#define TCP 0x1
#define UDP 0x2
+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
#define KREAD(addr, buf, len) kvm_ckread((addr), (buf), (len))
#define NVAL(indx) namelist[(indx)].n_value
#define NPTR(indx) (void *)NVAL((indx))
OpenPOWER on IntegriCloud