]> granicus.if.org Git - strace/log
strace
8 years agotests/ioctl_block.c: tweak magic constants to make the test more reliable
Dmitry V. Levin [Thu, 26 May 2016 15:16:31 +0000 (15:16 +0000)]
tests/ioctl_block.c: tweak magic constants to make the test more reliable

* tests/ioctl_block.c (main): Change bad pointer to make
its lower 32-bit part closer to -1U.

8 years agotests/btrfs.c: check basic decoding of read-only ioctls
Dmitry V. Levin [Thu, 26 May 2016 14:26:15 +0000 (14:26 +0000)]
tests/btrfs.c: check basic decoding of read-only ioctls

* tests/btrfs.c (btrfs_test_read_ioctls): New function.
(main): Use it.

8 years agotests: check decoding of BLK* ioctls
Dmitry V. Levin [Thu, 26 May 2016 12:55:41 +0000 (12:55 +0000)]
tests: check decoding of BLK* ioctls

* configure.ac (AC_CHECK_TYPES): Add struct blk_user_trace_setup.
* tests/ioctl_block.c: New file.
* tests/ioctl_block.test: New test.
* tests/.gitignore: Add ioctl_block.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_block.test.

8 years agoMpersify BLK* ioctl parser
Dmitry V. Levin [Thu, 26 May 2016 10:43:51 +0000 (10:43 +0000)]
Mpersify BLK* ioctl parser

* defs.h (block_ioctl): Remove.
* block.c: Mpersify struct blk_user_trace_setup,
struct blkpg_ioctl_arg, struct blkpg_partition, and ioctl numbers.
(block_ioctl): Mpersify.
* NEWS: Mention this enhancement.

8 years agoblock.c: optimize decoding of paired ioctls
Dmitry V. Levin [Thu, 26 May 2016 12:36:56 +0000 (12:36 +0000)]
block.c: optimize decoding of paired ioctls

* block.c (block_ioctl): Optimize decoding of commands that return
a signed int.

8 years agoblock.c: fix printing of uint64_t pairs
Dmitry V. Levin [Thu, 26 May 2016 12:33:21 +0000 (12:33 +0000)]
block.c: fix printing of uint64_t pairs

* block.c (block_ioctl): Print uint64_t values using PRIu64 format.

8 years agoblock.c: fix printing of struct blk_user_trace_setup
Dmitry V. Levin [Thu, 26 May 2016 10:04:39 +0000 (10:04 +0000)]
block.c: fix printing of struct blk_user_trace_setup

* block.c (block_ioctl): Fix printing of comma before
struct blk_user_trace_setup.name on exiting syscall.

8 years agoMove parser of 'X' type ioctls to a separate file
Dmitry V. Levin [Thu, 26 May 2016 00:37:26 +0000 (00:37 +0000)]
Move parser of 'X' type ioctls to a separate file

