Commit Graph

6573 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
321f9be806 tests: add btrfs tests with verbose xlat decoding
* tests/btrfs-X.test: New test.
* tests/btrfs-vX.test: Likewise.
* tests/btrfs-vwX.test: Likewise.
* tests/btrfs-wX.test: Likewise.
* tests/Makefile.am (DECODER_TESTS): Add them.
* tests/btrfs.c (verbose_xlat): New static variable.
(prfl_btrfs, prxval_btrfs): New function.
(btrfs_print_qgroup_inherit, btrfs_print_vol_args_v2,
btrfs_print_balance_args, btrfs_test_balance_ioctls,
btrfs_test_clone_ioctls, btrfs_test_defrag_ioctls,
btrfs_test_space_info_ioctl, btrfs_print_defrag_range_args,
btrfs_test_scrub_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_send_ioctl, btrfs_test_send_ioctl,
btrfs_test_quota_ctl_ioctl, btrfs_test_get_dev_stats_ioctl,
btrfs_test_get_dev_stats_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl, btrfs_print_features): Use prfl_btrfs and
prxval_btrfs instead of printflags and printxval, respectively.
(btrfs_test_balance_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_quota_ctl_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl): Update expected output based on
verbose_xlat setting.
(btrfs_print_defrag_range_args): Add compress_type_known arg, pass it
to prxval_btrfs.
(main): Handle -X option.
2018-04-20 12:39:05 +00:00
Eugene Syromyatnikov
ad7a72cd06 tests: check -X option syntax
* tests/options-syntax.test: Add checks for -X option with invalid
arguments.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-20 12:39:05 +00:00
Eugene Syromyatnikov
3cdaf39e3d Add user interface for configuring xlat output style
* strace.c (init): Handle -X option, set xlat_verbosity
according to -X argument.
* strace.1.in: Document -X option.
* NEWS: Mention it.

Closes: https://github.com/strace/strace/issues/27
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-20 12:39:05 +00:00
Eugene Syromyatnikov
aa01b5368d bpf: print fields that interpreted as pointers using printaddr64
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_LOOKUP_ELEM),
BEGIN_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)): Print key and value
fields using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_MAP_DELETE_ELEM)): Print key field using
PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_NEXT_KEY)): Print key and next_key
field using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print insns and log_buf fields
using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_TEST_RUN)): Print data_in and data_out
fields using PRINT_FIELD_ADDR64.
* tests/bpf.c: Update expected output.
2018-04-20 12:39:05 +00:00
fc8294cbc2 build: make it even more reproducible
* Makefile.am (today): Consistently print the UTC date in C locale.
* configure.ac (RPM_CHANGELOGTIME, DEB_CHANGELOGTIME): Likewise.
* maint/update_copyright_years.sh: Likewise.
* copyright-year-gen: Likewise.  When $SOURCE_DATE_EPOCH is non-empty,
use it as fallback date before the current system date.

References: https://github.com/strace/strace/pull/68
2018-04-20 13:15:38 +00:00
2e5167cc4f unwind: move unwind_tcb_init invocation to after_successful_attach
There is no need to call unwind_tcb_init before the tracee is attached.

* strace.c (alloctcb) [ENABLE_STACKTRACE]: Move unwind_tcb_init
invocation ...
(after_successful_attach) [ENABLE_STACKTRACE]: ... here.
(init) [ENABLE_STACKTRACE]: Remove unwind_tcb_init invocation loop.
* unwind.c (unwind_tcb_fin): Skip if tcp->unwind_queue is NULL.
2018-04-19 18:03:58 +00:00
ca5ca349ee strace: move setting of post-attach flags inside after_successful_attach
* strace.c (after_successful_attach): Add "flags" argument.
Set TCB_ATTACHED, TCB_STARTUP, and "flags" in tcp->flags.
All users updated.
2018-04-19 18:03:58 +00:00
4069dcb912 strace: rename newoutf to after_successful_attach
This function is going to be used for other things that have to be done
right after a successful attach, hence the rename.

* strace.c (newoutf): Rename to after_successful_attach,
all users updated.
2018-04-19 18:03:58 +00:00
0635ea34a8 unwind: remove stray newline in error diagnostics
* unwind-libdw.c (tcb_init): Do not pass trailing "\n" to error_msg
as the latter prints newline itself.
2018-04-19 18:03:58 +00:00
31ce194d23 build: make it more reproducible
* file-date-gen: Consistently print the UTC date in C locale.
When $SOURCE_DATE_EPOCH is non-empty, use it as fallback date
before the current system date.

