Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin improve error messages (remove \n, use __func__, etc)



details:   https://anonhg.NetBSD.org/src/rev/7d56bf55967c
branches:  trunk
changeset: 338913:7d56bf55967c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 16 23:04:13 2015 +0000

description:
improve error messages (remove \n, use __func__, etc)

diffstat:

 usr.sbin/acpitools/acpidump/acpi.c   |   6 ++--
 usr.sbin/altq/altqstat/quip_client.c |   5 +--
 usr.sbin/btattach/btattach.c         |   6 ++--
 usr.sbin/btattach/init_bcm2035.c     |   6 ++--
 usr.sbin/btattach/init_digi.c        |   6 ++--
 usr.sbin/btattach/init_ericsson.c    |   6 ++--
 usr.sbin/btattach/init_st.c          |   6 ++--
 usr.sbin/btattach/init_swave.c       |   6 ++--
 usr.sbin/btattach/init_unistone.c    |   6 ++--
 usr.sbin/crash/Makefile              |   4 +-
 usr.sbin/crash/crash.c               |  51 +++++++++++++++++++++++++++++++++-
 usr.sbin/makefs/cd9660.c             |  53 ++++++++++++++++++-----------------
 usr.sbin/makefs/udf.c                |   6 ++--
 usr.sbin/ndiscvt/ndiscvt.c           |   5 +--
 usr.sbin/ndp/ndp.c                   |   8 ++--
 usr.sbin/npf/npftest/npftest.c       |   4 +-
 usr.sbin/pf/pfs/pfs.c                |  12 ++++----
 usr.sbin/quotacheck/quotacheck.c     |   6 ++--
 usr.sbin/repquota/repquota.c         |   6 ++--
 usr.sbin/timed/timed/timed.c         |  22 +++++++-------
 20 files changed, 138 insertions(+), 92 deletions(-)

diffs (truncated from 793 to 300 lines):

diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c        Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c        Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.9 2014/03/20 14:39:43 riastradh Exp $ */
+/* $NetBSD: acpi.c,v 1.10 2015/06/16 23:04:13 christos Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.9 2014/03/20 14:39:43 riastradh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.10 2015/06/16 23:04:13 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/endian.h>
@@ -2480,6 +2480,6 @@
        else
                sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt);
        if (acpi_checksum(sdt, sdt->Length))
-               errx(EXIT_FAILURE, "DSDT is corrupt\n");
+               errx(EXIT_FAILURE, "DSDT is corrupt");
        return (sdt);
 }
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/altq/altqstat/quip_client.c
--- a/usr.sbin/altq/altqstat/quip_client.c      Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/altq/altqstat/quip_client.c      Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quip_client.c,v 1.10 2013/10/19 17:16:37 christos Exp $        */
+/*     $NetBSD: quip_client.c,v 1.11 2015/06/16 23:04:14 christos Exp $        */
 /*     $KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $     */
 /*
  * Copyright (C) 1999-2000
@@ -122,8 +122,7 @@
        strlcpy(addr.sun_path, QUIP_PATH,sizeof(addr.sun_path));
 
        if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-               fprintf(stderr, "can't talk to altqd!\n"
-                       "probably, altqd is not running\n");
+               warnx("can't talk to altqd;probably, altqd is not running");
                return (-1);
        }
 
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/btattach.c
--- a/usr.sbin/btattach/btattach.c      Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/btattach.c      Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btattach.c,v 1.12 2011/08/27 22:17:53 joerg Exp $      */
+/*     $NetBSD: btattach.c,v 1.13 2015/06/16 23:04:14 christos Exp $   */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008 Iain Hibbert.  All rights reserved.");
-__RCSID("$NetBSD: btattach.c,v 1.12 2011/08/27 22:17:53 joerg Exp $");
+__RCSID("$NetBSD: btattach.c,v 1.13 2015/06/16 23:04:14 christos Exp $");
 
 #include <sys/ioctl.h>
 #include <sys/param.h>
