IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
* bootstrap: Install README before invoking autoreconf to get README
included into distributed tarball.
Fixes: v4.21-93-g4bb8454 ("Move README to dist subdirectory")
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
Fast syscalls usually take less than a microsecond of system cpu time
nowadays, making -O option almost useless.
* count.c (call_summary_pers): Avoid negative time counts.
* tests/count.test: Check it.
* NEWS: Mention it.
* count.c (shortest): Remove.
(overhead): Initialize to zero.
(call_summary_pers): Remove shortest handling.
(count_syscall): Remove dead code. The remaining code does the same
wrong calculations as before the change, though.
* README-hacking (Requirements): Enhance phrasing.
(Commit log requirements): Rename to "Commit requirements",
describe "absence of whitespace errors" requirement, add references
to the Linux kernel coding style and scripts/checkpatch.pl script.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
README was originally written for users of distribution tarballs.
Nowadays it appears to be confusing for those who build strace
using a GIT version of strace source code.
* README: Move...
* dist/README: ...here.
* bootstrap: Copy README from dist subdirectory to the toplevel
directory after successful autoreconf.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
References: https://github.com/strace/strace/issues/56
On Linux, poll syscall interprets any negative timeout value as an
infinite timeout, so no need to handle BSD-specific INFTIM.
* poll.c (SYS_FUNC(poll)): Remove INFTIM handling.
Depending on libc implementation, various -lrt functions can be
implemented either in -lc or in -lrt. For example, starting with
glibc-2.17 the clock_* suite of functions is available directly in -lc.
Check whether clock_* and mq_* suites of functions are provided
by -lrt or by the main C library, do not link with -lrt unnecessarily.
This change affects only tests yet, but this is going to be
more important as soon as strace starts using clock_gettime.
* configure.ac (AC_SEARCH_LIBS): Check for clock_gettime and mq_open
in -lrt.
(AC_SUBST): Add clock_LIBS and mq_LIBS.
* tests/Makefile.am (mq_LDADD): Replace -lrt with $(mq_LIBS).
(threads_execve_LDADD, times_LDADD): Replace -lrt with $(clock_LIBS).
Introduce an internal cache of pid2tcb translations.
This can save more than 80% of CPU user time spent by strace.
Tested using the following setup:
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
int main()
{
int i;
sleep(1);
for (i = 1; i < 1000; ++i) {
pid_t pid = fork();
if (pid < 0)
return 2;
if (pid)
return wait(&i) != pid || i;
}
sleep(1);
for (i = 0; i < 10000000; ++i)
umask(0777);
return 0;
}
old$ ./set_ptracer_any ./pid2tcb >pid2tcb.wait & \
while [ ! -s pid2tcb.wait ]; do sleep 0.1; done; \
time -f '%Uuser %Ssystem %eelapsed %PCPU' \
../strace -qq -enone -esignal=none -f -p $!
5.51user 104.90system 122.45elapsed 90%CPU
new$ ./set_ptracer_any ./pid2tcb >pid2tcb.wait & \
while [ ! -s pid2tcb.wait ]; do sleep 0.1; done; \
time -f '%Uuser %Ssystem %eelapsed %PCPU' \
../strace -qq -enone -esignal=none -f -p $!
1.29user 102.78system 114.97elapsed 90%CPU
Assume that strace project on the local server contains an appropriate
musl repository, use this repository instead of hardcoded github
location.
* ci/install-dependencies.sh (clone_repo): Use local server by default.
(musl-gcc): Un-hardcode the location of musl repository.
* travis-build.sh: Rename to ci/run-build-and-tests.sh, all callers
updated.
* travis-install.sh: Rename to ci/install-dependencies.sh, all callers
updated.
The side effect of #include "xlat/nl_netfilter_msg_types.h" is
NFNL_MSG_BATCH_* constants properly defined in that header file.
While netlink.c does not use these constants itself,
netlink_netfilter.c is going to need them soon.
* defs.h (nl_netfilter_msg_types): New xlat prototype.
* netlink.c: Move inclusion of "xlat/nl_netfilter_msg_types.h" ...
* netlink_netfilter.c: ... here.
* tests/netlink_netfilter.c: Include <netinet/in.h>, <arpa/inet.h>
and <linux/netfilter/nf_tables.h>.
Replace "netlink.h" with "test_netlink.h".
(NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWTABLE): New macros.
(test_nlmsg_done, test_nfgenmsg): New functions.
(main): Use them.
NFNL_SUBSYS_COUNT is not a symbol with some constant value, it changes
with time, just print it as an unrecognized number.
* xlat/nl_netfilter_subsys_ids.in (NFNL_SUBSYS_COUNT): Remove.
get_pagesize() has a static cache anyway, no need to duplicate it.
* bpf.c (SYS_FUNC(bpf)): Remove static size_t page_size and its
initialisation, use get_pagesize() as the size of buf directly.
This is important for recently introduced MAP_SHARED_VALIDATE flag.
* xlat/mmap_flags.in (MAP_SHARED, MAP_PRIVATE, MAP_SHARED_VALIDATE):
Add constant values.
Fixes: v4.21-67-g8c209d1 ("tests: fix remap_file_pages.test breakage on hppa")
* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print
union bpf_attr.kern_version in the form of KERNEL_VERSION macro call.
* tests/bpf.c: Update expected output.
Apparently, hppa is the only architecture that has MAP_TYPE
defined to 0x3 instead of 0xf, and the tests hit that corner case.
* tests/remap_file_pages.c (main) [MAP_HUGETLB]: Print the value
of mapping type depending on the architecture (MAP_SHARED_VALIDATE
for hppa and unknown value for other architectures).
Fixes: v4.21~59 ("xlat: update MAP_* constants")
* defs.h (ethernet_protocols_size): New declaration.
* netlink_packet_diag.c (decode_packet_diag_req): Use
printxval_searchnn to print Ethernet protocols.
* sockaddr.c (ethernet_protocols_size): New constant, item count
in ethernet_protocols array.
(print_sockaddr_data_ll): Use printxval_search instead of
printxval to print Ethernet protocols.
* xlat/ethernet_protocols.in: Sort it by value, add comment
about the fact.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
It is quite unwieldy to have this distinction between sorted and
unsorted arrays when we can just decrement the size in a wrapper.
* defs.h (printxval_search): Decrement array size.
* xlat/fsmagic.in (#unterminated): Remove.
* xlat/hw_breakpoint_type.in (#unterminated): Remove.
* xlat/perf_hw_cache_id.in (#unterminated): Remove.
* xlat/perf_hw_cache_op_id.in (#unterminated): Remove.
* xlat/perf_hw_cache_op_result_id.in (#unterminated): Remove.
* xlat/perf_hw_id.in (#unterminated): Remove.
* xlat/perf_sw_ids.in (#unterminated): Remove.
* xlat/perf_type_id.in (#unterminated): Remove.
* xlat/gen.sh (gen_header): Remove #unterminated support.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
As the note that -C makes strace "also print regular output" can be
easily overlooked.
* strace.1.in (.SS Statistics) <.TP .B \-c>: Mention that -c supresses
regular output.
When built with --enable-gcc-Werror, s390_sthyi test build fails
with the following error:
s390_sthyi.c:63:1: error: ‘print_u8’ defined but not used [-Werror=unused-function]
print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero)
^~~~~~~~
Apparently, after some back and forth, all occurrences of printing u8
values landed under verbose printing, so this function is no longer
used in non-verbose mode. Let's avoid this in the future by inlining
all the utility functions in this test.
* tests/s390_sthyi.c (print_0x8, print_u8, print_u16, print_x32,
print_weight, ebcdic2ascii, is_empty, print_ebcdic): Add inline
qualifier.
[!VERBOSE] (is_empty): Remove "# if VERBOSE" guard.
The field has been introduced in Linux commit v4.15-rc1~135^2~17.
* btrfs.c: Implement decoding of
struct btrfs_ioctl_logical_ino_args.flags field.
* configure.ac: Check for struct btrfs_ioctl_logical_ino_args.flags
presence in linux/btrfs.h.
* tests/btrfs.c: Update expected output, add additional checks.
* xlat/btrfs_logical_ino_args_flags.in: New file.
* btrfs.c (btrfs_ioctl) <case BTRFS_IOC_INO_PATHS>: Print fspath field
with printaddr64.
(btrfs_ioctl) <case BTRFS_IOC_LOGICAL_INO>: Print inodes field with
printaddr64.
* tests/btrfs.c: Add checks for NULL in fspath and inodes fields.
* NEWS: Mention it.
Sometimes, 64-bit value is expected to be interpreted as an address
(in BTRFS ioctl interface, for example).
* defs.h (printaddr64): New declaration.
* util.c (printaddr64): Rename from printaddr, change argument type
to uint64_t.
(printaddr): Turn into a thin wrapper around printaddr64.
(printnum_addr_int, printnum_addr_int64): Use printaddr64 instead of
printaddr. printnum_addr_int64 is not used outside the cases where
kernel_long is less or equal than 64 bit currently, so this change
should be safe.
These commands were introduced in Linux commit v4.15-rc1~110^2~9.
* xlat/pr_sve_vl_flags.in: New file.
* xlat/prctl_options.in: Likewise.
* prctl.c: Include "xstring.h" and "xlat/pr_sve_vl_flags.h".
[!PR_SVE_VL_LEN_MASK] (PR_SVE_VL_LEN_MASK): New macro constant.
(sprint_sve_val): New function.
(SYS_FUNC(prctl)): Add decoding for PR_SVE_GET_VL and PR_SVE_SET_VL
commands.
* NEWS: Mention it.