Reported-by: Chris Lamb <lamby@debian.org>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896016
Closes: https://github.com/strace/strace/pull/68
2018-04-19 18:03:58 +00:00
Masatake YAMATO
98d3356b04 unwind: initialize unwind context only if given tcb is initialized
With libdw based unwinder, following warnings are reported
when -p is passed before -k:

   $ ./strace -p 1 -k
   ...
   ./strace: dwfl_linux_proc_attach returned an error for process 0: No such file or directory
   ...

It seems that commit 54c7792b, "Fix libunwind segfault when -p is
passed before -k" doesn't fix the original issue.

* strace.c (init) [ENABLE_STACKTRACE]: Initialize unwind context only
if given tcb is initialized.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-04-19 18:03:58 +00:00
ee2c065dd4 bpf: harmonize length checks
The rest of the decoder uses offsetof to check the length.

* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_PIN),
BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Use offsetof instead
of offsetofend.
2018-04-12 23:00:29 +00:00
Eugene Syromyatnikov
25a5961610 bpf: add support for map_name and map_ifindex fields in BPF_MAP_CREATE
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode map_name
and map_ifindex fields that were added in Linux commits
v4.15-rc1~84^2~605^2~3 and v4.16-rc1~123^2~145^2~5^2~8, respectively.
* bpf_attr.h (struct BPF_MAP_CREATE_struct): Add map_name
and map_ifindex fields.
* tests/bpf.c (init_BPF_MAP_CREATE_attr7): New function.
(BPF_MAP_CREATE_checks): Remove const qualifier, add two more checks.
2018-04-12 23:00:29 +00:00
Eugene Syromyatnikov
b20f744662 bpf: improve handling of various sizes of BPF_MAP_CREATE attributes
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Skip printing
the rest of the structure if len is less than the offset of the end
of max_entries, map_flags, or inner_map_fd field.
* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.
2018-04-12 23:00:29 +00:00
Eugene Syromyatnikov
b8ed708a54 tests: add checks for bpf BPF_MAP_CREATE arguments
* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
79a79e7b9b bpf: print numa_node using xlat
As the value of -1 has a special meaning.  The issue is complicated
by the fact that this constant is not exported by UAPI.

* xlat/numa_node.in: New file.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Print numa_node field
using printxvals_ex with a special xlat style.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
7db513885a btrfs: use umove_or_printaddr_ignore_syserror instead of u_error mangling
* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_TREE_SEARCH_V2>: Use umove_or_printaddr_ignore_syserror
instead of tcp->u_error mangling around umove_or_printaddr call.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
68869ae825 defs.h: introduce umove_or_printaddr{,64}_ignore_syserror wrappers
* defs.h (umove_or_printaddr64_ignore_syserror): New macro, a thin
wrapper around umoven_or_printaddr64_ignore_syserror.
(umove_or_printaddr_ignore_syserror): New macro, a thin wrapper around
umoven_or_printaddr_ignore_syserror.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
fd3f73b1f4 print_fields.h: add PRINT_FIELD_XVAL_U for printing xlat in %u format
* print_fields.h (PRINT_FIELD_XVAL_U): New macro.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
59819338ab print_fields.h: add PRINT_FIELD_U64 for printing u64 with UINT64_MAX handling
* print_fields.h (PRINT_FIELD_U64): New macro.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
2342efed27 bpf_sock_filter: use print_xlat32
We can't simply use print_xlat here due to the way those SKF_*_OFF
constants are defined.

* bpf_sock_filter.c (print_sock_filter_k): Use print_xlat32 for printing
SKF_AD_OFF, SKF_NET_OFF, and SKF_LL_OFF named constants.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
f21f7033f9 defs.h: add print_xlat32 macro
For those cases where inadvertent sign extension is possible.

* defs.h (print_xlat32): New macro, a wrapper for print_xlat_ex.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
0ae5745181 open: use print_xlat_d in print_dirfd
* open.c (print_dirfd): Use print_xlat_d for printing AT_FDCWD named
constant.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
966da001af fanotify: use print_xlat_d
* fanotify.c (SYS_FUNC(fanotify_mark)): Use print_xlat_d for printing
FAN_NOFD named constant.
2018-04-12 23:00:28 +00:00
Eugene Syromyatnikov
bda859a94e Add print_xlat_u and print_xlat_d shorthands
Add variants of print_xlat with various value printing formats.

