[PATCH] Remove support for pre-C89
Andreas Schwab
schwab at redhat.com
Tue Oct 27 15:59:24 UTC 2009
>From 4af0b4866c0caeeb7b40126e9579d04b14afd5f2 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab at redhat.com>
Date: Tue, 27 Oct 2009 16:56:43 +0100
Subject: [PATCH] Remove support for pre-C89
* defs.h: Remove references to __STDC__ and P macros.
* strace.c: Likewise.
---
defs.h | 186 +++++++++++++++++++++++++++++---------------------------------
strace.c | 36 +++---------
2 files changed, 96 insertions(+), 126 deletions(-)
diff --git a/defs.h b/defs.h
index 5bcaa07..6376e79 100644
--- a/defs.h
+++ b/defs.h
@@ -158,15 +158,11 @@
#include <asm/ptrace.h>
#undef __KERNEL__
#endif
-#ifdef __STDC__
#ifdef LINUX
extern long ptrace(int, int, char *, long);
#else /* !LINUX */
extern int ptrace(int, int, char *, int, ...);
#endif /* !LINUX */
-#else /* !__STDC__ */
-extern int ptrace();
-#endif /* !__STDC__ */
#endif /* !LINUXSPARC */
#endif /* !SVR4 */
@@ -469,112 +465,106 @@ extern unsigned int nprocs, tcbtabsize;
extern int max_strlen;
extern struct tcb *tcp_last;
-#ifdef __STDC__
-#define P(args) args
-#else
-#define P(args) ()
-#endif
-
enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
-extern int set_personality P((int personality));
-extern const char *xlookup P((const struct xlat *, int));
-extern struct tcb *alloc_tcb P((int, int));
-extern struct tcb *pid2tcb P((int));
-extern void droptcb P((struct tcb *));
-extern void expand_tcbtab P((void));
+extern int set_personality (int personality);
+extern const char *xlookup (const struct xlat *, int);
+extern struct tcb *alloc_tcb (int, int);
+extern struct tcb *pid2tcb (int);
+extern void droptcb (struct tcb *);
+extern void expand_tcbtab (void);
#define alloctcb(pid) alloc_tcb((pid), 1)
-extern void set_sortby P((char *));
-extern void set_overhead P((int));
-extern void qualify P((char *));
-extern int get_scno P((struct tcb *));
-extern long known_scno P((struct tcb *));
-extern long do_ptrace P((int request, struct tcb *tcp, void *addr, void *data));
-extern int ptrace_restart P((int request, struct tcb *tcp, int sig));
-extern int trace_syscall P((struct tcb *));
-extern int count_syscall P((struct tcb *, struct timeval *));
-extern void printxval P((const struct xlat *, int, const char *));
-extern int printargs P((struct tcb *));
-extern int addflags P((const struct xlat *, int));
-extern int printflags P((const struct xlat *, int, const char *));
-extern const char *sprintflags P((const char *, const struct xlat *, int));
-extern int umoven P((struct tcb *, long, int, char *));
-extern int umovestr P((struct tcb *, long, int, char *));
-extern int upeek P((struct tcb *, long, long *));
-extern void dumpiov P((struct tcb *, int, long));
-extern void dumpstr P((struct tcb *, long, int));
-extern void printstr P((struct tcb *, long, int));
-extern void printnum P((struct tcb *, long, char *));
-extern void printnum_int P((struct tcb *, long, char *));
-extern void printpath P((struct tcb *, long));
-extern void printpathn P((struct tcb *, long, int));
-extern void printtv_bitness P((struct tcb *, long, enum bitness_t, int));
-extern void sprinttv P((struct tcb *, long, enum bitness_t, char *));
-extern void print_timespec P((struct tcb *, long));
-extern void sprint_timespec P((char *, struct tcb *, long));
+extern void set_sortby (char *);
+extern void set_overhead (int);
+extern void qualify (char *);
+extern int get_scno (struct tcb *);
+extern long known_scno (struct tcb *);
+extern long do_ptrace (int request, struct tcb *tcp, void *addr, void *data);
+extern int ptrace_restart (int request, struct tcb *tcp, int sig);
+extern int trace_syscall (struct tcb *);
+extern int count_syscall (struct tcb *, struct timeval *);
+extern void printxval (const struct xlat *, int, const char *);
+extern int printargs (struct tcb *);
+extern int addflags (const struct xlat *, int);
+extern int printflags (const struct xlat *, int, const char *);
+extern const char *sprintflags (const char *, const struct xlat *, int);
+extern int umoven (struct tcb *, long, int, char *);
+extern int umovestr (struct tcb *, long, int, char *);
+extern int upeek (struct tcb *, long, long *);
+extern void dumpiov (struct tcb *, int, long);
+extern void dumpstr (struct tcb *, long, int);
+extern void printstr (struct tcb *, long, int);
+extern void printnum (struct tcb *, long, char *);
+extern void printnum_int (struct tcb *, long, char *);
+extern void printpath (struct tcb *, long);
+extern void printpathn (struct tcb *, long, int);
+extern void printtv_bitness (struct tcb *, long, enum bitness_t, int);
+extern void sprinttv (struct tcb *, long, enum bitness_t, char *);
+extern void print_timespec (struct tcb *, long);
+extern void sprint_timespec (char *, struct tcb *, long);
#ifdef HAVE_SIGINFO_T
-extern void printsiginfo P((siginfo_t *, int));
-#endif
-extern void printsock P((struct tcb *, long, int));
-extern void print_sock_optmgmt P((struct tcb *, long, int));
-extern void printrusage P((struct tcb *, long));
-extern void printuid P((const char *, unsigned long));
-extern int clearbpt P((struct tcb *));
-extern int setbpt P((struct tcb *));
-extern int sigishandled P((struct tcb *, int));
-extern void printcall P((struct tcb *));
-extern const char *signame P((int));
-extern void print_sigset P((struct tcb *, long, int));
-extern void printsignal P((int));
-extern void printleader P((struct tcb *));
-extern void printtrailer P((void));
-extern void tabto P((int));
-extern void call_summary P((FILE *));
-extern void tprint_iov P((struct tcb *, unsigned long, unsigned long));
-extern void tprint_open_modes P((mode_t));
-extern const char *sprint_open_modes P((mode_t));
-extern int is_restart_error P((struct tcb *));
-
-extern int change_syscall P((struct tcb *, int));
+extern void printsiginfo (siginfo_t *, int);
+#endif
+extern void printsock (struct tcb *, long, int);
+extern void print_sock_optmgmt (struct tcb *, long, int);
+extern void printrusage (struct tcb *, long);
+extern void printuid (const char *, unsigned long);
+extern int clearbpt (struct tcb *);
+extern int setbpt (struct tcb *);
+extern int sigishandled (struct tcb *, int);
+extern void printcall (struct tcb *);
+extern const char *signame (int);
+extern void print_sigset (struct tcb *, long, int);
+extern void printsignal (int);
+extern void printleader (struct tcb *);
+extern void printtrailer (void);
+extern void tabto (int);
+extern void call_summary (FILE *);
+extern void tprint_iov (struct tcb *, unsigned long, unsigned long);
+extern void tprint_open_modes (mode_t);
+extern const char *sprint_open_modes (mode_t);
+extern int is_restart_error (struct tcb *);
+
+extern int change_syscall (struct tcb *, int);
#ifdef LINUX
-extern int internal_clone P((struct tcb *));
-#endif
-extern int internal_fork P((struct tcb *));
-extern int internal_exec P((struct tcb *));
-extern int internal_wait P((struct tcb *, int));
-extern int internal_exit P((struct tcb *));
-
-extern const struct ioctlent *ioctl_lookup P((long));
-extern const struct ioctlent *ioctl_next_match P((const struct ioctlent *));
-extern int ioctl_decode P((struct tcb *, long, long));
-extern int term_ioctl P((struct tcb *, long, long));
-extern int sock_ioctl P((struct tcb *, long, long));
-extern int proc_ioctl P((struct tcb *, int, int));
-extern int stream_ioctl P((struct tcb *, int, int));
+extern int internal_clone (struct tcb *);
+#endif
+extern int internal_fork (struct tcb *);
+extern int internal_exec (struct tcb *);
+extern int internal_wait (struct tcb *, int);
+extern int internal_exit (struct tcb *);
+
+extern const struct ioctlent *ioctl_lookup (long);
+extern const struct ioctlent *ioctl_next_match (const struct ioctlent *);
+extern int ioctl_decode (struct tcb *, long, long);
+extern int term_ioctl (struct tcb *, long, long);
+extern int sock_ioctl (struct tcb *, long, long);
+extern int proc_ioctl (struct tcb *, int, int);
+extern int stream_ioctl (struct tcb *, int, int);
#ifdef LINUX
-extern int rtc_ioctl P((struct tcb *, long, long));
-extern int scsi_ioctl P((struct tcb *, long, long));
+extern int rtc_ioctl (struct tcb *, long, long);
+extern int scsi_ioctl (struct tcb *, long, long);
#endif
-extern void tv_tv P((struct timeval *, int, int));
-extern int tv_nz P((struct timeval *));
-extern int tv_cmp P((struct timeval *, struct timeval *));
-extern double tv_float P((struct timeval *));
-extern void tv_add P((struct timeval *, struct timeval *, struct timeval *));
-extern void tv_sub P((struct timeval *, struct timeval *, struct timeval *));
-extern void tv_mul P((struct timeval *, struct timeval *, int));
-extern void tv_div P((struct timeval *, struct timeval *, int));
+extern void tv_tv (struct timeval *, int, int);
+extern int tv_nz (struct timeval *);
+extern int tv_cmp (struct timeval *, struct timeval *);
+extern double tv_float (struct timeval *);
+extern void tv_add (struct timeval *, struct timeval *, struct timeval *);
+extern void tv_sub (struct timeval *, struct timeval *, struct timeval *);
+extern void tv_mul (struct timeval *, struct timeval *, int);
+extern void tv_div (struct timeval *, struct timeval *, int);
#ifdef SUNOS4
-extern int fixvfork P((struct tcb *));
+extern int fixvfork (struct tcb *);
#endif
#if !(defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(IA64))
-extern long getrval2 P((struct tcb *));
+extern long getrval2 (struct tcb *);
#endif
#ifdef USE_PROCFS
-extern int proc_open P((struct tcb *tcp, int attaching));
+extern int proc_open (struct tcb *tcp, int attaching);
#endif
#define umove(pid, addr, objp) \
@@ -585,22 +575,18 @@ extern int proc_open P((struct tcb *tcp, int attaching));
#define printtv_special(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1)
-#ifdef __STDC__
#ifdef __GNUC__
extern void tprintf(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
#else
extern void tprintf(const char *fmt, ...);
#endif
-#else
-extern void tprintf();
-#endif
#ifndef HAVE_STRERROR
-const char *strerror P((int));
+const char *strerror (int);
#endif
#ifndef HAVE_STRSIGNAL
-const char *strsignal P((int));
+const char *strsignal (int);
#endif
extern int current_personality;
diff --git a/strace.c b/strace.c
index 7294e8e..0baa97f 100644
--- a/strace.c
+++ b/strace.c
@@ -119,33 +119,29 @@ unsigned int nprocs, tcbtabsize;
char *progname;
extern char **environ;
-static int detach P((struct tcb *tcp, int sig));
-static int trace P((void));
-static void cleanup P((void));
-static void interrupt P((int sig));
+static int detach (struct tcb *tcp, int sig);
+static int trace (void);
+static void cleanup (void);
+static void interrupt (int sig);
static sigset_t empty_set, blocked_set;
#ifdef HAVE_SIG_ATOMIC_T
static volatile sig_atomic_t interrupted;
#else /* !HAVE_SIG_ATOMIC_T */
-#ifdef __STDC__
static volatile int interrupted;
-#else /* !__STDC__ */
-static int interrupted;
-#endif /* !__STDC__ */
#endif /* !HAVE_SIG_ATOMIC_T */
#ifdef USE_PROCFS
-static struct tcb *pfd2tcb P((int pfd));
-static void reaper P((int sig));
-static void rebuild_pollv P((void));
+static struct tcb *pfd2tcb (int pfd);
+static void reaper (int sig);
+static void rebuild_pollv (void);
static struct pollfd *pollv;
#ifndef HAVE_POLLABLE_PROCFS
-static void proc_poll_open P((void));
-static void proc_poller P((int pfd));
+static void proc_poll_open (void);
+static void proc_poller (int pfd);
struct proc_pollfd {
int fd;
@@ -2611,26 +2607,14 @@ Process %d attached (waiting for parent)\n",
#endif /* !USE_PROCFS */
-#ifdef __STDC__
#include <stdarg.h>
-#define VA_START(a, b) va_start(a, b)
-#else
-#include <varargs.h>
-#define VA_START(a, b) va_start(a)
-#endif
void
-#ifdef __STDC__
tprintf(const char *fmt, ...)
-#else
-tprintf(fmt, va_alist)
-char *fmt;
-va_dcl
-#endif
{
va_list args;
- VA_START(args, fmt);
+ va_start(args, fmt);
if (outf) {
int n = vfprintf(outf, fmt, args);
if (n < 0) {
--
1.6.5.1
--
Andreas Schwab, schwab at redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
More information about the Strace-devel
mailing list