summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-08-18 00:48:58 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-08-18 00:48:58 +0000
commit51c6f5e0f5f6f300b649e518110808b2b6142098 (patch)
treeef4493f33798663d78e64da953be0b0a0532567b
parentfdaeb3d021ec2144bc6bf1bc3bd2686bdf31734a (diff)
Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.
-rw-r--r--usr.bin/kdump/kdump.c76
-rw-r--r--usr.bin/kdump/mkioctls6
-rw-r--r--usr.bin/ktrace/extern.h29
-rw-r--r--usr.bin/ktrace/ktrace.c20
-rw-r--r--usr.bin/ktrace/subr.c7
5 files changed, 95 insertions, 43 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index ae4c1dd4c03..4e8a11abf45 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.11 2001/07/12 05:17:12 deraadt Exp $ */
+/* $OpenBSD: kdump.c,v 1.12 2001/08/18 00:48:57 espie Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: kdump.c,v 1.11 2001/07/12 05:17:12 deraadt Exp $";
+static char *rcsid = "$OpenBSD: kdump.c,v 1.12 2001/08/18 00:48:57 espie Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -65,6 +65,7 @@ static char *rcsid = "$OpenBSD: kdump.c,v 1.11 2001/07/12 05:17:12 deraadt Exp $
#include <vis.h>
#include "ktrace.h"
+#include "extern.h"
int timestamp, decimal, fancy = 1, tail, maxdata;
char *tracefile = DEF_TRACEFILE;
@@ -144,13 +145,25 @@ static char *ptrace_ops[] = {
"PT_KILL", "PT_ATTACH", "PT_DETACH",
};
+static int fread_tail __P((void *, int, int));
+static void dumpheader __P((struct ktr_header *));
+static void ktrcsw __P((struct ktr_csw *));
+static void ktremul __P((char *, int));
+static void ktrgenio __P((struct ktr_genio *, int));
+static void ktrnamei __P((const char *, int));
+static void ktrpsig __P((struct ktr_psig *));
+static void ktrsyscall __P((struct ktr_syscall *));
+static void ktrsysret __P((struct ktr_sysret *));
+static void setemul __P((const char *));
+static void usage __P((void));
+
int
main(argc, argv)
int argc;
char *argv[];
{
int ch, ktrlen, size;
- register void *m;
+ void *m;
int trpoints = ALL_POINTS;
current = &emulations[0]; /* native */
@@ -238,11 +251,12 @@ main(argc, argv)
if (tail)
(void)fflush(stdout);
}
+ exit(0);
}
-int
+static int
fread_tail(buf, size, num)
- char *buf;
+ void *buf;
int num, size;
{
int i;
@@ -254,7 +268,7 @@ fread_tail(buf, size, num)
return (i);
}
-void
+static void
dumpheader(kth)
struct ktr_header *kth;
{
@@ -301,7 +315,7 @@ dumpheader(kth)
(void)printf("%s ", type);
}
-void
+static void
ioctldecode(cmd)
u_long cmd;
{
@@ -321,13 +335,12 @@ ioctldecode(cmd)
printf(")");
}
-void
+static void
ktrsyscall(ktr)
- register struct ktr_syscall *ktr;
+ struct ktr_syscall *ktr;
{
- register argsize = ktr->ktr_argsize;
- register register_t *ap;
- char *ioctlname();
+ int argsize = ktr->ktr_argsize;
+ register_t *ap;
if (ktr->ktr_code >= current->nsysnames || ktr->ktr_code < 0)
(void)printf("[%d]", ktr->ktr_code);
@@ -338,7 +351,7 @@ ktrsyscall(ktr)
char c = '(';
if (fancy) {
if (ktr->ktr_code == SYS_ioctl) {
- char *cp;
+ const char *cp;
if (decimal)
(void)printf("(%ld", (long)*ap);
else
@@ -377,12 +390,13 @@ ktrsyscall(ktr)
(void)putchar('\n');
}
+static void
ktrsysret(ktr)
struct ktr_sysret *ktr;
{
- register int ret = ktr->ktr_retval;
- register int error = ktr->ktr_error;
- register int code = ktr->ktr_code;
+ int ret = ktr->ktr_retval;
+ int error = ktr->ktr_error;
+ int code = ktr->ktr_code;
if (code >= current->nsysnames || code < 0)
(void)printf("[%d] ", code);
@@ -412,14 +426,18 @@ ktrsysret(ktr)
(void)putchar('\n');
}
+static void
ktrnamei(cp, len)
- char *cp;
+ const char *cp;
+ int len;
{
(void)printf("\"%.*s\"\n", len, cp);
}
+static void
ktremul(cp, len)
char *cp;
+ int len;
{
char name[1024];
@@ -433,16 +451,18 @@ ktremul(cp, len)
setemul(name);
}
+static void
ktrgenio(ktr, len)
struct ktr_genio *ktr;
+ int len;
{
- register int datalen = len - sizeof (struct ktr_genio);
- register char *dp = (char *)ktr + sizeof (struct ktr_genio);
- register char *cp;
- register int col = 0;
- register width;
+ int datalen = len - sizeof (struct ktr_genio);
+ char *dp = (char *)ktr + sizeof (struct ktr_genio);
+ char *cp;
+ int col = 0;
+ int width;
char visbuf[5];
- static screenwidth = 0;
+ static int screenwidth = 0;
if (screenwidth == 0) {
struct winsize ws;
@@ -495,7 +515,7 @@ ktrgenio(ktr, len)
(void)printf("\"\n");
}
-void
+static void
ktrpsig(psig)
struct ktr_psig *psig;
{
@@ -507,7 +527,7 @@ ktrpsig(psig)
(u_long)psig->action, psig->mask, psig->code);
}
-void
+static void
ktrcsw(cs)
struct ktr_csw *cs;
{
@@ -515,7 +535,7 @@ ktrcsw(cs)
cs->user ? "user" : "kernel");
}
-void
+static void
usage()
{
@@ -524,9 +544,9 @@ usage()
exit(1);
}
-void
+static void
setemul(name)
- char *name;
+ const char *name;
{
int i;
for (i = 0; emulations[i].name != NULL; i++)
diff --git a/usr.bin/kdump/mkioctls b/usr.bin/kdump/mkioctls
index 85f24874754..e71f12121bd 100644
--- a/usr.bin/kdump/mkioctls
+++ b/usr.bin/kdump/mkioctls
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: mkioctls,v 1.5 1999/12/28 06:02:34 angelos Exp $
+# $OpenBSD: mkioctls,v 1.6 2001/08/18 00:48:57 espie Exp $
#
# Copyright (c) 1994
@@ -52,9 +52,9 @@ BEGIN {
print "#define COMPAT_43"
print "#include <sys/ioctl.h>"
print ""
- print "char *"
+ print "const char *"
print "ioctlname(val)"
- print "\tlong val;"
+ print "\tunsigned long val;"
print "{"
print ""
}
diff --git a/usr.bin/ktrace/extern.h b/usr.bin/ktrace/extern.h
new file mode 100644
index 00000000000..b64675c9a9e
--- /dev/null
+++ b/usr.bin/ktrace/extern.h
@@ -0,0 +1,29 @@
+/* $OpenBSD: extern.h,v 1.1 2001/08/18 00:48:57 espie Exp $ */
+
+/*
+ * Copyright (c) 2001 Marc Espie.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+extern int getpoints __P((const char *));
+extern const char *ioctlname __P((unsigned long));
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c
index a3aa28d606c..349e26cae84 100644
--- a/usr.bin/ktrace/ktrace.c
+++ b/usr.bin/ktrace/ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrace.c,v 1.10 2001/07/12 05:17:13 deraadt Exp $ */
+/* $OpenBSD: ktrace.c,v 1.11 2001/08/18 00:48:57 espie Exp $ */
/* $NetBSD: ktrace.c,v 1.4 1995/08/31 23:01:44 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ktrace.c 8.2 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: ktrace.c,v 1.10 2001/07/12 05:17:13 deraadt Exp $";
+static char *rcsid = "$OpenBSD: ktrace.c,v 1.11 2001/08/18 00:48:57 espie Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -61,9 +61,11 @@ static char *rcsid = "$OpenBSD: ktrace.c,v 1.10 2001/07/12 05:17:13 deraadt Exp
#include <unistd.h>
#include "ktrace.h"
+#include "extern.h"
-void no_ktrace __P((int));
-void usage __P((void));
+static int rpid __P((const char *));
+static void no_ktrace __P((int));
+static void usage __P((void));
int
main(argc, argv)
@@ -123,7 +125,7 @@ main(argc, argv)
argv += optind;
argc -= optind;
- if (pidset && *argv || !pidset && !*argv)
+ if ((pidset && *argv) || (!pidset && !*argv))
usage();
if (inherit)
@@ -171,9 +173,9 @@ main(argc, argv)
exit(0);
}
-int
+static int
rpid(p)
- char *p;
+ const char *p;
{
static int first;
@@ -188,7 +190,7 @@ rpid(p)
return(atoi(p));
}
-void
+static void
usage()
{
(void)fprintf(stderr,
@@ -196,7 +198,7 @@ usage()
exit(1);
}
-void
+static void
no_ktrace(sig)
int sig;
{
diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c
index 5965c3c5789..80d51d0f10d 100644
--- a/usr.bin/ktrace/subr.c
+++ b/usr.bin/ktrace/subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.c,v 1.3 2001/07/12 05:17:13 deraadt Exp $ */
+/* $OpenBSD: subr.c,v 1.4 2001/08/18 00:48:57 espie Exp $ */
/* $NetBSD: subr.c,v 1.6 1995/08/31 23:01:45 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.2 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: subr.c,v 1.3 2001/07/12 05:17:13 deraadt Exp $";
+static char *rcsid = "$OpenBSD: subr.c,v 1.4 2001/08/18 00:48:57 espie Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -51,10 +51,11 @@ static char *rcsid = "$OpenBSD: subr.c,v 1.3 2001/07/12 05:17:13 deraadt Exp $";
#include <stdio.h>
#include "ktrace.h"
+#include "extern.h"
int
getpoints(s)
- char *s;
+ const char *s;
{
int facs = 0;