Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump be a bit smarter about fcntl



details:   https://anonhg.NetBSD.org/src/rev/0512642a1f2d
branches:  trunk
changeset: 342660:0512642a1f2d
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 03 22:05:18 2016 +0000

description:
be a bit smarter about fcntl

diffstat:

 usr.bin/kdump/kdump.c |  42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diffs (70 lines):

diff -r 9d5a5f070cb5 -r 0512642a1f2d usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Sun Jan 03 21:58:17 2016 +0000
+++ b/usr.bin/kdump/kdump.c     Sun Jan 03 22:05:18 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.120 2015/06/17 00:01:59 christos Exp $     */
+/*     $NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $     */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.120 2015/06/17 00:01:59 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -460,6 +460,31 @@
                printf(as_x ? "%#lx" : "%ld", it);
 }
 
+static const char *
+fcntlname(u_long cmd)
+{
+#define        FCNTLCASE(a)    case a: return # a
+       switch (cmd) {
+       FCNTLCASE(F_DUPFD);
+       FCNTLCASE(F_GETFD);
+       FCNTLCASE(F_SETFD);
+       FCNTLCASE(F_GETFL);
+       FCNTLCASE(F_SETFL);
+       FCNTLCASE(F_GETOWN);
+       FCNTLCASE(F_SETOWN);
+       FCNTLCASE(F_GETLK);
+       FCNTLCASE(F_SETLK);
+       FCNTLCASE(F_SETLKW);
+       FCNTLCASE(F_CLOSEM);
+       FCNTLCASE(F_MAXFD);
+       FCNTLCASE(F_DUPFD_CLOEXEC);
+       FCNTLCASE(F_GETNOSIGPIPE);
+       FCNTLCASE(F_SETNOSIGPIPE);
+       default:
+               return NULL;
+       }
+}
+
 static void
 ioctldecode(u_long cmd)
 {
@@ -544,6 +569,19 @@
                        argcount--;
                        c = ',';
 
+               } else if (strcmp(sys_name, "fcntl") == 0 && argcount >= 2) {
+                       (void)putchar('(');
+                       output_long((long)*ap, !(decimal || small(*ap)));
+                       ap++;
+                       argcount--;
+                       if ((cp = fcntlname(*ap)) != NULL)
+                               (void)printf(",%s", cp);
+                       else {
+                               (void)printf(",%#lx", *ap);
+                       }
+                       ap++;
+                       argcount--;
+                       c = ',';
                } else if ((strstr(sys_name, "sigaction") != NULL ||
                    strstr(sys_name, "sigvec") != NULL) && argcount >= 1) {
                        (void)printf("(SIG%s", signame(ap[0], 1));



Home | Main Index | Thread Index | Old Index