diff options
author | markm <markm@FreeBSD.org> | 2001-12-11 23:34:02 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2001-12-11 23:34:02 +0000 |
commit | 87c4eaeeed39514ac24329e5481562c3f2725f87 (patch) | |
tree | e098039357509d2cf005759f795894172bd324b8 /usr.bin | |
parent | 21b6b26912b00bb37f9f16080ba7d49241814935 (diff) | |
download | FreeBSD-src-87c4eaeeed39514ac24329e5481562c3f2725f87.zip FreeBSD-src-87c4eaeeed39514ac24329e5481562c3f2725f87.tar.gz |
Partial WARNS=1 fizes with NO_WERROR set to prevent world breakage.
Use __FBSDID().
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/truss/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/truss/amd64-linux32.c | 3 | ||||
-rw-r--r-- | usr.bin/truss/extern.h | 47 | ||||
-rw-r--r-- | usr.bin/truss/i386-linux.c | 3 | ||||
-rw-r--r-- | usr.bin/truss/main.c | 31 | ||||
-rw-r--r-- | usr.bin/truss/setup.c | 4 | ||||
-rw-r--r-- | usr.bin/truss/syscall.h | 2 | ||||
-rw-r--r-- | usr.bin/truss/syscalls.c | 23 |
8 files changed, 78 insertions, 38 deletions
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile index 9b43792..788822b 100644 --- a/usr.bin/truss/Makefile +++ b/usr.bin/truss/Makefile @@ -8,6 +8,9 @@ SRCS+= alpha-fbsd.c SRCS+= i386-fbsd.c i386-linux.c linux_syscalls.h .endif +WARNS?= 1 +NO_WERROR=yes + CFLAGS+= -I${.CURDIR} -I. CLEANFILES+=i386l-syscalls.master syscalls.master linux_syscalls.h \ syscalls.h ioctl.c diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c index 27b964e..9c297b6 100644 --- a/usr.bin/truss/amd64-linux32.c +++ b/usr.bin/truss/amd64-linux32.c @@ -55,6 +55,7 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> +#include "extern.h" #include "syscall.h" static int fd = -1; @@ -183,7 +184,7 @@ i386_linux_syscall_entry(int pid, int nargs) { /* * Linux syscalls return negative errno's, we do positive and map them */ -int bsd_to_linux_errno[] = { +const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h new file mode 100644 index 0000000..90bf46e --- /dev/null +++ b/usr.bin/truss/extern.h @@ -0,0 +1,47 @@ +/* + * Copryight 1997 Sean Eric Fagan + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Sean Eric Fagan + * 4. Neither the name of the author may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +extern int setup_and_wait(char **); +extern int start_tracing(int, int); +extern void restore_proc(int); +extern const char *ioctlname(register_t val); +#ifdef __alpha__ +extern void alpha_syscall_entry(int, int); +extern void alpha_syscall_exit(int, int); +#endif +#ifdef __i386__ +extern void i386_syscall_entry(int, int); +extern void i386_syscall_exit(int, int); +extern void i386_linux_syscall_entry(int, int); +extern void i386_linux_syscall_exit(int, int); +#endif diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c index 27b964e..9c297b6 100644 --- a/usr.bin/truss/i386-linux.c +++ b/usr.bin/truss/i386-linux.c @@ -55,6 +55,7 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> +#include "extern.h" #include "syscall.h" static int fd = -1; @@ -183,7 +184,7 @@ i386_linux_syscall_entry(int pid, int nargs) { /* * Linux syscalls return negative errno's, we do positive and map them */ -int bsd_to_linux_errno[] = { +const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 7faf3e8..e6c4160 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -53,18 +53,7 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> -extern int setup_and_wait(char **); -extern int start_tracing(int, int); -#ifdef __alpha__ -extern void alpha_syscall_entry(int, int); -extern void alpha_syscall_exit(int, int); -#endif -#ifdef __i386__ -extern void i386_syscall_entry(int, int); -extern void i386_syscall_exit(int, int); -extern void i386_linux_syscall_entry(int, int); -extern void i386_linux_syscall_exit(int, int); -#endif +#include "extern.h" /* * These should really be parameterized -- I don't like having globals, @@ -75,7 +64,6 @@ int pid = 0; int nosigs = 0; FILE *outfile; int Procfd; -char progtype[50]; /* OS and type of executable */ static inline void usage(void) @@ -91,7 +79,7 @@ usage(void) * work correctly. */ struct ex_types { - char *type; + const char *type; void (*enter_syscall)(int, int); void (*exit_syscall)(int, int); } ex_types[] = { @@ -113,28 +101,28 @@ struct ex_types { */ static struct ex_types * -set_etype() { +set_etype(void) { struct ex_types *funcs; char etype[24]; - char progtype[32]; + char progt[32]; int fd; sprintf(etype, "/proc/%d/etype", pid); if ((fd = open(etype, O_RDONLY)) == -1) { - strcpy(progtype, "FreeBSD a.out"); + strcpy(progt, "FreeBSD a.out"); } else { - int len = read(fd, progtype, sizeof(progtype)); - progtype[len-1] = '\0'; + int len = read(fd, progt, sizeof(progt)); + progt[len-1] = '\0'; close(fd); } for (funcs = ex_types; funcs->type; funcs++) - if (!strcmp(funcs->type, progtype)) + if (!strcmp(funcs->type, progt)) break; if (funcs == NULL) { warn("Execution type %s is not supported -- using FreeBSD a.out\n", - progtype); + progt); funcs = &ex_types[0]; } return funcs; @@ -191,7 +179,6 @@ main(int ac, char **av) { signal(SIGTERM, SIG_IGN); signal(SIGQUIT, SIG_IGN); } else { - extern void restore_proc(int); signal(SIGINT, restore_proc); signal(SIGTERM, restore_proc); signal(SIGQUIT, restore_proc); diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c index c3e7970..115ba15 100644 --- a/usr.bin/truss/setup.c +++ b/usr.bin/truss/setup.c @@ -53,6 +53,8 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> +#include "extern.h" + static int evflags = 0; /* @@ -172,7 +174,7 @@ start_tracing(int pid, int flags) { * process. */ void -restore_proc(int signo) { +restore_proc(int signo __unused) { extern int Procfd; ioctl(Procfd, PIOCBIC, ~0); diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index a663573..815ae59 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -34,7 +34,7 @@ struct syscall_args { }; struct syscall { - char *name; + const char *name; int ret_type; /* 0, 1, or 2 return values */ int nargs; /* actual number of meaningful arguments */ /* Hopefully, no syscalls with > 10 args */ diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index fd3c700..333e0d2 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -53,6 +53,7 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> +#include "extern.h" #include "syscall.h" /* @@ -103,8 +104,6 @@ struct syscall syscalls[] = { { 0, 0, 0, { { 0, 0 }}}, }; -char * ioctlname __P((int)); - /* * If/when the list gets big, it might be desirable to do it * as a hash table or binary search. @@ -128,7 +127,7 @@ get_syscall(const char *name) { * Copy a fixed amount of bytes from the process. */ -int +static int get_struct(int procfd, void *offset, void *buf, int len) { char *pos; FILE *p; @@ -261,7 +260,7 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { break; case Ioctl: { - char *temp = ioctlname(args[sc->offset]); + const char *temp = ioctlname(args[sc->offset]); if (temp) tmp = strdup(temp); else { @@ -290,8 +289,8 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { { struct sockaddr_storage ss; char addr[64]; - struct sockaddr_in *sin; - struct sockaddr_in6 *sin6; + struct sockaddr_in *lsin; + struct sockaddr_in6 *lsin6; struct sockaddr_un *sun; struct sockaddr *sa; char *p; @@ -316,14 +315,14 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { switch (ss.ss_family) { case AF_INET: - sin = (struct sockaddr_in *)&ss; - inet_ntop(AF_INET, &sin->sin_addr, addr, sizeof addr); - asprintf(&tmp, "{ AF_INET %s:%d }", addr, htons(sin->sin_port)); + lsin = (struct sockaddr_in *)&ss; + inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof addr); + asprintf(&tmp, "{ AF_INET %s:%d }", addr, htons(lsin->sin_port)); break; case AF_INET6: - sin6 = (struct sockaddr_in6 *)&ss; - inet_ntop(AF_INET6, &sin6->sin6_addr, addr, sizeof addr); - asprintf(&tmp, "{ AF_INET6 [%s]:%d }", addr, htons(sin6->sin6_port)); + lsin6 = (struct sockaddr_in6 *)&ss; + inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, sizeof addr); + asprintf(&tmp, "{ AF_INET6 [%s]:%d }", addr, htons(lsin6->sin6_port)); break; case AF_UNIX: sun = (struct sockaddr_un *)&ss; |