* defs.h (print_xlat_u, print_xlat_d): New macro, a wrapper for
print_xlat_ex.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
78be7e9d8a xlat: introduce XLAT_STYLE_FMT_D
As there are some possible users for it, apparently.

* defs.h (XLAT_STYLE_FORMAT_MASK): Update the value in order to
accommodate XLAT_STYLE_FMT_D.
(enum xlat_style) <XLAT_STYLE_FMT_D>: New enumeration entity.
(printxval64_d, printxval_d): New function, a shorthand for
printxvals_ex with a single xlat and XLAT_STYLE_FMT_D xlat style.
* xlat.c (sprint_xlat_val): Handle XLAT_STYLE_FMT_D.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
d451b0e283 defs.h: add shorthands for printing xval with XLAT_STYLE_FMT_U
* defs.h (printxval_u, printxval64_u): New function, a shorthand for
printxvals_ex with a single xlat and XLAT_STYLE_FMT_U as a style.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
039717c2e6 Add support for various xlat formats
Since xlat printing routines now have a notion of "style" that should be
used for printing xlat values, we can also employ this argument for
passing information about number printing format (unsigned decimal
or hexadecimal, so far).

* defs.h (XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FORMAT_MASK): New macro
constant.
(enum xlat_style) <XLAT_STYLE_FMT_X, XLAT_STYLE_FMT_U>: New enumeration
entities.
* xlat.c (xlat_verbose, xlat_format): New macro for checking specific
aspect of style argument.
(get_xlat_style): Use xlat_verbose for checking xlat verbosity style.
(sprint_xlat_val, print_xlat_val): New function, for easing printing
raw constant number with respect to printing format style.
(printxvals_ex, sprintxval_ex, printxval_searchn_ex,
printxval_searchn_ex, sprintflags_ex, printflags_ex, print_xlat_ex):
Use xlat_verbose macro for xlat verbosity style checks. Use
print_xlat_val instead of direct raw xlat value printing.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
21b5ba134f v4l2: use print_xlat in print_v4l2_queryctrl
* v4la.c (print_v4l2_queryctrl): Use print_xlat for printing
V4L2_CTRL_FLAG_NEXT_CTRL named constant.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
e29b9270c7 prctl: use print_xlat_ex to print PR_SET_PTRACER_ANY
We cannot simply use print_xlat as PR_SET_PTRACER_ANY is defined
differently in kernel headers.

* prctl.c (SYS_FUNC(prctl)) <case PR_SET_PTRACER>: Use print_xlat_ex
for printing PR_SET_PTRACER_ANY named constant.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
1e00c76862 nlattr: use print_xlat
* nlattr.c (print_nlattr): Use print_xlat for printing NLA_F_NESTED and
NLA_F_NET_BYTEORDER named constants.
2018-04-13 01:00:10 +02:00
Eugene Syromyatnikov
37db70c027 ipc_defs.h: use print_xlat
* ipc_defs.h (PRINTCTL): Use print_xlat for printing IPC_64 named
constant.
2018-04-13 01:00:09 +02:00
Eugene Syromyatnikov
83c129f51c futex: use print_xlat
* futex.c [!FUTEX_OP_OPARG_SHIFT] (FUTEX_OP_OPARG_SHIFT): New macro
constant.
(SYS_FUNC(futex)): Use print_xlat for printing FUTEX_OP_OPARG_SHIFT
named constant.
2018-04-13 01:00:09 +02:00
Eugene Syromyatnikov
a465477fc7 ipc: use printxval for printing key
Convert explicit constant printing logic into a printxval call in order
to account for xlat style setting.

