Commit Graph

89 Commits

Author SHA1 Message Date
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
mjl 3d418a4a73 ANSIfy. 2001-01-05 04:59:21 +00:00
mjl 96015e4766 (From FreeBSD)
Get things right for tty names of length UT_LINESIZE. (FreeBSD PR 3638)
If the utmp login time is greater than the tty atime, use it to calculate
the idle time instead of the atime.
Fix -n with 16-chars hostnames (FreeBSD PR 11286).
Domain names are case insensitive.
2001-01-05 04:54:53 +00:00
cgd 2af1e46eab __CONCAT does token pasting, not string concatnation. if something like:
__CONCAT("foo","bar");
actually works to concantate strings, it's because the preprocessor expands
it into "foo""bar" as separate strings, and then ANSI string concatenation
is performed on that.  It's more straightforward to just use ANSI string
concatenation directly, and newer GCCs complain (rightly) about misuse
of token pasting.
2000-12-20 01:17:49 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
jdolecek f8031c2d6d add code to recognize special ftpd utmp entries and match corresponding
process accordingly, so that w parses entries made by "ftpd -U" correctly

the new code is conditionalized upon define SUPPORT_FTPD_UTMP, turned
on by default in w(1)'s Makefile

This addresses bin/11095 by Daniel Hagerty.
2000-09-28 18:20:29 +00:00
christos 2120a34cd6 - Don't core dump when we have stale utmp entries; warn the user instead.
- Make this work again in single user when invoked as uptime and utmp is
  not present.
2000-08-21 00:19:06 +00:00
simonb 0afebfffdf Redo previous slightly differently - restore the behaviour of two
characters for the tty name and the first 'T' of 'TTY' hanging over
the blank column at the end of the username field.
2000-07-22 03:14:06 +00:00
enami ce5e5c761e - Set the minimum width for login name to 4, the width of "USER".
- Fix the number of colmuns left for proc. args.  Previously, an effect of
  NUL was canceled implicitly, but now we must handle it explicitly.
- Fix the width for tty name.
2000-07-15 22:45:14 +00:00
simonb 34d4c12031 Use KERN_CONSDEV for determining the console device instead of CPU_CONSDEV
which is not available on all ports.
2000-07-13 14:28:07 +00:00
simonb b00d9cf6cc Use p_login from struct proc instead of ut_name from struct utmp so
that a truncated name isn't used if the login name is over 8 characters
long.  Size USER field to suit.

Fixes PR bin/2459 from Neil McRae.
2000-06-25 13:41:12 +00:00
enami 4dc07f088a Pass the size of struct kinfo_proc2 instead of kinfo_proc to kvm_getproc2
so that w(1) displays what commands are running as before.
2000-06-08 02:37:28 +00:00
simonb ea74487218 Use new sysctl/kvm interfaces and remove sgid bit. 2000-05-26 03:10:31 +00:00
thorpej 06b81d67f4 Handle SONPROC state. 2000-05-26 00:42:34 +00:00
pk 9c865e3e82 No need for <machine/cpu.h> here. 1999-11-29 11:15:13 +00:00
drochner 85cbf55d16 Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
1999-11-09 15:06:30 +00:00
mrg 45cd15f3ed recognise "dty" the same as we do "tty" 1999-10-11 11:55:27 +00:00
chs 21eedb0ec1 the PMAP_NEW option is gone as the new interface is no longer optional. 1999-09-12 01:19:23 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
garbled 9e44e9b578 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:16:34 +00:00
pk e7a15783a6 Use correct buffer in kvm_openfiles(). 1999-01-29 14:17:21 +00:00
mrg 80efe80bc9 - change setgid kmem programs (that lend themselves to this) so setegid(getgid())
and the top, and then set the effective gid back to kmem around the call to
  kvm_openfiles().  this reduces the time group kmem is available.
- for those above that also allow this, setgid(getgid()) after the call to
  kvm_openfiles() to fully revoke priviledges.
- some KNF
- use err(3) over fprintf(3) in some places
1998-07-06 07:50:18 +00:00
mrg 32f519716b - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:56:06 +00:00
kleink 9406f10815 Need <time.h> for strftime() and related definitions. Also, no need to
include <sys/tty.h>.
1998-04-02 11:39:40 +00:00
kleink b17e4cc794 Need <time.h> for localtime() and strftime() prototypes. 1998-04-02 11:34:23 +00:00
perry ba7b5f16ff add -DPMAP_NEW if PMAP_NEW is on in mk.conf 1998-02-18 03:54:58 +00:00
mrg 279ce528ce add -DUVM to CPPFLAGS if defined(UVM) 1998-02-09 06:25:15 +00:00
mycroft d58f35482e Kill trailing comma in SEE ALSO section. 1997-11-01 03:28:22 +00:00
lukem 831bc1ae96 minor WARNS for i386 1997-10-20 03:08:44 +00:00
mrg 615373621d WARNSify; deprecate register; clean up .Nm 1997-10-20 02:49:14 +00:00
phil 133748a721 Don't print "up" if uptime is less than 30 seconds. (uptime rounds
to the nearest minute.)  Closes PR 2082.
1997-07-07 20:30:08 +00:00
mycroft 79bc5bb41f Use inet_aton(3) rather than inet_addr(3). 1997-05-19 03:44:43 +00:00
gwr 10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00