]> granicus.if.org Git - strace/commitdiff
Create and use struct_sysent and struct_ioctlent typedefs.
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 22 Feb 2013 12:26:10 +0000 (13:26 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 22 Feb 2013 12:26:10 +0000 (13:26 +0100)
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>
defs.h
io.c
ioctl.c
pathtrace.c
strace.c
syscall.c

diff --git a/defs.h b/defs.h
index 39d8b90ed69ab0a2dcc14cf040140561683dd51d..980dd3af364fbaafbfd75f55f5810ca659c8fe21 100644 (file)
--- 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 f0f07560d0b806257a4026c3c95666d65515eacc..0e9bb32de8758814ddbba55a72709d4397bfaa1b 100644 (file)
--- 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 323946d39474505ce661d3a2521e8d31a2a1971f..f5e93a88696214e414a3d77478e88f1fe67ed9bb 100644 (file)
--- 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;
 
index 7f90dd5c68051f82d95117603521f170b298ca36..f202c99fbbdec7e92d1629ddc85252bfe9b07188 100644 (file)
@@ -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;
index 8d7ee74d6486cca8ce5a0071bd8bbee3a0ff4c54..900915ee9f18bc1edf9fb991ebe0f2589b6e4025 100644 (file)
--- 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;
index 5fce9d8ce5d65f89d5e72b957b4e2b407fc0eaed..b92ddc0efbecb672a632a3fc2d83c82b72f103b7 100644 (file)
--- a/syscall.c
+++ b/syscall.c
 #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,