1999-02-19 03:21:36 +03:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
1999-12-23 17:20:14 +03:00
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
2018-06-14 14:00:00 +03:00
* Copyright ( c ) 1999 - 2018 The strace developers .
1999-02-19 03:21:36 +03:00
* All rights reserved .
*
2018-12-10 03:00:00 +03:00
* SPDX - License - Identifier : LGPL - 2.1 - or - later
1999-02-19 03:21:36 +03:00
*/
# include "defs.h"
# include <fcntl.h>
2014-11-21 23:46:16 +03:00
# include <sys/uio.h>
1999-02-19 03:21:36 +03:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( read )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
Fix decoding of file descriptors
* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
2011-03-04 05:08:02 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
if ( syserror ( tcp ) )
2015-07-20 14:06:54 +03:00
printaddr ( tcp - > u_arg [ 1 ] ) ;
1999-02-19 03:21:36 +03:00
else
2016-12-20 19:43:26 +03:00
printstrn ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_rval ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu , tcp - > u_arg [ 2 ] ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( write )
1999-02-19 03:21:36 +03:00
{
2015-07-20 14:19:30 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
2016-12-20 19:43:26 +03:00
printstrn ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu , tcp - > u_arg [ 2 ] ) ;
2015-07-20 14:19:30 +03:00
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
2016-05-08 01:54:04 +03:00
struct print_iovec_config {
2016-06-22 16:27:03 +03:00
enum iov_decode decode_iov ;
2016-12-26 13:26:03 +03:00
kernel_ulong_t data_size ;
2016-05-08 01:54:04 +03:00
} ;
static bool
print_iovec ( struct tcb * tcp , void * elem_buf , size_t elem_size , void * data )
{
2016-12-26 13:26:03 +03:00
const kernel_ulong_t * iov ;
kernel_ulong_t iov_buf [ 2 ] , len ;
2016-05-08 01:54:04 +03:00
struct print_iovec_config * c = data ;
2017-06-18 01:23:09 +03:00
if ( elem_size < sizeof ( iov_buf ) ) {
2016-05-08 01:54:04 +03:00
iov_buf [ 0 ] = ( ( unsigned int * ) elem_buf ) [ 0 ] ;
iov_buf [ 1 ] = ( ( unsigned int * ) elem_buf ) [ 1 ] ;
iov = iov_buf ;
} else {
iov = elem_buf ;
}
2016-07-14 01:54:55 +03:00
tprints ( " {iov_base= " ) ;
2016-05-08 01:54:04 +03:00
2016-06-22 16:27:03 +03:00
len = iov [ 1 ] ;
switch ( c - > decode_iov ) {
case IOV_DECODE_STR :
if ( len > c - > data_size )
len = c - > data_size ;
2016-12-26 13:26:03 +03:00
if ( c - > data_size ! = ( kernel_ulong_t ) - 1 )
2016-09-29 15:57:55 +03:00
c - > data_size - = len ;
2016-12-20 19:43:26 +03:00
printstrn ( tcp , iov [ 0 ] , len ) ;
2016-06-22 16:27:03 +03:00
break ;
2016-07-06 18:49:22 +03:00
case IOV_DECODE_NETLINK :
if ( len > c - > data_size )
len = c - > data_size ;
2016-12-26 13:26:03 +03:00
if ( c - > data_size ! = ( kernel_ulong_t ) - 1 )
2016-09-29 15:57:55 +03:00
c - > data_size - = len ;
2016-07-11 15:54:59 +03:00
/* assume that the descriptor is 1st syscall argument */
decode_netlink ( tcp , tcp - > u_arg [ 0 ] , iov [ 0 ] , len ) ;
2016-07-06 18:49:22 +03:00
break ;
2016-06-22 16:27:03 +03:00
default :
printaddr ( iov [ 0 ] ) ;
break ;
2016-05-08 01:54:04 +03:00
}
2016-12-26 13:16:35 +03:00
tprintf ( " , iov_len=% " PRI_klu " } " , iov [ 1 ] ) ;
2016-05-08 01:54:04 +03:00
return true ;
}
2012-04-28 16:26:18 +04:00
/*
* data_size limits the cumulative size of printed data .
* Example : recvmsg returing a short read .
*/
2000-09-02 01:03:06 +04:00
void
2016-12-26 13:26:03 +03:00
tprint_iov_upto ( struct tcb * const tcp , const kernel_ulong_t len ,
const kernel_ulong_t addr , const enum iov_decode decode_iov ,
const kernel_ulong_t data_size )
2000-09-02 01:03:06 +04:00
{
2016-12-26 13:26:03 +03:00
kernel_ulong_t iov [ 2 ] ;
2017-06-18 01:23:09 +03:00
struct print_iovec_config config = {
. decode_iov = decode_iov , . data_size = data_size
} ;
2000-09-02 01:03:06 +04:00
2016-05-08 01:54:04 +03:00
print_array ( tcp , addr , len , iov , current_wordsize * 2 ,
print_array: enhance printing of unfetchable object addresses
When umoven_func invocation fails to fetch data, it prints the faulty
address. If this happens to a subsequent umoven_func invocation,
the printed address may be undistinguishable from a valid data printed
by print_func, e.g. when the data is printed in a numeric form like
[0x1, 0x2, 0x3, 0xdefaced].
Fix this source of confusion by moving the printing of the faulty
address from umoven_func to print_array itself. This change renames
umoven_func to tfetch_mem_func and changes its semantics, so that
- tfetch_mem_func never prints anything;
- tfetch_mem_func returns true if the fetch succeeded,
and false otherwise.
* defs.h (print_array): Replace umoven_func argument with
tfetch_mem_func.
* util.c (print_array): Replace umoven_func argument with
tfetch_mem_func, document expected tfetch_mem_func return value
semantics. When tfetch_mem_func returns false, print either addr
or "... /* addr */" depending on the context (inside the array or not).
* bpf.c (print_ebpf_prog, print_bpf_prog_info,
BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Replace umoven_or_printaddr
argument of print_array with tfetch_mem.
* bpf_filter.c (print_bpf_fprog): Likewise.
* btrfs.c (btrfs_print_logical_ino_container,
btrfs_print_ino_path_container, btrfs_print_qgroup_inherit,
btrfs_ioctl): Likewise.
* dm.c (dm_decode_dm_target_deps): Likewise.
* epoll.c (epoll_wait_common): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* kexec.c (print_kexec_segments): Likewise.
* mem.c (SYS_FUNC(subpage_prot)): Likewise.
* net.c (print_getsockopt): Likewise.
* netlink.c (decode_nlmsgerr_attr_cookie): Likewise.
* netlink_netlink_diag.c (decode_netlink_diag_groups): Likewise.
* netlink_packet_diag.c (decode_packet_diag_mclist): Likewise.
* netlink_unix_diag.c (decode_unix_diag_inode): Likewise.
* nlattr.c (decode_nla_meminfo): Likewise.
* numa.c (print_nodemask, SYS_FUNC(move_pages),
* perf_ioctl.c (perf_ioctl_query_bpf): Likewise.
* poll.c (decode_poll_entering): Likewise.
* printsiginfo.c (print_siginfo_array): Likewise.
* rtnl_tc.c (decode_tca_stab_data): Likewise.
* sock.c (decode_ifconf): Likewise.
* uid.c (print_groups): Likewise.
* io.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents)): Replace
umoven_or_printaddr argument of print_array with tfetch_mem.
(tprint_iov_upto): Replace umoven_or_printaddr_ignore_syserror
with tfetch_mem_ignore_syserror.
* v4l2.c (print_v4l2_format_fmt): Replace umoven_or_printaddr argument
of print_array with tfetch_mem.
(print_v4l2_ext_controls): Replace umoven_or_printaddr_ignore_syserror
with tfetch_mem_ignore_syserror.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Rename
to fetch_struct_mmsghdr_for_print, do not print address, return bool.
(decode_mmsgvec): Replace fetch_struct_mmsghdr_or_printaddr
with fetch_struct_mmsghdr_for_print.
* tests/aio.c (main): Update expected output.
* tests/bpf.c (print_BPF_PROG_QUERY_attr5): Likewise.
* tests/ioctl_perf-success.c (main): Likewise.
* tests/ioctl_v4l2.c (main): Update expected output.
* tests/kexec_load.c (main): Likewise.
* tests/mmsg_name.c (test_mmsg_name): Update expected output.
* tests/move_pages.c (print_page_array, print_node_array): Likewise.
* tests/poll.c (print_pollfd_array_entering): Likewise.
* tests/preadv-pwritev.c (main): Likewise.
* tests/preadv2-pwritev2.c (dumpio): Likewise.
* tests/process_vm_readv_writev.c (print_iov): Likewise.
* tests/pwritev.c (print_iovec): Likewise.
* tests/readv.c (main): Likewise.
* tests/seccomp-filter-v.c
* tests/semop.c (main): Likewise.
* tests/set_mempolicy.c (print_nodes): Likewise.
* tests/setgroups.c (main): Likewise.
* tests/test_nlattr.h (print_nlattr) Likewise.
Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-05-29 04:15:19 +03:00
tfetch_mem_ignore_syserror , print_iovec , & config ) ;
2000-09-02 01:03:06 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( readv )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
Fix decoding of file descriptors
* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
2011-03-04 05:08:02 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
2016-06-22 16:27:03 +03:00
tprint_iov_upto ( tcp , tcp - > u_arg [ 2 ] , tcp - > u_arg [ 1 ] ,
2016-10-15 02:30:47 +03:00
syserror ( tcp ) ? IOV_DECODE_ADDR :
2016-06-22 16:27:03 +03:00
IOV_DECODE_STR , tcp - > u_rval ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu , tcp - > u_arg [ 2 ] ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( writev )
1999-02-19 03:21:36 +03:00
{
2015-07-20 14:19:30 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
2016-06-22 16:27:03 +03:00
tprint_iov ( tcp , tcp - > u_arg [ 2 ] , tcp - > u_arg [ 1 ] , IOV_DECODE_STR ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu , tcp - > u_arg [ 2 ] ) ;
2015-07-20 14:19:30 +03:00
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( pread )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
Fix decoding of file descriptors
* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
2011-03-04 05:08:02 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
if ( syserror ( tcp ) )
2015-07-20 14:06:54 +03:00
printaddr ( tcp - > u_arg [ 1 ] ) ;
1999-02-19 03:21:36 +03:00
else
2016-12-20 19:43:26 +03:00
printstrn ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_rval ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu " , " , tcp - > u_arg [ 2 ] ) ;
2016-08-20 17:02:55 +03:00
printllval ( tcp , " %lld " , 3 ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( pwrite )
1999-02-19 03:21:36 +03:00
{
2015-07-20 14:19:30 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
2016-12-20 19:43:26 +03:00
printstrn ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu " , " , tcp - > u_arg [ 2 ] ) ;
2016-08-20 17:02:55 +03:00
printllval ( tcp , " %lld " , 3 ) ;
2015-07-20 14:19:30 +03:00
return RVAL_DECODED ;
1999-05-09 04:29:58 +04:00
}
Fix preadv/pwritev offset decoding on bigendian architectures
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.
2014-08-07 04:07:28 +04:00
static void
2016-03-30 06:54:21 +03:00
print_lld_from_low_high_val ( struct tcb * tcp , int arg )
Fix preadv/pwritev offset decoding on bigendian architectures
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.
2014-08-07 04:07:28 +04:00
{
2016-12-26 20:06:12 +03:00
# if SIZEOF_KERNEL_LONG_T > 4
2016-12-19 21:30:22 +03:00
# ifndef current_klongsize
2016-12-26 20:06:12 +03:00
if ( current_klongsize < SIZEOF_KERNEL_LONG_T ) {
tprintf ( " % " PRI_kld , ( tcp - > u_arg [ arg + 1 ] < < 32 )
2016-12-19 15:05:31 +03:00
| tcp - > u_arg [ arg ] ) ;
2016-12-19 21:30:22 +03:00
} else
# endif /* !current_klongsize */
{
2016-12-26 13:16:35 +03:00
tprintf ( " % " PRI_kld , tcp - > u_arg [ arg ] ) ;
2016-12-19 21:30:22 +03:00
}
2016-12-26 20:06:12 +03:00
# else /* SIZEOF_KERNEL_LONG_T == 4 */
2016-03-30 06:54:21 +03:00
tprintf ( " %lld " ,
2016-12-26 20:06:12 +03:00
( ( long long ) tcp - > u_arg [ arg + 1 ] < < 32 )
| ( ( long long ) tcp - > u_arg [ arg ] ) ) ;
Fix preadv/pwritev offset decoding on bigendian architectures
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.
2014-08-07 04:07:28 +04:00
# endif
}
2016-05-11 03:42:10 +03:00
# include "xlat/rwf_flags.h"
static int
do_preadv ( struct tcb * tcp , const int flags_arg )
2011-05-12 16:57:40 +04:00
{
if ( entering ( tcp ) ) {
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2011-05-12 16:57:40 +04:00
} else {
2016-12-26 20:47:55 +03:00
kernel_ulong_t len =
truncate_kulong_to_current_wordsize ( tcp - > u_arg [ 2 ] ) ;
2016-12-20 01:13:21 +03:00
tprint_iov_upto ( tcp , len , tcp - > u_arg [ 1 ] ,
2016-10-15 02:30:47 +03:00
syserror ( tcp ) ? IOV_DECODE_ADDR :
IOV_DECODE_STR , tcp - > u_rval ) ;
2016-12-26 20:47:55 +03:00
tprintf ( " , % " PRI_klu " , " , len ) ;
2016-03-30 06:54:21 +03:00
print_lld_from_low_high_val ( tcp , 3 ) ;
2016-05-11 03:42:10 +03:00
if ( flags_arg > = 0 ) {
tprints ( " , " ) ;
printflags ( rwf_flags , tcp - > u_arg [ flags_arg ] , " RWF_??? " ) ;
}
2011-05-12 16:57:40 +04:00
}
return 0 ;
}
2016-05-11 03:42:10 +03:00
SYS_FUNC ( preadv )
{
return do_preadv ( tcp , - 1 ) ;
}
static int
do_pwritev ( struct tcb * tcp , const int flags_arg )
2011-05-12 16:57:40 +04:00
{
2016-12-26 20:47:55 +03:00
kernel_ulong_t len =
truncate_kulong_to_current_wordsize ( tcp - > u_arg [ 2 ] ) ;
2016-12-20 01:13:21 +03:00
2015-07-20 14:19:30 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
2016-12-20 01:13:21 +03:00
tprint_iov ( tcp , len , tcp - > u_arg [ 1 ] , IOV_DECODE_STR ) ;
2016-12-26 20:47:55 +03:00
tprintf ( " , % " PRI_klu " , " , len ) ;
2016-03-30 06:54:21 +03:00
print_lld_from_low_high_val ( tcp , 3 ) ;
2016-05-11 03:42:10 +03:00
if ( flags_arg > = 0 ) {
tprints ( " , " ) ;
printflags ( rwf_flags , tcp - > u_arg [ flags_arg ] , " RWF_??? " ) ;
}
2015-07-20 14:19:30 +03:00
return RVAL_DECODED ;
2011-05-12 16:57:40 +04:00
}
2016-05-11 03:42:10 +03:00
SYS_FUNC ( pwritev )
{
return do_pwritev ( tcp , - 1 ) ;
}
2017-02-25 18:55:31 +03:00
/*
* x32 is the only architecture where preadv2 takes 5 arguments
* instead of 6 , see preadv64v2 in kernel sources .
* Likewise , x32 is the only architecture where pwritev2 takes 5 arguments
* instead of 6 , see pwritev64v2 in kernel sources .
*/
# if defined X86_64
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 2 ? 4 : 5)
# elif defined X32
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 0 ? 4 : 5)
# else
# define PREADV2_PWRITEV2_FLAGS_ARG_NO 5
# endif
SYS_FUNC ( preadv2 )
{
return do_preadv ( tcp , PREADV2_PWRITEV2_FLAGS_ARG_NO ) ;
}
2016-05-11 03:42:10 +03:00
SYS_FUNC ( pwritev2 )
{
2017-02-25 18:55:31 +03:00
return do_pwritev ( tcp , PREADV2_PWRITEV2_FLAGS_ARG_NO ) ;
2016-05-11 03:42:10 +03:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/splice_flags.h"
2011-10-11 21:07:05 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( tee )
2011-10-11 21:07:05 +04:00
{
2015-07-20 14:19:30 +03:00
/* int fd_in */
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
/* int fd_out */
printfd ( tcp , tcp - > u_arg [ 1 ] ) ;
tprints ( " , " ) ;
/* size_t len */
2016-12-26 13:16:35 +03:00
tprintf ( " % " PRI_klu " , " , tcp - > u_arg [ 2 ] ) ;
2015-07-20 14:19:30 +03:00
/* unsigned int flags */
printflags ( splice_flags , tcp - > u_arg [ 3 ] , " SPLICE_F_??? " ) ;
return RVAL_DECODED ;
2011-10-11 21:07:05 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( splice )
2011-10-11 21:07:05 +04:00
{
2015-07-20 14:19:30 +03:00
/* int fd_in */
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
/* loff_t *off_in */
2016-02-14 01:31:30 +03:00
printnum_int64 ( tcp , tcp - > u_arg [ 1 ] , " % " PRId64 ) ;
2015-07-20 14:19:30 +03:00
tprints ( " , " ) ;
/* int fd_out */
printfd ( tcp , tcp - > u_arg [ 2 ] ) ;
tprints ( " , " ) ;
/* loff_t *off_out */
2016-02-14 01:31:30 +03:00
printnum_int64 ( tcp , tcp - > u_arg [ 3 ] , " % " PRId64 ) ;
2015-07-20 14:19:30 +03:00
tprints ( " , " ) ;
/* size_t len */
2016-12-26 13:16:35 +03:00
tprintf ( " % " PRI_klu " , " , tcp - > u_arg [ 4 ] ) ;
2015-07-20 14:19:30 +03:00
/* unsigned int flags */
printflags ( splice_flags , tcp - > u_arg [ 5 ] , " SPLICE_F_??? " ) ;
return RVAL_DECODED ;
2011-10-11 21:07:05 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( vmsplice )
2011-10-11 21:07:05 +04:00
{
2015-07-20 14:19:30 +03:00
/* int fd */
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
/* const struct iovec *iov, unsigned long nr_segs */
2016-06-22 16:27:03 +03:00
tprint_iov ( tcp , tcp - > u_arg [ 2 ] , tcp - > u_arg [ 1 ] , IOV_DECODE_STR ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu " , " , tcp - > u_arg [ 2 ] ) ;
2015-07-20 14:19:30 +03:00
/* unsigned int flags */
printflags ( splice_flags , tcp - > u_arg [ 3 ] , " SPLICE_F_??? " ) ;
return RVAL_DECODED ;
2011-10-11 21:07:05 +04:00
}