Commit Graph

219 Commits

Author SHA1 Message Date
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
48f0890953 ia64: use PTRACE_GETREGS to fetch registers
* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
(ia64_frame_ptr): New declaration.
* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
* syscall.c [IA64]: Include <asm/rse.h>.
[IA64] (ia64_regs, ia64_frame_ptr): New variable.
[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
[IA64] (ia64_ia32mode): Convert to macro.
[IA64] (ia64_r8, ia64_r10): Remove.
(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
Use ia64_regs.
(get_syscall_result) [IA64]: Remove.
2015-03-05 23:37:27 +00:00
20eca8a1c5 s390, s390x: use PTRACE_GETREGSET to fetch registers
* linux/s390/arch_regs.h: New file.
* linux/s390x/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add them.
* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
(print_pc) [S390 || S390X]: Use s390_regset.
(get_scno) [S390 || S390X]: Likewise.
(get_syscall_args) [S390 || S390X]: Likewise.
(get_error) [S390 || S390X]: Likewise.
(get_syscall_result) [S390 || S390X]: Remove.
2015-03-05 22:10:15 +00:00
59f63d3106 Use SIGRTMIN from kernel headers
* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>.
* signal.c: Use ASM_SIGRTMIN instead of constants provided by libc.
* tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value.
Use lower RT_* numbers to support pre-3.18 hppa kernels.
* tests/sigreturn.test: Update regexp.
2015-03-05 05:42:30 +00:00
67dab706cf ppc64: fix compilation warning
Fix compilation warning introduced by commit
577be2593d

* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
mask on 32bit personality.
2015-03-05 04:29:37 +00:00
a1c5e0721f i386: simplify sigreturn decoding
* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
i386_sigcontext_struct and i386_fpstate structures.
2015-03-05 01:16:52 +00:00
f3582cd204 sigreturn: print signal mask as a syscall argument
Although sigreturn takes signal mask via frame pointer,
it's more convenient to display signal mask as a syscall argument
rather than an outstanding object of unknown nature:

Before this change:
    sigreturn() (mask [USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]) = 0

After this change:
    sigreturn({mask=[USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]}) = 0

* signal.c (sys_sigreturn): Display signal mask as a syscall argument.
2015-03-04 23:55:25 +00:00
5b9b7e1d34 aarch64: implement rt_sigreturn decoding
* linux/64/syscallent.h (139): Use sys_sigreturn for rt_sigreturn
decoding.
* syscall.c [ARM] (arm_regs): Make static.
[ARM] (arm_sp_ptr): New variable.
[AARCH64] (aarch64_sp_ptr, arm_sp_ptr): New variables.
* linux/aarch64/arch_regs.h: New file.
* linux/arm/arch_regs.h (arm_regs): Remove.
(arm_sp_ptr): New declaration.
* signal.c (sys_sigreturn) [ARM]: Use arm_sp_ptr.
[AARCH64]: Print signal mask.
2015-03-04 23:05:53 +00:00
26d16c8ade arm: simplify sigreturn decoding
* signal.c (sys_sigreturn) [ARM]: Do not define sigcontext and ucontext
structures, fetch signal mask only, use print_sigset_addr_len.
2015-03-04 22:27:35 +00:00
085411b806 s390: fix sigreturn decoding
* signal.c (sys_sigreturn) [S390]: Fix signal mask decoding.
2015-03-04 21:48:44 +00:00
fd6d2072b1 mips o32: fix sigreturn decoding
* signal.c (sys_sigreturn) [LINUX_MIPSO32]: Fix the address of signal mask.
[MIPS] Use print_sigset_addr_len to print signal mask.
2015-03-04 21:48:44 +00:00
ccb4fdac43 x86_64, x32: implement rt_sigreturn decoding
* syscall.c [X86_64 || X32] (x86_64_rsp_ptr): New variable.
* linux/x86_64/arch_regs.h (x86_64_rsp_ptr): New declaration.
* linux/x86_64/syscallent.h (15): Use sys_sigreturn for rt_sigreturn
decoding.
* linux/x32/syscallent.h (513): Likewise.
* signal.c (sys_sigreturn) [X86_64 || X32]: Print signal mask
for non-i386 personalities.
2015-03-04 17:54:25 +00:00
db19936861 sparc, sparc64: fix sigreturn decoding
* linux/sparc/arch_regs.h (U_REG_FP): New macro.
* signal.c (sys_sigreturn) [SPARC || SPARC64]: Fix decoding
of upper 32 bits of the sigmask.
2015-03-04 17:54:25 +00:00
577be2593d ppc, ppc64: fix sigreturn decoding
* signal.c (sys_sigreturn) [POWERPC]: Fix decoding of upper 32 bits
of the sigmask.
2015-03-04 16:06:05 +00:00
d46899286e sigreturn: issue a less innocuous warning
* signal.c (sys_sigreturn): Issue a less innocuous warning on
architectures for which signal mask decoding is not implemented yet.
2015-03-04 14:52:56 +00:00
1e8a454474 ia64: fix sigreturn decoding
* signal.c (sys_sigreturn) [IA64]: Fix the address of signal mask.
Use print_sigset_addr_len to print signal mask.
2015-03-04 12:11:31 +00:00
24b8eb0dee sparc, sparc64: fix rt_sigaction decoding
Fix regression introduced by commit v4.9-9-gc3a5c01.

* signal.c (HAVE_SA_RESTORER): New macro.
[HPPA || IA64]: Do not undefine SA_RESTORER.
(old_sigaction, old_sigaction32, new_sigaction): Use HAVE_SA_RESTORER
instead of SA_RESTORER to check whether to define sa_restorer.
(decode_old_sigaction, decode_new_sigaction): Use HAVE_SA_RESTORER in
addition to SA_RESTORER to check whether to use sa_restorer.
2015-02-28 17:55:25 +00:00
7211dbcb2f build: include ptrace.h after regs.h
Restore the order of including <sys/reg.h> and <linux/ptrace.h>
headers that was inadvertently changed by commit v4.9-280-g5503dd2.

This should fix build on platforms like m68k where some constants
are defined simultaneously as enums by <sys/reg.h> and as macros
by <asm/ptrace.h>.

* process.c: Include "ptrace.h" after "regs.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2015-02-28 12:20:21 +00:00
5dd336bb4e x86_64, x32: fix sys_sigreturn
On x86_64/x32, sys_sigreturn is defined only for i386 personality.

* signal.c (sys_sigreturn): Define for X32.
(sys_sigreturn) [X86_64 || X32]: Implement for i386 personality only.
2015-02-23 16:21:55 +00:00
b2f8c77d66 Change errnoent.h files to use designated initializers
* signal.c (printsiginfo): Allow elements of errnoent array to be zero.
* syscall.c (trace_syscall_exiting): Likewise.
* errnoent.sh: Output designated initializers.
* linux/errnoent.h: Regenerated.
* linux/alpha/errnoent.h: Regenerated.
* linux/hppa/errnoent.h: Regenerated.
* linux/mips/errnoent.h: Regenerated.
* linux/sparc/errnoent.h: Regenerated.
* linux/sparc/errnoent1.h: Regenerated.
* linux/powerpc/errnoent.h: New file.
* linux/powerpc64/errnoent.h: Include "powerpc/errnoent.h".
* Makefile.am (EXTRA_DIST): Add linux/powerpc/errnoent.h
and linux/powerpc64/errnoent.h.
2015-02-23 13:29:17 +00:00
4f2d1ae243 mips: use PTRACE_GETREGS to fetch all registers
* linux/mips/arch_regs.h (struct mips_regs): New structure.
(mips_REG_*): New macros.
* signal.c (sys_sigreturn) [MIPS]: Use mips_REG_SP.
* syscall.c [MIPS] (struct mips_regs): New variable.
[MIPS] (ARCH_REGS_FOR_GETREGS): New macro.
(mips_a3, mips_r2): Remove.
(print_pc) [MIPS]: Use mips_REG_EPC.
(get_scno) [MIPS]: Use mips_REG_V0 and mips_REG_A3.
(get_syscall_args) [MIPS]: Use mips_REG_A[0-5].
(get_syscall_result) [MIPS]: Remove.
(get_error) [MIPS]: Use mips_REG_A3 and mips_REG_V0.
2015-02-16 02:39:13 +00:00
5503dd28c6 Move regs-related macros and declarations from defs.h to regs.h
* regs.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/arch_regs.h: New file.
* linux/alpha/arch_regs.h: Likewise.
* linux/arm/arch_regs.h: Likewise.
* linux/hppa/arch_regs.h: Likewise.
* linux/i386/arch_regs.h: Likewise.
* linux/ia64/arch_regs.h: Likewise.
* linux/mips/arch_regs.h: Likewise.
* linux/powerpc/arch_regs.h: Likewise.
* linux/sh64/arch_regs.h: Likewise.
* linux/sparc/arch_regs.h: Likewise.
* linux/sparc64/arch_regs.h: Likewise.
* linux/tile/arch_regs.h: Likewise.
* linux/x86_64/arch_regs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Remove definitions of PTRACE_*, REG_*, PT_*, U_REG_*,
and ARM_* macros.
Remove declarations of struct pt_regs variables.
[SPARC]: Do not include <asm/psr.h>.
[SPARC64]: Do not include <asm/psrcompat.h>.
* bjm.c: Do not include <sys/user.h>.
* process.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h> and <asm/rse.h>.
* util.c: Likewise.
* syscall.c: Likewise.
[AARCH64]: Define struct arm_pt_regs and ARM_* macros.
[SPARC]: Include <asm/psr.h>.
[SPARC64]: Include <asm/psrcompat.h>.
* signal.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h>.
* strace.c [IA64]: Do not include <asm/ptrace_offsets.h>.
2015-02-13 18:28:08 +00:00
fadf379b8e Move all ptrace-related macros and declarations from defs.h to ptrace.h
* ptrace.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Remove linux/ptrace.h and sys/ptrace.h.
* defs.h: Do not include <sys/ptrace.h> and <asm/ptrace.h>.
Remove definitions of PTRACE_* macros.
* process.c: Remove <linux/ptrace.h> workarounds, include "ptrace.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
* strace.c: Include "ptrace.h".
* wait.c: Likewise.
2015-02-13 18:27:58 +00:00
d8890b5c9d printsiginfo: constify the first argument
* signal.c (printsiginfo): Make the first argument a pointer to a const type.
* defs.h (printsiginfo): Likewise.
(printsiginfo, printsiginfo_at): Always define these prototypes.
* configure.ac (AC_CHECK_TYPES): Remove siginfo_t, as HAVE_SIGINFO_T
is no longer used.
2015-02-07 15:47:24 +00:00
36ab3d520b build: fix build if siginfo_t lacks si_timerid/si_overrun
* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_timerid and
siginfo_t.si_overrun.
* signal.c (printsiginfo) [SI_TIMER]: Check HAVE_SIGINFO_T_SI_TIMERID
and HAVE_SIGINFO_T_SI_OVERRUN.
2015-01-13 06:41:44 +00:00
Maarten ter Huurne
40c174b38b Include <linux/ptrace.h> regardless of <sys/reg.h> existence
This fixes compilation with musl libc.
This approach was already used in process.c, so I assume it is safe.

* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
* syscall.c: Likewise.
* util.c: Likewise.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
2014-10-31 23:04:59 +00:00
Vicente Olivert Riera
c3a5c01051 sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently
Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.

This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'

* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
2014-09-17 19:23:45 +00:00
3ed5d02183 Fix compilation warnings reported by gcc -Wsign-compare
* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
* defs.h (struct tcb): Change 'currpers' type to unsigned.
(struct xlat): Change 'val' type to unsigned
(signame): Add 'const' qualifier to its argument.
(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
change its type to unsigned.
(printpathn): Change the 3rd argument type to unsigned.
(ioctl_lookup): Change 1st argument type to unsigned.
* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
* file.c (print_xattr_list): Fix comparisons between signed and unsigned
long values.
* ioctl.c (compare): Fix cast.
(ioctl_lookup): Change 1st argument type to to unsigned.
(ioctl_next_match): Change 'code' type to unsigned.
* mem.c (sys_move_pages): Change 'i' type to unsigned.
* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
Print 'i' using %u format string.
* process.c (sys_prctl): Change 'i' type to unsigned.
(printargv): Change 'n' type to unsigned.
(sys_ptrace): Change 'addr' type to unsigned.
* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
and change its type to unsigned.  Change 'i' and 'allocated' types
to unsigned.
* signal.c (signame): Add 'const' qualifier to its argument.
Fix comparisons between signed and unsigned values.
(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
unsigned values.
* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
(detach): Change 'sig' type to unsigned.
(startup_attach): Change 'tcbi' type to unsigned.
(startup_child): Change 'm', 'n', and 'len' types to unsigned.
(init): Use new variable to iterate 'tcbtab'.
(pid2tcb): Change 'i' type to unsigned.
(cleanup): Change 'i' and 'sig' types to unsigned.
* syscall.c (update_personality): Change 'personality' argument type
to unsigned.
(struct qual_options): Change 'bitflag' type to unsigned.
(reallocate_qual): Add 'const' qualifier to its argument and change its
type to unsigned.
(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
Change 'p' type to signed int.
(qual_syscall): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'p' type to signed int.
(qual_signal): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'i' type to unsigned.
(qual_desc): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
(qualify): Change 'i' type to unsigned.
(get_scno): Change 'currpers' type to unsigned.
Fix a comparison between signed and unsigned values.
* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
Fix comparisons between signed and unsigned values.
* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
and change its type to unsigned.
(printuid): Fix a comparison between signed and unsigned values.
(printpathn): Change 'n' argument type to unsigned.
(printstr): Change 'size' type to unsigned.
Fix a comparison between signed and unsigned values.
(setbpt): Change 'i' type to unsigned.
* net.c (printsock): Silence a compilation warning.
* reboot.c (sys_reboot): Likewise.
2014-09-17 19:18:18 +00:00
Mike Frysinger
dd80a879be ia64: fix sigaction decoding
Looks like ia64 doesn't have sa_restorer either, yet still defines
SA_RESTORER.  Deploy the same trick that HPPA is using to make the
test pass.

* signal.c (SA_RESTORER): Undefine when IA64 is defined.
(struct new_sigaction) [IA64]: Disable sa_restorer.
2014-08-14 23:29:09 +00:00
Mike Frysinger
6ab2ed119a signal: fix thinko in sa_restorer
Previous commit here re-added the bugs trying to be fixed due to a
logic thinko.  The patches were tested in isolation and hand merged
later.  Oops.

* signal.c (struct new_sigaction): Change || to &&.
2014-08-10 09:23:22 +00:00
Mike Frysinger
d632e10f51 hppa: fix sigaction decoding
Since the rt_sigaction syscall on hppa doesn't have a sa_restorer,
do not include it in the kernel struct.

We also have to undefine SA_RESTORER so that code doesn't try to
use it.  The headers will export this, but the syscall doesn't
actually respect it.

* signal.c (SA_RESTORER): Undefine when HPPA is defined.
(struct new_sigaction): Disable sa_restorer on hppa.
2014-08-09 15:27:55 +00:00
Mike Frysinger
e355c60b1d alpha: fix sigaction decoding
Since the rt_sigaction syscall on alpha doesn't have a sa_restorer,
do not include it in the kernel struct.

* signal.c (struct new_sigaction): Disable sa_restorer on alpha.
2014-08-09 15:27:13 +00:00
d35bdcad13 Compress blank lines
Suppress empty lines left after automated xlat conversion.
2014-05-30 22:10:21 +00:00
0ed617bd66 Generate xlat/*.in files
Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.
2014-05-30 21:40:03 +00:00
bc091e3ce1 printsiginfo: add SIGSYS decoding
* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_syscall.
* signal.c (SYS_SECCOMP): Define if not yet defined.
(sigsys_codes): new xlat structure.
(printsiginfo): Decode SIGSYS.
2014-03-11 22:18:40 +00:00
b9d4d21a61 Update siginfo codes
* signal.c (siginfo_codes): Add SI_DETHREAD.
2014-03-11 01:57:02 +00:00
4a524dbbdf Factor out printing of si_pid and si_uid members of siginfo_t
* signal.c (printsigsource): New function.
(printsiginfo): Use it.
2014-03-11 00:47:01 +00:00
Elliott Hughes
4dd1e89cb8 Improve SI_TIMER decoding
Decode siginfo_t more clearly for si_code SI_TIMER.
The 'pid' is actually a POSIX timer id, and the 'uid' is actually the
overrun.
Also factor out the si_value dumping so it's the same for every si_code.

Signed-off-by: Elliott Hughes <enh@google.com>
2014-03-10 19:33:49 +00:00