CVS commit: src/usr.bin/kdump

2021-06-19 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Jun 20 00:25:29 UTC 2021

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
fix printf format string for xattr names (the length of the xattr name
needs to be a precision rather than a width).


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.139 src/usr.bin/kdump/kdump.c:1.140
--- src/usr.bin/kdump/kdump.c:1.139	Thu Apr 30 15:12:25 2020
+++ src/usr.bin/kdump/kdump.c	Sun Jun 20 00:25:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.139 2020/04/30 15:12:25 martin Exp $	*/
+/*	$NetBSD: kdump.c,v 1.140 2021/06/20 00:25:29 chs Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.139 2020/04/30 15:12:25 martin Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.140 2021/06/20 00:25:29 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -1288,7 +1288,7 @@ ktruser_soname(const char *name, const v
 static void
 ktruser_xattr_name(const char *name, const void *buf, size_t len)
 {
-	printf("%.*s: [%*s]\n", KTR_USER_MAXIDLEN, name, (int)len,
+	printf("%.*s: [%.*s]\n", KTR_USER_MAXIDLEN, name, (int)len,
 	(const char *)buf);
 }
 



CVS commit: src/usr.bin/kdump

2020-09-11 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Sep 12 01:36:26 UTC 2020

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
kdump: include netinet/in_var.h to access in_nbrinfo


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.56 src/usr.bin/kdump/mkioctls:1.57
--- src/usr.bin/kdump/mkioctls:1.56	Thu Apr  2 21:36:03 2020
+++ src/usr.bin/kdump/mkioctls	Sat Sep 12 01:36:26 2020
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.56 2020/04/02 21:36:03 christos Exp $
+#	$NetBSD: mkioctls,v 1.57 2020/09/12 01:36:26 roy Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -67,6 +67,7 @@ echo "#include "
 echo "#include "
 echo "#include "
 echo "#include "
+echo "#include "
 echo "#include "
 echo "#include "
 echo "#include "



CVS commit: src/usr.bin/kdump

2020-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 30 15:12:25 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
futexput: cast the mask to u_long (as the op already is)


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.138 src/usr.bin/kdump/kdump.c:1.139
--- src/usr.bin/kdump/kdump.c:1.138	Thu Apr 30 12:17:01 2020
+++ src/usr.bin/kdump/kdump.c	Thu Apr 30 15:12:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.138 2020/04/30 12:17:01 thorpej Exp $	*/
+/*	$NetBSD: kdump.c,v 1.139 2020/04/30 15:12:25 martin Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.138 2020/04/30 12:17:01 thorpej Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.139 2020/04/30 15:12:25 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -661,7 +661,7 @@ futexput(u_long op)
 	const char *s = "";
 
 	if (opname == NULL) {
-		printf("%#lx", op & FUTEX_CMD_MASK);
+		printf("%#lx", op & (u_long)FUTEX_CMD_MASK);
 	} else {
 		fputs(opname, stdout);
 	}



CVS commit: src/usr.bin/kdump

2020-04-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 30 12:17:02 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Decode futex op codes.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.137 src/usr.bin/kdump/kdump.c:1.138
--- src/usr.bin/kdump/kdump.c:1.137	Mon Apr 20 00:35:41 2020
+++ src/usr.bin/kdump/kdump.c	Thu Apr 30 12:17:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.138 2020/04/30 12:17:01 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.138 2020/04/30 12:17:01 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -55,6 +55,7 @@ __RCSID("$NetBSD: kdump.c,v 1.137 2020/0
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -629,6 +630,59 @@ putprot(int pr)
 	}
 }
 
+static const char *
+futex_op_name(u_long op)
+{
+#define	FUTEXCASE(a)	case a:	return # a
+	switch (op & FUTEX_CMD_MASK) {
+	FUTEXCASE(FUTEX_WAIT);
+	FUTEXCASE(FUTEX_WAKE);
+	FUTEXCASE(FUTEX_FD);
+	FUTEXCASE(FUTEX_REQUEUE);
+	FUTEXCASE(FUTEX_CMP_REQUEUE);
+	FUTEXCASE(FUTEX_WAKE_OP);
+	FUTEXCASE(FUTEX_LOCK_PI);
+	FUTEXCASE(FUTEX_UNLOCK_PI);
+	FUTEXCASE(FUTEX_TRYLOCK_PI);
+	FUTEXCASE(FUTEX_WAIT_BITSET);
+	FUTEXCASE(FUTEX_WAKE_BITSET);
+	FUTEXCASE(FUTEX_WAIT_REQUEUE_PI);
+	FUTEXCASE(FUTEX_CMP_REQUEUE_PI);
+	default:
+		return NULL;
+	}
+#undef FUTEXCASE
+}
+
+static void
+futexput(u_long op)
+{
+	const char *opname = futex_op_name(op);
+	const char *s = "";
+
+	if (opname == NULL) {
+		printf("%#lx", op & FUTEX_CMD_MASK);
+	} else {
+		fputs(opname, stdout);
+	}
+	op &= ~FUTEX_CMD_MASK;
+
+	if (op & FUTEX_PRIVATE_FLAG) {
+		fputs("_PRIVATE", stdout);
+		op &= ~FUTEX_PRIVATE_FLAG;
+	}
+
+	if (op & FUTEX_CLOCK_REALTIME) {
+		printf("%sFUTEX_CLOCK_REALTIME", s);
+		op &= ~FUTEX_CLOCK_REALTIME;
+		s = "|";
+	}
+
+	if (op) {
+		printf("%s%#lx", s, op);
+	}
+}
+
 static void
 ktrsyscall(struct ktr_syscall *ktr)
 {
@@ -699,6 +753,25 @@ ktrsyscall(struct ktr_syscall *ktr)
 			ap++;
 			argcount--;
 			c = ',';
+
+			/*
+			 * Linux name is "futex".
+			 * Native name is "__futex".
+			 * Both have the same op argument.
+			 */
+		} else if ((strcmp(sys_name, "futex") == 0 ||
+			strcmp(sys_name, "__futex") == 0) &&
+			   argcount > 2) {
+			(void)putchar('(');
+			output_long((long)*ap, 1);
+			(void)putchar(',');
+			ap++;
+			argcount--;
+			futexput(*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));



CVS commit: src/usr.bin/kdump

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 20 00:35:42 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Understand xattr ktruser records


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.136 src/usr.bin/kdump/kdump.c:1.137
--- src/usr.bin/kdump/kdump.c:1.136	Fri Apr  3 02:13:07 2020
+++ src/usr.bin/kdump/kdump.c	Sun Apr 19 20:35:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $	*/
+/*	$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1213,6 +1213,36 @@ ktruser_soname(const char *name, const v
 }
 
 static void
+ktruser_xattr_name(const char *name, const void *buf, size_t len)
+{
+	printf("%.*s: [%*s]\n", KTR_USER_MAXIDLEN, name, (int)len,
+	(const char *)buf);
+}
+
+static void
+ktruser_xattr_val(const char *name, const void *buf, size_t len)
+{
+	const uint8_t *p = buf;
+	printf("%.*s: ", KTR_USER_MAXIDLEN, name);
+	for (size_t i = 0; i < len; i++)
+		printf("%.2x", *p++);
+	printf("\n");
+}
+
+static void
+ktruser_xattr_list(const char *name, const void *buf, size_t len)
+{
+	const uint8_t *p = buf, *ep = p + len;
+	printf("%.*s:", KTR_USER_MAXIDLEN, name);
+	while (p < ep) {
+		int l = *p++;
+		printf(" %.*s", l, p);
+		p += l;
+	}
+	printf("\n");
+}
+
+static void
 ktruser_control(const char *name, const void *buf, size_t len)
 {
 	struct cmsghdr m;
@@ -1266,6 +1296,9 @@ static struct {
 	{ "mbsoname", ktruser_soname },
 	{ "mbcontrol", ktruser_control },
 	{ "malloc", ktruser_malloc },
+	{ "xattr-name", ktruser_xattr_name },
+	{ "xattr-val", ktruser_xattr_val },
+	{ "xattr-list", ktruser_xattr_list },
 	{ NULL,	ktruser_misc },
 };
 



CVS commit: src/usr.bin/kdump

2020-04-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr  3 06:13:07 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Update usage for ioctlprint.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.135 src/usr.bin/kdump/kdump.c:1.136
--- src/usr.bin/kdump/kdump.c:1.135	Thu Apr  2 17:41:34 2020
+++ src/usr.bin/kdump/kdump.c	Fri Apr  3 06:13:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.135 2020/04/02 17:41:34 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.135 2020/04/02 17:41:34 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -1319,7 +1319,7 @@ static void
 usage(void)
 {
 	if (strcmp(getprogname(), "ioctlprint") == 0) {
-		(void)fprintf(stderr, "Usage: %s [-f format] [-e emulation]  ...\n",
+		(void)fprintf(stderr, "Usage: %s [-l] [-e emulation] [-f format]  ...\n",
 		getprogname());
 	} else {
 		(void)fprintf(stderr, "Usage: %s [-dElNnRT] [-e emulation] "



CVS commit: src/usr.bin/kdump

2020-04-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr  3 06:12:48 UTC 2020

Modified Files:
src/usr.bin/kdump: ioctlprint.1

Log Message:
Increase column widths. Improve -l description wording to match ioctl(2).
Fix Xr.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/kdump/ioctlprint.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/ioctlprint.1
diff -u src/usr.bin/kdump/ioctlprint.1:1.4 src/usr.bin/kdump/ioctlprint.1:1.5
--- src/usr.bin/kdump/ioctlprint.1:1.4	Thu Apr  2 17:41:34 2020
+++ src/usr.bin/kdump/ioctlprint.1	Fri Apr  3 06:12:48 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: ioctlprint.1,v 1.4 2020/04/02 17:41:34 christos Exp $
+.\" $NetBSD: ioctlprint.1,v 1.5 2020/04/03 06:12:48 wiz Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -47,12 +47,11 @@ to by one or more
 .Ar arg
 arguments.
 The argument can either be an
-.Xr ioctl
-symbolic name or the
-ioctl value.
+.Xr ioctl 2
+symbolic name or the ioctl value.
 .Pp
 The options are as follows:
-.Bl -tag -width Fl
+.Bl -tag -width 12n
 .It Fl e Ar emulation
 If an emulation of a process is unknown,
 interpret system call maps assuming the named emulation instead of
@@ -65,7 +64,7 @@ style format string that allows customiz
 output.
 .Pp
 The following conversion characters can be used:
-.Bl -tag -width 
+.Bl -tag -width 9n
 .It \&%E
 Symbolic decoded ioctl string.
 .It \&%e
@@ -85,9 +84,9 @@ The default format is:
 "%n %e %x\\n"
 .Ed
 .It Fl l
-List all 
+List all known
 .Xr ioctl 2
-known.
+requests.
 .El
 .Sh SEE ALSO
 .Xr kdump 1 ,



CVS commit: src/usr.bin/kdump

2020-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  2 21:36:04 UTC 2020

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
remove debugging


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.55 src/usr.bin/kdump/mkioctls:1.56
--- src/usr.bin/kdump/mkioctls:1.55	Thu Apr  2 13:41:34 2020
+++ src/usr.bin/kdump/mkioctls	Thu Apr  2 17:36:03 2020
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.55 2020/04/02 17:41:34 christos Exp $
+#	$NetBSD: mkioctls,v 1.56 2020/04/02 21:36:03 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -39,9 +39,6 @@
 : ${CC:=cc}
 : ${SED:=sed}
 
-set -x
-AWK=gawk
-
 echo "/* Automatically generated file, do not edit! */"
 #echo "#define const" 	# XXX: timepps lossage
 echo "#define COMPAT_43"



CVS commit: src/usr.bin/kdump

2020-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  2 17:40:33 UTC 2020

Modified Files:
src/usr.bin/kdump: ioctlprint.1 kdump.c mkioctls


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/kdump/ioctlprint.1
cvs rdiff -u -r1.133 -r1.134 src/usr.bin/kdump/kdump.c
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/ioctlprint.1
diff -u src/usr.bin/kdump/ioctlprint.1:1.2 src/usr.bin/kdump/ioctlprint.1:1.3
--- src/usr.bin/kdump/ioctlprint.1:1.2	Thu Apr  2 04:38:22 2020
+++ src/usr.bin/kdump/ioctlprint.1	Thu Apr  2 13:40:33 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: ioctlprint.1,v 1.2 2020/04/02 08:38:22 wiz Exp $
+.\" $NetBSD: ioctlprint.1,v 1.3 2020/04/02 17:40:33 christos Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,6 +35,7 @@
 .Nd display descriptive ioctl value
 .Sh SYNOPSIS
 .Nm
+.Op Fl l
 .Op Fl e Ar emulation
 .Op Fl f Ar format
 .Op Ar arg ...
@@ -45,6 +46,10 @@ utility displays information about the f
 to by one or more
 .Ar arg
 arguments.
+The argument can either be an
+.Xr ioctl
+symbolic name or the
+ioctl value.
 .Pp
 The options are as follows:
 .Bl -tag -width Fl
@@ -61,8 +66,10 @@ output.
 .Pp
 The following conversion characters can be used:
 .Bl -tag -width 
+.It \&%E
+Symbolic decoded ioctl string.
 .It \&%e
-Decoded ioctl string.
+Decoded ioctl string with hex values.
 .It \&%n
 Descriptive ioctl operation name.
 .It \&%x
@@ -77,6 +84,10 @@ The default format is:
 .Bd -literal -offset indent
 "%n %e %x\\n"
 .Ed
