summaryrefslogtreecommitdiff
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix the length argument passed from print_iovec to decode_netlinkDmitry V. Levin2017-04-171-1/+1
| | | | | | * io.c (print_iovec): Pass the actual length to decode_netlink instead of the original length. * NEWS: Mention this fix.
* x32: fix decoding of flags argument of preadv2 and pwritev2 syscallsDmitry V. Levin2017-02-251-6/+21
| | | | | | | | | | | | x32 is the only linux architecture where preadv2 and pwritev2 syscalls take 5 arguments instead of 6. * io.c (PREADV2_PWRITEV2_FLAGS_ARG_NO): New macro. (SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): Use it. * linux/x32/syscallent.h (preadv2, pwritev2): Change nargs to 5. * NEWS: Mention this fix. * tests/preadv2-pwritev2.c (main): Fix invocation of preadv2 and pwritev2 syscalls on x32.
* Replace widen_to_ulong with truncate_kulong_to_current_wordsizeDmitry V. Levin2016-12-261-4/+6
| | | | | | * defs.h (widen_to_ulong): Remove. (truncate_kulong_to_current_wordsize): New static inline function. * io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.
* Simplify print_lld_from_low_high_val ifdeferyDmitry V. Levin2016-12-261-19/+6
| | | | | | | | | | | | The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler implementation. * io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG] and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases into a single [SIZEOF_KERNEL_LONG_T > 4] case. [SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long instead of zero_extend_signed_to_ull.
* Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrvalDmitry V. Levin2016-12-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After transition from long to kernel_ulong_t these fields are no longer needed. * defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove. (struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove. [HAVE_STRUCT_TCB_EXT_ARG]: Remove. (RVAL_MASK): Update. * io.c (print_lld_from_low_high_val): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] instead of [HAVE_STRUCT_TCB_EXT_ARG]. Use u_arg instead of ext_arg. * linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove. * linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]: Remove. [LINUX_MIPSN64]: Extend to [LINUX_MIPSN32]. * linux/x86_64/get_error.c (get_error) [X32]: Remove. * linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove. * lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] instead of [HAVE_STRUCT_TCB_EXT_ARG]. [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg instead of ext_arg. Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL. * mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly to print_mmap. * syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove. * times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL. * util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] instead of [HAVE_STRUCT_TCB_EXT_ARG]. Use u_arg instead of ext_arg.
* Automatically replace PRI_kr[dux] with PRI_kl[dux]Dmitry V. Levin2016-12-261-12/+12
| | | | | | | | | | 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.
* Automatically replace kernel_(scno|ureg)_t with kernel_ulong_tDmitry V. Levin2016-12-261-9/+9
| | | | | | | | | | | | | 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.
* Print kernel_ureg_t and kernel_scno_t using dedicated format stringsDmitry V. Levin2016-12-261-12/+12
| | | | | | | | 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.
* io: change size types from unsigned long to kernel_ureg_tDmitry V. Levin2016-12-251-8/+8
| | | | | | | | | | | | | * defs.h (tprint_iov_upto): Change the type of len and data_size arguments from unsigned long to kernel_ureg_t. (tprint_iov): Change the type of len argument from unsigned long to kernel_ureg_t. * io.c (print_iovec_config): Change data_size type from unsigned long to kernel_ureg_t. (print_iovec): Change the type of *iov, iov_buf, and len variables from unsigned long to kernel_ureg_t. (tprint_iov_upto): Change the type of len and data_size arguments, and the type of iov variable from unsigned long to kernel_ureg_t.
* printstr: rename to printstrn, add printstr as a thin wrapperDmitry V. Levin2016-12-251-5/+5
| | | | | | | | As about half of all printstr uses cases are invocations with the last argument set to -1, create a dedicated function for this use case. * defs.h (printstr): Rename to printstrn. All callers updated. (printstr): New static inline function. All callers updated.
* tprint_iov*: change address argument type from unsigned long to kernel_ureg_tDmitry V. Levin2016-12-231-2/+3
| | | | | | * defs.h (tprint_iov, tprint_iov_upto): Change address argument type from unsigned long to kernel_ureg_t. * io.c (tprint_iov, tprint_iov_upto): Likewise.
* Make tprint_iov function a static inline wrapperDmitry V. Levin2016-12-201-7/+0
| | | | | * io.c (tprint_iov): Move ... * defs.h: ... here, add static inline keywords.
* x32: fix decoding of 3rd argument of preadv* and pwritev* syscallsEugene Syromyatnikov2016-12-201-4/+8
| | | | | | | | In x32 personality these syscalls use compat type for the 3rd argument, therefore it has to be truncated there. * io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using widen_to_ulong.
* Check for current_klongsize instead of current_personality where appropriateDmitry V. Levin2016-12-191-14/+10
| | | | | | | | | | | | | current_klongsize checks are more universal, therefore they are usually shorter and easier to comprehend. * desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize instead of current_personality and current_wordsize. * io.c (print_lld_from_low_high_val): Likewise. * lseek.c (SYS_FUNC(lseek)): Likewise. * resource.c (decode_rlimit): Likewise. * syscall.c (is_negated_errno): Likewise. * util.c (getllval, getarg_klu): Likewise.
* struct tcb: make types of syscall arguments unsignedDmitry V. Levin2016-12-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step in the direction of revisiting current practice of indiscriminate use of signed types for syscall arguments and memory addresses. * kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long. * defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t. [HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long to unsigned long long. * desc.c (decode_select): Change type of syscall arguments from long to kernel_ureg_t. (SYS_FUNC(oldselect)): Change type of select_args from long to kernel_ureg_t. * io.c (print_lld_from_low_high_val): Remove no longer needed cast of syscall arguments to unsigned long. * lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long to long. * mem.c (print_mmap): Change type of syscall arguments from long to kernel_ureg_t. (SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg from long to kernel_ureg_t. (SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove no longer needed cast of syscall arguments to unsigned long. * pathtrace.c (pathtrace_match): Change type of args and select_args from long to kernel_ureg_t. * util.c (getarg_ull): Remove no longer needed casts of syscall arguments to unsigned types.
* Replace "(unsigned long) -1L" with -1ULDmitry V. Levin2016-12-181-3/+3
| | | | | | | | * defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL. * io.c (print_iovec, tprint_iov): Likewise. * msghdr.c (SYS_FUNC(sendmsg)): Likewise. * syscall.c (dumpio): Likewise. * poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.
* io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_uptoEugene Syromyatnikov2016-10-281-3/+5
| | | | | | | | | | | | | | | | | | | | | | | This enables printing of iovec arrays even in case of failed syscall (failed syscall doesn't mean that iovec itself is inaccessible and useless). One caveat here is that we should explicitly provide proper IOV_DECODE_* value based on syserror value in case printing is performed on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting when syserror is up, since this may be called by code which tries to print iovec containing local data, which should be perfectly accessible (on the other hand, there are no cases of such behaviour at the moment). Since iovecs themselves are printed even if syscall has failed now, preadv test is updated to reflect this. It is notable, though, that this is the only place where this case is checked. * io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror instead of umoven_or_printaddr as umoven_func parameter. (SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value based on syserror(tcp) value. * scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise. * tests/preadv.c: Update expected output for the case when preadv with singe-item iovec failed.
* io: handle data_size of -1 as unlimited data in print_iovecEugene Syromyatnikov2016-10-021-2/+4
| | | | | | | | Otherwise it can be depleted and print_iovec starts printing empty strings. * io.c (print_iovec): Interpret c->data_size of -1 as unlimited data and do not decrease it in this case.
* Rename widen_to_ull to zero_extend_signed_to_ullDmitry V. Levin2016-08-231-4/+4
| | | | | | * defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull. All callers changed. * tests/tests.h: Likewise.
* Move SH-specific argument number calculation to getllvalEugene Syromyatnikov2016-08-211-13/+2
| | | | | | | | | | | | This change prevents scattering of ll-related hacks and simplifies pread/pwrite syscalls parsers' logic a bit. * util.c (getllval): Add fixup for arg_no for SuperH when argument number is equal to 3. * io.c (PREAD_OFFSET_ARG): Remove. (SYS_FUNC(pread)): Always use argument number 3 for "count" argument printing. (SYS_FUNC(pwrite)): Likewise.
* Print struct iovec as a regular structureDmitry V. Levin2016-07-131-2/+2
| | | | | | | | | | | | | | | | | * io.c (print_iovec): Print names of iov_base and iov_len fields. * tests/aio.c (main): Update expected output. * tests/inet-cmsg.c (main): Likewise. * tests/mmsg.c (main): Likewise. * tests/msg_name.c (test_msg_name): Likewise. * tests/preadv-pwritev.c (main): Likewise. * tests/preadv2-pwritev2.c (main): Likewise. * tests/preadv.c (main): Likewise. * tests/pwritev.c (main): Likewise. * tests/readv.c (main): Likewise. * tests/recvmsg.c (main): Likewise. * tests/vmsplice.c (main): Likewise. * tests/scm_rights-fd.test: Likewise. * tests/uio.expected: Likewise.
* Add a general netlink socket parserFabien Siron2016-07-071-0/+6
| | | | | | | | | | | | | | | | | | | | | Introduce a general socket netlink parser which prints the header and a string for the remaining part of the buffer. It doesn't handle all the netlink flags and types yet because the parser needs more information, this will be implemented later. * net.c (decode_sockbuf): New function. (SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)): Use it instead of printstr. * msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto() for netlink sockets. * netlink.c: New file. * Makefile.am (strace_SOURCES): Add it. * defs.h (decode_netlink, getfdproto): New prototypes. (iov_decode): Add IOV_DECODER_NETLINK. * io.c (print_iovec): Use decode_netlink(). * util.c (getfdproto): Remove static keyword. * xlat/netlink_flags.in: New file. * xlat/netlink_types.in: New file.
* Add a enum for decoding to tprint_iov() and tprint_iov_upto()Fabien Siron2016-06-221-18/+23
| | | | | | | | | | | | | | | | | | | | | Introduce a new type iov_decode which will be used instead of the integer "decode" as a parameter. * defs.h (iov_decode): New enum. (tprint_iov, tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. * aio.c (print_iocb): Change type of "decode_iov" to enum iov_decode in tprint_iov() call. * keyctl.c (keyctl_instantiate_key_iov): Likewise. * process.c (ptrace): Likewise. * process_vm.c (process_vm_readv, process_vm_writev): Likewise. * io.c (writev, do_pwritev, vmsplice): Likewise. (print_iovec): Replace the condition with a switch. (tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. (readv, do_preadv): Change type of "decode_iov" to enum iov_decode in tprint_iov_upto() call. * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res): Likewise. * net.c (do_msghdr): Adapt call of tprint_iov_upto().
* Introduce HAVE_STRUCT_TCB_EXT_ARG macroDmitry V. Levin2016-06-171-6/+14
| | | | | | | | | | | | | | Check for "if HAVE_STRUCT_TCB_EXT_ARG" instead of "if defined LINUX_MIPSN32 || defined X32". * defs.h (HAVE_STRUCT_TCB_EXT_ARG): Define for LINUX_MIPSN32 || X32. (struct tcb): Check it instead of LINUX_MIPSN32 || X32. (RVAL_LUDECIMAL): Likewise. * io.c (print_lld_from_low_high_val): Likewise. * lseek.c (SYS_FUNC(lseek)): Likewise. * mem.c (SYS_FUNC(mmap)): Likewise. * syscall.c (trace_syscall_exiting): Likewise. * util.c (getllval): Likewise.
* Fix explicit casts of signed integer types to unsigned long longDmitry V. Levin2016-05-261-2/+2
| | | | | | | | | | | | | | | * defs.h (widen_to_ull): New macro. * dirent.c (print_old_dirent, SYS_FUNC(getdents)): Use it in place of explicit casts to unsigned long long. * io.c (print_lld_from_low_high_val): Likewise. * lseek.c (SYS_FUNC(llseek)): Likewise. * printsiginfo.c (print_si_info): Likewise. * printstat.h (DO_PRINTSTAT): Likewise. * sysinfo.c (SYS_FUNC(sysinfo)): Likewise. * times.c (SYS_FUNC(times)): Likewise. * fetch_struct_statfs.c (ASSIGN_NUMBER): Remove. (fetch_struct_statfs, fetch_struct_statfs64): Replace ASSIGN_NUMBER with widen_to_ull.
* Implement decoding of preadv2 and pwritev2 syscallsDmitry V. Levin2016-05-111-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * io.c: Include "xlat/rwf_flags.h". (do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): New functions. (SYS_FUNC(preadv)): Use do_preadv. (SYS_FUNC(pwritev)): Use do_pwritev. * linux/32/syscallent.h (preadv2, pwritev2): New entries. * linux/64/syscallent.h: Likewise. * linux/arm/syscallent.h: Likewise. * linux/hppa/syscallent.h: Likewise. * linux/i386/syscallent.h: Likewise. * linux/ia64/syscallent.h: Likewise. * linux/m68k/syscallent.h: Likewise. * linux/mips/syscallent-n32.h: Likewise. * linux/mips/syscallent-n64.h: Likewise. * linux/mips/syscallent-o32.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/powerpc64/syscallent.h: Likewise. * linux/s390/syscallent.h: Likewise. * linux/s390x/syscallent.h: Likewise. * linux/sparc/syscallent.h: Likewise. * linux/sparc64/syscallent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/syscallent.h: Likewise. * syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2. * xlat/rwf_flags.in: New file. * NEWS: Mention parsers of new syscalls.
* io.c: use print_array functionDmitry V. Levin2016-05-071-51/+43
| | | | | | | | * io.c (print_iovec_config): New structure. (print_iovec): New function. (tprint_iov_upto): Use print_array. * tests/preadv.c (main): Update. * tests/pwritev.c (print_iovec, main): Likewise.
* Fix printing of negative offsets in pread64 and pwrite64 syscallsDmitry V. Levin2016-04-021-2/+2
| | | | | | | | | | | * io.c (SYS_FUNC(pread), SYS_FUNC(pwrite)): Print offset using %lld format string. * tests/pread64-pwrite64.c: New file. * tests/pread64-pwrite64.test: New test. * tests/.gitignore: Add pread64-pwrite64. * tests/Makefile.am (check_PROGRAMS): Likewise. (pread64_pwrite64_CPPFLAGS): New variable. (DECODER_TESTS): Add pread64-pwrite64.
* Fix decoding of preadv syscall in case of short readDmitry V. Levin2016-03-301-1/+2
| | | | | | | * io.c (SYS_FUNC(preadv)): Call tprint_iov_upto instead of tprint_iov and specify syscall return value as a data size limit. * NEWS: Mention it. * tests/preadv.c (main): Add a test case for preadv short read.
* Fix printing of negative offsets in preadv and pwritev syscallsDmitry V. Levin2016-03-301-7/+7
| | | | | | | | | | | | | | * io.c (print_llu_from_low_high_val): Rename to print_lld_from_low_high_val, all callers changed. Print value as a signed integer. * tests/preadv.c: New file. * tests/preadv.test: New test. * tests/pwritev.c: New file. * tests/pwritev.test: New test. * tests/.gitignore: Add preadv and pwritev. * tests/Makefile.am (check_PROGRAMS): Likewise. (preadv_CPPFLAGS, pwritev_CPPFLAGS): New variables. (DECODER_TESTS): Add preadv.test and pwritev.test.
* Fix printing of unreadable struct iovecDmitry V. Levin2016-03-301-6/+13
| | | | | | * io.c (tprint_iov_upto): If the first element of iovec array is unreadable, print its address without array markup. * tests/readv.c (main): Check it.
* Fix printing of negative offsets in splice syscallDmitry V. Levin2016-02-141-2/+2
| | | | | | | | | | * io.c (SYS_FUNC(splice)): Use PRId64 instead of PRIu64 for printing offsets. * tests/splice.c: New file. * tests/splice.test: New test. * tests/.gitignore: Add splice. * tests/Makefile.am (check_PROGRAMS): Likewise. (TESTS): Add splice.test.
* Fix decoding and dumping of readv syscall in case of short readDmitry V. Levin2016-01-201-1/+2
| | | | | | | | | | | | | | | | | * defs.h (dumpiov_upto): New prototype. (dumpiov): Change to a wrapper around dumpiov_upto. * util.c (dumpiov): Rename to dumpiov_upto, add and check data_size argument. * io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead of tprint_iov and specify syscall return value as a data size limit. * syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead of dumpiov and specify syscall return value as a data size limit. * NEWS: Mention this fix. * tests/readv.c: New file. * tests/readv.test: New test. * tests/Makefile.am (check_PROGRAMS): Add readv. (TESTS): Add readv.test. * tests/.gitignore: Add readv.
* x86_64: fix x32 personality support in print_llu_from_low_high_valDmitry V. Levin2015-11-261-0/+4
| | | | | | | | x86 is the only personality supported on x86_64 that has 32-bit syscall arguments. * io.c (print_llu_from_low_high_val) [X86_64]: Fix current_personality == 2 case.
* Add a new helper function umove_ulong_array_or_printaddrDmitry V. Levin2015-09-151-25/+8
| | | | | | | | | | | | * defs.h (umove_ulong_array_or_printaddr): New prototype. * util.c (umove_ulong_array_or_printaddr): New function. * desc.c (sys_pselect6): Use it instead of open-coding a proxy struct parser for different personalities. * io.c (tprint_iov_upto): Use it instead of open-coding a struct iovec parser for different personalities. * kexec.c (print_kexec_segments): Use it instead of open-coding a struct kexec_segment parser for different personalities. (print_seg): Pass arguments using an array.
* io.c: move sendfile parsers to a separate fileDmitry V. Levin2015-08-191-24/+0
| | | | | | * sendfile.c: New file. * Makefile.am (strace_SOURCES): Add it. * io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c
* Fix printing tracee's long integersDmitry V. Levin2015-08-181-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* io.c: make use of RVAL_DECODEDDmitry V. Levin2015-07-201-91/+82
| | | | | | * io.c (sys_write, sys_writev, sys_pwrite, sys_pwritev, sys_sendfile, sys_sendfile64, sys_tee, sys_splice, sys_vmsplice): Update for RVAL_DECODED.
* Use printnum_int64 instead of print_loff_tDmitry V. Levin2015-07-201-12/+3
| | | | | | | * defs.h (print_loff_t): Remove. * io.c (print_loff_t): Remove. (sys_sendfile64, sys_splice): Use printnum_int64 instead of print_loff_t. * mtd.c (mtd_ioctl): Likewise.
* io.c: use printaddr and umove_or_printaddrDmitry V. Levin2015-07-201-46/+11
| | | | | | | | | * io.c (sys_read, sys_pread): Use printaddr. (tprint_iov_upto): Do not fetch data in case of syserror. Use printaddr. (sys_readv, sys_preadv): Remove redundant check for syserror. (print_off_t): Use printnum_int and printnum_long. (print_loff_t): Use umove_or_printaddr.
* Move ioctl syscall parser to ioctl.cDmitry V. Levin2015-07-021-29/+0
| | | | | | | | | * io.c (sys_ioctl): Move ... * ioctl.c: ... here. (ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode, ioctl_decode_command_number): Declare as static. * defs.h (ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode, ioctl_decode_command_number): Remove.
* Declare syscall parsers using SYS_FUNC macroDmitry V. Levin2015-04-071-28/+14
| | | | | | | | | | | | | | 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.
* Change last parameter of umoven() from char* to void*Denys Vlasenko2015-03-211-1/+1
| | | | | | Saves tons of casts. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* mips n32: fix preadv/pwritev offset decodingDmitry V. Levin2015-03-031-2/+0
| | | | | | | In mips n32 abi, like in most of 32-bit architectures, offset is passed to preadv/pwritev syscalls using two syscall arguments. * io.c (print_llu_from_low_high_val) [LINUX_MIPSN32]: Remove.
* Fix ILP32 personality preadv/pwritev offset decoding on LP64 architecturesDmitry V. Levin2015-01-241-1/+10
| | | | | | * io.c (print_llu_from_low_high_val) [SIZEOF_LONG == SIZEOF_LONG_LONG && SUPPORTED_PERSONALITIES > 1]: Properly handle the case of current_wordsize < sizeof(long).
* ioctl: add decoding for parametrized command namesGabriel Laskar2015-01-211-7/+10
| | | | | | | | | | | | | | | Some ioctl commands from evdev, hiddev, mixer, uinput, spi, and joystick are parametrized by a size or a number that are variable. This change implements printing of these parametrized ioctl command names. * configure.ac (AC_CHECK_HEADERS): Add linux/input.h. * defs.h (ioctl_decode_number): New prototype. * io.c (sys_ioctl): Use ioctl_decode_number. * ioctl.c (ioctl_decode_number): New function. * xlat/evdev_abs.in: New file. * xlat/evdev_ev.in: New file. Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
* ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) formatDmitry V. Levin2015-01-211-1/+1
| | | | | | | | * defs.h (ioctl_print_code): New prototype. * ioctl.c: Include xlat/ioctl_dirs.h. (ioctl_print_code): New function. * io.c (sys_ioctl): Use it. * xlat/ioctl_dirs.in: New file.
* Include <sys/uio.h> unconditionallyDmitry V. Levin2014-11-211-8/+1
| | | | | | | | | | | | | | | Since <sys/uio.h> is standardized by POSIX and is present in all available versions of glibc, it's safe to assume that any usable libc implementation provides this header file. * configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h. * io.c: Include <sys/uio.h> unconditionally. (tprint_iov_upto, tprint_iov, sys_readv, sys_writev, print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define unconditionally. * net.c: Include <sys/uio.h> unconditionally. * util.c: Include <sys/uio.h> unconditionally. (dumpiov): Define unconditionally.
* Fix preadv/pwritev offset decoding on ILP32 architecturesDmitry V. Levin2014-08-071-3/+3
| | | | | | | This fixes regression introduced by the previous commit. * io.c (print_llu_from_low_high_val) [SIZEOF_LONG != SIZEOF_LONG_LONG]: Cast argument to unsigned long before casting it to unsigned long long.
* Fix preadv/pwritev offset decoding on bigendian architecturesDmitry V. Levin2014-08-071-4/+24
| | | | | | | | | | | | | | This partially reverts commit 7845a42b39e59e904d01e75e21f7bc7eb6462560. * util.c (printllval): Remove align argument. * defs.h (printllval): Update prototype. (printllval_aligned, printllval_unaligned): Remove. * file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64, sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2, sys_fallocate): Replace printllval_aligned call with printllval. * io.c (sys_pread, sys_pwrite): Likewise. (print_llu_from_low_high_val): New function. (sys_preadv, sys_pwritev): Use it instead of printllval_unaligned.