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.
This commit is contained in:
David Malone 2002-04-01 10:49:11 +00:00
parent 4a213d4ae9
commit ebdb213b72
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93523
3 changed files with 29 additions and 12 deletions

View File

@ -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");

View File

@ -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 *));

View File

@ -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;
{