Commit Graph

24 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
988cace650 print_fields.h: whitespace fix in PRINT_FIELD_HEX_ARRAY 2018-04-04 16:33:19 +00:00
daaf8ab7fe Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-02-13 22:00:00 +00:00
Eugene Syromyatnikov
4ba4e62a51 print_fields.h: add macro to print hexadecimal array field
* print_fields.h (PRINT_FIELD_HEX_ARRAY): New macro, prints target
array with QUOTE_FORCE_HEX.
2018-01-29 14:10:10 +01:00
Eugene Syromyatnikov
03a7b946e2 print_fields.h: add PRINT_FIELD_U_CAST
Add a macro for printing fields explicitly casted to specific type.
This is useful for bit fields, as otherwise the magic of *_extend_to_*
macros breaks.

* print_field.h (PRINT_FIELD_U_CAST): New macro.
2018-01-08 00:40:22 +00:00
Eugene Syromyatnikov
45532079c6 print_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID
As uid is not the only thing that has a special treatment of the -1
value (and, as a result, needs special care), let's rename
PRINT_FIELD_UID to PRINT_FIELD_ID and make PRINT_FIELD_UID its alias.

* print_fields.h (PRINT_FIELD_ID): Rename from PRINT_FIELD_UID.
(PRINT_FIELD_UID): Define to PRINT_FIELD_ID.
2018-01-08 00:40:22 +00:00
63ea6d172d bpf: use PRINT_FIELD_* macros
* print_fields.h (PRINT_FIELD_STR, PRINT_FIELD_PATH): New macros.
* bpf.c: Include "print_fields.h".
(bpf_map_create): Use PRINT_FIELD_U and PRINT_FIELD_XVAL.
(bpf_map_update_elem): Use PRINT_FIELD_FD, PRINT_FIELD_X, and
PRINT_FIELD_XVAL.
(bpf_map_delete_elem, bpf_map_io): Use PRINT_FIELD_FD and PRINT_FIELD_X.
(bpf_prog_load): Use PRINT_FIELD_STR, PRINT_FIELD_U, PRINT_FIELD_X,
and PRINT_FIELD_XVAL.
(bpf_obj_manage): Use PRINT_FIELD_FD and PRINT_FIELD_PATH.
(bpf_prog_attach_detach): Use PRINT_FIELD_FD, PRINT_FIELD_FLAGS,
and PRINT_FIELD_XVAL.
2017-07-25 12:47:19 +00:00
de484eced5 Introduce print_quoted_cstring
In many places where kernel expects a NUL-terminated string of length
up to a known fixed limit, e.g. when a NUL-terminated string is
a fixed-size field of a structure, strace does not print the last byte
assuming it is NUL, which is not always the case.

Change output format for such strings to distinguish NUL-terminated
strings from non-NUL-terminated ones: append ellipsis to the output
when the string is not NUL-terminated.

