Sun Jul 1 09:53:54 2018 UTC ()
Revert previous


(jmcneill)
diff -r1.172 -r1.173 src/sys/kern/subr_prf.c

cvs diff -r1.172 -r1.173 src/sys/kern/subr_prf.c (expand / switch to unified diff)

--- src/sys/kern/subr_prf.c 2018/06/30 17:15:01 1.172
+++ src/sys/kern/subr_prf.c 2018/07/01 09:53:54 1.173
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $ */ 1/* $NetBSD: subr_prf.c,v 1.173 2018/07/01 09:53:54 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1986, 1988, 1991, 1993 4 * Copyright (c) 1986, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * @(#)subr_prf.c 8.4 (Berkeley) 5/4/95 36 * @(#)subr_prf.c 8.4 (Berkeley) 5/4/95
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.173 2018/07/01 09:53:54 jmcneill Exp $");
41 41
42#ifdef _KERNEL_OPT 42#ifdef _KERNEL_OPT
43#include "opt_ddb.h" 43#include "opt_ddb.h"
44#include "opt_ipkdb.h" 44#include "opt_ipkdb.h"
45#include "opt_kgdb.h" 45#include "opt_kgdb.h"
46#include "opt_dump.h" 46#include "opt_dump.h"
47#include "opt_rnd_printf.h" 47#include "opt_rnd_printf.h"
48#endif 48#endif
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51#include <sys/stdint.h> 51#include <sys/stdint.h>
52#include <sys/systm.h> 52#include <sys/systm.h>
53#include <sys/buf.h> 53#include <sys/buf.h>
@@ -58,27 +58,26 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v @@ -58,27 +58,26 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v
58#include <sys/ioctl.h> 58#include <sys/ioctl.h>
59#include <sys/vnode.h> 59#include <sys/vnode.h>
60#include <sys/file.h> 60#include <sys/file.h>
61#include <sys/tty.h> 61#include <sys/tty.h>
62#include <sys/tprintf.h> 62#include <sys/tprintf.h>
63#include <sys/spldebug.h> 63#include <sys/spldebug.h>
64#include <sys/syslog.h> 64#include <sys/syslog.h>
65#include <sys/kprintf.h> 65#include <sys/kprintf.h>
66#include <sys/atomic.h> 66#include <sys/atomic.h>
67#include <sys/kernel.h> 67#include <sys/kernel.h>
68#include <sys/cpu.h> 68#include <sys/cpu.h>
69#include <sys/sha2.h> 69#include <sys/sha2.h>
70#include <sys/rndsource.h> 70#include <sys/rndsource.h>
71#include <sys/timetc.h> 
72 71
73#include <dev/cons.h> 72#include <dev/cons.h>
74 73
75#include <net/if.h> 74#include <net/if.h>
76 75
77#ifdef IPKDB 76#ifdef IPKDB
78#include <ipkdb/ipkdb.h> 77#include <ipkdb/ipkdb.h>
79#endif 78#endif
80 79
81static kmutex_t kprintf_mtx; 80static kmutex_t kprintf_mtx;
82static bool kprintf_inited = false; 81static bool kprintf_inited = false;
83 82
84#ifdef KGDB 83#ifdef KGDB
@@ -494,29 +493,26 @@ addtstamp(int flags, struct tty *tp) @@ -494,29 +493,26 @@ addtstamp(int flags, struct tty *tp)
494 struct timespec ts; 493 struct timespec ts;
495 int n, prec; 494 int n, prec;
496 long fsec; 495 long fsec;
497 496
498 prec = log_ts_prec; 497 prec = log_ts_prec;
499 if (prec < 0) { 498 if (prec < 0) {
500 prec = 0; 499 prec = 0;
501 log_ts_prec = prec; 500 log_ts_prec = prec;
502 } else if (prec > 9) { 501 } else if (prec > 9) {
503 prec = 9; 502 prec = 9;
504 log_ts_prec = prec; 503 log_ts_prec = prec;
505 } 504 }
506 505
507 if (cold) 
508 tc_ticktock(); 
509 
510 getnanouptime(&ts); 506 getnanouptime(&ts);
511 507
512 for (n = prec, fsec = ts.tv_nsec; n < 8; n++) 508 for (n = prec, fsec = ts.tv_nsec; n < 8; n++)
513 fsec /= 10; 509 fsec /= 10;
514 if (n < 9) 510 if (n < 9)
515 fsec = (fsec / 10) + ((fsec % 10) >= 5); 511 fsec = (fsec / 10) + ((fsec % 10) >= 5);
516 512
517 n = snprintf(buf, sizeof(buf), "[% 4jd.%.*ld] ", 513 n = snprintf(buf, sizeof(buf), "[% 4jd.%.*ld] ",
518 (intmax_t)ts.tv_sec, prec, fsec); 514 (intmax_t)ts.tv_sec, prec, fsec);
519 515
520 for (int i = 0; i < n; i++) 516 for (int i = 0; i < n; i++)
521 putone(buf[i], flags, tp); 517 putone(buf[i], flags, tp);
522} 518}