+.It Fl l
+List all 
+.Xr ioctl 2
+known.
 .El
 .Sh SEE ALSO
 .Xr kdump 1 ,

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.133 src/usr.bin/kdump/kdump.c:1.134
--- src/usr.bin/kdump/kdump.c:1.133	Wed Apr  1 23:32:46 2020
+++ src/usr.bin/kdump/kdump.c	Thu Apr  2 13:40:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.133 2020/04/02 03:32:46 kamil Exp $	*/
+/*	$NetBSD: kdump.c,v 1.134 2020/04/02 17:40:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.133 2020/04/02 03:32:46 kamil Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.134 2020/04/02 17:40:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,9 +108,9 @@ static const char * const linux_ptrace_o
 	"PTRACE_SYSCALL",
 };
 
-static const char default_format[] = { "%n %e %x\n" };
+static const char default_format[] = { "%n\t%E\t%x\n" };
 
-static void	fmtprint(const char *, unsigned long int);
+static void	fmtprint(const char *, const struct ioctlinfo *ii);
 static int	fread_tail(void *, size_t, size_t);
 static int	dumpheader(struct ktr_header *);
 static int	output_ts(const struct timespec *);
@@ -132,11 +132,11 @@ static void	rprint(register_t);
 static const char *signame(long, int);
 static void hexdump_buf(const void *, int, int);
 static void visdump_buf(const void *, int, int);
+static const struct ioctlinfo *find_ioctl(const char *);
 
 int
 main(int argc, char **argv)
 {
-	unsigned long int u;
 	unsigned int ktrlen, size;
 	int ch;
 	void *m;
@@ -145,15 +145,16 @@ main(int argc, char **argv)
 	const char *emul_name = "netbsd";
 	const char *format = default_format;
 	int col;
-	int e;
 	char *cp;
 
 	setprogname(argv[0]);
 
 	if (strcmp(getprogname(), "ioctlprint") == 0) {
+		const struct ioctlinfo *ii;
+		int list = 0;
 		int i;
 
-		while ((ch = getopt(argc, argv, "e:f:")) != -1)
+		while ((ch = getopt(argc, argv, "e:f:l")) != -1)
 			switch (ch) {
 			case 'e':
 emul_name = optarg;
@@ -163,22 +164,34 @@ main(int argc, char **argv)
 	errx(1, "Too many formats");
 format = optarg;
 break;
+			case 'l':
+list = 1;
+break;
 			default:
 usage();
 break;
 			}
+
 		setemul(emul_name, 0, 0);
 		argv += optind;
 		argc -= optind;
 
-		if (argc < 1)
+		if (argc < 1 && !list)
 			usage();
 
+		if (list) {
+			for (i = 0; ioctlinfo[i].name != NULL; i++) {
+fmtprint(format, &ioctlinfo[i]);
+			}
+			return 0;
+		}
+
 		for (i = 0; i < argc; i++) {
-			u = strtou(argv[i], NULL, 0, 0, ULONG_MAX, &e);
-			if (e)
-errc(1, e, "invalid argument: `%s'", argv[i]);
-			fmtprint(format, u);
+			if ((ii = find_ioctl(argv[i])) == NULL) {
+warnx("Can't find ioctl `%s'", argv[i]);
+continue;
+			}
+			fmtprint(format, ii);
 		}
 		return 0;
 	}
@@ -338,11 +351,11 @@ main(int argc, char **argv)
 }
 
 static void
-fmtprint(const char *fmt, unsigned long int u)
+fmtprint(const char *fmt, const struct ioctlinfo *ii)
 {
-	const char *name;
 	int c;
 
+
 	while ((c = *fmt++) != '\0') {
 		switch (c) {
 		default:
@@ -368,21 +381,23 @@ fmtprint(const char *fmt, unsigned long 
 			default:
 putchar(c);
 break;
+			case 'E':
+printf("%s", ii->expr);
+

CVS commit: src/usr.bin/kdump

2020-04-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr  2 08:38:22 UTC 2020

Modified Files:
src/usr.bin/kdump: ioctlprint.1

Log Message:
Remove superfluous Pp. Add comma in enumeration. Add RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/kdump/ioctlprint.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/ioctlprint.1
diff -u src/usr.bin/kdump/ioctlprint.1:1.1 src/usr.bin/kdump/ioctlprint.1:1.2
--- src/usr.bin/kdump/ioctlprint.1:1.1	Thu Apr  2 03:32:46 2020
+++ src/usr.bin/kdump/ioctlprint.1	Thu Apr  2 08:38:22 2020
@@ -1,3 +1,4 @@
+.\" $NetBSD: ioctlprint.1,v 1.2 2020/04/02 08:38:22 wiz Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -40,7 +41,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility displays information about the file ioctl operation pointed to by one or more
+utility displays information about the file ioctl operation pointed
+to by one or more
 .Ar arg
 arguments.
 .Pp
@@ -54,7 +56,7 @@ default "netbsd".
 The argument is a
 .Xr printf 3
 style format string that allows customization of
-.Nm ioctlprint Ns 's
+.Nm ioctlprint Ap s
 output.
 .Pp
 The following conversion characters can be used:
@@ -76,9 +78,8 @@ The default format is:
 "%n %e %x\\n"
 .Ed
 .El
-.Pp
 .Sh SEE ALSO
-.Xr kdump 1
+.Xr kdump 1 ,
 .Xr ktrace 1
 .Sh HISTORY
 The



CVS commit: src/usr.bin/kdump

2020-04-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr  2 08:35:12 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.1

Log Message:
Add comma in enumeration.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/kdump/kdump.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.1
diff -u src/usr.bin/kdump/kdump.1:1.29 src/usr.bin/kdump/kdump.1:1.30
--- src/usr.bin/kdump/kdump.1:1.29	Thu Apr  2 03:35:48 2020
+++ src/usr.bin/kdump/kdump.1	Thu Apr  2 08:35:12 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kdump.1,v 1.29 2020/04/02 03:35:48 kamil Exp $
+.\"	$NetBSD: kdump.1,v 1.30 2020/04/02 08:35:12 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -118,7 +118,7 @@ bytes.
 Supported values are 1, 2, 4, 8, and 16.
 .El
 .Sh SEE ALSO
-.Xr ioctlprint 1
+.Xr ioctlprint 1 ,
 .Xr ktrace 1
 .Sh HISTORY
 The



CVS commit: src/usr.bin/kdump

2020-04-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Apr  2 03:35:48 UTC 2020

Modified Files:
src/usr.bin/kdump: kdump.1

Log Message:
Note ioctlprint(1) in SEE ALSO


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/kdump/kdump.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.1
diff -u src/usr.bin/kdump/kdump.1:1.28 src/usr.bin/kdump/kdump.1:1.29
--- src/usr.bin/kdump/kdump.1:1.28	Sun Sep 10 10:09:34 2017
+++ src/usr.bin/kdump/kdump.1	Thu Apr  2 03:35:48 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kdump.1,v 1.28 2017/09/10 10:09:34 wiz Exp $
+.\"	$NetBSD: kdump.1,v 1.29 2020/04/02 03:35:48 kamil Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)kdump.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd September 9, 2017
+.Dd April 2, 2020
 .Dt KDUMP 1
 .Os
 .Sh NAME
@@ -118,6 +118,7 @@ bytes.
 Supported values are 1, 2, 4, 8, and 16.
 .El
 .Sh SEE ALSO
+.Xr ioctlprint 1
 .Xr ktrace 1
 .Sh HISTORY
 The



CVS commit: src/usr.bin/kdump

2019-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May  6 19:20:13 UTC 2019

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
You don't have to be _LP64 to run 32 bit binaries. You can be mips (64 bit
kernel/32 bit userland).


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.130 src/usr.bin/kdump/kdump.c:1.131
--- src/usr.bin/kdump/kdump.c:1.130	Sun Apr 29 14:00:31 2018
+++ src/usr.bin/kdump/kdump.c	Mon May  6 15:20:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.131 2019/05/06 19:20:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.131 2019/05/06 19:20:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -568,7 +568,6 @@ ktrsyscall(struct ktr_syscall *ktr)
 		sys_name = emul->sysnames[ktr->ktr_code];
 		(void)printf("%s", sys_name);
 	}
-#ifdef _LP64
 #define NETBSD32_	"netbsd32_"
 	if (cur_emul->flags & EMUL_FLAG_NETBSD32) {
 		size_t len = strlen(NETBSD32_);
@@ -576,7 +575,6 @@ ktrsyscall(struct ktr_syscall *ktr)
 			sys_name += len;
 	}
 #undef NETBSD32_
-#endif
 
 	ap = (register_t *)((char *)ktr + sizeof(struct ktr_syscall));
 	if (argcount) {



CVS commit: src/usr.bin/kdump

2018-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 29 18:09:32 UTC 2018

Modified Files:
src/usr.bin/kdump: setemul.c

Log Message:
ibcs2 is gone


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/kdump/setemul.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/setemul.c
diff -u src/usr.bin/kdump/setemul.c:1.30 src/usr.bin/kdump/setemul.c:1.31
--- src/usr.bin/kdump/setemul.c:1.30	Wed Dec 19 16:27:26 2018
+++ src/usr.bin/kdump/setemul.c	Sat Dec 29 18:09:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: setemul.c,v 1.30 2018/12/19 16:27:26 martin Exp $	*/
+/*	$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: setemul.c,v 1.30 2018/12/19 16:27:26 martin Exp $");
+__RCSID("$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -83,7 +83,6 @@ __RCSID("$NetBSD: setemul.c,v 1.30 2018/
 
 #include "../../sys/compat/netbsd32/netbsd32_syscall.h"
 #include "../../sys/compat/freebsd/freebsd_syscall.h"
-#include "../../sys/compat/ibcs2/ibcs2_syscall.h"
 #include "../../sys/compat/linux/linux_syscall.h"
 #include "../../sys/compat/linux32/linux32_syscall.h"
 #include "../../sys/compat/osf1/osf1_syscall.h"
@@ -99,7 +98,6 @@ __RCSID("$NetBSD: setemul.c,v 1.30 2018/
 
 #include "../../sys/compat/netbsd32/netbsd32_syscalls.c"
 #include "../../sys/compat/freebsd/freebsd_syscalls.c"
-#include "../../sys/compat/ibcs2/ibcs2_syscalls.c"
 #include "../../sys/compat/linux/linux_syscalls.c"
 #include "../../sys/compat/linux32/linux32_syscalls.c"
 #include "../../sys/compat/osf1/osf1_syscalls.c"
@@ -110,13 +108,11 @@ __RCSID("$NetBSD: setemul.c,v 1.30 2018/
 #include "../../sys/compat/aoutm68k/aoutm68k_syscalls.c"
 #endif
 
-#include "../../sys/compat/ibcs2/ibcs2_errno.c"
 #include "../../sys/compat/osf1/osf1_errno.c"
 #include "../../sys/compat/linux/common/linux_errno.c"
 #undef KTRACE
 
 #define SIGRTMIN	33	/* XXX */
-#include "../../sys/compat/ibcs2/ibcs2_signo.c"
 #include "../../sys/compat/osf1/osf1_signo.c"
 #include "../../sys/compat/linux/common/linux_signo.c"
 
@@ -136,10 +132,6 @@ const struct emulation emulations[] = {
 	  NULL,0,
 	  NULL,0,	0 },
 
-	{ "ibcs2",	ibcs2_syscallnames,	IBCS2_SYS_MAXSYSCALL,
-	  native_to_ibcs2_errno,	NELEM(native_to_ibcs2_errno),
-	  ibcs2_to_native_signo,	NSIG,	0 },
-
 	{ "linux",	linux_syscallnames,	LINUX_SYS_MAXSYSCALL,
 	  native_to_linux_errno,	NELEM(native_to_linux_errno),
 	  linux_to_native_signo,	NSIG,	0 },



CVS commit: src/usr.bin/kdump

2018-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 19 16:27:26 UTC 2018

Modified Files:
src/usr.bin/kdump: setemul.c

Log Message:
compat/svr4* is gone - adapt


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/kdump/setemul.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/setemul.c
diff -u src/usr.bin/kdump/setemul.c:1.29 src/usr.bin/kdump/setemul.c:1.30
--- src/usr.bin/kdump/setemul.c:1.29	Tue Apr 26 16:57:42 2011
+++ src/usr.bin/kdump/setemul.c	Wed Dec 19 16:27:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: setemul.c,v 1.29 2011/04/26 16:57:42 joerg Exp $	*/
+/*	$NetBSD: setemul.c,v 1.30 2018/12/19 16:27:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: setemul.c,v 1.29 2011/04/26 16:57:42 joerg Exp $");
+__RCSID("$NetBSD: setemul.c,v 1.30 2018/12/19 16:27:26 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -89,8 +89,6 @@ __RCSID("$NetBSD: setemul.c,v 1.29 2011/
 #include "../../sys/compat/osf1/osf1_syscall.h"
 #include "../../sys/compat/sunos32/sunos32_syscall.h"
 #include "../../sys/compat/sunos/sunos_syscall.h"
-#include "../../sys/compat/svr4/svr4_syscall.h"
-#include "../../sys/compat/svr4_32/svr4_32_syscall.h"
 #include "../../sys/compat/ultrix/ultrix_syscall.h"
 #ifdef __m68k__
 #include "../../sys/compat/aoutm68k/aoutm68k_syscall.h"
@@ -107,21 +105,17 @@ __RCSID("$NetBSD: setemul.c,v 1.29 2011/
 #include "../../sys/compat/osf1/osf1_syscalls.c"
 #include "../../sys/compat/sunos/sunos_syscalls.c"
 #include "../../sys/compat/sunos32/sunos32_syscalls.c"
-#include "../../sys/compat/svr4/svr4_syscalls.c"
-#include "../../sys/compat/svr4_32/svr4_32_syscalls.c"
 #include "../../sys/compat/ultrix/ultrix_syscalls.c"
 #ifdef __m68k__
 #include "../../sys/compat/aoutm68k/aoutm68k_syscalls.c"
 #endif
 
-#include "../../sys/compat/svr4/svr4_errno.c"
 #include "../../sys/compat/ibcs2/ibcs2_errno.c"
 #include "../../sys/compat/osf1/osf1_errno.c"
 #include "../../sys/compat/linux/common/linux_errno.c"
 #undef KTRACE
 
 #define SIGRTMIN	33	/* XXX */
