diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2002-04-01 10:49:11 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2002-04-01 10:49:11 +0000 |
commit | 766bb4cc90ee3309d97621e8f9ef788d90adc653 (patch) | |
tree | 5ee40a23861b6ef442be55ef886ae9773b128c48 /usr.bin | |
parent | 3bbc58aa98d18a3a13ba8c3028396b3e16fe25dc (diff) | |
download | FreeBSD-src-766bb4cc90ee3309d97621e8f9ef788d90adc653.zip FreeBSD-src-766bb4cc90ee3309d97621e8f9ef788d90adc653.tar.gz |
1) Clean up vendor and ID strings.
2) include stdlib.h for atoi.
3) staticise and constify.
4) add some missing prototypes.
5) add some parens to keep gcc happy.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ktrace/ktrace.c | 25 | ||||
-rw-r--r-- | usr.bin/ktrace/ktrace.h | 3 | ||||
-rw-r--r-- | usr.bin/ktrace/subr.c | 13 |
3 files changed, 29 insertions, 12 deletions
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 1d75ada..a9e2252 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -41,10 +41,11 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ktrace.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include <sys/param.h> #include <sys/stat.h> #include <sys/file.h> @@ -55,20 +56,23 @@ static const char rcsid[] = #include <err.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include "ktrace.h" -void no_ktrace(int); -void usage(void); +static void no_ktrace(int); +static int rpid(char *); +static void usage(void); +int main(argc, argv) int argc; char **argv; { enum { NOTSET, CLEAR, CLEARALL } clear; int append, ch, fd, inherit, ops, pid, pidset, trpoints; - char *tracefile; + const char *tracefile; mode_t omask; struct stat sb; @@ -118,7 +122,7 @@ main(argc, argv) argv += optind; argc -= optind; - if (pidset && *argv || !pidset && !*argv) + if ((pidset && *argv) || (!pidset && !*argv)) usage(); if (inherit) @@ -166,6 +170,7 @@ main(argc, argv) exit(0); } +static int rpid(p) char *p; { @@ -182,7 +187,7 @@ rpid(p) return(atoi(p)); } -void +static void usage() { (void)fprintf(stderr, "%s\n%s\n", @@ -191,9 +196,9 @@ usage() exit(1); } -void +static void no_ktrace(sig) - int sig; + int sig __unused; { (void)fprintf(stderr, "error:\tktrace() system call not supported in the running kernel\n\tre-compile kernel with 'options KTRACE'\n"); diff --git a/usr.bin/ktrace/ktrace.h b/usr.bin/ktrace/ktrace.h index 9f6431a..2f22ce3 100644 --- a/usr.bin/ktrace/ktrace.h +++ b/usr.bin/ktrace/ktrace.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)ktrace.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ @@ -39,3 +40,5 @@ #define ALL_POINTS (DEF_POINTS | KTRFAC_CSW) #define DEF_TRACEFILE "ktrace.out" + +int getpoints __P((char *)); diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c index 4e4b3bf..f7c324c 100644 --- a/usr.bin/ktrace/subr.c +++ b/usr.bin/ktrace/subr.c @@ -35,10 +35,11 @@ #if 0 static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include <sys/param.h> #include <sys/file.h> #include <sys/user.h> @@ -50,6 +51,11 @@ static const char rcsid[] = #include "ktrace.h" +void timevaladd(struct timeval *, struct timeval *); +void timevalsub(struct timeval *, struct timeval *); +void timevalfix(struct timeval *); + +int getpoints(s) char *s; { @@ -86,6 +92,7 @@ getpoints(s) return (facs); } +void timevaladd(t1, t2) struct timeval *t1, *t2; { @@ -94,6 +101,7 @@ timevaladd(t1, t2) timevalfix(t1); } +void timevalsub(t1, t2) struct timeval *t1, *t2; { @@ -102,6 +110,7 @@ timevalsub(t1, t2) timevalfix(t1); } +void timevalfix(t1) struct timeval *t1; { |