Commit Graph

281 Commits

Author SHA1 Message Date
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
lukem e7a39c4fb6 Fix -Wsign-compare issues 2009-04-13 23:20:27 +00:00
mrg fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
joerg 8929e0dce4 Don't workaround ancient macro argument limit with .Xo/.Xc. 2009-03-11 13:58:29 +00:00
njoly 90a93774af In vmstat display, increase software interrupt count output from 5 to
6 columns.
2009-03-09 19:48:02 +00:00
christos e12ce13bc6 cast for tdev. 2008-12-29 01:48:19 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
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
mrg 04f2afbef7 convert the rest of my licenses to 2-clause, extracting myself out
from a group as necessary.

bozohttpd remains, but it will get fixed next time i update it.
2008-05-30 02:29:37 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
thorpej caf49ea572 Make IPSEC and FAST_IPSEC stats per-cpu. Use <net/net_stats.h> and
netstat_sysctl().
2008-04-23 06:09:04 +00:00
thorpej 8fc3977bed Don't even bother initializing the namelist if we're not going to use it. 2008-04-10 17:16:39 +00:00
thorpej f2bff8adc3 Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
2008-04-10 17:14:25 +00:00
thorpej 3f466bce48 Change IPv6 stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old ip6stat structure; old netstat
binaries will continue to work properly.
2008-04-08 23:37:43 +00:00
thorpej f5c68c0b9f Change TCP stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old tcpstat structure; old netstat
binaries will continue to work properly.
2008-04-08 01:03:58 +00:00
thorpej 88d65e9212 Change IP stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old ipstat structure; old netstat
binaries will continue to work properly.
2008-04-07 06:31:27 +00:00
thorpej cca37a84ef Update for ICMP and UDP stats changes. 2008-04-07 05:18:25 +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
ad 703069c0e9 specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
  vnode can describe a block device. Instead, prohibit concurrent opens of
  block devices. As a bonus remove the unreliable code that prevents
  multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
  goes away, instead of abusing vnode::v_usecount to tell if the device is
  open.
2008-01-24 17:32:52 +00:00
christos 5665eef11f don't call curses from a signal handler! 2007-12-31 00:22:13 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
dsl eebb2036b8 Document 'systat syscall'. 2007-02-18 17:29:26 +00:00
dsl 49c5f0e9e5 Include code to display per system call counts and times. 2007-02-18 17:00:08 +00:00
pavel f5e7ca2447 Revert the changes done after newlock2 merge, except for the removal of
the now unused LSDEAD state. The current kernel headers are now
source-compatible with pre-newlock2 kernel headers again.

Approved by Andrew Doran.
2007-02-17 22:49:56 +00:00
ad 401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +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
dsl ded5cac581 Checkpoint this as 'WIP' before I break it again!
(Not complied by default.)
2006-05-20 20:07:35 +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
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +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 1655d9a820 Code to display per-system call counts.
Very useful to help identify which code is doing 1000s of system calls.
Not built because no one else has a kernel yet, and I need to make
the kernel side configurable.  But I don't want to lose this code....
2006-03-18 20:31:45 +00:00
dsl efc0bc90c3 Count both read bytes and write bytes when we are not showing separate read
and write statistics.  Discovered by go.
Since I broke in in rev 1.31, I guess I'll fix it first!
2006-03-18 16:48:44 +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 f9603a44ea Coverty 7449: Remove splurious check for 'sep == NULL'. 2006-03-18 11:02:48 +00:00
kleink 2d52a8c98a Print system processes' command names in square brackets, like ps(1) does. 2006-02-13 16:01:58 +00:00
dsl 0283f98333 Match changes to vmstat.c (splitting of dkreadstats).
Read tape stats if there are no disks found - is this possible?
2006-02-05 09:58:39 +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
dsl a6843277e3 Rename 'cur' to 'name' to avoid aliasing a global - this code has some
horrid globals...
2006-02-05 08:51:03 +00:00
matt d5eba984e9 Appease gcc 4.x 2005-12-24 21:14:50 +00:00
blymn 132bb1fe89 Add tape statistics. 2005-08-07 12:32:38 +00:00
xtraeme 5057789f26 Don't show ptyfs in the display, it's useless. 2005-08-01 02:38:03 +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 f62ff76f8b Add an extra digit to the kBps column - now overflows at 100MB/s 2005-02-26 22:28:23 +00:00
dsl 019733f61e WARNS=3 2005-02-26 22:12:33 +00:00
dsl ff927e7098 Fix field widths for 'numbers' display, and allow it without 'secs'. 2005-02-26 22:11:06 +00:00
dsl 5af2964703 Always treat ^h and ^? as erase chars (as well as stty erase).
Make the ':' erasable.
Fix typo in unviewable help message.
No point in having 'else' after 'return'...
2005-02-26 19:01:09 +00:00