@@ -440,7 +440,7 @@
                break;
 
        default: /* out of sync? */
-               errx(EXIT_FAILURE, "unknown packet type 0x%2.2x\n", type);
+               errx(EXIT_FAILURE, "unknown packet type 0x%2.2x", type);
        }
 
        while (want-- > 0)
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_bcm2035.c
--- a/usr.sbin/btattach/init_bcm2035.c  Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_bcm2035.c  Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_bcm2035.c,v 1.2 2009/04/15 00:32:23 lukem Exp $   */
+/*     $NetBSD: init_bcm2035.c,v 1.3 2015/06/16 23:04:14 christos Exp $        */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_bcm2035.c,v 1.2 2009/04/15 00:32:23 lukem Exp $");
+__RCSID("$NetBSD: init_bcm2035.c,v 1.3 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -66,7 +66,7 @@
        case B460800:   rate = 0xfd22;  break;
        case B921600:   rate = 0xff55;  break;
        default:
-               errx(EXIT_FAILURE, "invalid speed for bcm2035: %u\n", speed);
+               errx(EXIT_FAILURE, "invalid speed for bcm2035: %u", speed);
        };
 
        rate = htole16(rate);
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_digi.c
--- a/usr.sbin/btattach/init_digi.c     Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_digi.c     Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_digi.c,v 1.2 2009/04/15 00:32:23 lukem Exp $      */
+/*     $NetBSD: init_digi.c,v 1.3 2015/06/16 23:04:14 christos Exp $   */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_digi.c,v 1.2 2009/04/15 00:32:23 lukem Exp $");
+__RCSID("$NetBSD: init_digi.c,v 1.3 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -53,7 +53,7 @@
        case B57600:    rate = 0x08;    break;
        case B115200:   rate = 0x09;    break;
        default:
-               errx(EXIT_FAILURE, "invalid speed for digi: %u\n", speed);
+               errx(EXIT_FAILURE, "invalid speed for digi: %u", speed);
        }
 
        uart_send_cmd(fd, HCI_CMD_DIGIANSWER_SET_UART_BAUD_RATE, &rate, sizeof(rate));
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_ericsson.c
--- a/usr.sbin/btattach/init_ericsson.c Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_ericsson.c Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_ericsson.c,v 1.2 2009/04/15 00:32:23 lukem Exp $  */
+/*     $NetBSD: init_ericsson.c,v 1.3 2015/06/16 23:04:14 christos Exp $       */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_ericsson.c,v 1.2 2009/04/15 00:32:23 lukem Exp $");
+__RCSID("$NetBSD: init_ericsson.c,v 1.3 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -78,7 +78,7 @@
        case 300000:    rate = 0x27;    break;
        case 400000:    rate = 0x2b;    break;
        default:
-               errx(EXIT_FAILURE, "invalid speed for ericsson: %u\n", speed);
+               errx(EXIT_FAILURE, "invalid speed for ericsson: %u", speed);
        }
 
        uart_send_cmd(fd, HCI_CMD_ERICSSON_SET_UART_BAUD_RATE, &rate, sizeof(rate));
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_st.c
--- a/usr.sbin/btattach/init_st.c       Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_st.c       Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_st.c,v 1.2 2009/04/15 00:32:23 lukem Exp $        */
+/*     $NetBSD: init_st.c,v 1.3 2015/06/16 23:04:14 christos Exp $     */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_st.c,v 1.2 2009/04/15 00:32:23 lukem Exp $");
+__RCSID("$NetBSD: init_st.c,v 1.3 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -59,7 +59,7 @@
        case B460800:   rate = 0x13;    break;
        case B921600:   rate = 0x14;    break;
        default:
-               errx(EXIT_FAILURE, "invalid speed for st: %u\n", speed);
+               errx(EXIT_FAILURE, "invalid speed for st: %u", speed);
        }
 
        uart_send_cmd(fd, HCI_CMD_ST_SET_UART_BAUD_RATE, &rate, sizeof(rate));
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_swave.c
--- a/usr.sbin/btattach/init_swave.c    Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_swave.c    Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_swave.c,v 1.3 2010/03/09 02:01:51 kiyohara Exp $  */
+/*     $NetBSD: init_swave.c,v 1.4 2015/06/16 23:04:14 christos Exp $  */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_swave.c,v 1.3 2010/03/09 02:01:51 kiyohara Exp $");
+__RCSID("$NetBSD: init_swave.c,v 1.4 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -78,7 +78,7 @@
        case B57600:    cp.transport_rate = 0x01;       break;
        case B115200:   cp.transport_rate = 0x00;       break;
        default:
-               errx(EXIT_FAILURE, "invalid speed for swave: %u\n", speed);
+               errx(EXIT_FAILURE, "invalid speed for swave: %u", speed);
        }
 
        uart_send_cmd(fd, HCI_CMD_SWAVE_PARAM_ACCESS_SET, &cp, sizeof(cp));
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/btattach/init_unistone.c
--- a/usr.sbin/btattach/init_unistone.c Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/btattach/init_unistone.c Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_unistone.c,v 1.1 2009/12/06 12:55:46 kiyohara Exp $       */
+/*     $NetBSD: init_unistone.c,v 1.2 2015/06/16 23:04:14 christos Exp $       */
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: init_unistone.c,v 1.1 2009/12/06 12:55:46 kiyohara Exp $");
+__RCSID("$NetBSD: init_unistone.c,v 1.2 2015/06/16 23:04:14 christos Exp $");
 
 #include <bluetooth.h>
 #include <err.h>
