* Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Linux for s390 port by D.J. Barrow
* <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com>
- * Copyright (c) 2001-2017 The strace developers.
+ * Copyright (c) 2001-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "defs.h"
#include "nsig.h"
+#include "xstring.h"
/* The libc headers do not define this constant since it should only be
used by the implementation. So we define it here. */
* Some architectures, otherwise, do not define SA_RESTORER in their headers,
* but actually have sa_restorer.
*/
-#ifdef SA_RESTORER
-# if defined HPPA || defined IA64
-# define HAVE_SA_RESTORER 0
-# else
-# define HAVE_SA_RESTORER 1
-# endif
-#else /* !SA_RESTORER */
-# if defined SPARC || defined SPARC64 || defined M68K
+#ifdef HAVE_ARCH_SA_RESTORER
+# define HAVE_SA_RESTORER HAVE_ARCH_SA_RESTORER
+#else /* !HAVE_ARCH_SA_RESTORER */
+# ifdef SA_RESTORER
# define HAVE_SA_RESTORER 1
# else
# define HAVE_SA_RESTORER 0
# endif
-#endif
+#endif /* HAVE_ARCH_SA_RESTORER */
#include "xlat/sa_handler_values.h"
#include "xlat/sigact_flags.h"
const char *sa_handler_str = get_sa_handler_str(handler);
if (sa_handler_str)
- tprints(sa_handler_str);
+ print_xlat_ex(handler, sa_handler_str, XLAT_STYLE_DEFAULT);
else
printaddr(handler);
}
return signalent[s];
#ifdef ASM_SIGRTMAX
if (s >= ASM_SIGRTMIN && s <= (unsigned int) ASM_SIGRTMAX) {
- sprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
+ xsprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
return buf;
}
#endif
}
- sprintf(buf, "%d", sig);
+ xsprintf(buf, "%d", sig);
return buf;
}
}
#ifdef ASM_SIGRTMAX
else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) {
- s += sprintf(s, "RT_%u", i - ASM_SIGRTMIN);
+ s = xappendstr(outstr, s, "RT_%u", i - ASM_SIGRTMIN);
}
#endif
else {
- s += sprintf(s, "%u", i);
+ s = xappendstr(outstr, s, "%u", i);
}
sep = ' ';
}
{
if (entering(tcp)) {
tprint_old_sigmask_val("", (unsigned) tcp->u_arg[0]);
- }
- else if (!syserror(tcp)) {
+ } else if (!syserror(tcp)) {
tcp->auxstr = sprint_old_sigmask_val("old mask ",
(unsigned) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
tprints("{sa_handler=");
print_sa_handler(sa.sa_handler__);
tprints(", sa_mask=");
- tprintsigmask_val("", sa.sa_mask);
+ tprint_old_sigmask_val("", sa.sa_mask);
tprints(", sa_flags=");
printflags(sigact_flags, sa.sa_flags, "SA_???");
#if !(defined ALPHA || defined MIPS)
SYS_FUNC(sigaction)
{
if (entering(tcp)) {
- printsignal(tcp->u_arg[0]);
+ int signo = tcp->u_arg[0];
+#if defined SPARC || defined SPARC64
+ if (signo < 0) {
+ tprints("-");
+ signo = -signo;
+ }
+#endif
+ printsignal(signo);
tprints(", ");
decode_old_sigaction(tcp, tcp->u_arg[1]);
tprints(", ");
if (entering(tcp)) {
printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
tprintsigmask_val(", ", tcp->u_arg[1]);
- }
- else if (!syserror(tcp)) {
+ } else if (!syserror(tcp)) {
tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
return RVAL_HEX | RVAL_STR;
}
tprints(", ");
print_sigset_addr_len(tcp, tcp->u_arg[1], current_wordsize);
tprints(", ");
- }
- else {
+ } else {
print_sigset_addr_len(tcp, tcp->u_arg[2], current_wordsize);
}
return 0;
tprints(", ");
print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[3]);
tprints(", ");
- }
- else {
+ } else {
print_sigset_addr_len(tcp, tcp->u_arg[2], tcp->u_arg[3]);
tprintf(", %" PRI_klu, tcp->u_arg[3]);
}
}
/* Structure describing the action to be taken when a signal arrives. */
-struct new_sigaction
-{
+struct new_sigaction {
/* sa_handler may be a libc #define, need to use other name: */
#ifdef MIPS
unsigned int sa_flags;
unsigned long sa_mask[NSIG / sizeof(long)];
};
/* Same for i386-on-x86_64 and similar cases */
-struct new_sigaction32
-{
+struct new_sigaction32 {
uint32_t sa_handler__;
uint32_t sa_flags;
#if HAVE_SA_RESTORER
}
}
return 0;
-};
+}
SYS_FUNC(restart_syscall)
{