* defs.h (print_quoted_cstring): New prototype.
* util.c (print_quoted_cstring): New function.
(printpathn): Use it instead of print_quoted_string with
QUOTE_0_TERMINATED argument.
* print_fields.h (PRINT_FIELD_CSTRING): Likewise.
* btrfs.c (btrfs_ioctl): Likewise.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* print_ifindex.c (print_ifindex): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* ubi.c (ubi_ioctl): Likewise.
* tests/tests.h (print_quoted_cstring): New prototype.
* tests/print_quoted_string.c (print_quoted_cstring): New function.
* tests/ioctl_block.c (main): Update expected output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_loop.c (print_loop_info, print_loop_info64): Likewise.
* tests/netlink_crypto.c (test_crypto_msg_newalg): Likewise.
2017-07-24 12:10:54 +00:00
3754255061 Unify PRINT_FIELD_XVAL and PRINT_FIELD_XVAL64
* print_fields.h (PRINT_FIELD_XVAL64): Unify with PRINT_FIELD_XVAL.
2017-07-23 11:16:23 +00:00
8c1c2066f8 Unify PRINT_FIELD_FLAGS and PRINT_FIELD_FLAGS64
* print_fields.h (PRINT_FIELD_FLAGS64): Unify with PRINT_FIELD_FLAGS.
* userfaultfd.c (uffdio_ioctl): Replace PRINT_FIELD_FLAGS64 with
PRINT_FIELD_FLAGS.
2017-07-23 11:16:23 +00:00
58dbb36efa Introduce PRINT_FIELD_FLAGS64 and PRINT_FIELD_XVAL64
* print_fields.h (PRINT_FIELD_FLAGS64, PRINT_FIELD_XVAL64): New macros.
2017-07-18 21:54:38 +00:00
844c15975b Introduce PRINT_FIELD_FD and PRINT_FIELD_STRN
* print_fields.h (PRINT_FIELD_FD, PRINT_FIELD_STRN): New macros.
2017-07-17 11:59:26 +00:00
5bafd10074 Introduce PRINT_FIELD_PTR
* print_fields.h (PRINT_FIELD_PTR): New macro.
2017-07-15 00:08:12 +00:00
837a76f4ee Introduce PRINT_FIELD_CSTRING
* print_fields.h (PRINT_FIELD_CSTRING): New macro.
* block.c (print_blkpg_req, block_ioctl): Use PRINT_FIELD_CSTRING
instead of print_quoted_string.
* btrfs.c (btrfs_ioctl): Likewise.
* dm.c (dm_decode_device, dm_decode_dm_target_spec): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Likewise.
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc,
print_v4l2_standard, print_v4l2_input, print_v4l2_tuner,
print_v4l2_queryctrl): Likewise.
* netlink_sock_diag.c (decode_smc_diag_lgrinfo): Use PRINT_FIELD_CSTRING
instead of PRINT_FIELD_STRING.
* uname.c (PRINT_UTS_MEMBER): Remove.
(SYS_FUNC(uname)): Use PRINT_FIELD_CSTRING instead of PRINT_UTS_MEMBER.
2017-07-11 00:20:54 +00:00
8d3bd017a5 Rename PRINT_FIELD_QUOTED_STRING to PRINT_FIELD_STRING
As string fields are always qouted when printed, choose a shorter name
for the helper macro.

