Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/crash add -w



details:   https://anonhg.NetBSD.org/src/rev/890907c87a88
branches:  trunk
changeset: 802859:890907c87a88
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 05 22:58:43 2014 +0000

description:
add -w

diffstat:

 usr.sbin/crash/crash.8 |   7 +++++--
 usr.sbin/crash/crash.c |  14 +++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (95 lines):

diff -r 75c9d63f5a10 -r 890907c87a88 usr.sbin/crash/crash.8
--- a/usr.sbin/crash/crash.8    Sun Oct 05 20:40:46 2014 +0000
+++ b/usr.sbin/crash/crash.8    Sun Oct 05 22:58:43 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: crash.8,v 1.3 2011/04/10 22:49:52 pgoyette Exp $
+.\"    $NetBSD: crash.8,v 1.4 2014/10/05 22:58:43 christos Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 7, 2009
+.Dd October 5, 2014
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nm
 .Op Fl M Ar core
 .Op Fl N Ar kernel
+.Op Fl w
 .Sh DESCRIPTION
 The
 .Nm
@@ -58,6 +59,8 @@
 .It Fl N Ar kernel
 Extract the name list from the specified kernel instead of the default
 .Pa /dev/ksyms .
+.It Fl w
+Enable writing.
 .El
 .Pp
 The command syntax used by
diff -r 75c9d63f5a10 -r 890907c87a88 usr.sbin/crash/crash.c
--- a/usr.sbin/crash/crash.c    Sun Oct 05 20:40:46 2014 +0000
+++ b/usr.sbin/crash/crash.c    Sun Oct 05 22:58:43 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $       */
+/*     $NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 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.5 2013/03/10 19:32:29 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $");
 #endif /* not lint */
 
 #include <ddb/ddb.h>
@@ -329,19 +329,20 @@
        struct stat sb;
        size_t sz;
        void *elf;
-       int fd, ch;
+       int fd, ch, flags;
        char c;
 
        nlistf = _PATH_KSYMS;
        memf = _PATH_MEM;
        ofp = stdout;
+       flags = O_RDONLY;
 
        setprogname(argv[0]);
 
        /*
         * Parse options.
         */
-       while ((ch = getopt(argc, argv, "M:N:")) != -1) {
+       while ((ch = getopt(argc, argv, "M:N:w")) != -1) {
                switch (ch) {
                case 'M':
                        memf = optarg;
@@ -349,6 +350,9 @@
                case 'N':
                        nlistf = optarg;
                        break;
+               case 'w':
+                       flags = O_RDWR;
+                       break;
                default:
                        usage();
                }
@@ -364,7 +368,7 @@
        /*
         * Open the images (crash dump and symbol table).
         */
-       kd = kvm_open(nlistf, memf, NULL, O_RDONLY, getprogname());
+       kd = kvm_open(nlistf, memf, NULL, flags, getprogname());
        if (kd == NULL) {
                return EXIT_FAILURE;
        }



Home | Main Index | Thread Index | Old Index