-#include "../../sys/compat/svr4/svr4_signo.c"
 #include "../../sys/compat/ibcs2/ibcs2_signo.c"
 #include "../../sys/compat/osf1/osf1_signo.c"
 #include "../../sys/compat/linux/common/linux_signo.c"
@@ -166,14 +160,6 @@ const struct emulation emulations[] = {
 	  NULL,0,
 	  NULL,0,	0 },
 
-	{ "svr4",	svr4_syscallnames,	SVR4_SYS_MAXSYSCALL,
-	  native_to_svr4_errno,		NELEM(native_to_svr4_errno),
-	  svr4_to_native_signo,		NSIG,	0 },
-
-	{ "svr4_32",	svr4_syscallnames,	SVR4_SYS_MAXSYSCALL,
-	  native_to_svr4_errno,		NELEM(native_to_svr4_errno),
-	  svr4_to_native_signo,		NSIG,	EMUL_FLAG_NETBSD32 },
-
 	{ "ultrix",	ultrix_syscallnames,	ULTRIX_SYS_MAXSYSCALL,
 	  NULL,0,
 	  NULL,0,	0 },



CVS commit: src/usr.bin/kdump

2018-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 12 15:41:35 UTC 2018

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
remove extra quotes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.36 src/usr.bin/kdump/Makefile.ioctl-c:1.37
--- src/usr.bin/kdump/Makefile.ioctl-c:1.36	Tue Jun 12 11:40:39 2018
+++ src/usr.bin/kdump/Makefile.ioctl-c	Tue Jun 12 11:41:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.36 2018/06/12 15:40:39 christos Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.37 2018/06/12 15:41:35 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -62,7 +62,7 @@ CPPFLAGS+=	-D__MGA_DRM_H__		# Dup ioctls
 
 ${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}
 	${_MKTARGET_CREATE}
-	AWK=${TOOL_AWK:q} CC="${CC:q}" DESTDIR=${DESTDIR:q} SED=${TOOL_SED:q} \
+	AWK=${TOOL_AWK:q} CC=${CC:q} DESTDIR=${DESTDIR:q} SED=${TOOL_SED:q} \
 	NETBSDSRCDIR=${NETBSDSRCDIR:q} CPPFLAGS=${CPPFLAGS:q} \
 	${HOST_SH} ${NETBSDSRCDIR}/usr.bin/kdump/mkioctls \
 	${DEPFILES} >${.TARGET}



CVS commit: src/usr.bin/kdump

2018-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 12 15:40:39 UTC 2018

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c mkioctls

Log Message:
- instead of hard-coding the include paths in mkioctls, pass them in
  from the Makefile so that they are consistent.
- do more sed so that destination paths are not hard-coded inside #include
  statements.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/kdump/Makefile.ioctl-c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.35 src/usr.bin/kdump/Makefile.ioctl-c:1.36
--- src/usr.bin/kdump/Makefile.ioctl-c:1.35	Mon May 28 17:05:02 2018
+++ src/usr.bin/kdump/Makefile.ioctl-c	Tue Jun 12 11:40:39 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.35 2018/05/28 21:05:02 chs Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.36 2018/06/12 15:40:39 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -35,11 +35,6 @@ DEPFILEGLOB = ${TOOL_SED} \
 DEPFILES != (${DEPFILEGLOB}; echo ${EXTRAS}) | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
 .endif
 
-${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}
-	${_MKTARGET_CREATE}
-	AWK=${TOOL_AWK:Q} CC="${CC}" DESTDIR="${DESTDIR}" SED=${TOOL_SED:Q} \
-	${HOST_SH} ${NETBSDSRCDIR}/usr.bin/kdump/mkioctls \
-	${DEPFILES} >${.TARGET}
 
 SRCS+=		${PROG}-ioctl.c
 CLEANFILES+=	${PROG}-ioctl.c
@@ -65,4 +60,11 @@ CPPFLAGS+=	-D__RADEON_DRM_H__	# Dup ioct
 CPPFLAGS+=	-D__MACH64_DRM_H__	# Dup ioctls
 CPPFLAGS+=	-D__MGA_DRM_H__		# Dup ioctls
 
+${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}
+	${_MKTARGET_CREATE}
+	AWK=${TOOL_AWK:q} CC="${CC:q}" DESTDIR=${DESTDIR:q} SED=${TOOL_SED:q} \
+	NETBSDSRCDIR=${NETBSDSRCDIR:q} CPPFLAGS=${CPPFLAGS:q} \
+	${HOST_SH} ${NETBSDSRCDIR}/usr.bin/kdump/mkioctls \
+	${DEPFILES} >${.TARGET}
+
 ${DEPFILES}: .PRECIOUS

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.51 src/usr.bin/kdump/mkioctls:1.52
--- src/usr.bin/kdump/mkioctls:1.51	Sat Jun  2 16:07:15 2018
+++ src/usr.bin/kdump/mkioctls	Tue Jun 12 11:40:39 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.51 2018/06/02 20:07:15 mrg Exp $
+#	$NetBSD: mkioctls,v 1.52 2018/06/12 15:40:39 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -94,19 +94,16 @@ do
 		fi;;
 	esac
 	echo "#include <$i>"
-done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
+done | ${SED} -e "s,${DESTDIR}/usr/include/,,g" \
+	-e "s,${DESTDIR}/usr/X11R7/include/,,g" \
+	-e "s,${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common/,,g"
 
 if ! $needundef; then
 echo "#define bool _Bool"
 fi
 
