| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: subr_prf.c,v 1.166 2018/04/11 15:25:58 christos Exp $ */ | | 1 | /* $NetBSD: subr_prf.c,v 1.167 2018/04/11 23:20:15 christos 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.166 2018/04/11 15:25:58 christos Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.167 2018/04/11 23:20:15 christos 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> |
| @@ -484,27 +484,27 @@ putlogpri(int level) | | | @@ -484,27 +484,27 @@ putlogpri(int level) |
484 | | | 484 | |
485 | #ifndef KLOG_NOTIMESTAMP | | 485 | #ifndef KLOG_NOTIMESTAMP |
486 | static int needtstamp = 1; | | 486 | static int needtstamp = 1; |
487 | | | 487 | |
488 | static void | | 488 | static void |
489 | addtstamp(int flags, struct tty *tp) | | 489 | addtstamp(int flags, struct tty *tp) |
490 | { | | 490 | { |
491 | char buf[64]; | | 491 | char buf[64]; |
492 | struct timespec ts; | | 492 | struct timespec ts; |
493 | int n; | | 493 | int n; |
494 | | | 494 | |
495 | getnanouptime(&ts); | | 495 | getnanouptime(&ts); |
496 | n = snprintf(buf, sizeof(buf), "[% 9jd.%.9ld] ", | | 496 | n = snprintf(buf, sizeof(buf), "[% 9jd.%.9ld] ", |
497 | (intptr_t)ts.tv_sec, ts.tv_nsec); | | 497 | (intmax_t)ts.tv_sec, ts.tv_nsec); |
498 | | | 498 | |
499 | for (int i = 0; i < n; i++) | | 499 | for (int i = 0; i < n; i++) |
500 | putone(buf[i], flags, tp); | | 500 | putone(buf[i], flags, tp); |
501 | } | | 501 | } |
502 | #endif | | 502 | #endif |
503 | | | 503 | |
504 | /* | | 504 | /* |
505 | * putchar: print a single character on console or user terminal. | | 505 | * putchar: print a single character on console or user terminal. |
506 | * | | 506 | * |
507 | * => if console, then the last MSGBUFS chars are saved in msgbuf | | 507 | * => if console, then the last MSGBUFS chars are saved in msgbuf |
508 | * for inspection later (e.g. dmesg/syslog) | | 508 | * for inspection later (e.g. dmesg/syslog) |
509 | * => we must already be in the mutex! | | 509 | * => we must already be in the mutex! |
510 | */ | | 510 | */ |