Commit Graph

71 Commits

Author SHA1 Message Date
dholland 16e3bec279 Clarify how one is supposed to use the pointers returned by getutentries()
(the utmpentry.c code), specifically with respect to who owns them and
when to free them. Now they're owned by utmpentry.c, only. Abolish the
freeutentries() function, which was the wrong abstraction; add instead
endutentries(), which flushes out the internally managed memory.

Update callers as necessary. Some (e.g. talkd) had been leaking memory;
others (e.g. syslogd) had been accidentally freeing and reloading utmp
more often than necessary. There are a couple untidy bits in users and
rwhod that someone should look after sometime, maybe.

Fixes PR bin/35131, which was about talkd's memory leak.
2008-07-13 20:07:48 +00:00
dyoung 4ef6fc056a #include <sys/evcnt.h> instead of <sys/device.h>, since the former
is sufficient, anyway.  Do not needlessly #include <sys/device.h>.

Note well: device_t is not part of the kernel ABI.
2008-02-11 03:51:17 +00:00
christos 8a3920f2c8 use c99 initializers
consistently terminate nlist arrays with NULL not ""
2006-10-22 16:43:24 +00:00
dsl 35fde98d40 Reduce the field widths for the summary line of traps, system calls
and interrupts so that the numbers don't all run into one.
2006-05-21 20:22:34 +00:00
christos abcf3383b8 Gcc 4 needs to have the enum declaration in scope to determine the enum size. 2006-05-14 02:56:27 +00:00
yamt ee458ef97e include errno.h directly rather than via user.h. 2006-05-11 12:01:33 +00:00
blymn e48af18bc5 Update to use new kernel io statistics. 2006-04-14 13:14:06 +00:00
dsl 7ee2912cf6 free() intrnamebuf, intrname and intrloc on entry so we don't leak them
every time initvmstat() is called.
Change intrnamebuf to be static so this works.
Inspired by Coverty CID 2072 (incorrectly) reporting that the memory assigned
to intrnamebuf wasn't being freed.
2006-03-20 20:36:38 +00:00
dsl bee1c2beb6 Make the functions that display the top 8 lines externally visible so
they can be used to head other pages (not ready to commit yet...).
Use puthumanint() for oversize numbers when display_mode is RUN or BOOT (when
very big numbers are to be expected).
Allow an extra column for Csw..Flt.
Adjust some #defines to avoid use of global s & s1.
2006-03-18 14:58:49 +00:00
dsl 228802f437 Split dkreadstats() into dkreadstats(), tkreadstats() and cpureadstats().
Similarly for dkswap().
Allows code to only call one of these.
Rename struct _disk to _vminfo to be nearer its contents.
Change 'systat vm' so that it always shows the 'current' cpu times, even
after ':run' or ':boot' commands. The code in vmstat.c doesn't support :run.
2006-02-05 09:54:50 +00:00
blymn 132bb1fe89 Add tape statistics. 2005-08-07 12:32:38 +00:00
chs d5b80101e7 do not rely on the pre-evcnt interrupt counter kernel symbols being present.
if they do not exist, then interrupt stats are all in evcnts.
2005-05-22 14:00:59 +00:00
dsl 019733f61e WARNS=3 2005-02-26 22:12:33 +00:00
christos b74b94a591 PR/29505: Nicolas Joly: Increase width of csw value in systat vmstat. 2005-02-22 15:13:57 +00:00
christos 29e8340e26 PR/29213: Nicolas Joly: sysstat(1) vmstat cannot display large memory values 2005-02-03 16:16:00 +00:00
mycroft b00b298ce8 Fix a display glitch when blanking out drive columns. 2004-06-13 08:56:21 +00:00
itojun 407df6861c realloc pedant 2003-09-19 07:08:50 +00:00
dsl 99135be3ff Use correct size when copying interrupt counters.
Fixes second part of bin/10095 (first part fixed in rev 1.25)
2003-08-30 12:57:03 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
grant c330a8c5ed Discs->Disks 2003-08-05 20:01:25 +00:00
drochner 96b62d8a69 no need to #include <sys/dkstat.h> 2003-06-11 17:26:31 +00:00
itojun 5bce78caa7 use strlcpy 2003-05-15 01:00:07 +00:00
dsl 34e0475375 Pivot the disk stats into extra lines if they run out of columns
(approved by christos)
2003-02-18 14:55:05 +00:00
dsl c4ccc4eaf4 Fiddle with screen layout to generate room for longer labels on the
interrupt count fields.
(approved by christos)
2003-02-17 19:30:33 +00:00
dsl c22a42ecd8 Avoid displaying "intr" for all interrupt counter titles
(approved by christos)
2003-02-13 08:09:33 +00:00
dsl 85ed0bb278 Make kernel address arg of kvm_ckread() const void * so caller doesn't
need a cast.
(approved by christos)
2003-01-20 18:24:03 +00:00
christos 8e448c92b9 kill warns. 2003-01-18 21:18:18 +00:00
dsl 24ec5512d1 pull interrupt stats from event counts
fix disk xfer byte count
fix absolute counts - were divided by time interval
2003-01-18 21:02:35 +00:00
mrg 3cf4c73d05 iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics.  "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
2002-11-01 12:47:55 +00:00
christos 836efa3eb4 PR/18408: Chris Demetriou: Kilo is abbreviated using a small k not a CAPITAL K. 2002-09-25 13:50:39 +00:00
abs 3dbe098822 introduce puthumanint() which calls humanize_number(), and use to
display disk transfer values (Suggested by Simon Burge). Also clip
%busy to 100 and display as an int which has the useful side effect
of stopping it overflowing into the next column (100.0).
2002-08-08 17:06:31 +00:00
christos 84610072e6 scan utmpx/utmp. 2002-08-01 23:36:54 +00:00
sommerfeld f80c7eebd7 Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.

