Commit Graph

12 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
09a1a5a2ca Rename umove_long_or_printaddr to umove_ulong_or_printaddr
Rename the recently added function to reflect what kind of data type
it actually deals with: unsigned long int, without sign extension.

* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
chage 3rd argument to unsigned long *.
* util.c (umove_long_or_printaddr): Likewise.
* aio.c (sys_io_submit): Update callers.
2015-09-14 23:02:29 +00:00
f56046e459 aio: rewrite from libaio.h to linux/aio_abi.h
* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
* aio.c: Assume that <linux/aio_abi.h> is available,
include it instead of <libaio.h>.
[!IOCB_RESFD]: Remove.
(enum iocb_sub): Remove SUB_POLL.
(tprint_lio_opcode): Update.
(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
rename fields of struct iocb.
(iocb_is_valid, print_iocb_header, print_iocb): New functions.
(sys_io_submit): Use print_iocb.
(print_io_event): Fix struct io_event decoding.
(sys_io_cancel): Use print_iocb_header.
* strace.spec (BuildRequires): Remove libaio-devel.
* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
and struct io_event decoding.
* tests/aio.test (syscalls): Add io_cancel.
2015-08-26 21:05:17 +00:00
13c2173393 Fix multiple personalities support in parser of io_submit syscall
Introduce a new helper function to fetch tracee's long integers
and use it to fix multiple personalities support in io_submit parser.

* defs.h (umove_long_or_printaddr): New prototype.
* util.c (umove_long_or_printaddr): New function.
* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
* tests/aio.c: New file.
* tests/aio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add aio.
(TESTS): Add aio.test.
* tests/.gitignore: Add aio.
2015-08-26 21:05:17 +00:00
56872838e4 Fix printing of io_getevents first argument
* aio.c (sys_io_getevents): Print first argument using "%lu" format.
2015-08-26 16:16:47 +00:00
Elvira Khabirova
afac9f0207 Fix io_setup first argument printing
* aio.c (sys_io_setup): Print first argument using "%u" format.
2015-08-18 16:42:37 +00:00
2479ef0bce Fix printing tracee's long integers
Replace ambiguous printnum_long that used to fetch native long integers
from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
that fetch tracee's pointer, signed long, and unsigned long integers.

* defs.h (printnum_long, printpair_long): Remove prototypes.
(printnum_int64, printpair_int64): Remove macros, declare functions
unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New prototype.
(printnum_ptr, printnum_slong, printnum_ulong): New macros.
* aio.c (sys_io_setup): Use printnum_ulong.
* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
and printnum_ulong.
* io.c (print_off_t): Remove.
(sys_sendfile): Use printnum_ulong.
* ipc.c (sys_semctl): Use printnum_ptr.
* prctl.c (sys_prctl): Likewise.
* process.c (sys_ptrace): Likewise.
* rtc.c (rtc_ioctl): Use printnum_ulong.
* util.c (printnum_long, printpair_long): Remove.
(printnum_int64, printpair_int64): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New function.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
2015-08-18 16:15:33 +00:00
07eaf50848 aio.c: enhance io_* syscalls decoding
* aio.c (sys_io_setup): Use printnum_int64 and printnum_long.
(sys_io_destroy, sys_io_submit): Update for RVAL_DECODED.
(sys_io_submit): Use umove_or_printaddr and printaddr.
Enclose iocb array in square brackets.
Change to traditional structure output format.
(print_io_event): New function.
(sys_io_cancel, sys_io_getevents): Use it.
(sys_io_cancel): Use umove_or_printaddr and printaddr.
(sys_io_getevents): Use printaddr.
2015-07-20 22:03:07 +00:00
d93c4e80b3 Consistenly use #ifdef to check for AC_DEFINE'd macros
* aio.c (print_common_flags): Use #ifdef in the check for
HAVE_STRUCT_IOCB_U_C_FLAGS.
* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
* net.c: Use #ifdef in the check for HAVE_SENDMSG.
* syscall.c (dumpio): Likewise.
* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
HAVE_STRUCT_STAT_ST_* macros.
* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.
2015-06-17 20:09:13 +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
b7dd5e63bf Use external libaio.h
Stop using an outdated partial copy of libaio.h, switch back to external
libaio.h from libaio.
This partially reverts commit 2df03c494e.

* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
HAVE_DECL_IO_CMD_PWRITEV.
* configure.ac: Check for libaio.h and declaration it provides.
2014-09-08 16:43:36 +00:00
2b64034786 Move io_* syscalls decoding to a separate file
* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
sys_io_getevents, declarations from libaio.h): Move to ...
* aio.c: new file.
* Makefile.am (strace_SOURCES): Add aio.c.
2013-11-11 15:06:18 +00:00