Cosmetic fixes, no code changes

* 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>
This commit is contained in:
Denys Vlasenko 2011-08-18 12:48:56 +02:00
parent 04f8b4860f
commit 041b3ee42e
3 changed files with 19 additions and 13 deletions

5
defs.h
View File

@ -57,8 +57,8 @@
#endif #endif
#endif #endif
#ifndef DEFAULT_STRLEN #ifndef DEFAULT_STRLEN
#define DEFAULT_STRLEN 32 /* default maximum # of bytes printed in /* default maximum # of bytes printed in `printstr', change with -s switch */
`printstr', change with `-s' switch */ #define DEFAULT_STRLEN 32
#endif #endif
#ifndef DEFAULT_ACOLUMN #ifndef DEFAULT_ACOLUMN
#define DEFAULT_ACOLUMN 40 /* default alignment column for results */ #define DEFAULT_ACOLUMN 40 /* default alignment column for results */
@ -67,6 +67,7 @@
# ifdef HPPA # ifdef HPPA
# define MAX_ARGS 6 /* maximum number of args to a syscall */ # define MAX_ARGS 6 /* maximum number of args to a syscall */
# else # 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 */ # define MAX_ARGS 32 /* maximum number of args to a syscall */
# endif # endif
#endif #endif

View File

@ -70,7 +70,7 @@
#ifdef IA64 #ifdef IA64
# include <asm/ptrace_offsets.h> # include <asm/ptrace_offsets.h>
#endif /* !IA64 */ #endif
#if defined (LINUX) && defined (SPARC64) #if defined (LINUX) && defined (SPARC64)
# undef PTRACE_GETREGS # undef PTRACE_GETREGS
@ -131,13 +131,17 @@ struct sigcontext
#endif /* M68K */ #endif /* M68K */
#endif /* !I386 */ #endif /* !I386 */
#endif /* !HAVE_ASM_SIGCONTEXT_H */ #endif /* !HAVE_ASM_SIGCONTEXT_H */
#ifndef NSIG #ifndef NSIG
#warning: NSIG is not defined, using 32
#define NSIG 32 #define NSIG 32
#endif #endif
#ifdef ARM #ifdef ARM
/* Ugh. Is this really correct? ARM has no RT signals?! */
#undef NSIG #undef NSIG
#define NSIG 32 #define NSIG 32
#endif #endif
#endif /* LINUX */ #endif /* LINUX */
const char *const signalent0[] = { const char *const signalent0[] = {
@ -178,7 +182,7 @@ static const struct xlat sigvec_flags[] = {
#if defined LINUX && (defined I386 || defined X86_64) #if defined LINUX && (defined I386 || defined X86_64)
/* The libc headers do not define this constant since it should only be /* 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 # ifndef SA_RESTORER
# define SA_RESTORER 0x04000000 # define SA_RESTORER 0x04000000
# endif # endif
@ -261,18 +265,18 @@ static const struct xlat sigprocmaskcmds[] = {
const char * const char *
signame(int sig) signame(int sig)
{ {
static char buf[30]; static char buf[sizeof("SIGRT_%d") + sizeof(int)*3];
if (sig >= 0 && sig < nsignals) {
if (sig >= 0 && sig < nsignals)
return signalent[sig]; return signalent[sig];
#ifdef SIGRTMIN #ifdef SIGRTMIN
} else if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) { if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
sprintf(buf, "SIGRT_%ld", (long)(sig - __SIGRTMIN)); sprintf(buf, "SIGRT_%d", (int)(sig - __SIGRTMIN));
return buf;
#endif /* SIGRTMIN */
} else {
sprintf(buf, "%d", sig);
return buf; return buf;
} }
#endif
sprintf(buf, "%d", sig);
return buf;
} }
#ifndef UNIXWARE #ifndef UNIXWARE
@ -1727,7 +1731,6 @@ sys_rt_sigprocmask(struct tcb *tcp)
} }
else { else {
if (!tcp->u_arg[2]) if (!tcp->u_arg[2])
tprintf("NULL"); tprintf("NULL");
else if (syserror(tcp)) else if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[2]); tprintf("%#lx", tcp->u_arg[2]);

View File

@ -90,9 +90,11 @@
#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
#endif #endif
#ifndef NSIG #ifndef NSIG
#warning: NSIG is not defined, using 32
#define NSIG 32 #define NSIG 32
#endif #endif
#ifdef ARM #ifdef ARM
/* Ugh. Is this really correct? ARM has no RT signals?! */
#undef NSIG #undef NSIG
#define NSIG 32 #define NSIG 32
#undef NR_SYSCALL_BASE #undef NR_SYSCALL_BASE