* print_fields.h (PRINT_FIELD_QUOTED_STRING): Rename
to PRINT_FIELD_STRING.  All callers updated.
2017-07-11 00:20:54 +00:00
2d727ee3d2 Intorduce PRINT_FIELD_0X
* print_fields.h (PRINT_FIELD_0X): New macro.
* sockaddr.c (print_sockaddr_data_ipx, print_sockaddr_data_nl): Use it
instead of manual tprintf statements.
* netlink_sock_diag.c (PRINT_FIELD_SMC_DIAG_CONNINFO_FLAGS): Remove.
(decode_smc_diag_conninfo): Replace it with PRINT_FIELD_0X.
2017-07-10 02:23:00 +00:00
ce1f4d12aa Intorduce PRINT_FIELD_SOCKADDR
* print_fields.h (PRINT_FIELD_SOCKADDR): New macro.
* msghdr.c (print_cmsg_ip_recverr): Use it instead of print_sockaddr.
* net.c (print_group_req): Likewise.
* sock.c (PRINT_IFREQ_ADDR): Remove.
(print_ifreq, print_ifconf_ifreq): Use PRINT_FIELD_SOCKADDR
instead of PRINT_IFREQ_ADDR.
2017-07-09 18:43:34 +00:00
c1506a0ca6 Intorduce PRINT_FIELD_DEV
* print_fields.h (PRINT_FIELD_DEV): New macro.
* dm.c (dm_decode_device, dm_decode_dm_name_list): Use it
instead of print_dev_t.
* loop.c (decode_loop_info, decode_loop_info64): Likewise.
* netlink_sock_diag.c (decode_unix_diag_vfs): Likewise.
2017-07-09 18:43:34 +00:00
cb0ce38988 Intorduce PRINT_FIELD_INET4_ADDR
* print_fields.h (PRINT_FIELD_INET4_ADDR): New macro.
* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of manual
tprintf statements.
* net.c (print_mreq): Likewise.
* sockaddr.c (print_sockaddr_data_in): Likewise.
2017-07-09 18:43:34 +00:00
c3d63a580f Intorduce PRINT_FIELD_NET_PORT
* print_fields.h (PRINT_FIELD_NET_PORT): New macro.
* netlink_sock_diag.c (print_inet_diag_sockid): Use it
instead of a manual tprintf statement.
* sockaddr.c (print_sockaddr_data_in, print_sockaddr_data_in6,
print_sockaddr_data_ipx): Likewise.
2017-07-09 18:43:34 +00:00
4652a842a9 Intorduce PRINT_FIELD_IFINDEX
* print_fields.h (PRINT_FIELD_IFINDEX): New macro.
* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of print_ifindex.
* net.c (print_mreq6): Likewise.
* netlink_sock_diag.c (print_packet_diag_mclist,
print_inet_diag_sockid): Likewise.
* sockaddr.c (print_sockaddr_data_in6, print_sockaddr_data_ll):
Likewise.
2017-07-09 18:43:34 +00:00
b63dc54a1d Intorduce PRINT_FIELD_INET_ADDR
* print_fields.h (PRINT_FIELD_INET_ADDR): New macro.
* net.c (print_mreq6): Use it instead of print_inet_addr.
* netlink_sock_diag.c (print_inet_diag_sockid): Likewise.
* sockaddr.c (print_sockaddr_data_in6): Likewise.
2017-07-09 18:43:34 +00:00
JingPiao Chen
f8ce9d580c netlink: decode AF_PACKET packet_diag_msg attributes
* linux/packet_diag.h (packet_diag_info, packet_diag_mclist,
packet_diag_ring): New structures.
(PDI_*): New macros.
* netlink_sock_diag.c: Include <linux/filter.h>
and "xlat/packet_diag_info_flags.h".
(decode_packet_diag_info, decode_packet_diag_mclist,
decode_packet_diag_ring, decode_packet_diag_filter): New functions.
(packet_diag_msg_nla_decoders): New array.
(decode_packet_diag_msg): Use it.
* print_fields.h (PRINT_FIELD_QUOTED_STRING): New macro.
* xlat/packet_diag_info_flags.in: New file.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-09 00:21:02 +00:00
0c4052b9ca net: accept arbitrary option length for getsockopt's SO_PEERCRED
* print_fields.h (PRINT_FIELD_UID): New macro.
* net.c (print_ucred): Rewrite to match the kernel behaviour.
* NEWS: Mention this.
2017-07-08 19:27:26 +00:00
26954f7753 Unify different generic PRINT_FIELD_* implementations
Create a new header print_fields.h and move generic PRINT_FIELD_*
macros there.

* print_fields.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_sock_diag.c: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_COOKIE, PRINT_FIELD_FLAGS,
PRINT_FIELD_XVAL): Move to print_fields.h file.
* quota.c: Include "print_fields.h".
(PRINT_FIELD_D): Move to print_fields.h file.
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* statx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(SYS_FUNC(statx)): Update PRINT_FIELD_U callers.
* tests/quotactl.h: Include "print_fields.h".
* tests/quotactl-xfs.c: Update callers of PRINT_FIELD_* macros.
* tests/quotactl.c: Likewise.
(PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/test_nlattr.h: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/xstatx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(print_stat): Update PRINT_FIELD_U callers.
* tests/tests.h [!STRACE_PRINTF] (STRACE_PRINTF): Define to printf.
2017-07-01 13:14:49 +00:00