* fs_x_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* block.c: (block_ioctl): Move parser of FITRIM, FIFREEZE, and FITHAW
to fs_x_ioctl.c.
* defs.h (fs_x_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call fs_x_ioctl for ioctl type 'X'.

8 years agoMove parser of HDIO_* ioctls to a separate file
Dmitry V. Levin [Thu, 26 May 2016 00:07:17 +0000 (00:07 +0000)]
Move parser of HDIO_* ioctls to a separate file

* hdio.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* block.c: Do not include <linux/hdreg.h>.
(block_ioctl): Move parser of HDIO_GETGEO to hdio.c.
* defs.h (hdio_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call hdio_ioctl for ioctl type 0x03.

8 years agoFix explicit casts of signed integer types to unsigned long long
Dmitry V. Levin [Thu, 26 May 2016 10:12:17 +0000 (10:12 +0000)]
Fix explicit casts of signed integer types to unsigned long long

* 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.

8 years agoscsi.c: print __u64 types using PRI__u64 format
Dmitry V. Levin [Thu, 26 May 2016 10:07:36 +0000 (10:07 +0000)]
scsi.c: print __u64 types using PRI__u64 format

* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Remove explicit casts
to unsigned long long, print fields of type __u64 using PRI__u64 format.

8 years agotests: check decoding of RTC_* ioctls
Dmitry V. Levin [Wed, 25 May 2016 15:44:32 +0000 (15:44 +0000)]
tests: check decoding of RTC_* ioctls

* configure.ac (AC_CHECK_FUNCS): Add ioctl_rtc.
* tests/ioctl_rtc.c: New file.
* tests/ioctl_rtc-v.c: Likewise.
* tests/ioctl_rtc.test: New test.
* tests/ioctl_rtc-v.test: Likewise.
* tests/.gitignore: Add ioctl_rtc and ioctl_rtc-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_rtc.test and ioctl_rtc-v.test.

8 years agoMpersify RTC_* ioctl parser
Dmitry V. Levin [Wed, 25 May 2016 15:59:27 +0000 (15:59 +0000)]
Mpersify RTC_* ioctl parser

* defs.h (rtc_ioctl): Remove.
* rtc.c: Mpersify struct rtc_pll_info and ioctl numbers.
(rtc_ioctl): Mpersify.
* NEWS: Mention this enhancement.

8 years agortc.c: fix decoding of struct rtc_wkalrm
Dmitry V. Levin [Wed, 25 May 2016 15:28:23 +0000 (15:28 +0000)]
rtc.c: fix decoding of struct rtc_wkalrm

* rtc.c (decode_rtc_wkalrm): Print field name of struct rtc_wkalrm.time.

8 years agofile_ioctl.c: print file descriptors using printfd
Dmitry V. Levin [Wed, 25 May 2016 07:59:13 +0000 (07:59 +0000)]
file_ioctl.c: print file descriptors using printfd

* file_ioctl.c (print_file_dedupe_range_info): Print
struct file_dedupe_range_info.dest_fd using printfd.
(file_ioctl): Print struct file_clone_range.src_fd using printfd.

8 years agortc.c: do not print argument of ioctls that have no arguments
Dmitry V. Levin [Wed, 25 May 2016 07:44:19 +0000 (07:44 +0000)]
rtc.c: do not print argument of ioctls that have no arguments

* rtc.c (rtc_ioctl): Do not print argument of RTC_{A,U,P,W}IE_{ON,OFF}
and RTC_VL_CLR ioctls.

8 years agortc.c: decode RTC_PLL_GET and RTC_PLL_SET
Dmitry V. Levin [Wed, 25 May 2016 07:43:15 +0000 (07:43 +0000)]
rtc.c: decode RTC_PLL_GET and RTC_PLL_SET

* rtc.c (rtc_ioctl): Decode RTC_PLL_GET and RTC_PLL_SET

8 years agortc.c: optimize decoding of paired ioctls
Dmitry V. Levin [Wed, 25 May 2016 07:37:44 +0000 (07:37 +0000)]
rtc.c: optimize decoding of paired ioctls

* rtc.c (rtc_ioctl): Optimize decoding of RTC_ALM_READ/RTC_ALM_SET,
RTC_RD_TIME/RTC_SET_TIME, and RTC_WKALM_RD/RTC_WKALM_SET ioctl pairs.

8 years agoblock.c: handle BLKDAXGET
Dmitry V. Levin [Wed, 25 May 2016 07:33:02 +0000 (07:33 +0000)]
block.c: handle BLKDAXGET

* block.c [!BLKDAXGET] (BLKDAXGET): Define.
(block_ioctl): Handle it.

8 years agotests: check decoding of mount syscall
Dmitry V. Levin [Wed, 25 May 2016 00:11:37 +0000 (00:11 +0000)]
tests: check decoding of mount syscall

* tests/mount.c: New file.
* tests/mount.test: New test.
* tests/.gitignore: Add mount.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mount.

8 years agotests/vhangup.c: diassociate from the controlling terminal first
Dmitry V. Levin [Tue, 24 May 2016 20:12:25 +0000 (20:12 +0000)]
tests/vhangup.c: diassociate from the controlling terminal first

* tests/vhangup.c (main): Call setsid before vhangup.

8 years agotests: add vhangup.test
Fei Jie [Thu, 19 May 2016 07:58:37 +0000 (15:58 +0800)]
tests: add vhangup.test

* tests/vhangup.c: New file.
* tests/vhangup.test: New test.
* tests/.gitignore: Add vhangup.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add vhangup.test.

8 years agoNEWS: Prepare for 4.12 release
Dmitry V. Levin [Tue, 24 May 2016 18:11:47 +0000 (18:11 +0000)]
NEWS: Prepare for 4.12 release

8 years agotests/btrfs.c: fix build on x32
Gleb Fotengauer-Malinovskiy [Tue, 24 May 2016 15:09:46 +0000 (18:09 +0300)]
tests/btrfs.c: fix build on x32

* tests/btrfs.c (btrfs_test_ino_path_ioctls): Fix printing of st_ino.

8 years agotests/btrfs.c: fix build with u64 based BTRFS_IOC_DEFAULT_SUBVOL
Dmitry V. Levin [Tue, 24 May 2016 02:56:39 +0000 (02:56 +0000)]
tests/btrfs.c: fix build with u64 based BTRFS_IOC_DEFAULT_SUBVOL

* tests/btrfs.c: Fix build on systems where BTRFS_IOC_DEFAULT_SUBVOL
is defined using unexported type "u64".

8 years agobtrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME
Dmitry V. Levin [Tue, 24 May 2016 02:40:13 +0000 (02:40 +0000)]
btrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME

* btrfs.c (btrfs_ioctl): Skip BTRFS_IOC_FILE_EXTENT_SAME case
if this constant is not defined.
* tests/btrfs.c (btrfs_test_extent_same_ioctl): Skip this part
of the test if BTRFS_IOC_FILE_EXTENT_SAME is not defined.

8 years agotests/btrfs.c: fix printing struct btrfs_ioctl_clone_range_args
Dmitry V. Levin [Tue, 24 May 2016 02:17:49 +0000 (02:17 +0000)]
tests/btrfs.c: fix printing struct btrfs_ioctl_clone_range_args

* tests/btrfs.c (btrfs_test_clone_ioctls): Print __u64 members
of struct btrfs_ioctl_clone_range_args using PRI__u64 format.

8 years agotests/btrfs.c: tweak magic constants to make the test more reliable
Dmitry V. Levin [Tue, 24 May 2016 02:07:47 +0000 (02:07 +0000)]
tests/btrfs.c: tweak magic constants to make the test more reliable

* tests/btrfs.c (btrfs_test_sync_ioctls): Change u64val
to 0xdeadbeefbadc0ded.
(btrfs_test_subvol_ioctls): Likewise.  Change bad_pointer
to make their lower 32-bit parts closer to -1U.

8 years agobtrfs.c: print file descriptors using printfd
Dmitry V. Levin [Tue, 24 May 2016 01:53:02 +0000 (01:53 +0000)]
btrfs.c: print file descriptors using printfd

* btrfs.c (btrfs_ioctl): Print struct btrfs_ioctl_send_args.send_fd,
struct btrfs_ioctl_vol_args.fd, and struct btrfs_ioctl_vol_args_v2.fd
using printfd.
* tests/btrfs.c (btrfs_print_vol_args_v2, btrfs_test_subvol_ioctls,
btrfs_test_device_ioctls, btrfs_test_clone_ioctls,
btrfs_test_send_ioctl): Update.

8 years agotests/btrfs.c: do not print errno in case of fs type mismatch
Dmitry V. Levin [Tue, 24 May 2016 01:33:08 +0000 (01:33 +0000)]
tests/btrfs.c: do not print errno in case of fs type mismatch

* tests/btrfs.c (main): Use error_msg_and_fail instead of
perror_msg_and_fail when the fs type of the given directory
is not BTRFS_SUPER_MAGIC.

8 years agotests/btrfs.c: fix indentation
Dmitry V. Levin [Tue, 24 May 2016 01:32:55 +0000 (01:32 +0000)]
tests/btrfs.c: fix indentation

* tests/btrfs.c: Fix indentation of preprocessor directives
and function prototypes.

8 years agotests/btrfs.c: sort included headers
Dmitry V. Levin [Tue, 24 May 2016 01:32:41 +0000 (01:32 +0000)]
tests/btrfs.c: sort included headers

* tests/btrfs.c: Sort included headers.

8 years agotests/btrfs.c: do not use alloca
Dmitry V. Levin [Tue, 24 May 2016 01:32:27 +0000 (01:32 +0000)]
tests/btrfs.c: do not use alloca

* tests/btrfs.c: Don't include <alloca.h>.
(btrfs_test_subvol_ioctls): Allocate
struct btrfs_ioctl_vol_args_v2.qgroup_inherit using tail_alloc.

8 years agotests/btrfs.c: fix build on systems without <linux/btrfs.h> or <linux/fiemap.h>
Dmitry V. Levin [Tue, 24 May 2016 01:32:09 +0000 (01:32 +0000)]
tests/btrfs.c: fix build on systems without <linux/btrfs.h> or <linux/fiemap.h>

* tests/btrfs.c: Include "tests.h" first.
Skip the test if [!HAVE_LINUX_BTRFS_H].  Skip parts of the test
that use struct fiemap if [!HAVE_LINUX_FIEMAP_H].

8 years agotests: add testing for btrfs ioctls
Jeff Mahoney [Wed, 18 May 2016 22:09:42 +0000 (18:09 -0400)]
tests: add testing for btrfs ioctls

* tests/btrfs.c: New file.
* tests/btrfs.test: New test.
* tests/btrfs-v.test: Likewise.
* tests/.gitignore: Add btrfs.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add btrfs.test and btrfs-v.test.

8 years agotests/file_ioctl.c: use tail_alloc
Dmitry V. Levin [Tue, 24 May 2016 01:29:49 +0000 (01:29 +0000)]
tests/file_ioctl.c: use tail_alloc

* tests/file_ioctl.c (main): Allocate struct fiemap using tail_alloc.

8 years agotests/file_ioctl.c: fix build on systems without <linux/fiemap.h>
Dmitry V. Levin [Tue, 24 May 2016 01:29:38 +0000 (01:29 +0000)]
tests/file_ioctl.c: fix build on systems without <linux/fiemap.h>

* tests/file_ioctl.c: Include "tests.h" first.
Skip the test if [!HAVE_LINUX_FIEMAP_H].

8 years agotests: add testing for FS_IOC_FIEMAP
Jeff Mahoney [Wed, 18 May 2016 22:09:41 +0000 (18:09 -0400)]
tests: add testing for FS_IOC_FIEMAP

This is limited to FIEMAP.  FICLONE* and FIDEDUPERANGE originated in
btrfs and will be tested there.

* tests/file_ioctl.c: New file.
* tests/file_ioctl.test: New test.
* tests/.gitignore: Add file_ioctl.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add file_ioctl.test.

8 years agoMpersify btrfs.c
Dmitry V. Levin [Tue, 24 May 2016 01:28:26 +0000 (01:28 +0000)]
Mpersify btrfs.c

* btrfs.c: Mpersify 3 arch-specific structures
and corresponding ioctl numbers.
(btrfs_ioctl): Mpersify.
* defs.h (btrfs_ioctl): Remove.

8 years agobtrfs.c: use print_array
Dmitry V. Levin [Tue, 24 May 2016 01:15:18 +0000 (01:15 +0000)]
btrfs.c: use print_array

* btrfs.c (print_btrfs_data_container_logical_ino,
print_btrfs_data_container_ino_path, print_uint64,
print_btrfs_ioctl_search_header, print_objectid_callback,
print_btrfs_ioctl_space_info): New functions.
(btrfs_print_logical_ino_container, btrfs_print_ino_path_container):
Rewrite printers of struct btrfs_data_container.val array
using print_array.
(btrfs_print_qgroup_inherit): Rewrite printer of
struct btrfs_qgroup_inherit.qgroups array using print_array.
(btrfs_print_tree_search): Rewrite printer of
struct btrfs_ioctl_search_header array using print_array.
(btrfs_ioctl): Rewrite printer of
struct btrfs_ioctl_send_args.clone_sources and
struct btrfs_ioctl_space_args.spaces using print_array.

8 years agobtrfs.c: simplify BTRFS_IOC_GET_FSLABEL parser
Dmitry V. Levin [Tue, 24 May 2016 01:12:41 +0000 (01:12 +0000)]
btrfs.c: simplify BTRFS_IOC_GET_FSLABEL parser

* btrfs.c (btrfs_ioctl): Share code of parser of BTRFS_IOC_SET_FSLABEL
with parser of BTRFS_IOC_GET_FSLABEL only on BTRFS_IOC_GET_FSLABEL's
entering.

8 years agobtrfs.c: fix BTRFS_IOC_TREE_SEARCH_V2 output
Dmitry V. Levin [Tue, 24 May 2016 01:10:53 +0000 (01:10 +0000)]
btrfs.c: fix BTRFS_IOC_TREE_SEARCH_V2 output

* btrfs.c (btrfs_ioctl): Fix BTRFS_IOC_TREE_SEARCH_V2 output
in case of EOVERFLOW and failed umove.

8 years agobtrfs.c: cleanup use of tcp->auxstr
Dmitry V. Levin [Tue, 24 May 2016 01:09:04 +0000 (01:09 +0000)]
btrfs.c: cleanup use of tcp->auxstr

* btrfs.c (btrfs_ioctl): Reset tcp->auxstr only if it is set.

8 years agobtrfs.c: cleanup struct btrfs_ioctl_get_dev_stats.nr_items check
Dmitry V. Levin [Tue, 24 May 2016 01:04:56 +0000 (01:04 +0000)]
btrfs.c: cleanup struct btrfs_ioctl_get_dev_stats.nr_items check

* btrfs.c (btrfs_ioctl): Cleanup check of iterator of
btrfs_ioctl_get_dev_stats.values array.

8 years agobtrfs.c: do not use BTRFS_SUBVOL_NAME_MAX
Dmitry V. Levin [Tue, 24 May 2016 00:59:40 +0000 (00:59 +0000)]
btrfs.c: do not use BTRFS_SUBVOL_NAME_MAX

* btrfs.c [BTRFS_SUBVOL_NAME_MAX]: Remove.
(btrfs_ioctl): Use sizeof(struct btrfs_ioctl_vol_args_v2.name)
instead of BTRFS_SUBVOL_NAME_MAX + 1.

8 years agobtrfs.c: mark some function arguments as const
Dmitry V. Levin [Tue, 24 May 2016 00:56:08 +0000 (00:56 +0000)]
btrfs.c: mark some function arguments as const

* btrfs.c (btrfs_print_balance_args, btrfs_print_features,
btrfs_print_qgroup_limit, btrfs_print_data_container_header,
btrfs_print_logical_ino_container, btrfs_print_ino_path_container,
btrfs_print_qgroup_inherit): Mark some function arguments as const.

8 years agobtrfs.c: use umove instead of umoven
Dmitry V. Levin [Tue, 24 May 2016 00:49:50 +0000 (00:49 +0000)]
btrfs.c: use umove instead of umoven

* btrfs.c: Use umove instead of umoven and umove_or_printaddr
instead of umoven_or_printaddr.

8 years agobtrfs.c: remove unused variable
Dmitry V. Levin [Tue, 24 May 2016 00:45:05 +0000 (00:45 +0000)]
btrfs.c: remove unused variable

* btrfs.c (btrfs_ioctl): Remove "ret" variable.

8 years agobtrfs.c: use printxval/printxval64 instead of printxvals
Dmitry V. Levin [Tue, 24 May 2016 00:35:49 +0000 (00:35 +0000)]
btrfs.c: use printxval/printxval64 instead of printxvals

* btrfs.c (btrfs_ioctl): Do not call printxvals directly,
use printxval/printxval64 wrappers that do the right thing.

8 years agobtrfs.c: fix indentation
Dmitry V. Levin [Tue, 24 May 2016 00:23:31 +0000 (00:23 +0000)]
btrfs.c: fix indentation

* btrfs.c: Fix indentation of preprocessor directives and print formats.

8 years agoxlat/btrfs_dev_stats_values.in: cleanup
Dmitry V. Levin [Tue, 24 May 2016 00:20:23 +0000 (00:20 +0000)]
xlat/btrfs_dev_stats_values.in: cleanup

* xlat/btrfs_dev_stats_values.in: Remove HAVE_DECL_* defines,
use #unconditional instead.

8 years agofile_ioctl.c: use print_array
Dmitry V. Levin [Tue, 24 May 2016 00:20:07 +0000 (00:20 +0000)]
file_ioctl.c: use print_array

* file_ioctl.c (file_ioctl): Rewrite printers of
struct file_dedupe_range_info and struct fiemap_extent arrays
using print_array.

8 years agofile_ioctl.c: fix indentation
Dmitry V. Levin [Tue, 24 May 2016 00:19:53 +0000 (00:19 +0000)]
file_ioctl.c: fix indentation

* file_ioctl.c: Fix indentation of preprocessor directives
and print formats.

8 years agofile_ioctl.c: include <linux/ioctl.h> instead of <sys/ioctl.h>
Dmitry V. Levin [Tue, 24 May 2016 00:19:40 +0000 (00:19 +0000)]
file_ioctl.c: include <linux/ioctl.h> instead of <sys/ioctl.h>

Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
no benefits for this parser.

* file_ioctl.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.

8 years agofile_ioctl.c: fix build on systems without <linux/fiemap.h>
Dmitry V. Levin [Tue, 24 May 2016 00:19:17 +0000 (00:19 +0000)]
file_ioctl.c: fix build on systems without <linux/fiemap.h>

* configure.ac (AC_CHECK_HEADERS): Add linux/fiemap.h.
* file_ioctl.c: Do not include <linux/fiemap.h> and xlat/fiemap_*.h
if [!HAVE_LINUX_FIEMAP_H].
(file_ioctl): Do not parse FS_IOC_FIEMAP if [!HAVE_LINUX_FIEMAP_H].

8 years agoioctl.c: fix build
Dmitry V. Levin [Tue, 24 May 2016 00:19:03 +0000 (00:19 +0000)]
ioctl.c: fix build

* ioctl.c (ioctl_decode): Move definition of "ret" variable
to [ALPHA || POWERPC] case.
[ALPHA || POWERPC]: Fix syntax error.

8 years agoioctl: add decoding for FS_IOC_FIEMAP
Jeff Mahoney [Wed, 18 May 2016 22:09:40 +0000 (18:09 -0400)]
ioctl: add decoding for FS_IOC_FIEMAP

* file_ioctl.c: Include <linux/fiemap.h>, "xlat/fiemap_flags.h",
and "xlat/fiemap_extent_flags.h".
(file_ioctl): Handle FS_IOC_FIEMAP.
* ioctl.c (ioctl_decode): Use file_ioctl for decoding 'f' code ioctls.

8 years agoAdd xlat/fiemap_flags.in and xlat/fiemap_extent_flags.in
Dmitry V. Levin [Tue, 24 May 2016 00:18:39 +0000 (00:18 +0000)]
Add xlat/fiemap_flags.in and xlat/fiemap_extent_flags.in

* xlat/fiemap_flags.in: New file.
* xlat/fiemap_extent_flags.in: Likewise.

8 years agoioctl: add decoding support for btrfs ioctls
Jeff Mahoney [Wed, 18 May 2016 22:09:39 +0000 (18:09 -0400)]
ioctl: add decoding support for btrfs ioctls

* btrfs.c: New file.
* file_ioctl.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h.
(AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags,
struct btrfs_ioctl_fs_info_args.nodesize,
struct btrfs_ioctl_defrag_range_args.start,
and struct btrfs_ioctl_search_args_v2.buf_size.
(AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums.
* defs.h (btrfs_ioctl, file_ioctl): New prototypes.
* ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl.
* xlat/btrfs_balance_args.in: New file.
* xlat/btrfs_balance_ctl_cmds.in: Likewise.
* xlat/btrfs_balance_flags.in: Likewise.
* xlat/btrfs_balance_state.in: Likewise.
* xlat/btrfs_compress_types.in: Likewise.
* xlat/btrfs_defrag_flags.in: Likewise.
* xlat/btrfs_dev_replace_cmds.in: Likewise.
* xlat/btrfs_dev_replace_results.in: Likewise.
* xlat/btrfs_dev_replace_state.in: Likewise.
* xlat/btrfs_dev_stats_flags.in: Likewise.
* xlat/btrfs_dev_stats_values.in: Likewise.
* xlat/btrfs_features_compat.in: Likewise.
* xlat/btrfs_features_compat_ro.in: Likewise.
* xlat/btrfs_features_incompat.in: Likewise.
* xlat/btrfs_key_types.in: Likewise.
* xlat/btrfs_qgroup_ctl_cmds.in: Likewise.
* xlat/btrfs_qgroup_inherit_flags.in: Likewise.
* xlat/btrfs_qgroup_limit_flags.in: Likewise.
* xlat/btrfs_qgroup_status_flags.in: Likewise.
* xlat/btrfs_scrub_flags.in: Likewise.
* xlat/btrfs_send_flags.in: Likewise.
* xlat/btrfs_snap_flags_v2.in: Likewise.
* xlat/btrfs_space_info_flags.in: Likewise.
* xlat/btrfs_tree_objectids.in: Likewise.

8 years agox32: update ioctl entries from linux 4.6
Gleb Fotengauer-Malinovskiy [Tue, 24 May 2016 14:49:46 +0000 (17:49 +0300)]
x32: update ioctl entries from linux 4.6

* linux/x32/ioctls_inc0.h: Update from linux v4.6 using ioctls_gen.sh.

8 years agotests/attach-f-p.c: sleep a bit more to let the tracer catch up
Dmitry V. Levin [Tue, 24 May 2016 11:10:22 +0000 (11:10 +0000)]
tests/attach-f-p.c: sleep a bit more to let the tracer catch up

On noticeably lagging systems, the parent process may invoke its chdir
call before the tracer gets notified about completion of its last child
process.  Add extra sleep in the parent process to win the race.

* tests/attach-f-p.c (main): Change timerid into a static array.
Arm a timer in the parent process and wait for it.

8 years agotests/attach-p-cmd-cmd.c: fix potential errno clobbering
Dmitry V. Levin [Mon, 23 May 2016 16:39:23 +0000 (16:39 +0000)]
tests/attach-p-cmd-cmd.c: fix potential errno clobbering

* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.

8 years agotests/net-yy-netlink.c: robustify against libc specific issues
Dmitry V. Levin [Mon, 23 May 2016 10:26:46 +0000 (10:26 +0000)]
tests/net-yy-netlink.c: robustify against libc specific issues

* tests/net-yy-netlink.c (main): Use getsockname instead of recvmsg
as the latter has notible implementation differences that make
the test unreliable.

8 years agotests/net-yy-netlink.c: robustify against os specific issues
Dmitry V. Levin [Mon, 23 May 2016 10:26:46 +0000 (10:26 +0000)]
tests/net-yy-netlink.c: robustify against os specific issues

* tests/net-yy-netlink.c (main): Pass a pointer to a real struct msghdr
as NULL doesn't work well on some systems.

8 years agotests/net-yy-{inet,netlink}.test: cleanup
Dmitry V. Levin [Mon, 23 May 2016 10:12:48 +0000 (10:12 +0000)]
tests/net-yy-{inet,netlink}.test: cleanup

* tests/net-yy-inet.test: Do not pass arguments to net-yy-inet
as the latter does not accept them.
* tests/net-yy-netlink.test: Do not pass arguments to net-yy-netlink
as the latter does not accept them.

8 years agotests: define PRI__[dux]64 macros to print __s64 and __u64 values
Jeff Mahoney [Wed, 18 May 2016 22:09:41 +0000 (18:09 -0400)]
tests: define PRI__[dux]64 macros to print __s64 and __u64 values

Rather than cast every __u64 or __s64 before printing,
define printing helpers for those types directly.

This complements commit 1f3482bedad505a41caf1d61b3a4e7e09a2f4330.

* tests/tests.h (PRI__d64, PRI__u64, PRI__x64): New macros.

8 years agotests: remove manual creation of memory mapping holes
Dmitry V. Levin [Sun, 22 May 2016 22:29:33 +0000 (22:29 +0000)]
tests: remove manual creation of memory mapping holes

We used to call tail_alloc(1) to create memory mapping holes around
regular tail_alloc allocations.  This is no longer needed since regular
tail_alloc allocations create additional memory mapping holes.

* tests/clock_adjtime.c (main): Remove creation of memory mapping holes
using tail_alloc(1).
* tests/futimesat.c (main): Likewise.
* tests/get_mempolicy.c (print_nodes, main): Likewise.
* tests/getgroups.c (main): Likewise.
* tests/getresugid.c (main): Likewise.
* tests/ioctl_uffdio.c (main): Likewise.
* tests/ioctl_v4l2.c (main): Likewise.
* tests/move_pages.c (main): Likewise.
* tests/net-icmp_filter.c (main): Likewise.
* tests/ptrace.c (test_peeksiginfo, main): Likewise.
* tests/pwritev.c (main): Likewise.
* tests/set_mempolicy.c (print_nodes): Likewise.
* tests/setgroups.c (main): Likewise.
* tests/umovestr3.c (main): Likewise.
* tests/utimes.c (main): Likewise.
* tests/xattr.c (main): Likewise.

8 years agotests: make tail_alloc create additional memory mapping holes
Dmitry V. Levin [Sun, 22 May 2016 22:21:48 +0000 (22:21 +0000)]
tests: make tail_alloc create additional memory mapping holes

* tests/tail_alloc.c (tail_alloc): Create additional memory mapping
holes before and after the allocated memory.

8 years agompers: add support of conditionally compiled printers
Dmitry V. Levin [Sat, 21 May 2016 22:53:06 +0000 (22:53 +0000)]
mpers: add support of conditionally compiled printers

We used to declare and define all printers marked with
MPERS_PRINTER_DECL, including ifdef'ed ones.  That approach left us
no way to conditionally compile mpersified printers, which was not
a problem until btrfs ioctls appeared on the horizon.

With this change, those mpersified printers that are not going
to be compiled are also won't be declared and won't be added to
struct_printers.

This is implemented by filtering all source files containing
MPERS_PRINTER_DECL markers through CPP.  As a nice side effect, this
also lifts an ugly requirement of writing all MPERS_PRINTER_DECL
declarations in a single line.

* README-mpers: Update description of MPERS_PRINTER_DECL syntax.
* defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into
a recursive variadic macro.
[!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro.
All callers changed.
* Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern):
New variables.
(CLEANFILES): Add $(mpers_preproc_files).
(%.c.mpers.i): New rule.
(printers.h, %_printer_decls.h, %_printer_defs.h): Use
mpers_preproc_files instead of srcdir_mpers_source_files,
use mpers_printer_decl_pattern.
* .gitignore: Add /*.mpers.i.

8 years agoRemove redundant declaration of v4l2_ioctl
Dmitry V. Levin [Fri, 20 May 2016 22:47:39 +0000 (22:47 +0000)]
Remove redundant declaration of v4l2_ioctl

There is no need to declare mpers printers in defs.h because
they are already declared in printers.h or native_printer_decls.h.

This complements commit 1e56814f77594a22a74ddee629639eb0bb7edf3a.

* defs.h (v4l2_ioctl): Remove.

8 years agoFix one more code pattern that might break gcc strict aliasing rules
Dmitry V. Levin [Thu, 19 May 2016 01:23:40 +0000 (01:23 +0000)]
Fix one more code pattern that might break gcc strict aliasing rules

* socketutils.c (receive_responses): Turn static buffer into a union
to avoid breaking of gcc strict aliasing rules.
* tests/netlink_inet_diag.c (check_responses): Likewise.
* tests/netlink_netlink_diag.c (check_responses): Likewise.
* tests/netlink_unix_diag.c (check_responses): Likewise.

8 years agotests: add check for netlink protocol decoding with -yy option
Fabien Siron [Sat, 21 May 2016 07:49:00 +0000 (07:49 +0000)]
tests: add check for netlink protocol decoding with -yy option

* tests/netlink_netlink_diag.c: New file.
* tests/net-yy-netlink.c: New file.
* tests/net-yy-netlink.test: New test.
* tests/.gitignore: Add net-yy-netlink and netlink_netlink_diag
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add net-yy-netlink.test.

8 years agoAdd netlink domain sockets support to socketutils
Fabien Siron [Tue, 17 May 2016 10:08:47 +0000 (10:08 +0000)]
Add netlink domain sockets support to socketutils

* linux/netlink_diag.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* socketutils.c: Include it and "xlat/netlink_protocols.h".
(netlink_send_query, netlink_parse_response, netlink_print): New
functions.
(print_sockaddr_by_inode): Hook up netlink_print.

8 years agotests/pread64-pwrite64.c: robustify against os specific issues
Dmitry V. Levin [Wed, 18 May 2016 09:21:54 +0000 (09:21 +0000)]
tests/pread64-pwrite64.c: robustify against os specific issues

Do not assume that pwrite64 syscall fails when only part of the
specified memory buffer is accessible.  With some kernels, one
accessible byte at the end of page is enough for pwrite64 syscall
to return 1.

* tests/pread64-pwrite64.c (main): Tweak the test that can lead
to a partial write.

8 years agotests/read-write.c: robustify against os specific issues
Dmitry V. Levin [Wed, 18 May 2016 09:14:12 +0000 (09:14 +0000)]
tests/read-write.c: robustify against os specific issues

Do not assume that write syscall fails when only part of the specified
memory buffer is accessible.  With some kernels, one accessible byte
at the end of page is enough for write syscall to return 1.

* tests/read-write.c (main): Tweak the test that can lead to a partial
write.

8 years agoumovestr3.test: extend test coverage
Dmitry V. Levin [Tue, 17 May 2016 17:53:40 +0000 (17:53 +0000)]
umovestr3.test: extend test coverage

* tests/umovestr3.c: Include <sys/param.h>.
(main): Test with each number between PATH_MAX-1 and 0.

8 years agotests/timer_create.c: robustify against os specific issues
Dmitry V. Levin [Tue, 17 May 2016 17:18:48 +0000 (17:18 +0000)]
tests/timer_create.c: robustify against os specific issues

* tests/timer_create.c (main): Do not assume any specific error code
returned by timer_create, print whatever it is.

8 years agoFix some compilation warnings on older systems
Dmitry V. Levin [Tue, 17 May 2016 17:17:13 +0000 (20:17 +0300)]
Fix some compilation warnings on older systems

* print_statfs.c (print_statfs_flags): Define only
for [HAVE_STRUCT_STATFS_F_FLAGS || HAVE_STRUCT_STATFS64_F_FLAGS].
* tests/inet-cmsg.c (print_origdstaddr): Define only
for [IP_ORIGDSTADDR].

8 years agoUpdate generic ioctl entries from linux 4.6
Dmitry V. Levin [Tue, 17 May 2016 16:19:48 +0000 (16:19 +0000)]
Update generic ioctl entries from linux 4.6

* linux/64/ioctls_inc.h: Update from linux v4.6 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* NEWS: Mention this.

8 years agomaint: update for linux 4.6
Dmitry V. Levin [Tue, 17 May 2016 15:57:28 +0000 (15:57 +0000)]
maint: update for linux 4.6

* maint/ioctls_sym.sh: Update workarounds for linux/kvm.h.

8 years agoUpdate SOL_* constants
Dmitry V. Levin [Tue, 17 May 2016 10:58:21 +0000 (10:58 +0000)]
Update SOL_* constants

* xlat/socketlayers.in: Add SOL_KCM.

8 years agoUpdate MSG_* constants
Dmitry V. Levin [Tue, 17 May 2016 10:57:32 +0000 (10:57 +0000)]
Update MSG_* constants

* xlat/msg_flags.in: Add MSG_BATCH.

8 years agoUpdate AF_* constants
Dmitry V. Levin [Tue, 17 May 2016 10:55:57 +0000 (10:55 +0000)]
Update AF_* constants

* xlat/addrfams.in: Add AF_KCM.

8 years agotests: add brk.test
Fei Jie [Tue, 17 May 2016 09:59:45 +0000 (17:59 +0800)]
tests: add brk.test

* tests/brk.c: New file.
* tests/brk.test: New test.
* tests/.gitignore: Add brk.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add brk.test.

8 years agoFix printing of invalid arguments of term ioctls
Dmitry V. Levin [Mon, 16 May 2016 23:36:14 +0000 (23:36 +0000)]
Fix printing of invalid arguments of term ioctls

* term.c (term_ioctl): Print arguments of TCXONC and TCFLSH ioctls
using printxval_long.

8 years agomips: fix printing of invalid operations argument of sysmips syscall
Dmitry V. Levin [Mon, 16 May 2016 23:34:01 +0000 (23:34 +0000)]
mips: fix printing of invalid operations argument of sysmips syscall

* sysmips.c (SYS_FUNC(sysmips)): Print 1st argument of syscall using
printxval_long.

8 years agobfin: fix printing of invalid flags argument of sram_alloc syscall
Dmitry V. Levin [Mon, 16 May 2016 23:31:59 +0000 (23:31 +0000)]
bfin: fix printing of invalid flags argument of sram_alloc syscall

* sram_alloc.c (SYS_FUNC(sram_alloc)): Print 2nd argument using
printflags_long.

8 years agoFix printing of invalid arguments of prctl syscall
Dmitry V. Levin [Mon, 16 May 2016 23:22:11 +0000 (23:22 +0000)]
Fix printing of invalid arguments of prctl syscall

* prctl.c (SYS_FUNC(prctl)): Print 2nd syscall argument
of PR_CAPBSET_DROP, PR_CAPBSET_READ, PR_CAP_AMBIENT, PR_MCE_KILL,
and PR_SET_SECCOMP using printxval_long.
Print 2nd syscall argument of PR_SET_SECUREBITS using printflags_long.
Print 3rd syscall argument of PR_CAP_AMBIENT and PR_MCE_KILL using
printxval_long.
* tests/prctl-seccomp-strict.c (main): Update.

8 years agoFix printing of invalid flags argument of perf_event_open syscall
Dmitry V. Levin [Mon, 16 May 2016 23:19:23 +0000 (23:19 +0000)]
Fix printing of invalid flags argument of perf_event_open syscall

* numa.c (SYS_FUNC(perf_event_open)): Print 5th argument of syscall
using printflags_long.

8 years agoor1k: fix printing of invalid 1st argument of or1k_atomic syscall
Dmitry V. Levin [Mon, 16 May 2016 23:17:19 +0000 (23:17 +0000)]
or1k: fix printing of invalid 1st argument of or1k_atomic syscall

* or1k_atomic.c (SYS_FUNC(or1k_atomic)): Print 1st argument using
printxval_long.

8 years agoFix printing of invalid flags argument of get_mempolicy syscall
Dmitry V. Levin [Mon, 16 May 2016 23:15:06 +0000 (23:15 +0000)]
Fix printing of invalid flags argument of get_mempolicy syscall

* numa.c (SYS_FUNC(get_mempolicy)): Print 5th argument of syscall
using printxval_long.

8 years agoFix printing of invalid mode argument of mbind syscall
Dmitry V. Levin [Mon, 16 May 2016 23:13:04 +0000 (23:13 +0000)]
Fix printing of invalid mode argument of mbind syscall

* numa.c (SYS_FUNC(mbind)): Print 3rd argument of syscall
using printxval_long.
* tests/mbind.c (main): Update.

8 years agoFix printing of invalid argument of MTDFILEMODE ioctl
Dmitry V. Levin [Mon, 16 May 2016 23:06:17 +0000 (23:06 +0000)]
Fix printing of invalid argument of MTDFILEMODE ioctl

* mtd.c (mtd_ioctl): Print 3rd argument of MTDFILEMODE ioctl
using printflags_long.

8 years agoFix printing of invalid flags argument of mount syscall
Dmitry V. Levin [Mon, 16 May 2016 23:04:54 +0000 (23:04 +0000)]
Fix printing of invalid flags argument of mount syscall

* mount.c (SYS_FUNC(mount)): Print 1st argument using printflags_long.

8 years agoFix printing of invalid arguments of memory mapping related syscalls
Dmitry V. Levin [Mon, 16 May 2016 22:58:45 +0000 (22:58 +0000)]
Fix printing of invalid arguments of memory mapping related syscalls

* mem.c (print_mmap): Print 3rd and 4th arguments of syscall
using printflags_long.
(SYS_FUNC(mprotect)): Print 3rd argument of syscall using
printflags_long.
(SYS_FUNC(mremap)): Print 4th argument of syscall using printflags_long.
(SYS_FUNC(remap_file_pages)): Print 3rd and 4th arguments of syscall
using printflags_long.
* tests/remap_file_pages.c (main): Update.

8 years agoFix printing of invalid flags argument of kexec_load and kexec_file_load
Dmitry V. Levin [Mon, 16 May 2016 22:54:41 +0000 (22:54 +0000)]
Fix printing of invalid flags argument of kexec_load and kexec_file_load

* kexec.c (SYS_FUNC(kexec_load), SYS_FUNC(kexec_file_load)): Print
flags argument using printflags_long.

8 years agoFix printing of invalid 3rd argument of fcntl/fcntl64 syscall
Dmitry V. Levin [Mon, 16 May 2016 22:52:04 +0000 (22:52 +0000)]
Fix printing of invalid 3rd argument of fcntl/fcntl64 syscall

* fcntl.c (print_fcntl): Print 3rd argument of F_NOTIFY, F_SETLEASE, and
F_ADD_SEALS operations using printflags_long.

8 years agoFix printing of invalid flags argument of unshare syscall
Dmitry V. Levin [Mon, 16 May 2016 22:49:54 +0000 (22:49 +0000)]
Fix printing of invalid flags argument of unshare syscall

* clone.c (SYS_FUNC(unshare)): Print 1st argument using printflags_long.

8 years agoIntroduce printflags_long and printxval_long
Dmitry V. Levin [Mon, 16 May 2016 22:44:50 +0000 (22:44 +0000)]
Introduce printflags_long and printxval_long

* defs.h (printflags_long, printxval_long): New static inline functions.

8 years agoFix printing of invalid struct xfs_dqblk.d_flags
Dmitry V. Levin [Mon, 16 May 2016 22:28:31 +0000 (22:28 +0000)]
Fix printing of invalid struct xfs_dqblk.d_flags

* quota.c (decode_cmd_data): Explicitly cast struct xfs_dqblk.d_flags
to uint8_t to avoid potential sign-extension bug when printing
invalid struct xfs_dqblk.d_flags.