-${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
--I${DESTDIR}/usr/X11R7/include \
--I${DESTDIR}/usr/X11R7/include/pixman-1 \
--I${DESTDIR}/usr/X11R7/include/libdrm \
--D_VIA_DRM_H_ \
--dM "${@}" | \
-${AWK} '
+${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include ${CPPFLAGS} -dM "${@}" | \
+${AWK} '
 BEGIN {
 	keep["SLIOCGUNIT"] = 1;	# Same as PPPIOCGASYNCMAP
 	keep["TUNSLMODE"] = 1;	# Same as PPPIOCGASYNCMAP



CVS commit: src/usr.bin/kdump

2018-06-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun  2 20:07:15 UTC 2018

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
just include  for mkioctls.  this works fine for me
for several platforms and fixes the clang build.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.50 src/usr.bin/kdump/mkioctls:1.51
--- src/usr.bin/kdump/mkioctls:1.50	Tue May 29 14:29:53 2018
+++ src/usr.bin/kdump/mkioctls	Sat Jun  2 20:07:15 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.50 2018/05/29 14:29:53 martin Exp $
+#	$NetBSD: mkioctls,v 1.51 2018/06/02 20:07:15 mrg Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -49,10 +49,10 @@ echo "typedef struct crap videomemory_t;
 echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
 echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
 echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
-echo "typedef struct kmutex kmutex_t;" # XXX needed by ZFS headers
 echo "#include "
 echo "#include "
 echo "#include "
+echo "#include "
 echo "#ifndef NBPG"
 echo "#define NBPG 4096 /* workaround / dummy for sparc */"
 echo "#endif /* NBPG */"



CVS commit: src/usr.bin/kdump

2018-05-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 29 14:29:53 UTC 2018

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Use proper forward declaration for kmutex_t. This makes MKDTRACE=no builds
work again.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.49 src/usr.bin/kdump/mkioctls:1.50
--- src/usr.bin/kdump/mkioctls:1.49	Tue May 29 13:10:28 2018
+++ src/usr.bin/kdump/mkioctls	Tue May 29 14:29:53 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.49 2018/05/29 13:10:28 martin Exp $
+#	$NetBSD: mkioctls,v 1.50 2018/05/29 14:29:53 martin Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -49,7 +49,7 @@ echo "typedef struct crap videomemory_t;
 echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
 echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
 echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
-echo "typedef void *kmutex_t;" # XXX needed by ZFS headers
+echo "typedef struct kmutex kmutex_t;" # XXX needed by ZFS headers
 echo "#include "
 echo "#include "
 echo "#include "



CVS commit: src/usr.bin/kdump

2018-05-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 29 13:10:28 UTC 2018

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Ooops, backout previous - it was an update build artifact (or something)


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.48 src/usr.bin/kdump/mkioctls:1.49
--- src/usr.bin/kdump/mkioctls:1.48	Tue May 29 11:18:50 2018
+++ src/usr.bin/kdump/mkioctls	Tue May 29 13:10:28 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.48 2018/05/29 11:18:50 martin Exp $
+#	$NetBSD: mkioctls,v 1.49 2018/05/29 13:10:28 martin Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -49,6 +49,7 @@ echo "typedef struct crap videomemory_t;
 echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
 echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
 echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
+echo "typedef void *kmutex_t;" # XXX needed by ZFS headers
 echo "#include "
 echo "#include "
 echo "#include "



CVS commit: src/usr.bin/kdump

2018-05-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 29 11:18:50 UTC 2018

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Backout previous: "typedef void *kmutex_t;
is incompatible with our kmutex_t and breaks the build. ZFS will need
to find a better way to work around this.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.47 src/usr.bin/kdump/mkioctls:1.48
--- src/usr.bin/kdump/mkioctls:1.47	Mon May 28 21:05:02 2018
+++ src/usr.bin/kdump/mkioctls	Tue May 29 11:18:50 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.47 2018/05/28 21:05:02 chs Exp $
+#	$NetBSD: mkioctls,v 1.48 2018/05/29 11:18:50 martin Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -49,7 +49,6 @@ echo "typedef struct crap videomemory_t;
 echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
 echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
 echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
-echo "typedef void *kmutex_t;" # XXX needed by ZFS headers
 echo "#include "
 echo "#include "
 echo "#include "



CVS commit: src/usr.bin/kdump

2018-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 29 18:00:31 UTC 2018

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
print the mprotect perm argument symbolically.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.129 src/usr.bin/kdump/kdump.c:1.130
--- src/usr.bin/kdump/kdump.c:1.129	Sun Sep 10 06:09:40 2017
+++ src/usr.bin/kdump/kdump.c	Sun Apr 29 14:00:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $	*/
+/*	$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -516,6 +516,37 @@ ioctldecode(u_long cmd)
 }
 
 static void
+putprot(int pr)
+{
+	const char *s = "";
+
+	if (pr == PROT_NONE) {
+		fputs("PROT_NONE", stdout);
+		return;
+	}
+
+	if (pr & PROT_READ) {
+		fputs("PROT_READ", stdout);
+		s = "|";
+		pr &= ~PROT_READ;
+	}
+
+	if (pr & PROT_WRITE) {
+		printf("%sPROT_WRITE", s);
+		pr &= ~PROT_WRITE;
+		s = "|";
+	}
+	if (pr & PROT_EXEC) {
+		printf("%sPROT_EXEC", s);
+		pr &= ~PROT_EXEC;
+		s = "|";
+	}
+	if (pr) {
+		printf("%s%#lx", s, (long)pr);
+	}
+}
+
+static void
 ktrsyscall(struct ktr_syscall *ktr)
 {
 	int argcount;
@@ -602,6 +633,17 @@ ktrsyscall(struct ktr_syscall *ktr)
 			ap += 2;
 			argcount -= 2;
 			c = ',';
+		} else if (strcmp(sys_name, "mprotect") == 0 && argcount >= 3) {
+			putchar('(');
+			output_long((long)ap[0], !(decimal || small(ap[0])));
+			c = ',';
+			putchar(c);
+			output_long((long)ap[1], !(decimal || small(ap[1])));
+			putchar(c);
+			putprot(ap[2]);
+			ap += 3;
+			argcount -= 3;
+			c = ',';
 		} else if (strcmp(sys_name, "mmap") == 0 && argcount >= 6) {
 			char buf[1024];
 			putchar('(');
@@ -610,30 +652,7 @@ ktrsyscall(struct ktr_syscall *ktr)
 			putchar(c);
 			output_long((long)ap[1], !(decimal || small(ap[1])));
 			putchar(c);
-			if (ap[2] == PROT_NONE) {
-			fputs("PROT_NONE", stdout);
-			} else {
-			const char *s = "";
-			c = 0;
-			if (ap[2] & PROT_READ) {
-fputs("PROT_READ", stdout);
-s = "|";
-ap[2] &= ~PROT_READ;
-			}
-			if (ap[2] & PROT_WRITE) {
-printf("%sPROT_WRITE", s);
-ap[2] &= ~PROT_WRITE;
-s = "|";
-			}
-			if (ap[2] & PROT_EXEC) {
-printf("%sPROT_EXEC", s);
-ap[2] &= ~PROT_EXEC;
-s = "|";
-			}
-			if (ap[2]) {
-printf("%s%#lx", s, (long)ap[2]);
-			}
-			}
+			putprot(ap[2]);
 			snprintb(buf, sizeof(buf), MAP_FMT, ap[3]);
 			printf(",%s", buf);
 			ap += 4;



CVS commit: src/usr.bin/kdump

2017-11-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  5 22:52:12 UTC 2017

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
- fix "obsolete" skipping to handle obsolete entries that contain other
  variables
- skip files particular to other xserver versions than ours.

XXX: How does this build in the build farm?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.33 src/usr.bin/kdump/Makefile.ioctl-c:1.34
--- src/usr.bin/kdump/Makefile.ioctl-c:1.33	Thu Aug 18 04:02:58 2016
+++ src/usr.bin/kdump/Makefile.ioctl-c	Sun Nov  5 17:52:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.33 2016/08/18 08:02:58 mrg Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.34 2017/11/05 22:52:12 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -25,7 +25,13 @@ EXTRAS=	${NETBSDSRCDIR}/external/cddl/os
 .endif
 
 .if !make(cleandir) && !make(obj) && !make(includes) && !make(install)
-DEPFILEGLOB = ${TOOL_SED} -ne '/\/usr\/.*include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
+DEPFILEGLOB = ${TOOL_SED} \
+-ne '/\/usr\/.*include\/.*\.h[ 	]/{s/[ 	,]obsolete//;t' \
+-e "s/xorg_server_ver=${XORG_SERVER_VER}//;t skipserver" \
+-e "s/xorg_server_ver=//;t" \
+-e ":skipserver" \
+-e 's/xenio//;t' \
+-e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
 DEPFILES != (${DEPFILEGLOB}; echo ${EXTRAS}) | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
 .endif
 



CVS commit: src/usr.bin/kdump

2017-11-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  5 17:44:29 UTC 2017

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
deal with the stdbool.h mess defining bool in  and 
and then xf86Opt.h wanting to define a struct field called bool.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.45 src/usr.bin/kdump/mkioctls:1.46
--- src/usr.bin/kdump/mkioctls:1.45	Wed Oct 21 20:29:58 2015
+++ src/usr.bin/kdump/mkioctls	Sun Nov  5 12:44:28 2017
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.45 2015/10/22 00:29:58 christos Exp $
+#	$NetBSD: mkioctls,v 1.46 2017/11/05 17:44:28 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -79,11 +79,26 @@ echo "#include "
 echo "#include "
 echo
 
+# kernel headers  and  should not include stdbool.h
+# but they do; then xf86Opt.h needs a bool struct field.
+
+needundef=true
 for i
 do
+	case $i in
+	*X11*)
+		if $needundef; then
+			echo "#undef bool"
+			needundef=false;
+		fi;;
+	esac
 	echo "#include <$i>"
 done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
 
+if ! $needundef; then
+echo "#define bool _Bool"
+fi
+
 ${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
 -I${DESTDIR}/usr/X11R7/include \
 -I${DESTDIR}/usr/X11R7/include/pixman-1 \



CVS commit: src/usr.bin/kdump

2017-09-10 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep 10 10:09:35 UTC 2017

Modified Files:
src/usr.bin/kdump: kdump.1

Log Message:
Sort flags in SYNOPSIS. Remove unnecessary .Tn. Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/kdump/kdump.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.1
diff -u src/usr.bin/kdump/kdump.1:1.27 src/usr.bin/kdump/kdump.1:1.28
--- src/usr.bin/kdump/kdump.1:1.27	Fri Sep  8 21:09:29 2017
+++ src/usr.bin/kdump/kdump.1	Sun Sep 10 10:09:34 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kdump.1,v 1.27 2017/09/08 21:09:29 uwe Exp $
+.\"	$NetBSD: kdump.1,v 1.28 2017/09/10 10:09:34 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -37,7 +37,7 @@
 .Nd display kernel trace data
 .Sh SYNOPSIS
 .Nm
-.Op Fl EdlNnRT
+.Op Fl dElNnRT
 .Op Fl e Ar emulation
 .Op Fl f Ar file
 .Op Fl m Ar maxdata
@@ -75,8 +75,7 @@ more data.
 .It Fl m Ar maxdata
 Display at most
 .Ar maxdata
-bytes when decoding
-.Tn I/O .
+bytes when decoding I/O.
 .It Fl N
 Suppress system call number-to-name translation.
 .It Fl n
@@ -111,12 +110,12 @@ Display GIO data in hex and ascii instea
 .Xr vis 3
 format.
 .It Fl X Ar size
-Same as 
+Same as
 .Fl x
-but display hex values by groups of 
-.Ar size 
+but display hex values by groups of
+.Ar size
 bytes.
-Supported values are 1, 2, 4, 8, and 16. 
+Supported values are 1, 2, 4, 8, and 16.
 .El
 .Sh SEE ALSO
 .Xr ktrace 1



CVS commit: src/usr.bin/kdump

2017-09-10 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep 10 10:09:40 UTC 2017

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.128 src/usr.bin/kdump/kdump.c:1.129
--- src/usr.bin/kdump/kdump.c:1.128	Fri Sep  8 21:45:08 2017
+++ src/usr.bin/kdump/kdump.c	Sun Sep 10 10:09:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.128 2017/09/08 21:45:08 uwe Exp $	*/
+/*	$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.128 2017/09/08 21:45:08 uwe Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -1200,7 +1200,7 @@ usage(void)
 		(void)fprintf(stderr, "Usage: %s [-e emulation]  ...\n",
 		getprogname());
 	} else {
-		(void)fprintf(stderr, "Usage: %s [-dlNnRT] [-e emulation] "
+		(void)fprintf(stderr, "Usage: %s [-dElNnRT] [-e emulation] "
 		   "[-f file] [-m maxdata] [-p pid]\n [-t trstr] "
 		   "[-x | -X size] [file]\n", getprogname());
 	}



CVS commit: src/usr.bin/kdump

2017-09-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Sep  8 21:45:08 UTC 2017

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Print negative time offsets correctly.  Provide an exegetical quote
from riastradh@, slightly edited to fit the metre.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.127 src/usr.bin/kdump/kdump.c:1.128
--- src/usr.bin/kdump/kdump.c:1.127	Fri Sep  8 21:09:29 2017
+++ src/usr.bin/kdump/kdump.c	Fri Sep  8 21:45:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.127 2017/09/08 21:09:29 uwe Exp $	*/
+/*	$NetBSD: kdump.c,v 1.128 2017/09/08 21:45:08 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.127 2017/09/08 21:09:29 uwe Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.128 2017/09/08 21:45:08 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,6 +109,7 @@ static const char * const linux_ptrace_o
 
 static int	fread_tail(void *, size_t, size_t);
 static int	dumpheader(struct ktr_header *);
+static int	output_ts(const struct timespec *);
 static void	output_long(u_long, int);
 static void	ioctldecode(u_long);
 static void	ktrsyscall(struct ktr_syscall *);
@@ -399,8 +400,7 @@ dumpheader(struct ktr_header *kth)
 		if (timestamp & TIMESTAMP_ABSOLUTE) {
 			temp.tv_sec = kth->ktr_ts.tv_sec;
 			temp.tv_nsec = kth->ktr_ts.tv_nsec;
-			col += printf("%lld.%09ld ",
-			(long long)temp.tv_sec, (long)temp.tv_nsec);
+			col += output_ts(&temp);
 		}
 
 		if (timestamp & TIMESTAMP_ELAPSED) {
@@ -410,8 +410,7 @@ dumpheader(struct ktr_header *kth)
 temp.tv_sec = temp.tv_nsec = 0;
 			} else
 timespecsub(&kth->ktr_ts, &starttime, &temp);
-			col += printf("%lld.%09ld ",
-			(long long)temp.tv_sec, (long)temp.tv_nsec);
+			col += output_ts(&temp);
 		}
 
 		if (timestamp & TIMESTAMP_RELATIVE) {
@@ -421,14 +420,42 @@ dumpheader(struct ktr_header *kth)
 timespecsub(&kth->ktr_ts, &prevtime, &temp);
 			prevtime.tv_sec = kth->ktr_ts.tv_sec;
 			prevtime.tv_nsec = kth->ktr_ts.tv_nsec;
-			col += printf("%lld.%09ld ",
-			(long long)temp.tv_sec, (long)temp.tv_nsec);
+			col += output_ts(&temp);
 		}
 	}
 	col += printf("%-4s  ", type);
 	return col;
 }
 
+static int
+output_ts(const struct timespec *ts)
+{
+	int col;
+
+	if (__predict_true(ts->tv_sec >= 0))
+	col = printf("%lld.%09ld ",
+			 (long long)ts->tv_sec, (long)ts->tv_nsec);
+	else {
+	/*
+	 * The time represented by a timespec object ts is always
+	 *
+	 *   ts.tv_sec + ts.tv_nsec * 1e-9
+	 *
+	 * where ts.tv_sec may be negative but ts.tv_nsec is
+	 * always in [0, 1e9).  So, for example, -1/4 second is
+	 * represented by the struct timespec object
+	 *
+	 *   { .tv_sec = -1, .tv_nsec = 75000 }
+	 */
+	const struct timespec zero_ts = { 0, 0 };
+	struct timespec abs_ts;
+	timespecsub(&zero_ts, ts, &abs_ts);
+	col = printf("-%lld.%09ld ",
+			 (long long)abs_ts.tv_sec, (long)abs_ts.tv_nsec);
+	}
+	return col;
+}
+
 static void
 output_long(u_long it, int as_x)
 {



CVS commit: src/usr.bin/kdump

2017-09-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Sep  8 21:09:29 UTC 2017

Modified Files:
src/usr.bin/kdump: kdump.1 kdump.c

Log Message:
Option -E to display elapsed timestamps (time since beginning of trace).

Option name from FreeBSD.  While here, make it possible to use a
combination of -T -E and -R to display timestamps in several formats.
Idea also from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/kdump/kdump.1
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.1
diff -u src/usr.bin/kdump/kdump.1:1.26 src/usr.bin/kdump/kdump.1:1.27
--- src/usr.bin/kdump/kdump.1:1.26	Sun Nov 16 23:10:00 2003
+++ src/usr.bin/kdump/kdump.1	Fri Sep  8 21:09:29 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kdump.1,v 1.26 2003/11/16 23:10:00 wiz Exp $
+.\"	$NetBSD: kdump.1,v 1.27 2017/09/08 21:09:29 uwe Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)kdump.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd November 15, 2003
+.Dd September 9, 2017
 .Dt KDUMP 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd display kernel trace data
 .Sh SYNOPSIS
 .Nm
-.Op Fl dlNnRT
+.Op Fl EdlNnRT
 .Op Fl e Ar emulation
 .Op Fl f Ar file
 .Op Fl m Ar maxdata
@@ -60,6 +60,8 @@ The options are as follows:
 .Bl -tag -width Fl
 .It Fl d
 Display all numbers in decimal.
+.It Fl E
+Display elapsed timestamps (time since beginning of trace).
 .It Fl e Ar emulation
 If an emulation of a process is unknown,
 interpret system call maps assuming the named emulation instead of

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.126 src/usr.bin/kdump/kdump.c:1.127
--- src/usr.bin/kdump/kdump.c:1.126	Fri Sep  8 20:36:56 2017
+++ src/usr.bin/kdump/kdump.c	Fri Sep  8 21:09:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $	*/
+/*	$NetBSD: kdump.c,v 1.127 2017/09/08 21:09:29 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.127 2017/09/08 21:09:29 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,6 +72,11 @@ __RCSID("$NetBSD: kdump.c,v 1.126 2017/0
 
 #include 
 
+#define TIMESTAMP_NONE		0x0
+#define TIMESTAMP_ABSOLUTE	0x1
+#define TIMESTAMP_ELAPSED	0x2
+#define TIMESTAMP_RELATIVE	0x4
+
 static int timestamp, decimal, plain, tail, maxdata = -1, numeric;
 static int word_size = 0;
 static pid_t do_pid = -1;
@@ -162,9 +167,14 @@ main(int argc, char **argv)
 		}
 		return 0;
 	}
-		
-	while ((ch = getopt(argc, argv, "e:f:dlm:Nnp:RTt:xX:")) != -1) {
+
+	timestamp = TIMESTAMP_NONE;
+
+	while ((ch = getopt(argc, argv, "Ee:f:dlm:Nnp:RTt:xX:")) != -1) {
 		switch (ch) {
+		case 'E':
+			timestamp |= TIMESTAMP_ELAPSED;
+			break;
 		case 'e':
 			emul_name = strdup(optarg); /* it's safer to copy it */
 			break;
@@ -194,10 +204,10 @@ main(int argc, char **argv)
 			plain++;
 			break;
 		case 'R':
-			timestamp = 2;	/* relative timestamp */
+			timestamp |= TIMESTAMP_RELATIVE;
 			break;
 		case 'T':
-			timestamp = 1;
+			timestamp |= TIMESTAMP_ABSOLUTE;
 			break;
 		case 't':
 			trset = 1;
@@ -329,7 +339,7 @@ dumpheader(struct ktr_header *kth)
 {
 	char unknown[64];
 	const char *type;
-	static struct timespec prevtime;
+	static struct timespec starttime, prevtime;
 	struct timespec temp;
 	int col;
 
@@ -386,20 +396,34 @@ dumpheader(struct ktr_header *kth)
 	col = printf("%6d %6d ", kth->ktr_pid, kth->ktr_lid);
 	col += printf("%-8.*s ", MAXCOMLEN, kth->ktr_comm);
 	if (timestamp) {
-		if (timestamp == 2) {
+		if (timestamp & TIMESTAMP_ABSOLUTE) {
+			temp.tv_sec = kth->ktr_ts.tv_sec;
+			temp.tv_nsec = kth->ktr_ts.tv_nsec;
+			col += printf("%lld.%09ld ",
+			(long long)temp.tv_sec, (long)temp.tv_nsec);
+		}
+
+		if (timestamp & TIMESTAMP_ELAPSED) {
+			if (starttime.tv_sec == 0) {
+starttime.tv_sec = kth->ktr_ts.tv_sec;
+starttime.tv_nsec = kth->ktr_ts.tv_nsec;
+temp.tv_sec = temp.tv_nsec = 0;
+			} else
+timespecsub(&kth->ktr_ts, &starttime, &temp);
+			col += printf("%lld.%09ld ",
+			(long long)temp.tv_sec, (long)temp.tv_nsec);
+		}
+
+		if (timestamp & TIMESTAMP_RELATIVE) {
 			if (prevtime.tv_sec == 0)
 temp.tv_sec = temp.tv_nsec = 0;
 			else
 timespecsub(&kth->ktr_ts, &prevtime, &temp);
 			prevtime.tv_sec = kth->ktr_ts.tv_sec;
 			prevtime.tv_nsec = kth->ktr_ts.tv_nsec;
-		} else {
-			temp.tv_sec = kth->ktr_ts.tv_sec;
-			temp.tv_nsec = kth->ktr_ts.tv_nsec;
+			col += printf("%lld.%09ld ",
+			(long long)temp.tv_sec, (long)temp.tv_nsec);
 		}
-
-		col += printf("%lld.%09ld ",
-		(long long)temp.tv_sec, (long)temp.tv_nsec);
 	}
 	col += printf("%-4s  

CVS commit: src/usr.bin/kdump

2017-09-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Sep  8 20:36:56 UTC 2017

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Drop support for KTRFACv0 (NetBSD 3) and KTRFACv1 (NetBSD 5).
Note that on 32-bit platforms it probably never worked anyway because
header size changed from v1 to v2 when time_t became 64 bit.

ok christos@
CVS: --
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.125 src/usr.bin/kdump/kdump.c:1.126
--- src/usr.bin/kdump/kdump.c:1.125	Mon Sep  5 00:40:29 2016
+++ src/usr.bin/kdump/kdump.c	Fri Sep  8 20:36:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.125 2016/09/05 00:40:29 sevan Exp $	*/
+/*	$NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.125 2016/09/05 00:40:29 sevan Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -329,14 +329,14 @@ dumpheader(struct ktr_header *kth)
 {
 	char unknown[64];
 	const char *type;
-	union holdtime {
-		struct timeval tv;
-		struct timespec ts;
-	};
-	static union holdtime prevtime;
-	union holdtime temp;
+	static struct timespec prevtime;
+	struct timespec temp;
 	int col;
 
+	if (__predict_false(kth->ktr_version != KTRFAC_VERSION(KTRFACv2)))
+		errx(EXIT_FAILURE, "Unsupported ktrace version %x",
+		 kth->ktr_version);
+
 	switch (kth->ktr_type) {
 	case KTR_SYSCALL:
 		type = "CALL";
@@ -383,70 +383,23 @@ dumpheader(struct ktr_header *kth)
 		type = unknown;
 	}
 
-	col = printf("%6d ", kth->ktr_pid);
-	if (kth->ktr_version > KTRFACv0)
-		col += printf("%6d ", kth->ktr_lid);
+	col = printf("%6d %6d ", kth->ktr_pid, kth->ktr_lid);
 	col += printf("%-8.*s ", MAXCOMLEN, kth->ktr_comm);
 	if (timestamp) {
-		(void)&prevtime;
 		if (timestamp == 2) {
-			switch (kth->ktr_version) {
-			case KTRFAC_VERSION(KTRFACv0):
-if (prevtime.tv.tv_sec == 0)
-	temp.tv.tv_sec = temp.tv.tv_usec = 0;
-else
-	timersub(&kth->ktr_otv,
-	&prevtime.tv, &temp.tv);
-prevtime.tv.tv_sec = kth->ktr_otv.tv_sec;
-prevtime.tv.tv_usec = kth->ktr_otv.tv_usec;
-break;
-			case KTRFAC_VERSION(KTRFACv1):
-if (prevtime.ts.tv_sec == 0)
-	temp.ts.tv_sec = temp.ts.tv_nsec = 0;
-else
-	timespecsub(&kth->ktr_ots,
-	&prevtime.ts, &temp.ts);
-prevtime.ts.tv_sec = kth->ktr_ots.tv_sec;
-prevtime.ts.tv_nsec = kth->ktr_ots.tv_nsec;
-break;
-			case KTRFAC_VERSION(KTRFACv2):
-if (prevtime.ts.tv_sec == 0)
-	temp.ts.tv_sec = temp.ts.tv_nsec = 0;
-else
-	timespecsub(&kth->ktr_ts,
-	&prevtime.ts, &temp.ts);
-prevtime.ts.tv_sec = kth->ktr_ts.tv_sec;
-prevtime.ts.tv_nsec = kth->ktr_ts.tv_nsec;
-break;
-			default:
-goto badversion;
-			}
+			if (prevtime.tv_sec == 0)
+temp.tv_sec = temp.tv_nsec = 0;
+			else
+timespecsub(&kth->ktr_ts, &prevtime, &temp);
+			prevtime.tv_sec = kth->ktr_ts.tv_sec;
+			prevtime.tv_nsec = kth->ktr_ts.tv_nsec;
 		} else {
-			switch (kth->ktr_version) {
-			case KTRFAC_VERSION(KTRFACv0):
-temp.tv.tv_sec = kth->ktr_otv.tv_sec;
-temp.tv.tv_usec = kth->ktr_otv.tv_usec;
-break;
-			case KTRFAC_VERSION(KTRFACv1):
-temp.ts.tv_sec = kth->ktr_ots.tv_sec;
-temp.ts.tv_nsec = kth->ktr_ots.tv_nsec;
-break;
-			case KTRFAC_VERSION(KTRFACv2):
-temp.ts.tv_sec = kth->ktr_ts.tv_sec;
-temp.ts.tv_nsec = kth->ktr_ts.tv_nsec;
-break;
-			default:
-			badversion:
-err(1, "Unsupported ktrace version %x",
-kth->ktr_version);
-			}
+			temp.tv_sec = kth->ktr_ts.tv_sec;
+			temp.tv_nsec = kth->ktr_ts.tv_nsec;
 		}
-		if (kth->ktr_version == KTRFACv0)
-			col += printf("%lld.%06ld ",
-			(long long)temp.tv.tv_sec, (long)temp.tv.tv_usec);
-		else
-			col += printf("%lld.%09ld ",
-			(long long)temp.ts.tv_sec, (long)temp.ts.tv_nsec);
+
+		col += printf("%ll

CVS commit: src/usr.bin/kdump

2016-08-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug 18 08:02:58 UTC 2016

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
don't hide _DEV_IC_BT8XX_H_ inside DTRACE.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.32 src/usr.bin/kdump/Makefile.ioctl-c:1.33
--- src/usr.bin/kdump/Makefile.ioctl-c:1.32	Fri Apr  1 07:23:15 2016
+++ src/usr.bin/kdump/Makefile.ioctl-c	Thu Aug 18 08:02:58 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.32 2016/04/01 07:23:15 knakahara Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.33 2016/08/18 08:02:58 mrg Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -44,8 +44,8 @@ CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/includ
 .if ${MKDTRACE} != "no"
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
-CPPFLAGS+=	-D_DEV_IC_BT8XX_H_
 .endif
+CPPFLAGS+=	-D_DEV_IC_BT8XX_H_
 CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
 # De-select one, dup ioctls
 CPPFLAGS+=	-D_VIA_DRM_H_		# Missing header



CVS commit: src/usr.bin/kdump

2016-05-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun  1 00:47:16 UTC 2016

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Symbolic printing for mmap


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.123 src/usr.bin/kdump/kdump.c:1.124
--- src/usr.bin/kdump/kdump.c:1.123	Sun Mar 27 17:51:20 2016
+++ src/usr.bin/kdump/kdump.c	Tue May 31 20:47:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.123 2016/03/27 21:51:20 alnsn Exp $	*/
+/*	$NetBSD: kdump.c,v 1.124 2016/06/01 00:47:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.123 2016/03/27 21:51:20 alnsn Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.124 2016/06/01 00:47:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -48,6 +48,7 @@ __RCSID("$NetBSD: kdump.c,v 1.123 2016/0
 #define _KMEMUSER/* To get the pseudo errors defined */
 #include 
 #undef _KMEMUSER
+#include 
 #include 
 #include 
 #include 
@@ -598,7 +599,43 @@ ktrsyscall(struct ktr_syscall *ktr)
 			ap += 2;
 			argcount -= 2;
 			c = ',';
-
+		} else if (strcmp(sys_name, "mmap") == 0 && argcount >= 6) {
+			char buf[1024];
+			putchar('(');
+			output_long((long)ap[0], !(decimal || small(ap[0])));
+			c = ',';
+			putchar(c);
+			output_long((long)ap[1], !(decimal || small(ap[1])));
+			putchar(c);
+			if (ap[2] == PROT_NONE) {
+			fputs("PROT_NONE", stdout);
+			} else {
+			const char *s = "";
+			c = 0;
+			if (ap[2] & PROT_READ) {
+fputs("PROT_READ", stdout);
+s = "|";
+ap[2] &= ~PROT_READ;
+			}
+			if (ap[2] & PROT_WRITE) {
+printf("%sPROT_WRITE", s);
+ap[2] &= ~PROT_WRITE;
+s = "|";
+			}
+			if (ap[2] & PROT_EXEC) {
+printf("%sPROT_EXEC", s);
+ap[2] &= ~PROT_EXEC;
+s = "|";
+			}
+			if (ap[2]) {
+printf("%s%#lx", s, (long)ap[2]);
+			}
+			}
+			snprintb(buf, sizeof(buf), MAP_FMT, ap[3]);
+			printf(",%s", buf);
+			ap += 4;
+			argcount -= 4;
+			c = ',';
 		} else if (strcmp(sys_name, "ptrace") == 0 && argcount >= 1) {
 			putchar('(');
 			if (strcmp(emul->name, "linux") == 0 ||



CVS commit: src/usr.bin/kdump

2016-04-01 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Apr  1 07:23:15 UTC 2016

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
' != " so make the condition actually work. (same as r1.30)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.31 src/usr.bin/kdump/Makefile.ioctl-c:1.32
--- src/usr.bin/kdump/Makefile.ioctl-c:1.31	Sat Feb  6 20:21:56 2016
+++ src/usr.bin/kdump/Makefile.ioctl-c	Fri Apr  1 07:23:15 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.31 2016/02/06 20:21:56 joerg Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.32 2016/04/01 07:23:15 knakahara Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -41,7 +41,7 @@ DPSRCS+=	${PROG}-ioctl.c
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/libdrm
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/pixman-1
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include
-.if ${MKDTRACE} != 'no"
+.if ${MKDTRACE} != "no"
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
 CPPFLAGS+=	-D_DEV_IC_BT8XX_H_



CVS commit: src/usr.bin/kdump

2016-03-27 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Mar 27 21:51:20 UTC 2016

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Don't enter infinite loop on big ktr_len values.

Fixes PR 49460.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.122 src/usr.bin/kdump/kdump.c:1.123
--- src/usr.bin/kdump/kdump.c:1.122	Mon Jan  4 08:24:42 2016
+++ src/usr.bin/kdump/kdump.c	Sun Mar 27 21:51:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.122 2016/01/04 08:24:42 martin Exp $	*/
+/*	$NetBSD: kdump.c,v 1.123 2016/03/27 21:51:20 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.122 2016/01/04 08:24:42 martin Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.123 2016/03/27 21:51:20 alnsn Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,7 +109,7 @@ static void	ioctldecode(u_long);
 static void	ktrsyscall(struct ktr_syscall *);
 static void	ktrsysret(struct ktr_sysret *, int);
 static void	ktrnamei(char *, int);
-static void	ktremul(char *, int, int);
+static void	ktremul(char *, size_t, size_t);
 static void	ktrgenio(struct ktr_genio *, int);
 static void	ktrpsig(void *, int);
 static void	ktrcsw(struct ktr_csw *);
@@ -126,7 +126,8 @@ static void visdump_buf(const void *, in
 int
 main(int argc, char **argv)
 {
-	int ch, ktrlen, size;
+	unsigned int ktrlen, size;
+	int ch;
 	void *m;
 	int trpoints = 0;
 	int trset = 0;
@@ -249,7 +250,7 @@ main(int argc, char **argv)
 			col = dumpheader(&ktr_header);
 		else
 			col = -1;
-		if ((ktrlen = ktr_header.ktr_len) < 0)
+		if ((ktrlen = ktr_header.ktr_len) > INT_MAX)
 			errx(1, "bogus length 0x%x", ktrlen);
 		if (ktrlen > size) {
 			while (ktrlen > size)
@@ -751,7 +752,7 @@ ktrnamei(char *cp, int len)
 }
 
 static void
-ktremul(char *name, int len, int bufsize)
+ktremul(char *name, size_t len, size_t bufsize)
 {
 
 	if (len >= bufsize)



CVS commit: src/usr.bin/kdump

2016-02-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb  6 20:21:56 UTC 2016

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
METEORGSIGNAL and METEORSFMT overlap with dtrace, prefer the latter.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.30 src/usr.bin/kdump/Makefile.ioctl-c:1.31
--- src/usr.bin/kdump/Makefile.ioctl-c:1.30	Mon Nov  2 12:06:33 2015
+++ src/usr.bin/kdump/Makefile.ioctl-c	Sat Feb  6 20:21:56 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.30 2015/11/02 12:06:33 joerg Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.31 2016/02/06 20:21:56 joerg Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -44,6 +44,7 @@ CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/includ
 .if ${MKDTRACE} != 'no"
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
+CPPFLAGS+=	-D_DEV_IC_BT8XX_H_
 .endif
 CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
 # De-select one, dup ioctls



CVS commit: src/usr.bin/kdump

2016-01-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  4 08:24:42 UTC 2016

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Cast register_t to unsigned long before printf'ing it with %lx.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.121 src/usr.bin/kdump/kdump.c:1.122
--- src/usr.bin/kdump/kdump.c:1.121	Sun Jan  3 22:05:18 2016
+++ src/usr.bin/kdump/kdump.c	Mon Jan  4 08:24:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.122 2016/01/04 08:24:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.122 2016/01/04 08:24:42 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -577,7 +577,7 @@ ktrsyscall(struct ktr_syscall *ktr)
 			if ((cp = fcntlname(*ap)) != NULL)
 (void)printf(",%s", cp);
 			else {
-(void)printf(",%#lx", *ap);
+(void)printf(",%#lx", (unsigned long)*ap);
 			}
 			ap++;
 			argcount--;



CVS commit: src/usr.bin/kdump

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  3 22:05:18 UTC 2016

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
be a bit smarter about fcntl


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.120 src/usr.bin/kdump/kdump.c:1.121
--- src/usr.bin/kdump/kdump.c:1.120	Tue Jun 16 20:01:59 2015
+++ src/usr.bin/kdump/kdump.c	Sun Jan  3 17:05:18 2016
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #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 @@ output_long(u_long it, int as_x)
 		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 @@ ktrsyscall(struct ktr_syscall *ktr)
 			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));



CVS commit: src/usr.bin/kdump

2015-11-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Nov  2 12:06:33 UTC 2015

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
' != " so make the condition actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.29 src/usr.bin/kdump/Makefile.ioctl-c:1.30
--- src/usr.bin/kdump/Makefile.ioctl-c:1.29	Sat Sep 26 03:31:11 2015
+++ src/usr.bin/kdump/Makefile.ioctl-c	Mon Nov  2 12:06:33 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.29 2015/09/26 03:31:11 christos Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.30 2015/11/02 12:06:33 joerg Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -20,7 +20,7 @@ SETFILES:= ${SETFILES} ${sb}/${md}
 .endif
 .endfor
 .endfor
-.if ${MKDTRACE} != 'no"
+.if ${MKDTRACE} != "no"
 EXTRAS=	${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common/sys/dtrace.h
 .endif
 



CVS commit: src/usr.bin/kdump

2015-10-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 22 00:29:58 UTC 2015

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
simplify


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.44 src/usr.bin/kdump/mkioctls:1.45
--- src/usr.bin/kdump/mkioctls:1.44	Sat Sep 26 23:37:16 2015
+++ src/usr.bin/kdump/mkioctls	Wed Oct 21 20:29:58 2015
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.44 2015/09/27 03:37:16 christos Exp $
+#	$NetBSD: mkioctls,v 1.45 2015/10/22 00:29:58 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -84,13 +84,12 @@ do
 	echo "#include <$i>"
 done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
 
-grep -v "" ${1+"$@"} | \
 ${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
 -I${DESTDIR}/usr/X11R7/include \
 -I${DESTDIR}/usr/X11R7/include/pixman-1 \
 -I${DESTDIR}/usr/X11R7/include/libdrm \
 -D_VIA_DRM_H_ \
--dM - | \
+-dM "${@}" | \
 ${AWK} '
 BEGIN {
 	keep["SLIOCGUNIT"] = 1;	# Same as PPPIOCGASYNCMAP



CVS commit: src/usr.bin/kdump

2015-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 27 03:37:16 UTC 2015

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Kill sys/modctl.h which we don't need.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.43 src/usr.bin/kdump/mkioctls:1.44
--- src/usr.bin/kdump/mkioctls:1.43	Wed May 20 03:16:15 2015
+++ src/usr.bin/kdump/mkioctls	Sat Sep 26 23:37:16 2015
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.43 2015/05/20 07:16:15 matt Exp $
+#	$NetBSD: mkioctls,v 1.44 2015/09/27 03:37:16 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -84,12 +84,13 @@ do
 	echo "#include <$i>"
 done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
 
+grep -v "" ${1+"$@"} | \
 ${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
 -I${DESTDIR}/usr/X11R7/include \
 -I${DESTDIR}/usr/X11R7/include/pixman-1 \
 -I${DESTDIR}/usr/X11R7/include/libdrm \
 -D_VIA_DRM_H_ \
--dM ${1+"$@"} | \
+-dM - | \
 ${AWK} '
 BEGIN {
 	keep["SLIOCGUNIT"] = 1;	# Same as PPPIOCGASYNCMAP



CVS commit: src/usr.bin/kdump

2015-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 26 03:31:11 UTC 2015

Modified Files:
src/usr.bin/kdump: Makefile Makefile.ioctl-c

Log Message:
Add dtrace ioctls


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile
diff -u src/usr.bin/kdump/Makefile:1.30 src/usr.bin/kdump/Makefile:1.31
--- src/usr.bin/kdump/Makefile:1.30	Wed Sep 21 13:48:51 2011
+++ src/usr.bin/kdump/Makefile	Fri Sep 25 23:31:11 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2011/09/21 17:48:51 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2015/09/26 03:31:11 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 		# for MKDYNAMICROOT & NETBSDSRCDIR
@@ -6,7 +6,6 @@
 USE_FORT?= yes	# cryptographic software
 
 PROG=	kdump
-CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/ktrace -I${NETBSDSRCDIR}/sys
 SRCS=	kdump.c subr.c setemul.c siginfo.c
 .PATH:	${NETBSDSRCDIR}/usr.bin/ktrace
 CLEANFILES+=siginfo.c
@@ -18,6 +17,8 @@ LDSTATIC?=-static
 .include "Makefile.ioctl-c"
 .include "Makefile.siginfo-c"
 
+CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/ktrace -I${NETBSDSRCDIR}/sys
+
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
 

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.28 src/usr.bin/kdump/Makefile.ioctl-c:1.29
--- src/usr.bin/kdump/Makefile.ioctl-c:1.28	Sat Feb  7 09:37:42 2015
+++ src/usr.bin/kdump/Makefile.ioctl-c	Fri Sep 25 23:31:11 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.28 2015/02/07 14:37:42 christos Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.29 2015/09/26 03:31:11 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -20,10 +20,13 @@ SETFILES:= ${SETFILES} ${sb}/${md}
 .endif
 .endfor
 .endfor
+.if ${MKDTRACE} != 'no"
+EXTRAS=	${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common/sys/dtrace.h
+.endif
 
 .if !make(cleandir) && !make(obj) && !make(includes) && !make(install)
 DEPFILEGLOB = ${TOOL_SED} -ne '/\/usr\/.*include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
-DEPFILES != ${DEPFILEGLOB} | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
+DEPFILES != (${DEPFILEGLOB}; echo ${EXTRAS}) | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
 .endif
 
 ${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}
@@ -38,6 +41,10 @@ DPSRCS+=	${PROG}-ioctl.c
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/libdrm
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/pixman-1
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include
+.if ${MKDTRACE} != 'no"
+CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys
+CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
+.endif
 CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
 # De-select one, dup ioctls
 CPPFLAGS+=	-D_VIA_DRM_H_		# Missing header



CVS commit: src/usr.bin/kdump

2015-05-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed May 20 07:16:15 UTC 2015

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
#include  for ksyms


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.42 src/usr.bin/kdump/mkioctls:1.43
--- src/usr.bin/kdump/mkioctls:1.42	Fri Feb  6 20:08:23 2015
+++ src/usr.bin/kdump/mkioctls	Wed May 20 07:16:15 2015
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.42 2015/02/06 20:08:23 christos Exp $
+#	$NetBSD: mkioctls,v 1.43 2015/05/20 07:16:15 matt Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -60,6 +60,7 @@ echo "#include "
 echo "#include "
 echo "#include "
 echo "#include "
+echo "#include "
 echo "#include "
 echo "#include "
 echo "#include "



CVS commit: src/usr.bin/kdump

2015-02-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  7 14:37:42 UTC 2015

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
Add QXL, re-enable I915


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.27 src/usr.bin/kdump/Makefile.ioctl-c:1.28
--- src/usr.bin/kdump/Makefile.ioctl-c:1.27	Sat Feb  7 06:24:55 2015
+++ src/usr.bin/kdump/Makefile.ioctl-c	Sat Feb  7 09:37:42 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.27 2015/02/07 11:24:55 martin Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.28 2015/02/07 14:37:42 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -41,7 +41,8 @@ CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/includ
 CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
 # De-select one, dup ioctls
 CPPFLAGS+=	-D_VIA_DRM_H_		# Missing header
-CPPFLAGS+=	-D_I915_DRM_H_		# Dup ioctls
+#CPPFLAGS+=	-D_I915_DRM_H_		# Dup ioctls
+CPPFLAGS+=	-DQXL_DRM_H		# Dup ioctls
 CPPFLAGS+=	-D__R128_DRM_H__	# Dup ioctls
 CPPFLAGS+=	-D__SIS_DRM_H__		# Dup ioctls
 CPPFLAGS+=	-D__SAVAGE_DRM_H__	# Dup ioctls



CVS commit: src/usr.bin/kdump

2015-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  7 11:24:55 UTC 2015

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
Drop i915, it still causes duplicate case statements
(DRM_IOCTL_QXL_UPDATE_AREA == DRM_IOCTL_I915_BATCHBUFFER)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.26 src/usr.bin/kdump/Makefile.ioctl-c:1.27
--- src/usr.bin/kdump/Makefile.ioctl-c:1.26	Fri Feb  6 20:07:45 2015
+++ src/usr.bin/kdump/Makefile.ioctl-c	Sat Feb  7 11:24:55 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.26 2015/02/06 20:07:45 christos Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.27 2015/02/07 11:24:55 martin Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -41,7 +41,7 @@ CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/includ
 CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
 # De-select one, dup ioctls
 CPPFLAGS+=	-D_VIA_DRM_H_		# Missing header
-#CPPFLAGS+=	-D_I915_DRM_H_		# Dup ioctls
+CPPFLAGS+=	-D_I915_DRM_H_		# Dup ioctls
 CPPFLAGS+=	-D__R128_DRM_H__	# Dup ioctls
 CPPFLAGS+=	-D__SIS_DRM_H__		# Dup ioctls
 CPPFLAGS+=	-D__SAVAGE_DRM_H__	# Dup ioctls



CVS commit: src/usr.bin/kdump

2015-02-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  6 20:07:45 UTC 2015

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
Extend the list of the headers processed to generate symbolic ioctls to
the X sets, and include the DRM ioctls. Unfortunately the DRM ioctls for
different cards overlap, so until I write some code to merge them, only
enable one (currently the i915).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.25 src/usr.bin/kdump/Makefile.ioctl-c:1.26
--- src/usr.bin/kdump/Makefile.ioctl-c:1.25	Sat Apr  6 09:48:12 2013
+++ src/usr.bin/kdump/Makefile.ioctl-c	Fri Feb  6 15:07:45 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.25 2013/04/06 13:48:12 uebayasi Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.26 2015/02/06 20:07:45 christos Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -7,16 +7,22 @@
 # and silently ignores any that don't exist in ${DESTDIR}.
 # NB: The compiler uses the .h files in ${NETBSDSRCDIR}.
 
-SETBASE=${NETBSDSRCDIR}/distrib/sets/lists/comp
-SETFILES:=${SETBASE}/mi
+SETBASES=	${NETBSDSRCDIR}/distrib/sets/lists/comp \
+		${NETBSDSRCDIR}/distrib/sets/lists/xcomp
+
+.for sb in ${SETBASES}
+.if exists(${sb}/mi)
+SETFILES:=${SETFILES} ${sb}/mi
+.endif
 .for md in md.${MACHINE} /md.${MACHINE}.${MACHINE_ARCH}
-.if exists(${SETBASE}/${md})
-SETFILES:= ${SETFILES} ${SETBASE}/${md}
+.if exists(${sb}/${md})
+SETFILES:= ${SETFILES} ${sb}/${md}
 .endif
 .endfor
+.endfor
 
 .if !make(cleandir) && !make(obj) && !make(includes) && !make(install)
-DEPFILEGLOB = ${TOOL_SED} -ne '/\/usr\/include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
+DEPFILEGLOB = ${TOOL_SED} -ne '/\/usr\/.*include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
 DEPFILES != ${DEPFILEGLOB} | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
 .endif
 
@@ -29,5 +35,18 @@ ${PROG}-ioctl.c: mkioctls Makefile ${DEP
 SRCS+=		${PROG}-ioctl.c
 CLEANFILES+=	${PROG}-ioctl.c
 DPSRCS+=	${PROG}-ioctl.c
+CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/libdrm
+CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/pixman-1
+CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include
+CPPFLAGS+=	-D_ALTQ_ALTQ_JOBS_H_	# redefinition of inline
+# De-select one, dup ioctls
+CPPFLAGS+=	-D_VIA_DRM_H_		# Missing header
+#CPPFLAGS+=	-D_I915_DRM_H_		# Dup ioctls
+CPPFLAGS+=	-D__R128_DRM_H__	# Dup ioctls
+CPPFLAGS+=	-D__SIS_DRM_H__		# Dup ioctls
+CPPFLAGS+=	-D__SAVAGE_DRM_H__	# Dup ioctls
+CPPFLAGS+=	-D__RADEON_DRM_H__	# Dup ioctls
+CPPFLAGS+=	-D__MACH64_DRM_H__	# Dup ioctls
+CPPFLAGS+=	-D__MGA_DRM_H__		# Dup ioctls
 
 ${DEPFILES}: .PRECIOUS



CVS commit: src/usr.bin/kdump

2015-02-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  6 20:08:23 UTC 2015

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Extend the scripts to handle the X drm ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.41 src/usr.bin/kdump/mkioctls:1.42
--- src/usr.bin/kdump/mkioctls:1.41	Thu Apr  4 18:32:12 2013
+++ src/usr.bin/kdump/mkioctls	Fri Feb  6 15:08:23 2015
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.41 2013/04/04 22:32:12 dsl Exp $
+#	$NetBSD: mkioctls,v 1.42 2015/02/06 20:08:23 christos Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -48,6 +48,7 @@ echo "struct crap { int _xxx; };" # XXX 
 echo "typedef struct crap videomemory_t;" # XXX arm video lossage
 echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
 echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
+echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
 echo "#include "
 echo "#include "
 echo "#include "
@@ -82,7 +83,12 @@ do
 	echo "#include <$i>"
 done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
 
-${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include -dM ${1+"$@"} | \
+${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
+-I${DESTDIR}/usr/X11R7/include \
+-I${DESTDIR}/usr/X11R7/include/pixman-1 \
+-I${DESTDIR}/usr/X11R7/include/libdrm \
+-D_VIA_DRM_H_ \
+-dM ${1+"$@"} | \
 ${AWK} '
 BEGIN {
 	keep["SLIOCGUNIT"] = 1;	# Same as PPPIOCGASYNCMAP
@@ -170,7 +176,7 @@ BEGIN {
 	print "\tswitch (val) {\n"
 }
 
-/^#[ 	]*define[ 	]*[A-Z0-9_]*[ 	]*_IO[W]*[R]*[ 	]*\(/ {
+/^#[ 	]*define[ 	]*[A-Z0-9_]*[ 	]*[D]*[R]*[M]*_IO[W]*[R]*[ 	]*\(/ {
 	
 	# find where the name starts
 	for (i = 1; i <= NF; i++)



CVS commit: src/usr.bin/kdump

2014-04-30 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Apr 30 11:51:51 UTC 2014

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Fix compat netbsd32 syscall return values display by calling
output_long() instead of printf().


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.117 src/usr.bin/kdump/kdump.c:1.118
--- src/usr.bin/kdump/kdump.c:1.117	Wed Nov 27 20:27:58 2013
+++ src/usr.bin/kdump/kdump.c	Wed Apr 30 11:51:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.117 2013/11/27 20:27:58 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.118 2014/04/30 11:51:51 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.117 2013/11/27 20:27:58 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.118 2014/04/30 11:51:51 njoly Exp $");
 #endif
 #endif /* not lint */
 
@@ -652,14 +652,13 @@ rprint(register_t ret)
 {
 
 	if (!plain) {
-		(void)printf("%ld", (long)ret);
-		if (!small(ret))
-			(void)printf("/%#lx", (long)ret);
+		output_long(ret, 0);
+		if (!small(ret)) {
+			putchar('/');
+			output_long(ret, 1);
+		}
 	} else {
-		if (decimal || small(ret))
-			(void)printf("%ld", (long)ret);
-		else
-			(void)printf("%#lx", (long)ret);
+		output_long(ret, !(decimal || small(ret)));
 	}
 }
 



CVS commit: src/usr.bin/kdump

2013-11-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 27 20:27:58 UTC 2013

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
PR/48413: Inappropriate sign extension in kdump output


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.116 src/usr.bin/kdump/kdump.c:1.117
--- src/usr.bin/kdump/kdump.c:1.116	Wed Jan  2 14:39:04 2013
+++ src/usr.bin/kdump/kdump.c	Wed Nov 27 15:27:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.116 2013/01/02 19:39:04 dsl Exp $	*/
+/*	$NetBSD: kdump.c,v 1.117 2013/11/27 20:27:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.116 2013/01/02 19:39:04 dsl Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.117 2013/11/27 20:27:58 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1055,7 +1055,7 @@ ktruser_misc(const char *name, const voi
 
 	printf("%.*s: %zu, ", KTR_USER_MAXIDLEN, name, len);
 	for (i = 0; i < len; i++)
-		printf("%02x", (unsigned int) dta[i]);
+		printf("%02x", (unsigned char)dta[i]);
 	printf("\n");
 }
 



CVS commit: src/usr.bin/kdump

2013-04-06 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Apr  6 13:48:12 UTC 2013

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
* Don't re-generate kdump-ioctl.c during install.
* Don't expand hundreds of *.h paths into a variable and command-line in !=.
  Lazily handle it the glob instead.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.24 src/usr.bin/kdump/Makefile.ioctl-c:1.25
--- src/usr.bin/kdump/Makefile.ioctl-c:1.24	Thu Apr  4 22:35:28 2013
+++ src/usr.bin/kdump/Makefile.ioctl-c	Sat Apr  6 13:48:12 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.24 2013/04/04 22:35:28 dsl Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.25 2013/04/06 13:48:12 uebayasi Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -15,9 +15,9 @@ SETFILES:= ${SETFILES} ${SETBASE}/${md}
 .endif
 .endfor
 
-.if !make(cleandir) && !make(obj) && !make(includes)
-DEPFILEGLOB != ${TOOL_SED} -ne '/\/usr\/include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
-DEPFILES != egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' ${DEPFILEGLOB} 2>/dev/null || :
+.if !make(cleandir) && !make(obj) && !make(includes) && !make(install)
+DEPFILEGLOB = ${TOOL_SED} -ne '/\/usr\/include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
+DEPFILES != ${DEPFILEGLOB} | xargs egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' 2>/dev/null || :
 .endif
 
 ${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}



CVS commit: src/usr.bin/kdump

2013-04-04 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Apr  4 22:35:29 UTC 2013

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
Extract a base list of .h files from the set lists instead of looking
  at the current contents of ${DESTDIR}.
Ignore missing files and also depend on the set lists themselves.
Should stop the build breaking here if there are extra files in DESTDIR (etc).
NB: The order of the .h files matters somewhat. Probably works by luck.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.23 src/usr.bin/kdump/Makefile.ioctl-c:1.24
--- src/usr.bin/kdump/Makefile.ioctl-c:1.23	Sat Oct 25 22:23:55 2008
+++ src/usr.bin/kdump/Makefile.ioctl-c	Thu Apr  4 22:35:28 2013
@@ -1,14 +1,26 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.23 2008/10/25 22:23:55 apb Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.24 2013/04/04 22:35:28 dsl Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
-DEPFILEGLOB=	${DESTDIR}/usr/include/*/*.h ${DESTDIR}/usr/include/*/*/*.h
+# We are trying to get the list of .h files that define all ioctls
+# This version grabs the non-obsolete .h files from the set lists
+# and silently ignores any that don't exist in ${DESTDIR}.
+# NB: The compiler uses the .h files in ${NETBSDSRCDIR}.
+
+SETBASE=${NETBSDSRCDIR}/distrib/sets/lists/comp
+SETFILES:=${SETBASE}/mi
+.for md in md.${MACHINE} /md.${MACHINE}.${MACHINE_ARCH}
+.if exists(${SETBASE}/${md})
+SETFILES:= ${SETFILES} ${SETBASE}/${md}
+.endif
+.endfor
 
 .if !make(cleandir) && !make(obj) && !make(includes)
-DEPFILES != egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' ${DEPFILEGLOB} | fgrep -v xenio
+DEPFILEGLOB != ${TOOL_SED} -ne '/\/usr\/include\/.*\.h[ 	]/{s/[ 	]obsolete$$//;t' -e 's/xenio//;t' -e 's,\.\([^ 	]*\).*,${DESTDIR}\1,;p;}' ${SETFILES}
+DEPFILES != egrep -l '(_IO\(|_IOR\(|_IOW\(|_IOWR\()' ${DEPFILEGLOB} 2>/dev/null || :
 .endif
 
-${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES}
+${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES} ${SETFILES}
 	${_MKTARGET_CREATE}
 	AWK=${TOOL_AWK:Q} CC="${CC}" DESTDIR="${DESTDIR}" SED=${TOOL_SED:Q} \
 	${HOST_SH} ${NETBSDSRCDIR}/usr.bin/kdump/mkioctls \



CVS commit: src/usr.bin/kdump

2013-04-04 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Apr  4 22:32:12 UTC 2013

Modified Files:
src/usr.bin/kdump: mkioctls

Log Message:
Output a blank line between the fixed and variable #include lines.
Just a little hint that they come from different places.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/kdump/mkioctls

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/mkioctls
diff -u src/usr.bin/kdump/mkioctls:1.40 src/usr.bin/kdump/mkioctls:1.41
--- src/usr.bin/kdump/mkioctls:1.40	Fri Mar  1 18:26:10 2013
+++ src/usr.bin/kdump/mkioctls	Thu Apr  4 22:32:12 2013
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mkioctls,v 1.40 2013/03/01 18:26:10 joerg Exp $
+#	$NetBSD: mkioctls,v 1.41 2013/04/04 22:32:12 dsl Exp $
 #
 # Copyright (c) 1994
 #	The Regents of the University of California.  All rights reserved.
@@ -75,6 +75,7 @@ echo "#include "
 echo "#include "
 echo "#include "
 echo "#include "
+echo
 
 for i
 do



CVS commit: src/usr.bin/kdump

2011-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 28 16:28:27 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
don't limit sockets to sizeof(sizeof sockaddr_storage). We can create valid
sockaddr_un sockets that exceed that. Arguably either
sizeof(struct sockaddr_storage) should be amended, or we should disallow
unix domain sockaddrs that exceed that size.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.114 src/usr.bin/kdump/kdump.c:1.115
--- src/usr.bin/kdump/kdump.c:1.114	Wed Sep 21 13:48:53 2011
+++ src/usr.bin/kdump/kdump.c	Wed Sep 28 12:28:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.114 2011/09/21 17:48:53 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.115 2011/09/28 16:28:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.114 2011/09/21 17:48:53 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.115 2011/09/28 16:28:27 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1031,11 +1031,7 @@ static void
 ktruser_soname(const char *name, const void *buf, size_t len)
 {
 	char fmt[512];
-	struct sockaddr_storage ss;
-
-	memset(&ss, 0, sizeof(ss));
-	memcpy(&ss, buf, len);
-	sockaddr_snprintf(fmt, sizeof(fmt), "%a", (struct sockaddr *)&ss);
+	sockaddr_snprintf(fmt, sizeof(fmt), "%a", buf);
 	printf("%.*s: [%s]\n", KTR_USER_MAXIDLEN, name, fmt);
 }
 



CVS commit: src/usr.bin/kdump

2011-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 21 17:48:53 UTC 2011

Modified Files:
src/usr.bin/kdump: Makefile kdump.c

Log Message:
Symbolic printing of some known MISC records.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile
diff -u src/usr.bin/kdump/Makefile:1.29 src/usr.bin/kdump/Makefile:1.30
--- src/usr.bin/kdump/Makefile:1.29	Tue Apr 14 18:15:21 2009
+++ src/usr.bin/kdump/Makefile	Wed Sep 21 13:48:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2009/04/14 22:15:21 lukem Exp $
+#	$NetBSD: Makefile,v 1.30 2011/09/21 17:48:51 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 		# for MKDYNAMICROOT & NETBSDSRCDIR
@@ -18,4 +18,7 @@
 .include "Makefile.ioctl-c"
 .include "Makefile.siginfo-c"
 
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
+
 .include 

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.113 src/usr.bin/kdump/kdump.c:1.114
--- src/usr.bin/kdump/kdump.c:1.113	Fri Sep  2 16:11:42 2011
+++ src/usr.bin/kdump/kdump.c	Wed Sep 21 13:48:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.113 2011/09/02 20:11:42 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.114 2011/09/21 17:48:53 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.113 2011/09/02 20:11:42 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.114 2011/09/21 17:48:53 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -64,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ktrace.h"
 #include "setemul.h"
@@ -1011,23 +1013,86 @@
 }
 
 static void
+ktruser_msghdr(const char *name, const void *buf, size_t len)
+{
+	struct msghdr m;
+
+	if (len != sizeof(m))
+		warnx("%.*s: len %zu != %zu", KTR_USER_MAXIDLEN, name, len,
+		sizeof(m));
+	memcpy(&m, buf, len);
+	printf("%.*s: [name=%p, namelen=%zu, iov=%p, iovlen=%zu, control=%p, "
+	"controllen=%zu, flags=%x]\n", KTR_USER_MAXIDLEN, name,
+	m.msg_name, (size_t)m.msg_namelen, m.msg_iov, (size_t)m.msg_iovlen,
+	m.msg_control, (size_t)m.msg_controllen, m.msg_flags);
+}
+
+static void
+ktruser_soname(const char *name, const void *buf, size_t len)
+{
+	char fmt[512];
+	struct sockaddr_storage ss;
+
+	memset(&ss, 0, sizeof(ss));
+	memcpy(&ss, buf, len);
+	sockaddr_snprintf(fmt, sizeof(fmt), "%a", (struct sockaddr *)&ss);
+	printf("%.*s: [%s]\n", KTR_USER_MAXIDLEN, name, fmt);
+}
+
+static void
+ktruser_control(const char *name, const void *buf, size_t len)
+{
+	struct cmsghdr m;
+
+	if (len < sizeof(m))
+		warnx("%.*s: len %zu < %zu", KTR_USER_MAXIDLEN, name, len,
+		sizeof(m));
+	memcpy(&m, buf, sizeof(m));
+	printf("%.*s: [len=%zu, level=%d, type=%d]\n", KTR_USER_MAXIDLEN, name,
+	(size_t)m.cmsg_len, m.cmsg_level, m.cmsg_type);
+}
+
+static void
+ktruser_misc(const char *name, const void *buf, size_t len)
+{
+	size_t i;
+	const char *dta = buf;
+
+	printf("%.*s: %zu, ", KTR_USER_MAXIDLEN, name, len);
+	for (i = 0; i < len; i++)
+		printf("%02x", (unsigned int) dta[i]);
+	printf("\n");
+}
+
+static struct {
+	const char *name;
+	void (*func)(const char *, const void *, size_t);
+} nv[] = {
+	{ "msghdr", ktruser_msghdr },
+	{ "mbsoname", ktruser_soname },
+	{ "mbcontrol", ktruser_control },
+	{ NULL,	ktruser_misc },
+};
+
+static void
 ktruser(struct ktr_user *usr, int len)
 {
-	int i;
 	unsigned char *dta;
 
 	len -= sizeof(struct ktr_user);
-	printf("%.*s:", KTR_USER_MAXIDLEN, usr->ktr_id);
 	dta = (unsigned char *)(usr + 1);
 	if (word_size) {
+		printf("%.*s:", KTR_USER_MAXIDLEN, usr->ktr_id);
 		printf("\n");
 		hexdump_buf(dta, len, word_size);
 		return;
 	}
-	printf(" %d, ", len);
-	for (i = 0; i < len; i++)
-		printf("%02x", (unsigned int) dta[i]);
-	printf("\n");
+	for (size_t j = 0; j < __arraycount(nv); j++)
+		if (nv[j].name == NULL ||
+		strncmp(nv[j].name, usr->ktr_id, KTR_USER_MAXIDLEN) == 0) {
+			(*nv[j].func)(usr->ktr_id, dta, len);
+			break;
+		}
 }
 
 static void



CVS commit: src/usr.bin/kdump

2011-09-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep  2 20:11:42 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
- use PT_STRINGS
- use __arraycount()


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.112 src/usr.bin/kdump/kdump.c:1.113
--- src/usr.bin/kdump/kdump.c:1.112	Wed Jun  1 17:28:32 2011
+++ src/usr.bin/kdump/kdump.c	Fri Sep  2 16:11:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.112 2011/06/01 21:28:32 alnsn Exp $	*/
+/*	$NetBSD: kdump.c,v 1.113 2011/09/02 20:11:42 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.112 2011/06/01 21:28:32 alnsn Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.113 2011/09/02 20:11:42 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,10 +81,7 @@
 #define small(v)	(((long)(v) >= 0) && ((long)(v) < 10))
 
 static const char * const ptrace_ops[] = {
-	"PT_TRACE_ME",	"PT_READ_I",	"PT_READ_D",	"PT_READ_U",
-	"PT_WRITE_I",	"PT_WRITE_D",	"PT_WRITE_U",	"PT_CONTINUE",
-	"PT_KILL",	"PT_ATTACH",	"PT_DETACH",	"PT_IO",
-	"PT_DUMPCORE",	"PT_LWPINFO", 	"PT_SYSCALL",
+	PT_STRINGS
 };
 
 #ifdef PT_MACHDEP_STRINGS
@@ -574,14 +571,13 @@
 else
 	output_long((long)*ap, 1);
 			} else {
-if ((long)*ap >= 0 && *ap <
-(register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0])))
+if ((long)*ap >= 0 && *ap < (register_t)
+__arraycount(ptrace_ops))
 	(void)printf("%s", ptrace_ops[*ap]);
 #ifdef PT_MACHDEP_STRINGS
 else if (*ap >= PT_FIRSTMACH &&
-*ap - PT_FIRSTMACH <
-(register_t)(sizeof(ptrace_machdep_ops) /
-		sizeof(ptrace_machdep_ops[0])))
+*ap - PT_FIRSTMACH < (register_t)
+__arraycount(ptrace_machdep_ops))
 	(void)printf("%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
 #endif
 else



CVS commit: src/usr.bin/kdump

2011-04-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 10 16:06:59 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Fix string constant so it compiles again.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.108 src/usr.bin/kdump/kdump.c:1.109
--- src/usr.bin/kdump/kdump.c:1.108	Sun Apr 10 14:38:19 2011
+++ src/usr.bin/kdump/kdump.c	Sun Apr 10 16:06:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.109 2011/04/10 16:06:59 pgoyette 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.108 2011/04/10 14:38:19 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.109 2011/04/10 16:06:59 pgoyette Exp $");
 #endif
 #endif /* not lint */
 
@@ -951,7 +951,7 @@
 return;
 			case SI_LWP:
 printf(": code=SI_LWP sent by pid=%d, "
-"uid=%d")\n", si->si_pid, si->si_uid);
+"uid=%d)\n", si->si_pid, si->si_uid);
 return;
 			default:
 code = NULL;



CVS commit: src/usr.bin/kdump

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 14:38:19 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
we don't have access to si_lid anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.107 src/usr.bin/kdump/kdump.c:1.108
--- src/usr.bin/kdump/kdump.c:1.107	Sat Apr  9 20:05:51 2011
+++ src/usr.bin/kdump/kdump.c	Sun Apr 10 10:38:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 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.107 2011/04/10 00:05:51 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -950,9 +950,8 @@
 si->si_value.sival_ptr);
 return;
 			case SI_LWP:
-printf(": code=SI_LWP sent by pid=%d, uid=%d "
-"with target lid=%d)\n", si->si_pid,
-si->si_uid, si->si_lid);
+printf(": code=SI_LWP sent by pid=%d, "
+"uid=%d")\n", si->si_pid, si->si_uid);
 return;
 			default:
 code = NULL;



CVS commit: src/usr.bin/kdump

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 00:05:51 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
print detailed info about other SI_ codes.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.106 src/usr.bin/kdump/kdump.c:1.107
--- src/usr.bin/kdump/kdump.c:1.106	Mon Jan 10 00:15:17 2011
+++ src/usr.bin/kdump/kdump.c	Sat Apr  9 20:05:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 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.106 2011/01/10 05:15:17 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -943,14 +943,17 @@
 si->si_uid, si->si_value.sival_ptr);
 return;
 			case SI_ASYNCIO:
-code = "SI_ASYNCIO";
-break;
 			case SI_MESGQ:
-code = "SI_MESGQ";
-break;
+printf(": code=%s with sigval %p)\n",
+si->si_code == SI_ASYNCIO ?
+"SI_ASYNCIO" : "SI_MESGQ",
+si->si_value.sival_ptr);
+return;
 			case SI_LWP:
-code = "SI_LWP";
-break;
+printf(": code=SI_LWP sent by pid=%d, uid=%d "
+"with target lid=%d)\n", si->si_pid,
+si->si_uid, si->si_lid);
+return;
 			default:
 code = NULL;
 break;



CVS commit: src/usr.bin/kdump

2011-01-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 10 05:15:17 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
format SI_QUEUE properly.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.105 src/usr.bin/kdump/kdump.c:1.106
--- src/usr.bin/kdump/kdump.c:1.105	Sun Aug  8 14:31:50 2010
+++ src/usr.bin/kdump/kdump.c	Mon Jan 10 00:15:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.105 2010/08/08 18:31:50 chs Exp $	*/
+/*	$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 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.105 2010/08/08 18:31:50 chs Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -936,12 +936,12 @@
 		if (si->si_code < 0) {
 			switch (si->si_code) {
 			case SI_TIMER:
-printf(": code=SI_TIMER sigval %p)\n",
-si->si_value.sival_ptr);
-return;
 			case SI_QUEUE:
-code = "SI_QUEUE";
-break;
+printf(": code=%s sent by pid=%d, uid=%d with "
+"sigval %p)\n", si->si_code == SI_TIMER ?
+"SI_TIMER" : "SI_QUEUE", si->si_pid,
+si->si_uid, si->si_value.sival_ptr);
+return;
 			case SI_ASYNCIO:
 code = "SI_ASYNCIO";
 break;



CVS commit: src/usr.bin/kdump

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:31:50 UTC 2010

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
fix emul state tracking for exit vs exit_group on linux.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.104 src/usr.bin/kdump/kdump.c:1.105
--- src/usr.bin/kdump/kdump.c:1.104	Mon Apr 13 14:39:23 2009
+++ src/usr.bin/kdump/kdump.c	Sun Aug  8 18:31:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.104 2009/04/13 14:39:23 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.105 2010/08/08 18:31:50 chs 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.104 2009/04/13 14:39:23 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.105 2010/08/08 18:31:50 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -532,7 +532,10 @@
 		if (plain) {
 			;
 
-		} else if (strcmp(sys_name, "exit") == 0) {
+		} else if (strcmp(sys_name, "exit_group") == 0 ||
+			   (strcmp(emul->name, "linux") != 0 &&
+			strcmp(emul->name, "linux32") != 0 &&
+			strcmp(sys_name, "exit") == 0)) {
 			ectx_delete();
 
 		} else if (strcmp(sys_name, "ioctl") == 0 && argcount >= 2) {



CVS commit: src/usr.bin/kdump

2009-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 13 14:39:23 UTC 2009

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
Allow kdump to be used as an ioctl decoder if invoked as ioctlname.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.103 src/usr.bin/kdump/kdump.c:1.104
--- src/usr.bin/kdump/kdump.c:1.103	Sun Apr 12 07:23:12 2009
+++ src/usr.bin/kdump/kdump.c	Mon Apr 13 10:39:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.103 2009/04/12 11:23:12 lukem Exp $	*/
+/*	$NetBSD: kdump.c,v 1.104 2009/04/13 14:39:23 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.103 2009/04/12 11:23:12 lukem Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.104 2009/04/13 14:39:23 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -136,6 +136,33 @@
 	char *cp;
 
 	setprogname(argv[0]);
+
+	if (strcmp(getprogname(), "ioctlname") == 0) {
+		int i;
+
+		while ((ch = getopt(argc, argv, "e:")) != -1)
+			switch (ch) {
+			case 'e':
+emul_name = optarg;
+break;
+			default:
+usage();
+break;
+			}
+		setemul(emul_name, 0, 0);
+		argv += optind;
+		argc -= optind;
+
+		if (argc < 1)
+			usage();
+
+		for (i = 0; i < argc; i++) {
+			ioctldecode(strtoul(argv[i], NULL, 0));
+			(void)putchar('\n');
+		}
+		return 0;
+	}
+		
 	while ((ch = getopt(argc, argv, "e:f:dlm:Nnp:RTt:xX:")) != -1) {
 		switch (ch) {
 		case 'e':
@@ -455,9 +482,9 @@
 
 	c = (cmd >> 8) & 0xff;
 	if (isprint(c))
-		printf(",_IO%s('%c',", dirbuf, c);
+		printf("_IO%s('%c',", dirbuf, c);
 	else
-		printf(",_IO%s(0x%02x,", dirbuf, c);
+		printf("_IO%s(0x%02x,", dirbuf, c);
 	output_long(cmd & 0xff, decimal == 0);
 	if ((cmd & IOC_VOID) == 0) {
 		putchar(',');
@@ -515,8 +542,10 @@
 			argcount--;
 			if ((cp = ioctlname(*ap)) != NULL)
 (void)printf(",%s", cp);
-			else
+			else {
+(void)putchar(',');
 ioctldecode(*ap);
+			}
 			ap++;
 			argcount--;
 			c = ',';
@@ -1060,9 +1089,13 @@
 static void
 usage(void)
 {
-
-	(void)fprintf(stderr, "Usage: %s [-dlNnRT] [-e emulation] "
-	   "[-f file] [-m maxdata] [-p pid]\n [-t trstr] "
-	   "[-x | -X size] [file]\n", getprogname());
+	if (strcmp(getprogname(), "ioctlname") == 0) {
+		(void)fprintf(stderr, "Usage: %s [-e emulation]  ...\n",
+		getprogname());
+	} else {
+		(void)fprintf(stderr, "Usage: %s [-dlNnRT] [-e emulation] "
+		   "[-f file] [-m maxdata] [-p pid]\n [-t trstr] "
+		   "[-x | -X size] [file]\n", getprogname());
+	}
 	exit(1);
 }



CVS commit: src/usr.bin/kdump

2009-04-12 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 12 11:23:12 UTC 2009

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
fix sign-compare issues


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/kdump/kdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.102 src/usr.bin/kdump/kdump.c:1.103
--- src/usr.bin/kdump/kdump.c:1.102	Sun Jan 11 03:05:41 2009
+++ src/usr.bin/kdump/kdump.c	Sun Apr 12 11:23:12 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.102 2009/01/11 03:05:41 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.103 2009/04/12 11:23:12 lukem 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.102 2009/01/11 03:05:41 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.103 2009/04/12 11:23:12 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -542,21 +542,21 @@
 			if (strcmp(emul->name, "linux") == 0 ||
 			strcmp(emul->name, "linux32") == 0) {
 if ((long)*ap >= 0 && *ap <
-sizeof(linux_ptrace_ops) /
-sizeof(linux_ptrace_ops[0]))
+(register_t)(sizeof(linux_ptrace_ops) /
+sizeof(linux_ptrace_ops[0])))
 	(void)printf("%s",
 	linux_ptrace_ops[*ap]);
 else
 	output_long((long)*ap, 1);
 			} else {
 if ((long)*ap >= 0 && *ap <
-sizeof(ptrace_ops) / sizeof(ptrace_ops[0]))
+(register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0])))
 	(void)printf("%s", ptrace_ops[*ap]);
 #ifdef PT_MACHDEP_STRINGS
 else if (*ap >= PT_FIRSTMACH &&
 *ap - PT_FIRSTMACH <
-		sizeof(ptrace_machdep_ops) /
-		sizeof(ptrace_machdep_ops[0]))
+(register_t)(sizeof(ptrace_machdep_ops) /
+		sizeof(ptrace_machdep_ops[0])))
 	(void)printf("%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
 #endif
 else
@@ -602,7 +602,7 @@
 	switch (error) {
 	case 0:
 		rprint(ktr->ktr_retval);
-		if (len > offsetof(struct ktr_sysret, ktr_retval_1) &&
+		if (len > (int)offsetof(struct ktr_sysret, ktr_retval_1) &&
 		ktr->ktr_retval_1 != 0) {
 			(void)printf(", ");
 			rprint(ktr->ktr_retval_1);
@@ -1035,7 +1035,7 @@
 static void
 ktrmib(int *namep, int len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < (len / sizeof(*namep)); i++)
 		printf("%s%d", (i == 0) ? "" : ".", namep[i]);