]> granicus.if.org Git - strace/commitdiff
Cosmetic fixes, no code changes
authorDenys Vlasenko <dvlasenk@redhat.com>
Thu, 18 Aug 2011 10:48:56 +0000 (12:48 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Tue, 23 Aug 2011 10:53:01 +0000 (12:53 +0200)
* defs.h: Add/reformat comments.
* signal.c: Remove wrong comment. Add warning directive
when we detect that NSIG is undefined. Add comment about
NSIG on ARM. Fix typo in comment.
(signame): Reformat code a bit without changes to logic.
Shorten static buffer.
(sys_rt_sigprocmask): Remove stray empty line.
* syscall.c: Add warning directive when we detect that
NSIG is undefined. Add comment about NSIG on ARM.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
defs.h
signal.c
syscall.c

diff --git a/defs.h b/defs.h
index aaa290e0aa6e24d39777ab2b745d23ac59e1020b..02242afc7f39c2e1a024b1cd8ee395fda3fa4150 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -57,8 +57,8 @@
 #endif
 #endif
 #ifndef DEFAULT_STRLEN
-#define DEFAULT_STRLEN 32      /* default maximum # of bytes printed in
-                                 `printstr', change with `-s' switch */
+/* default maximum # of bytes printed in `printstr', change with -s switch */
+#define DEFAULT_STRLEN 32
 #endif
 #ifndef DEFAULT_ACOLUMN
 #define DEFAULT_ACOLUMN        40      /* default alignment column for results */
@@ -67,6 +67,7 @@
 # ifdef HPPA
 #  define MAX_ARGS     6       /* maximum number of args to a syscall */
 # else
+/* Way too big. Switch your arch to saner size after you tested that it works */
 #  define MAX_ARGS     32      /* maximum number of args to a syscall */
 # endif
 #endif
index c7c9a6a6798a54419f5cf1eb8b48a9702d7b174c..889134ad57d1a48bb8ad8698bbe7d43a0ec107ea 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -70,7 +70,7 @@
 
 #ifdef IA64
 # include <asm/ptrace_offsets.h>
-#endif /* !IA64 */
+#endif
 
 #if defined (LINUX) && defined (SPARC64)
 # undef PTRACE_GETREGS
@@ -131,13 +131,17 @@ struct sigcontext
 #endif /* M68K */
 #endif /* !I386 */
 #endif /* !HAVE_ASM_SIGCONTEXT_H */
+
 #ifndef NSIG
+#warning: NSIG is not defined, using 32
 #define NSIG 32
 #endif
 #ifdef ARM
+/* Ugh. Is this really correct? ARM has no RT signals?! */
 #undef NSIG
 #define NSIG 32
 #endif
+
 #endif /* LINUX */
 
 const char *const signalent0[] = {
@@ -178,7 +182,7 @@ static const struct xlat sigvec_flags[] = {
 
 #if defined LINUX && (defined I386 || defined X86_64)
 /* The libc headers do not define this constant since it should only be
-   used by the implementation.  So wwe define it here.  */
+   used by the implementation.  So we define it here.  */
 # ifndef SA_RESTORER
 #  define SA_RESTORER 0x04000000
 # endif
@@ -261,18 +265,18 @@ static const struct xlat sigprocmaskcmds[] = {
 const char *
 signame(int sig)
 {
-       static char buf[30];
-       if (sig >= 0 && sig < nsignals) {
+       static char buf[sizeof("SIGRT_%d") + sizeof(int)*3];
+
+       if (sig >= 0 && sig < nsignals)
                return signalent[sig];
 #ifdef SIGRTMIN
-       } else if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
-               sprintf(buf, "SIGRT_%ld", (long)(sig - __SIGRTMIN));
-               return buf;
-#endif /* SIGRTMIN */
-       } else {
-               sprintf(buf, "%d", sig);
+       if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
+               sprintf(buf, "SIGRT_%d", (int)(sig - __SIGRTMIN));
                return buf;
        }
+#endif
+       sprintf(buf, "%d", sig);
+       return buf;
 }
 
 #ifndef UNIXWARE
@@ -1727,7 +1731,6 @@ sys_rt_sigprocmask(struct tcb *tcp)
        }
        else {
                if (!tcp->u_arg[2])
-
                        tprintf("NULL");
                else if (syserror(tcp))
                        tprintf("%#lx", tcp->u_arg[2]);
index 99600f7af4db5f33b9f93e67df76a0981bfbac72..2fd5bb4952b615427affdf76ec3bf2709612d69c 100644 (file)
--- a/syscall.c
+++ b/syscall.c
 #define ERESTART_RESTARTBLOCK 516      /* restart by calling sys_restart_syscall */
 #endif
 #ifndef NSIG
+#warning: NSIG is not defined, using 32
 #define NSIG 32
 #endif
 #ifdef ARM
+/* Ugh. Is this really correct? ARM has no RT signals?! */
 #undef NSIG
 #define NSIG 32
 #undef NR_SYSCALL_BASE