Commit Graph

6 Commits

Author SHA1 Message Date
b93d52fe3d Change the license of strace to LGPL-2.1-or-later
strace is now provided under the terms of the GNU Lesser General
Public License version 2.1 or later, see COPYING for more details.

strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00
Eugene Syromyatnikov
9a969eb670 print_ifindex: add public get_ifname method
In order to be able to obtain sanitised device name internally.

* defs.h (get_ifname): New declaration.
* print_ifindex.c (get_ifname): Refactor, leaving out addition
of if_nametoindex("") part.
(sprint_ifname): New function, adds if_nametoindex("")
to get_ifname's output.
(print_ifindex): Use sprint_ifname instead of get_ifname.
2018-09-02 17:44:26 +00:00
2b6e074846 Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-06-14 11:00:00 +00:00
Eugene Syromyatnikov
004742588e print_ifindex: respect xlat style settings
Print interface indices according to the preferred xlat style settings.

* print_ifindex.c (INI_PFX, INI_SFX): New helper macros.
[HAVE_IF_INDEXTONAME] (get_ifname): New function.
[HAVE_IF_INDEXTONAME] (print_ifindex): Implement as a wrapper around
get_ifname and print_xlat_ex.
2018-05-30 10:54:34 +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
70d8b32108 net: move print_ifindex to a separate file
* print_ifindex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* net.c (print_ifindex): Move to print_ifindex.c.
2017-07-09 18:43:34 +00:00