Commit Graph

121 Commits

Author SHA1 Message Date
dennis 61933bb52e Move enough additional 'w' code into 'uptime' to keep the latter
from double-counting utmp users.
2014-12-22 15:24:14 +00:00
mrg 4023260255 redo the previous; avoid a bunch of processing when running as "uptime",
and as a side effect, avoid any name lookups.
2014-12-03 06:12:19 +00:00
christos 3f1eb4e425 if doing uptime, don't bother resolving names. 2014-12-02 22:19:19 +00:00
joerg a400a0406f struct member can't be null, if the pointer itself is valid. 2014-02-27 00:49:46 +00:00
dsl dc210c7fbd Remove some pointless inclusions os sys/user.h 2014-02-19 20:42:14 +00:00
christos f812b4b441 Expand ep->host to contain the final string that we are going to print
before computing the width of the host column.
2013-09-09 19:20:38 +00:00
christos 924cacedb8 Remove stale proc_compare code and use the shared one in libutil. 2011-10-21 02:26:09 +00:00
joerg 6818646ac8 Use __dead 2011-09-16 15:39:25 +00:00
christos e6c0663544 Eliminate non-literal format strings, and now that gcc warns, kill y2k format
warning.
2011-08-17 13:48:11 +00:00
lukem 84a2852424 Fix -Wcast-qual issue 2009-04-14 07:41:36 +00:00
lukem c53da74354 Fix WARNS=4 issues 2009-04-14 07:37:31 +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
ad 75ab2e6537 Test p_pctcpu instead of p_estcpu (the latter is specific to SCHED_4BSD). 2007-11-05 20:46:08 +00:00
christos aca1acfb3f Use the UTX sizes + 1 for the struct to save space.
Don't complain if pid == 0
2006-06-22 17:57:31 +00:00
rpaulo caaefabc19 Don't print a warning about stale utmp{,x} entries if security.curtain
sysctl is equal to 1. We can still detect stale utmp entries if that
knob is off.
2005-09-15 00:58:49 +00:00
elad cf3a38f563 Revert previous commit. I forgot we already do that. :) 2005-09-04 21:18:33 +00:00
elad e93911118f Use sysctl to fetch process information if reading live kernel. 2005-09-04 19:02:08 +00:00
kim 077ff6605b One third of screen looks much better than half, for default maxhost. 2005-03-13 04:08:16 +00:00
wiz 36cdbd4840 Bump date for recent changes. 2005-01-11 09:39:12 +00:00
kim 61f9450361 Make -w flag apply to the WHAT field also (command and args).
Use at most half of ttywidth for WHERE field (hostname) instead
of a hardcoded maximum width.  (XXX: this is still not a good
default for displays under 80 columns.  Should probably count
the width of all the other columns, using 8 for the WHAT field.)
2005-01-08 05:08:53 +00:00
kim 2bb4a74034 Line up "days" style output in the IDLE field. 2005-01-08 05:04:34 +00:00
kim ee64b0d712 The w command does not display a CPU time, so don't talk about it. 2005-01-08 04:58:08 +00:00
wiz 3c75d39ba0 New sentence, new line. Add a comma. 2004-12-23 01:55:30 +00:00
christos 25c67c975f Fix usage, and call setprogname()! 2004-12-22 17:20:30 +00:00
christos 5df4136a03 PR/28751: Ed Ravin: Limit host field output by default to 35 characters so
that things don't wrap. Add -w flag to enable full output. Delete mention
of the old and not supported flags. This was 11 years ago, and very few
people even remember what these flags did.
2004-12-22 17:16:07 +00:00
christos 6b2a6f8a02 Be a bit more careful with errors; if you cannot find the pty to stat for
time, then report ? instead of the previous random contents of struct stat.
2004-11-19 13:17:06 +00:00
christos 280dbafe67 PR/28185: Brian Marcotte: w command broken when user specified 2004-11-11 00:09:07 +00:00
christos c7ead5d42d Don't print just two characters for the tty; change the field width of the
tty to 7.
2004-11-10 16:58:10 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
wiz 9b45ab8153 Remove superfluous max() macro.
Noted by Jeff Ito in PR 23932.
2004-01-03 01:18:14 +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
itojun 28f506f3a2 strlcpy 2003-07-12 13:57:49 +00:00
christos 0d2dc54013 keep track of the two proc entries significant to the utmp entry. The one
indicated by the pid in struct utmpx [or ftpd hack], and the one that is
associated with the controlling tty, is in the foreground process group,
and has most cpu. If the second one exists, use that one, else use the first
one.
2003-02-26 19:10:28 +00:00
fredb 1709947012 Print the command in parenthesis, if kvm_getargv2() returns no
arguments. This lets "xterm -e command" display as "(command)".
Reviewed by christos.
2003-02-26 19:01:54 +00:00
christos 8399be1bba keep track which entries are utmp and which are utmpx, so we can print
them on the stale message.
2003-02-26 15:04:10 +00:00
christos c7d4de107a - Remove SUPPORT_FTPD_UTMP flag. Enable it only for utmp entries, utmpx does
not need it since it can get the pid from the utmpx structure.
- If the line is not found, and the pid is present (from utmpx) use that to
  determine the process information for that particular entry.
2003-02-26 15:01:09 +00:00
thorpej 3fdac2b8c5 Merge the nathanw_sa branch. 2003-01-18 10:52:16 +00:00
enami b579228888 Fix whitespace usage. 2002-10-21 10:18:23 +00:00
enami f594d61275 If utmpx support is enabled, use sockaddr field to get numeric address. 2002-10-21 10:10:26 +00:00
lukem 5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +00:00
christos b3ac19283d Make uptime show the correct number of users. 2002-09-16 04:02:21 +00:00
mycroft 2f85ba247c uptime(1) is NOT supposed to always say `1 user'. 2002-09-16 01:49:06 +00:00
christos 52f955bcfd fixed user miscounting. reported by kim. 2002-08-22 14:52:55 +00:00
christos 156b33bc4e skip blank entries. 2002-07-28 20:47:57 +00:00
christos 1e703dc185 add utmpx support. 2002-07-27 23:58:40 +00:00
wiz d765b90d71 Sort SEE ALSO and sections. 2001-12-08 19:24:10 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
enami f7a77f5cca Fix whitespace usage. 2001-11-05 03:35:49 +00:00
wiz e26cad44d7 Appeared in .Bx 3.0, not .Ux 3.0. 2001-10-19 17:37:32 +00:00
cgd a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00