Fixes I/O rate deflation observed on multiprocessors.
2002-06-30 00:10:33 +00:00
kleink 697af10002 From Simon Burge: remove orphaned reference to _total; fixes PR bin/16804. 2002-05-15 06:43:37 +00:00
augustss 550d5dae5a Make it compile (more vmstat fallout). 2002-01-28 13:20:43 +00:00
augustss 6778fe934d Since the system call and trap rates are often 5 digit numbers these
days we move the columns a little to avoid running into other numbers.
2001-09-28 11:58:51 +00:00
simonb 828483a73e Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
2000-12-01 02:19:43 +00:00
simonb ba632e7078 Use the vm.uvmexp2 sysctl. 2000-11-29 11:18:33 +00:00
ad fc3915475d - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
2000-07-05 11:03:20 +00:00
mrg 8d4795719a remove include of <vm/vm.h> 2000-06-29 06:26:33 +00:00
mycroft 2f240403c3 Display disk busy statistics as `%busy', as it's less confusing. 2000-06-05 21:36:34 +00:00
mycroft 981f9b7d7b Use hline() and variants in a bunch of places. 2000-06-04 18:29:13 +00:00
mycroft 796e1a63fa Fix a check so that holding down the space bar doesn't cause systat to lose. 2000-06-04 18:14:45 +00:00
mycroft 3ddc3c22b9 Fix the CPU usage bar graph. 2000-06-04 18:10:40 +00:00
thorpej 13ba787e60 Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
2000-06-04 16:06:25 +00:00
perry bd70b1984f include sys/sched.h to get definition of CPUSTATES 2000-06-04 01:53:51 +00:00
simonb 60e2ae70e5 Another cp_time size fix - also, there are 5 CPUSTATES now not four... 2000-05-29 12:54:31 +00:00
mycroft f5d7100e26 Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.
2000-01-21 17:08:33 +00:00
jwise 850fb37f89 Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'.  Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing.  Third off, whatever we do we need
to be consistent.

There, I feel better now.
1999-12-20 23:11:50 +00:00
jwise 4c0fbd4c92 Two things:
1.) fix a bug which caused coredumps when starting with no mode arguments
  2.) move to table-lookup for mode-specific command parsing as well.
      all command matching is now table-driven.
1999-12-20 03:45:01 +00:00