Commit Graph

60 Commits

Author SHA1 Message Date
kre
7008793d77 Correct the 6 second offset issue between the time reported by
dmesg -T and the actual time a message was produced, noted on
current-users by Geoff Wing (Oct 27, 2018).

The size of the offset would depend upon architecture, and processor,
but was the delay from starting the clocks to initialising the time
of day (after mounting root, in case that is needed).

Change the kernel to set boottime to be the time at which the
clocks were started, rather than the time at which it is init'd
(by subtracting the interval between).

Correct dmesg to properly compute the ToD based upon the
boottime (which is a timespec, not a timeval, and has been
since Jan 2009) and the time logged in the message.

Note that this can (rarely) be 1 second earlier than date reports.
This occurs  when the time when the message was logged was actually
in the next second, but the timecounters have not yet processed
the tick, and so the time of the last tick, near the end of the
previous second, is reported instead.   Since times are always
truncated, rather than rounded, it is occasionally possible to
observe that disparity (if you try hard enough).

IOW: sys/kern/subr_prf.c:addtstamp() uses getnanouptime() rather
than nanouptime().

Note in dmesg(8) that -T conversions are gibberish other than
when the message comes from current the running kernel.  (It
could be fixed when -M is used, for messages generated by the
kernel whose corpse is being observed.   But hasn't been...)
2018-10-30 19:40:35 +00:00
kre
bbc0ac65c7 Whitespace. NFC. 2018-09-20 23:46:42 +00:00
kre
4cf82913ec Use the locale's numeric radix character ("decimal point") more generally
(in !SMALL versions of dmesg).
2018-09-20 19:50:42 +00:00
kre
ff30845eba s/or/of/ (a common typo of mine) and s/or// (too many of them.) 2018-09-20 10:03:31 +00:00
kre
3d4a88b591 Remove #if 0'd code that somehow got mangled in the (somewhat messy)
commit process and ended up being a syntax error...
2018-09-20 06:06:06 +00:00
wiz
604e240dd5 Remove a comma and some trailing whitespace. 2018-09-20 01:11:19 +00:00
christos
9f61665baf changes from kre@
- pass intmax to fmtydhmsf instead of time_t to avoid extra conversions.
- make -TTT mean "always keep 3 decimal digits of duration precision" (ie:
  always print ms)  (including trailing 0's, even .000 if it happens)
- make -T (all forms) be subject to the locale (obey the radix character)
- don't print ymd, since that would require calendar calculations to get
  right.
2018-09-19 23:02:14 +00:00
kre
2f9f119b68 Allow a third use of -T to force .NNN (always three digits) in -TT
(ISO8601 durations) format for timestamps - that is,not dropping trailing 0's.
2018-09-19 22:58:03 +00:00
kre
0d9f7721aa In -TT mode (ISO8601 duration timestamps) print milliseconds as
decimal fractions of a second (as they should be) rather than integer
milliseconds (ie nnn.1means nnn seconds and 1/10 of a second, not
nnn seconds, and 1 millisecond).   While here convert some inappropriate
time_t usage to intmax_t which works better (int, or long, would probably
work just as well).
2018-09-19 22:55:12 +00:00
christos
a1d2abcab8 add -TT printing ISO 8601 duration 2018-09-19 00:15:05 +00:00
kre
329132e2a8 Make timestamp reading code adapt to whatever precision (up to
nanoseconds, 9 digits) the kernel happens to send in the timestamps
in log messages.

Output (numeric) timestamps (when produced) are unchanged and always
in microseconds (for now).
2018-04-14 01:37:34 +00:00
kre
2b71f00cba Minor wording change (no date bump needed.) 2018-04-14 01:34:47 +00:00
wiz
ba701a99f9 Update usage. 2018-04-11 06:41:23 +00:00
wiz
a10e00a15c Sort flags in SYNOPSIS. 2018-04-11 06:40:53 +00:00
christos
2fef76cb66 match the linux dmesg flags. 2018-04-10 22:21:52 +00:00
christos
6d9827c89d eat NUL's first so that the state machine is not altered by them. 2018-04-02 01:15:31 +00:00
christos
eb23b853bb handle log being before timestamp... 2018-04-01 19:36:13 +00:00
christos
db02d1fb9e Handle new timestamp sequences. 2018-04-01 19:31:16 +00:00
sevan
7f58cf589a dmesg first appeared in 3BSD
http://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/dmesg.c
Bump date.
2016-09-11 02:24:00 +00:00
joerg
baa8e84b6f Use __dead 2011-08-29 14:34:58 +00:00
lukem
6543a91fea Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
2008-07-20 01:20:21 +00:00
christos
064b0504f7 c99 initializer 2006-10-16 02:43:19 +00:00
dsl
857f572e1b Make is worthwhile haveing #ifdef SMALL by making the Makefile set it when
SMALLPROG is defined (eg by src/distrib/commonMakefile.crunch).
Shrink SMALL version even more.
2005-09-05 20:56:41 +00:00
xtraeme
76500fc2f9 WARNS=2 is the default defined in sbin/Makefile.inc. (thanks wiz) 2005-01-20 16:39:22 +00:00
xtraeme
a448b41c5a Remove main() prototype; WARNS=2 2005-01-20 15:55:01 +00:00
wiz
f9ab138fb6 Bump date for previous; add comma in SEE ALSO; use Dv instead of Em. 2004-04-30 16:11:03 +00:00
briggs
6e27a7b0f6 Talk a little about the system message buffer and cross-reference
MSGBUFSIZE in options(4).
2004-04-30 13:34:48 +00:00
agc
bf07c8719a Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:11 +00:00
augustss
1225b61055 Make it possible to see \ in dmesg. 2002-06-05 06:31:21 +00:00
wiz
73f545bb5b Drop arguments of .Os. 2001-06-05 11:22:41 +00:00
simonb
73dfacb53d If "SMALL" is defined don't include kvm support, primarily for install
media.
2000-06-20 01:49:20 +00:00
simonb
6a2c167125 The default core file is /dev/mem, not /dev/kmem. 2000-06-20 01:47:03 +00:00
simonb
643cb3c341 Don't check namelist when choosing to use the sysctl interface. 2000-06-16 03:51:00 +00:00
simonb
907def68ca ANSIfy. 2000-06-16 03:42:12 +00:00
simonb
b75d5299d7 Oops, forgot to commit this file - actually remove the kmem setgid bit. 2000-06-16 03:41:37 +00:00
simonb
a7d9e1f93d Use new KERN_MSGBUF sysctl if running on a live kernel, and remove
setgid kmem bit from executable.
2000-06-16 00:20:23 +00:00
abs
49de827f3a Mention /var/run/dmesg.boot 2000-04-29 00:24:09 +00:00
mrg
b8ee40a314 discard privs as soon as possible. 1998-07-05 08:56:54 +00:00
enami
8c389fd0c2 Cosmetic change;
- indent continuation line by four space.
- put an empty line at the beginning of function which has no local variable.
1997-09-20 09:48:35 +00:00
enami
c6e5d31119 Fix revived bug, described in PR#3285. But use a bit simple way;
Use loop count instead of hackery pointer play.
1997-09-20 09:43:22 +00:00
enami
2d4b680a58 Don't include <sys/cdefs.h> twice in same file. 1997-09-20 06:26:43 +00:00
leo
71af424fee Commit userland part of pr-1891. 1997-09-19 19:38:57 +00:00
lukem
5f4e3656d9 - cleanup for WARNS=1
- cleanup .Nm usage
1997-09-14 08:53:45 +00:00
mjacob
f5c4107de6 We need a hint of *what* address is bad on the kvm_read. Also,
there are two reads- one for the msgbuf pointer, and then that
for what it points to.
1997-05-03 17:18:05 +00:00
thorpej
ee5ba12678 Don't get stuck in an infinite loop if the msgbuf index is 0 or 1, from
enami tsugutomo <enami@ba2.so-net.or.jp>, PR #3285.
1997-03-06 23:55:12 +00:00
cgd
0114e805ce convert to new RCS Id conventions; reduce my headache 1995-03-18 14:54:19 +00:00
cgd
06e2955ff1 specify man pages the new way. 1994-12-22 10:44:04 +00:00
cgd
5eeab43e28 more cleanups from Jim Jegers, passed over by me. 1994-12-05 20:15:31 +00:00
jtc
1d1682d63c vmunix -> netbsd (PR #375) 1994-08-06 06:11:03 +00:00
cgd
7b442030ed clean up import 1994-05-11 06:47:04 +00:00