summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-02-22 13:26:10 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-02-22 13:26:10 +0100
commita9fe13c9437707fa132fde4e51a20d88381e7430 (patch)
treee1949f82be3db26d69c910610461e967d552b544
parent40d63b9a92e049986fce1fb91cca10fdd3d3a64a (diff)
downloadstrace-a9fe13c9437707fa132fde4e51a20d88381e7430.tar.gz
strace-a9fe13c9437707fa132fde4e51a20d88381e7430.tar.bz2
strace-a9fe13c9437707fa132fde4e51a20d88381e7430.tar.xz
Create and use struct_sysent and struct_ioctlent typedefs.
This is a preparatory mass replace patch with no code changes. The future change will need to typedef sysent to sysent0, which results in compile failures when "struct sysent" string gets mangled into "struct sysent0". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--defs.h18
-rw-r--r--io.c2
-rw-r--r--ioctl.c10
-rw-r--r--pathtrace.c2
-rw-r--r--strace.c6
-rw-r--r--syscall.c40
6 files changed, 40 insertions, 38 deletions
diff --git a/defs.h b/defs.h
index 39d8b90..980dd3a 100644
--- a/defs.h
+++ b/defs.h
@@ -366,18 +366,18 @@ extern struct pt_regs arm_regs;
extern struct pt_regs tile_regs;
#endif
-struct sysent {
+typedef struct sysent {
unsigned nargs;
int sys_flags;
int (*sys_func)();
const char *sys_name;
-};
+} struct_sysent;
-struct ioctlent {
+typedef struct ioctlent {
const char *doth;
const char *symbol;
unsigned long code;
-};
+} struct_ioctlent;
/* Trace Control Block */
struct tcb {
@@ -398,7 +398,7 @@ struct tcb {
int curcol; /* Output column for this process */
FILE *outf; /* Output file for this process */
const char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */
- const struct sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
+ const struct_sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
struct timeval stime; /* System time usage as of last process wait */
struct timeval dtime; /* Delta for system time usage */
struct timeval etime; /* Syscall entry time */
@@ -673,8 +673,8 @@ extern void tprint_open_modes(mode_t);
extern const char *sprint_open_modes(mode_t);
extern void print_loff_t(struct tcb *, long);
-extern const struct ioctlent *ioctl_lookup(long);
-extern const struct ioctlent *ioctl_next_match(const struct ioctlent *);
+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);
@@ -745,11 +745,11 @@ extern unsigned current_wordsize;
# define widen_to_long(v) ((long)(v))
#endif
-extern const struct sysent *sysent;
+extern const struct_sysent *sysent;
extern unsigned nsyscalls;
extern const char *const *errnoent;
extern unsigned nerrnos;
-extern const struct ioctlent *ioctlent;
+extern const struct_ioctlent *ioctlent;
extern unsigned nioctlents;
extern const char *const *signalent;
extern unsigned nsignals;
diff --git a/io.c b/io.c
index f0f0756..0e9bb32 100644
--- a/io.c
+++ b/io.c
@@ -383,7 +383,7 @@ sys_vmsplice(struct tcb *tcp)
int
sys_ioctl(struct tcb *tcp)
{
- const struct ioctlent *iop;
+ const struct_ioctlent *iop;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
diff --git a/ioctl.c b/ioctl.c
index 323946d..f5e93a8 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -35,14 +35,14 @@ static int
compare(const void *a, const void *b)
{
unsigned long code1 = (long) a;
- unsigned long code2 = ((struct ioctlent *) b)->code;
+ unsigned long code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
-const struct ioctlent *
+const struct_ioctlent *
ioctl_lookup(long code)
{
- struct ioctlent *iop;
+ struct_ioctlent *iop;
code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
iop = bsearch((void*)code, ioctlent,
@@ -57,8 +57,8 @@ ioctl_lookup(long code)
return iop;
}
-const struct ioctlent *
-ioctl_next_match(const struct ioctlent *iop)
+const struct_ioctlent *
+ioctl_next_match(const struct_ioctlent *iop)
{
long code;
diff --git a/pathtrace.c b/pathtrace.c
index 7f90dd5..f202c99 100644
--- a/pathtrace.c
+++ b/pathtrace.c
@@ -157,7 +157,7 @@ pathtrace_select(const char *path)
int
pathtrace_match(struct tcb *tcp)
{
- const struct sysent *s;
+ const struct_sysent *s;
if (selected[0] == NULL)
return 1;
diff --git a/strace.c b/strace.c
index 8d7ee74..900915e 100644
--- a/strace.c
+++ b/strace.c
@@ -2074,7 +2074,8 @@ trace(void)
if (pid == strace_child)
exit_code = 0x100 | WTERMSIG(status);
if (cflag != CFLAG_ONLY_STATS
- && (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL)) {
+ && (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL)
+ ) {
printleader(tcp);
#ifdef WCOREDUMP
tprintf("+++ killed by %s %s+++\n",
@@ -2184,7 +2185,8 @@ trace(void)
show_stopsig:
#endif
if (cflag != CFLAG_ONLY_STATS
- && (qual_flags[sig] & QUAL_SIGNAL)) {
+ && (qual_flags[sig] & QUAL_SIGNAL)
+ ) {
#if defined(PT_CR_IPSR) && defined(PT_CR_IIP)
long pc = 0;
long psr = 0;
diff --git a/syscall.c b/syscall.c
index 5fce9d8..b92ddc0 100644
--- a/syscall.c
+++ b/syscall.c
@@ -118,18 +118,18 @@
#define NF SYSCALL_NEVER_FAILS
#define MA MAX_ARGS
-static const struct sysent sysent0[] = {
+static const struct_sysent sysent0[] = {
#include "syscallent.h"
};
-#if SUPPORTED_PERSONALITIES >= 2
-static const struct sysent sysent1[] = {
+#if SUPPORTED_PERSONALITIES > 1
+static const struct_sysent sysent1[] = {
# include "syscallent1.h"
};
#endif
-#if SUPPORTED_PERSONALITIES >= 3
-static const struct sysent sysent2[] = {
+#if SUPPORTED_PERSONALITIES > 2
+static const struct_sysent sysent2[] = {
# include "syscallent2.h"
};
#endif
@@ -159,7 +159,7 @@ static const char *const errnoent0[] = {
static const char *const signalent0[] = {
#include "signalent.h"
};
-static const struct ioctlent ioctlent0[] = {
+static const struct_ioctlent ioctlent0[] = {
#include "ioctlent.h"
};
enum { nsyscalls0 = ARRAY_SIZE(sysent0) };
@@ -168,14 +168,14 @@ enum { nsignals0 = ARRAY_SIZE(signalent0) };
enum { nioctlents0 = ARRAY_SIZE(ioctlent0) };
qualbits_t qual_flags0[MAX_QUALS];
-#if SUPPORTED_PERSONALITIES >= 2
+#if SUPPORTED_PERSONALITIES > 1
static const char *const errnoent1[] = {
# include "errnoent1.h"
};
static const char *const signalent1[] = {
# include "signalent1.h"
};
-static const struct ioctlent ioctlent1[] = {
+static const struct_ioctlent ioctlent1[] = {
# include "ioctlent1.h"
};
enum { nsyscalls1 = ARRAY_SIZE(sysent1) };
@@ -185,14 +185,14 @@ enum { nioctlents1 = ARRAY_SIZE(ioctlent1) };
qualbits_t qual_flags1[MAX_QUALS];
#endif
-#if SUPPORTED_PERSONALITIES >= 3
+#if SUPPORTED_PERSONALITIES > 2
static const char *const errnoent2[] = {
# include "errnoent2.h"
};
static const char *const signalent2[] = {
# include "signalent2.h"
};
-static const struct ioctlent ioctlent2[] = {
+static const struct_ioctlent ioctlent2[] = {
# include "ioctlent2.h"
};
enum { nsyscalls2 = ARRAY_SIZE(sysent2) };
@@ -202,10 +202,10 @@ enum { nioctlents2 = ARRAY_SIZE(ioctlent2) };
qualbits_t qual_flags2[MAX_QUALS];
#endif
-const struct sysent *sysent = sysent0;
+const struct_sysent *sysent = sysent0;
const char *const *errnoent = errnoent0;
const char *const *signalent = signalent0;
-const struct ioctlent *ioctlent = ioctlent0;
+const struct_ioctlent *ioctlent = ioctlent0;
unsigned nsyscalls = nsyscalls0;
unsigned nerrnos = nerrnos0;
unsigned nsignals = nsignals0;
@@ -254,7 +254,7 @@ set_personality(int personality)
qual_flags = qual_flags1;
break;
-# if SUPPORTED_PERSONALITIES >= 3
+# if SUPPORTED_PERSONALITIES > 2
case 2:
errnoent = errnoent2;
nerrnos = nerrnos2;
@@ -358,7 +358,7 @@ qualify_one(int n, int bitflag, int not, int pers)
qual_flags0[n] |= bitflag;
}
-#if SUPPORTED_PERSONALITIES >= 2
+#if SUPPORTED_PERSONALITIES > 1
if (pers == 1 || pers < 0) {
if (not)
qual_flags1[n] &= ~bitflag;
@@ -367,7 +367,7 @@ qualify_one(int n, int bitflag, int not, int pers)
}
#endif
-#if SUPPORTED_PERSONALITIES >= 3
+#if SUPPORTED_PERSONALITIES > 2
if (pers == 2 || pers < 0) {
if (not)
qual_flags2[n] &= ~bitflag;
@@ -397,7 +397,7 @@ qual_syscall(const char *s, int bitflag, int not)
rc = 0;
}
-#if SUPPORTED_PERSONALITIES >= 2
+#if SUPPORTED_PERSONALITIES > 1
for (i = 0; i < nsyscalls1; i++)
if (sysent1[i].sys_name &&
strcmp(s, sysent1[i].sys_name) == 0) {
@@ -406,7 +406,7 @@ qual_syscall(const char *s, int bitflag, int not)
}
#endif
-#if SUPPORTED_PERSONALITIES >= 3
+#if SUPPORTED_PERSONALITIES > 2
for (i = 0; i < nsyscalls2; i++)
if (sysent2[i].sys_name &&
strcmp(s, sysent2[i].sys_name) == 0) {
@@ -519,13 +519,13 @@ qualify(const char *s)
if (sysent0[i].sys_flags & n)
qualify_one(i, opt->bitflag, not, 0);
-#if SUPPORTED_PERSONALITIES >= 2
+#if SUPPORTED_PERSONALITIES > 1
for (i = 0; i < nsyscalls1; i++)
if (sysent1[i].sys_flags & n)
qualify_one(i, opt->bitflag, not, 1);
#endif
-#if SUPPORTED_PERSONALITIES >= 3
+#if SUPPORTED_PERSONALITIES > 2
for (i = 0; i < nsyscalls2; i++)
if (sysent2[i].sys_flags & n)
qualify_one(i, opt->bitflag, not, 2);
@@ -1452,7 +1452,7 @@ get_scno(struct tcb *tcp)
tcp->s_ent = &sysent[scno];
tcp->qual_flg = qual_flags[scno];
} else {
- static const struct sysent unknown = {
+ static const struct_sysent unknown = {
.nargs = MAX_ARGS,
.sys_flags = 0,
.sys_func = printargs,