Commit Graph

256 Commits

Author SHA1 Message Date
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
5f27295dfd sparc: enhance decoding of signal number argument of sigaction syscall
On sparc, unlike all other architectures, old sigaction syscall takes
a negated signal number.

* signal.c (SYS_FUNC(sigaction)) [SPARC || SPARC64]: Enhance printing
of negative signal number argument.
2017-05-28 17:13:29 +00:00
5061dfccc6 signal: enhance printing of old_sigaction.mask
* signal.c (decode_old_sigaction): Print old_sigaction.mask
using tprint_old_sigmask_val.
2017-05-28 17:13:29 +00:00
a9cdd9f54c signal: limit scope of struct old_sigaction32 definition
* signal.c (struct old_sigaction32): Define only if [!current_wordsize].
2017-05-28 17:13:29 +00:00
337d3a10ce signal: fix decoding of struct old_sigaction on some architectures
On alpha, struct old_sigaction.sa_flags has a 32-bit type.

On mips, only first word of old_sigaction.sa_mask is read.

On all architectures except alpha and mips that have old sigaction
syscall, struct old_sigaction has sa_restorer field that has to be
decoded.

* signal.c (struct old_sigaction) [ALPHA]: Change sa_flags type
to unsigned int, add ATTRIBUTE_PACKED.
[MIPS]: Dhrink sa_mask array to 1 element.
[!ALPHA && !MIPS]: Define sa_restorer field unconditionally.
(struct old_sigaction32): Likewise.
(decode_old_sigaction) [!current_wordsize]: Initialize sa_restorer field
from old_sigaction32.sa_restorer unconditionally.
[!ALPHA && !MIPS]: Print old_sigaction.sa_restorer if SA_RESTORER flag
is set.
* NEWS: Mention this change.
2017-05-28 17:13:29 +00:00
1570421357 alpha: rename sys_sigprocmask to sys_osf_sigprocmask
Parsers of sigprocmask and osf_sigprocmask syscalls are different
anyway, so rename the function to match the syscall name.

* signal.c [ALPHA] (SYS_FUNC(sigprocmask)): Rename
to SYS_FUNC(osf_sigprocmask).
* linux/alpha/syscallent.h: Update sys_func.
2017-05-28 00:09:32 +00:00
Eugene Syromyatnikov
d86b6bc773 Unify capitalisation of (c) in copyright notices 2017-05-26 19:43:11 +00:00
3b97ee486b Fix compat personality support for sgetmask syscall
* signal.c (SYS_FUNC(sgetmask)): Replace sprintsigmask_val
with sprint_old_sigmask_val.
* tests/sxetmask.c (main): Check decoding of signal mask containing
RT signals.
2017-05-23 23:20:18 +00:00
ba0bd3f1ec Fix decoding of sgetmask and ssetmask syscalls
Old ssetmask syscall takes an argument and returns a value of type int.
Old sgetmask syscall may return an error.

* signal.c (SYS_FUNC(ssetmask)): Explicitly convert the argument
and return value to unsigned int, print it using sprint_old_sigmask_val.
(SYS_FUNC(sgetmask)): Do not print the mask in case of syserror.
* tests/sxetmask.c: New file.
* tests/gen_tests.in (sxetmask): New entry.
* tests/pure_executables.list: Add sxetmask.
* tests/.gitignore: Likewise.
* NEWS: Mention this fix.
2017-05-22 17:33:51 +00:00
2a2347b5bd Rename sys_sig[gs]etmask to sys_s[gs]etmask to match syscall names
* signal.c (SYS_FUNC(sigsetmask)): Rename to SYS_FUNC(ssetmask).
(SYS_FUNC(siggetmask)): Rename to SYS_FUNC(sgetmask).
* linux/arm/syscallent.h (sgetmask, ssetmask): Update sys_func.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
2017-05-21 17:51:01 +00:00
eb446e3cd8 Fix compat personality support for old sigsuspend syscall
* signal.c (sprint_old_sigmask_val): New function.
(tprint_old_sigmask_val): New macro.
(SYS_FUNC(sigsuspend)): Use it.
2017-05-20 20:17:59 +00:00
d852b31a8b alpha, cris, mips, ppc, sh, sparc: fix decoding of sigsuspend syscall
On some architectures old sigsuspend syscall takes the signal mask from
the 3rd argument, on some from the 1st.  And, if it wasn't peculiar
enough, the signal mask is passed by value on all architectures except
mips where it's passed by reference.