* defs.h (ipc_private): New xlat array declaration.
* ipc_msg.c (SYS_FUNC(msgget)): Use printxval for printing IPC_PRIVATE.
* ipc_sem.c (SYS_FUNC(semtimedop)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* xlat/ipc_private.in: New file.
2018-04-13 01:00:09 +02:00
Eugene Syromyatnikov
b416f61c3e mount: use print_xlat for printing MS_MGC_VAL
* mount.c (SYS_FUNC(mount)): Use print_xlat for printing MS_MGC_VAL
named constant.
2018-04-13 00:25:13 +02:00
Eugene Syromyatnikov
6ece6574d2 Introduce print_xlat and print_xlat_ex
print_xlat_ex prints a named constant in accordance with xlat style
provided, print_xlat is a thin wrapper around print_xlat_ex that passes
stringified constant name as a string and XLAT_STYLE_DEFAULT as a style.

* defs.h (print_xlat_ex): New function prototype.
(print_xlat): New macro, a thin wrapper around print_xlat_ex.
* xlat.c (print_xlat_ex): New function.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-13 00:25:13 +02:00
Eugene Syromyatnikov
b9fcbe6112 Introduce XLAT_STYLE_DEFAULT
This will be needed later, with the introduction of user-configurable
xlat style setting (stored in xlat_verbosity variable).

* defs.h (XLAT_STYLE_VERBOSITY_MASK): New macro constant.
(enum xlat_style) <XLAT_STYLE_DEFAULT>: New enumeration entity.
(xlat_verbosity): New external declaration.
(printxvals, printxval_searchn, printxval_search_ex, sprintxval,
sprintflags, printflags64): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV.
* strace.c (xlat_verbosity): New variable.
* xlat.c (get_xlat_style): New function.
(printxvals_ex, sprintxval_ex, printxval_searchn_ex, sprintflags_ex,
printflags_ex): Use it.
2018-04-13 00:25:13 +02:00
Eugene Syromyatnikov
e8c3f34edd Introduce xlat verbosity styles
* defs.h (printxvals_ex): Rename from printxvals, add style argument.
(enum xlat_style): New enumeration.
(printxvals): New macro, a wrapper for printxvals_ex.
(printxval_searchn_ex): Rename from printxval_searchn, add style
argument.
(printxval_searchn): New macro, a wrapper for printxval_searchn_ex.
(printxval_search_ex): New macro, a wrapper for printxval_searchn_ex.
(sprintxval_ex): Rename from sprintxval, add style argument.
(sprintxval): New macro, a wrapper for sprintxval_ex.
(printflags_ex): Add style argument.
(sprintflags_ex): Rename from sprintflags, add style argument.
(sprintflags): New macro, a wrapper for sprintflags_ex.
(printflags64): Pass XLAT_STYLE_ABBREV as a style in printflags_ex call.
* netlink.c (decode_nlmsg_flags): Pass XLAT_STYLE_ABBREV as a style in
printflags_ex call.
* xlat.c (printxvals_ex): Rename from printxvals, add style argument,
handle it.
(sprintxval_ex): Rename from sprintxval, add style argument, handle it.
(printxval_searchn_ex): Rename from printxval_searchn, add style
argument, handle it.
(sprintflags_ex): Rename from sprintflags, add style argument,
handle it.
(printflags_ex): Add style argument, handle it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
References: https://github.com/strace/strace/issues/27
2018-04-13 00:25:13 +02:00
34c7794cc1 tests: robustify signal delivery test against kernel bugs
Recent kernel siginfo changes, namely, v4.14-rc1~60^2^2~1,
v4.16-rc1~159^2~37, and v4.16-rc1~159^2~39, introduced ABI regressions
that render the whole siginfo interface unreliable.

Looks like the kernel side is not eager to fix the breakage,
so here is a workaround.

* tests/signal_receive.c (s_sig, s_code, s_pid, s_uid): New volatile
variables.
(handler): Add siginfo_t parameter, save siginfo_t fields.
(sig_print): Remove.
(main): Rewrite.  Use variables saved by handler to print expected
siginfo output. Print diagnostics in case of siginfo mismatch.
* strace.spec.in (%check): Extract the diagnostics.

Closes: https://github.com/strace/strace/issues/21
2018-04-11 22:01:37 +00:00
ecf5284f7d Lift experimental status from stack tracing feature
* strace.1.in (.SH OPTIONS) <.B \-k>: Remove " (experimental)".
* strace.c (usage) [ENABLE_STACKTRACE]: Likewise.
2018-04-11 22:01:37 +00:00
dfd58df4a7 Enable stack tracing in packages on all architectures
The stack tracing feature used to be enabled in packages on x86_64 only.
This change enables -k option on all architectures.

* debian/control (Build-Depends) [!amd64]: Add pkg-config, libdw-dev,
and libiberty-dev.
* strace.spec.in (BuildRequires) [!x86_64]: Add
%buildrequires_stacktrace.
2018-04-11 22:01:37 +00:00
9165da9f68 Use libdw-based unwinder in ci and packages
* ci/install-dependencies.sh (common_packages): Add pkg-config,
replace libunwind8-dev with libdw-dev.
* debian/control (Build-Depends) [amd64]: Add pkg-config,
replace libunwind-dev with libdw-dev.
* debian/rules (build-udeb/Makefile): Replace --without-libunwind
with --without-stacktrace.
* strace.spec.in (buildrequires_libunwind_devel): Rename
to buildrequires_stacktrace, replace libunwind-devel with
either elfutils-devel or libdw-devel.
2018-04-11 22:01:37 +00:00
fd4a485828 tests: skip -k tests on unsupported architectures
* tests/strace-k.test: When actual strace -k output doesn't match the
expected output because of limited architecture support, skip the test
on architectures that are not currently supported by libdw.
2018-04-11 22:01:37 +00:00
Masatake YAMATO
ddb5a4ba73 unwind: add libdw as an unwinder
Implement alternative libdw-based unwinder for stack tracing.
Add --with-libdw configure option to control whether libdw can be used
as an unwinder.

* m4/st_libdw.m4: New file.
* m4/st_stacktrace.m4 (st_STACKTRACE): Invoke st_ARG_LIBDW and st_LIBDW,
check for mutually exclusive configure options,
(AM_CONDITIONAL): Add USE_LIBDW.
* unwind-libdw.c: New file.
* Makefile.am [USE_LIBDW] (strace_SOURCES): Append unwind-libdw.c.
[USE_LIBDW] (strace_CPPFLAGS): Append $(libdw_CPPFLAGS).
[USE_LIBDW] (strace_CFLAGS): Append $(libdw_CFLAGS).
[USE_LIBDW] (strace_LDFLAGS): Append $(libdw_LDFLAGS).
[USE_LIBDW] (strace_LDADD): Append $(libdw_LIBS).
* NEWS: Mention this improvement.

Closes: https://github.com/strace/strace/issues/12
Closes: https://github.com/strace/strace/issues/13
Co-Authored-by: Mark Wielaard <mjw@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-04-11 22:01:37 +00:00
c78af2c9cf tests: check corner cases of udev_monitor_netlink_header decoding
* tests/netlink_kobject_uevent.c (test_nlmsg_type_kernel): Create
a tail-allocated udev_monitor_netlink_header object and pass it
to sys_send.
(test_nlmsg_type_udev): Likewise.  Check decoding of
udev_monitor_netlink_header object that ends in unmapped memory region.
2018-04-11 22:01:37 +00:00
Harsha Sharma
968a545ab7 tests: check decoding of udev_monitor_netlink_header
* tests/netlink_kobject_uevent.c: Include <string.h>, <arpa/inet.h>,
and "netlink_kobject_uevent.h".
(test_nlmsg_type_udev, test_nlmsg_type_kernel): New functions.
(main): Use them.
2018-04-11 22:01:37 +00:00
Harsha Sharma
c9694f85ed netlink: decode libudev netlink header
* defs.h (decode_netlink_kobject_uevent): New prototype.
* netlink.c (decode_netlink): Decode family kobject_uevent.
* netlink_kobject_uevent.h: New file.
* netlink_kobject_uevent.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
2018-04-11 22:01:37 +00:00
Harsha Sharma
d94871775a tests: check basic decoding of PTP_* ioctl commands
* tests/ioctl_ptp.c: New file.
* tests/gen_tests.in (ioctl_ptp): New entry.
* tests/pure_executables.list: Add ioctl_ptp.
* tests/.gitignore: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-11 15:41:40 +00:00
Eugene Syromyatnikov
39f61ef513 bpf: decode BPF_PROG_QUERY command
BPF_PROG_QUERY was introduced in Linux commit v4.15-rc1~84^2~558^2~6.

* xlat/bpf_commands.in (BPF_PROG_QUERY): New constant.
* xlat/bpf_query_flags.in: New file.
* bpf.c: Include it.
(DECL_BPF_CMD_DECODER): Add priv argument for passing tcb private data.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Add BPF_PROG_QUERY entry.
(SYS_FUNC(bpf)): Fetch buf on entering and exiting, pass buf on exiting,
retrieve private data on exiting, pass it to decoder as well, explicitly
rework rc handling logic for size argument printing.
* bpf_attr.h (struct BPF_PROG_QUERY_struct): New structure declaration.
(BPF_PROG_QUERY_struct_size, expected_BPF_PROG_QUERY_struct_size): New
macro.
* tests/bpf.c: Add checks for BPF_PROG_QUERY command.
2018-04-10 03:38:10 +00:00
Eugene Syromyatnikov
459ea39686 Make print_uint64 from btrfs.c globally available
And rename it to print_uint64_array_member to make the name sensible
without additional context.

* defs.h (print_uint64_array_member): New function prototype.
* btrfs.c (print_uint64): Move...
* util.c (print_uint64_array_member): ...here, drop "static" qualifier.
2018-04-10 03:38:10 +00:00