@@ -90,7 +90,7 @@
        case B1843200:  rate = 0x08;    break;
 #endif
        default:
-               errx(EXIT_FAILURE, "invalid speed for infineon unistone: %u\n",
+               errx(EXIT_FAILURE, "invalid speed for infineon unistone: %u",
                    speed);
        }
 
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/crash/Makefile
--- a/usr.sbin/crash/Makefile   Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/crash/Makefile   Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.29 2015/02/09 17:48:07 christos Exp $
+#      $NetBSD: Makefile,v 1.30 2015/06/16 23:04:14 christos Exp $
 
 PROG=          crash
 MAN=           crash.8
@@ -34,7 +34,7 @@
 
 CPPFLAGS+=     -I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=     -DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER
-CPPFLAGS+=     -UDB_MACHINE_COMMANDS
+CPPFLAGS+=     -UDB_MACHINE_COMMANDS -DKERNHIST -DDDB
 
 # ddb files from kernel
 .PATH: $S/ddb
diff -r 1627c8eae935 -r 7d56bf55967c usr.sbin/crash/crash.c
--- a/usr.sbin/crash/crash.c    Tue Jun 16 22:54:10 2015 +0000
+++ b/usr.sbin/crash/crash.c    Tue Jun 16 23:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crash.c,v 1.8 2014/10/06 13:14:36 christos Exp $       */
+/*     $NetBSD: crash.c,v 1.9 2015/06/16 23:04:14 christos Exp $       */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.8 2014/10/06 13:14:36 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.9 2015/06/16 23:04:14 christos Exp $");
 #endif /* not lint */
 
 #include <ddb/ddb.h>
@@ -39,6 +39,7 @@
 #include <sys/fcntl.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <sys/kernhist.h>
 
 #include <machine/frame.h>
 
@@ -72,6 +73,8 @@
        { .n_name = "_osrelease" },
 #define        X_PANICSTR      1
        { .n_name = "_panicstr" },
+#define        X_KERN_HISTORIES        2
+       { .n_name = "_kern_histories" },
        { .n_name = NULL },
 };
 
@@ -301,6 +304,50 @@
        putc(c, ofp);
 }
 
+#define FMTLEN 1024
+#define FNLEN 128
+
+void
+kernhist_dump(struct kern_history *l)
+{
+       unsigned int lcv;
+       struct kern_history kh;
+       struct kern_history_ent ke;



Home | Main Index | Thread Index | Old Index