* signal.c (SYS_FUNC(sigsuspend)): Take the signal mask from the last
argument.
* linux/alpha/syscallent.h (sigsuspend): Set nargs to 1.
* linux/crisv10/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* tests/sigsuspend.c: New file.
* tests/gen_tests.in (sigsuspend): New entry.
* tests/pure_executables.list: Add sigsuspend.
* tests/.gitignore: Likewise.
* NEWS: Mention this fix.
2017-05-01 14:49:26 +00:00
43b7c24994 Introduce print_sigset_addr function
As the definition of NSIG_BYTES is based on NSIG defined in <signal.h>,
NSIG_BYTES cannot be used in files that use kernel sigset_t.

Add another wrapper around print_sigset_addr_len_limit function that
takes one argument less than print_sigset_addr_len wrapper.  This new
wrapper is going to be used in cases when the length argument is equal
to NSIG_BYTES.

* defs.h (print_sigset_addr): New function prototype.
* signal.c (print_sigset_addr): New function.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Replace
print_sigset_addr_len with print_sigset_addr.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
2017-03-09 22:51:46 +00:00
277fec6316 signal: remove redundant checks around NSIG
* signal.c (struct old_sigaction, struct new_sigaction,
struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).
2016-12-27 23:49:06 +00:00
e9c702f9ad Introduce NSIG_BYTES
* nsig.h (NSIG_BYTES): New macro.
* desc.c: Use it in comments instead of NSIG.
* epoll.c: Likewise.
* poll.c: Likewise.
* signalfd.c: Likewise.
* signal.c: Likewise.
(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
* tests/pselect6.c (main): Likewise.
2016-12-27 23:32:44 +00:00
5a25466437 Move NSIG ifdefery to a separate header file
* nsig.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c: Include "nsig.h" instead of <signal.h>, remove
NSIG workarounds.
* sigreturn.c: Likewise.
* syscall.c: Likewise.
* tests/pselect6.c: Likewise.
2016-12-27 23:18:21 +00:00
835fb3c5f2 Simplify personality checks in msghdr.c and signal.c
* msghdr.c: Check for [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
* signal.c: Likewise.
2016-12-27 01:08:58 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
2016-12-26 10:43:34 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
79cef3f3ff signal: cleanup decoding of sa_handler and sa_restorer
Change type of sa_handler and sa_restorer fields from function pointers
to unsigned long.  This saves the code from a lot of casts between
pointers and integers.

Rename __sa_handler to sa_handler__ as names starting with underscore
symbol are reserved and should not be used.

* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(old_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_old_sigaction): Remove now redundant casts from
old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
and from old_sigaction.sa_handler__ to unsigned long.  Print
old_sigaction.sa_restorer using printaddr.
* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(new_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_new_sigaction): Remove now redundant casts from
new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
and from new_sigaction.sa_handler__ to unsigned long.  Print
new_sigaction.sa_restorer using printaddr.
2016-12-25 23:24:08 +00:00
b2d117f249 signal: change signal handler address type from unsigned long to kernel_ureg_t
* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
from unsigned long to kernel_ureg_t.
2016-12-25 23:21:22 +00:00
6666c28424 signal: change address argument type from unsigned long to kernel_ureg_t
* signal.c (print_sigqueueinfo): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
a8bf674039 print_sigset_addr_len: change len argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len): Change len argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
2016-12-25 11:32:45 +00:00
0aa9cf807e print_sigset_addr_len: change address argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len) Change address argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
decode_old_sigaction, decode_new_sigaction): Likewise.
2016-12-25 11:32:44 +00:00
c239ebc31b Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
In all places where LONG_LONG is used the destination already has type
unsigned long long, so it is quite natural to change LONG_LONG as well.

* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
from long long to unsigned long long.  All callers updated.
2016-12-23 19:26:57 +00:00
Eugene Syromyatnikov
d454dac0dc signal: fix omission of field names in sigaction printers
* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
of the field names.
* tests/sigaction.awk: Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-11-29 10:05:16 +00:00
Eugene Syromiatnikov
2909c7c1d8 Refactor common sa_handler printing code
* xlat/sa_handler_values.in: New file.
* signal.c: Include "xlat/sa_handler_values.h".
(get_sa_handler_str, print_sa_handler): New functions.
(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.
2016-08-31 15:41:41 +00:00
78b0755828 Remove HAVE_SIGACTION checks
The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
regardless of libc sigaction function availability.

* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
* signal.c: Remove HAVE_SIGACTION checks.
2016-08-30 17:44:33 +00:00
aa0c46ffed Fix compat decoding of struct sigaction.sa_mask on big endian architectures
* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
struct sigaction to 64-bit struct sigaction.
2016-08-20 00:08:10 +00:00
c5d69183af Fix race condition in decoding rt_sigtimedwait's timeout argument
As the value returned by sprint_timespec points to a static area and may
be overwritten by subsequent calls to sprint_timespec, it is not safe to
save this value on entering syscall and use it later on exiting.

* signal.c (SYS_FUNC(rt_sigtimedwait)): On entering syscall, copy the
value returned by sprint_timespec to a dynamically allocated memory,
and save the pointer using set_tcb_priv_data.  On exiting, restore it
using get_tcb_priv_data.
2016-07-18 22:12:44 +00:00
484326dbd8 Consistently use printaddr for printing addresses
* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
2016-06-11 09:26:49 +00:00
f1cadc2675 Fix decoding of pid_t arguments of kill and tgkill syscalls
* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Print pid_t syscall
arguments using %d format.
2016-04-27 14:04:55 +00:00
11d623f10a Print pid_t arguments of rt_sigqueueinfo and rt_tgsigqueueinfo as int
* signal.c (SYS_FUNC(rt_sigqueueinfo)): Print first syscall argument
using %d format.
(SYS_FUNC(rt_tgsigqueueinfo)): Print first and second syscall arguments
using %d format.
* tests/rt_tgsigqueueinfo.c: New file.
* tests/rt_tgsigqueueinfo.test: New test.
* tests/.gitignore: Add rt_tgsigqueueinfo.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_tgsigqueueinfo.test.
2016-02-19 05:48:48 +00:00
49faae958a Print rt_sigtimedwait return value as a signal name
* signal.c (SYS_FUNC(rt_sigtimedwait)): Decode return value.
* tests/rt_sigtimedwait.c: New file.
* tests/rt_sigtimedwait.test: New test.
* tests/.gitignore: Add rt_sigtimedwait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigtimedwait.test.
2016-02-19 03:39:59 +00:00
11656206ff Fix corner cases of rt_sigpending syscall decoder
* signal (print_sigset_addr_len_limit): New function, cloned from
print_sigset_addr_len with added minimal length argument.
Treat length less than minimal length or greater than NSIG/8 as invalid.
Do not align length to 4-byte boundary.  Align destination buffer
to 4-byte boundary and initialize it with zeroes so that subsequent
call to sprintsigmask_n will not access uninitialized data.
(print_sigset_addr_len): Turn into a wrapper around
print_sigset_addr_len_limit with current_wordsize
as a minimal length argument.
(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
instead of print_sigset_addr_len with 1 as a minimal length argument.
* tests/rt_sigpending.c: New file.
* tests/rt_sigpending.test: New test.
* tests/.gitignore: Add rt_sigpending.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigpending.test.
2016-02-19 01:44:33 +00:00
07572c68dd signal.c: fix musl libc compilation warning
musl libc defines SIGRTMAX to a function that returns signed int,
which obviously makes gcc -Wsign-compare unhappy.

* signal.c (signame): Cast ASM_SIGRTMAX to unsigned int.
2016-01-12 03:07:39 +00:00
3858b93ad9 Add helper functions to clear/restore syserror
* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
New prototypes.
* syscall.c (saved_u_error): New variable.
(temporarily_clear_syserror, restore_cleared_syserror): New functions.
* aio.c (sys_io_getevents): Use temporarily_clear_syserror
and restore_cleared_syserror.
* mq.c (sys_mq_timedreceive): Likewise.
* signal.c (sys_rt_sigtimedwait): Likewise.
2015-09-19 04:04:49 +03:00
e2fb0bb2cf Simplify use of mpers printers
* native_defs.h: New file.
* syscall.c: Include it.
* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
* defs.h (MPERS_PRINTER_NAME): Remove.
[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
* Makefile.am (printers.h): ... here.
Add macro definitions for mpers printers.
(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
of "$(mpers_PREFIX)printer_decls.h".
(strace_SOURCES): Add native_defs.h.
* README-mpers: Update instructions for using mpers printers.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
* process.c (sys_ptrace): Call printsiginfo_at directly.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
* resource.c (sys_getrusage): Call printrusage directly.
* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
* wait.c (printwaitn): Call printrusage directly.
(sys_waitid): Call printrusage and printsiginfo_at directly.
2015-09-16 00:14:55 +00:00
Elvira Khabirova
a0b62498fd Mpersify printsiginfo_at printer
Fix multiple personalities support in parsers of ptrace,
rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
by converting printsiginfo_at into a mpersified printer.

* printsiginfo.c (siginfo_t): Mpersify.
(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
* defs.h (printsiginfo_at): Remove.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
printsiginfo_at.
* process.c (sys_ptrace): Likewise.
* wait.c (sys_waitid): Likewise.
2015-08-28 08:46:23 +00:00
2307d5c968 signal.c: move signalfd parsers to a separate file
* signalfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c
2015-08-03 09:12:26 +00:00
0e946ab2c2 defs.h: do not include <signal.h>
* printsiginfo.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Do not include <signal.h>.
(printsiginfo): Remove.
* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
* strace.c: Likewise.
* sigaltstack.c: Include <signal.h>.
* signal.c: Likewise.
* sigreturn.c: Likewise.
* time.c: Likewise.
2015-07-18 00:01:40 +00:00
0e45b50ce6 signal.c: make use of RVAL_DECODED
* signal.c (sys_sigsuspend, sys_kill, sys_tgkill, sys_rt_sigsuspend,
sys_rt_sigqueueinfo, sys_rt_tgsigqueueinfo, sys_restart_syscall,
do_signalfd): Update for RVAL_DECODED.
2015-07-17 00:54:55 +00:00
735843e23a signal.c: use printaddr and umove_or_printaddr
* signal.c (print_sigset_addr_len, decode_old_sigaction):
Use printaddr and umove_or_printaddr.
(sys_signal): Use printaddr.
(sys_sigprocmask, sys_sigpending, sys_rt_sigprocmask,
sys_rt_sigpending): Remove redundant checks for syserror.
(decode_new_sigaction): Use umove_or_printaddr.
2015-07-17 00:54:55 +00:00
a0bd3749fc Declare syscall parsers using SYS_FUNC macro
Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.
2015-04-07 11:22:49 +00:00
537c964fe9 signal.c: move siginfo_t parsers to a separate file
* printsiginfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (printsiginfo): Change second argument's type from int to bool.
* signal.c: Stop defining siginfo_t related constants.
Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
(printsiginfo): Change second argument's type from int to bool,
split, and move to printsiginfo.c.
2015-03-27 23:41:00 +00:00
174bb2b36e signal.c: move sigaltstack parser to a separate file
* sigaltstack.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (print_stack_t, sys_sigaltstack): Move to sigaltstack.c.
* xlat/sigaltstack_flags.in: Add default values.
2015-03-26 15:43:07 +00:00
Denys Vlasenko
8497b6222e Show the syscall name in "resuming interrupted call" message
When signal is received, or if we have attached to a process,
current syscall (if process is in one) gets restarted.

Some syscalls are restarted via "restart_syscall()" mechanism.
On such sycalls, we don't show _which_ syscall gets restarted.

IOW: users want to see "resuming interrupted nanosleep"
instead of "resuming interrupted call" when they attach to "sleep 999".

Kernel does expose this information. The only thing we need is
to fetch syscall# on attach, and save it.

This patch does this. It adds tcp->s_prev_ent, which is
a pointer to struct_sysent of the previous syscall of this tracee.
It can be NULL.

sys_restart_syscall() is made to use it when the message is generated.

To similarly handle restart_syscall() *after signals*, not just
on attach, on each syscall exit patch saves exited syscall's data
in the same member (tcp->s_prev_ent).

Example:

    $ sleep 3 & strace -p $!
    Process 8728 attached
    restart_syscall(<... resuming interrupted nanosleep ...>) = 0
    _exit(0)                                = ?
    +++ exited with 0 +++

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 18:04:53 +01:00
Andreas Schwab
a897136801 m68k: define HAVE_SA_RESTORER
On m68k the kernel sigaction structure has the sa_restorer member for
historical reasons.

* signal.c (HAVE_SA_RESTORER): Define for M68K.
2015-03-12 10:24:27 +01:00
74219ea36f Move sigreturn/rt_sigreturn parser to a separate file
* sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintsigmask_n): New prototype.
(tprintsigmask_addr): New macro.
* signal.c (sprintsigmask_n): Make global.
(tprintsigmask_addr): Remove.
(sys_sigreturn): Move to sigreturn.c.
2015-03-06 02:19:01 +00:00