diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-05-04 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-05-05 20:00:00 +0000 |
commit | 90b6023daef2518cff3599e6d7ef1f6adf0d65d2 (patch) | |
tree | dc7be8dc661565b8bb599ec68e4cb8a79b69c0a2 | |
parent | 3928ac601a007a007fc19ea96b08b06ac532a59b (diff) | |
download | strace-90b6023daef2518cff3599e6d7ef1f6adf0d65d2.tar.gz |
Remove -l alias for the recently introduced --syscall-limit option
As strace already has a lot of short options which are hard to remember,
let's avoid introducing new short options for a while.
* NEWS: Mention this.
* doc/strace.1.in: Update --syscall-limit documentation.
* src/strace.c (print_version): Do not mention -l option.
(optstring): Remove 'l'.
(GETOPT_SYSCALL_LIMIT): New enum constant.
(longopts, init): Use it instead of 'l'.
* tests/gen_tests.in (strace--syscall-limit-status-c,
strace--syscall-limit-status-summary): Replace -l with --syscall-limit.
* tests/options-syntax.test: Update expected output.
* tests/strace--syscall-limit-path.c: Update comment.
* tests/strace--syscall-limit-status.c: Likewise.
* tests/strace--syscall-limit.c: Likewise.
* tests/strace--syscall-limit.test: Likewise.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/strace.1.in | 6 | ||||
-rw-r--r-- | src/strace.c | 19 | ||||
-rw-r--r-- | tests/gen_tests.in | 4 | ||||
-rwxr-xr-x | tests/options-syntax.test | 4 | ||||
-rw-r--r-- | tests/strace--syscall-limit-path.c | 2 | ||||
-rw-r--r-- | tests/strace--syscall-limit-status.c | 2 | ||||
-rw-r--r-- | tests/strace--syscall-limit.c | 2 | ||||
-rwxr-xr-x | tests/strace--syscall-limit.test | 2 |
9 files changed, 21 insertions, 22 deletions
@@ -6,7 +6,7 @@ Noteworthy changes in release ?.? (????-??-??) associated with signalfd file descriptors. * Implemented -e trace-fds=set option for filtering only the syscalls that operate on the specified set of file descriptors. - * Implemented -l/--syscall-limit option to automatically detach tracees + * Implemented --syscall-limit option to automatically detach tracees after capturing the specified number of syscalls. * Implemented decoding of PR_GET_MDWE and PR_SET_MDWE operations of prctl syscall. diff --git a/doc/strace.1.in b/doc/strace.1.in index a523639cf..986e97eee 100644 --- a/doc/strace.1.in +++ b/doc/strace.1.in @@ -44,7 +44,6 @@ strace \- trace system calls and signals .OP \-b execve .OM \-e expr .OP \-I n -.OP \-l limit .OP \-o file .OP \-O overhead .OM \-p pid @@ -54,6 +53,7 @@ strace \- trace system calls and signals .OP \-U columns .OP \-X format .OP \-\-seccomp\-bpf +.OP \-\-syscall\-limit limit .if '@ENABLE_SECONTEXT_FALSE@'#' .OP \-\-secontext\fR[=\fIformat\fR] .OP \-\-tips\fR[=\fIformat\fR] .BR "" { @@ -71,13 +71,13 @@ strace \- trace system calls and signals .OP \-b execve .OM \-e expr .OP \-I n -.OP \-l limit .OP \-O overhead .OM \-p pid .OM \-P path .OP \-S sortby .OP \-U columns .OP \-\-seccomp\-bpf +.OP \-\-syscall\-limit limit .OP \-\-tips\fR[=\fIformat\fR] .BR "" { .OR \-p pid @@ -474,8 +474,6 @@ default if .BR \-D ). .RE .TP -.BI "\-l " limit -.TQ .BR "\-\-syscall\-limit" = \fIlimit\fR Detach all tracees when .I limit diff --git a/src/strace.c b/src/strace.c index 7caa6d9ec..265c0c6dc 100644 --- a/src/strace.c +++ b/src/strace.c @@ -467,7 +467,7 @@ Statistics:\n\ summarise syscall latency (default is system time)\n\ \n\ Stop condition:\n\ - -l LIMIT, --syscall-limit=LIMIT\n\ + --syscall-limit=LIMIT\n\ Detach all tracees after tracing LIMIT syscalls\n\ \n\ Tampering:\n\ @@ -2254,7 +2254,7 @@ init(int argc, char *argv[]) #endif static const char optstring[] = - "+a:Ab:cCdDe:E:fFhiI:kl:no:O:p:P:qrs:S:tTu:U:vVwxX:yYzZ"; + "+a:Ab:cCdDe:E:fFhiI:kno:O:p:P:qrs:S:tTu:U:vVwxX:yYzZ"; enum { GETOPT_SECCOMP = 0x100, @@ -2262,8 +2262,9 @@ init(int argc, char *argv[]) GETOPT_HEX_STR, GETOPT_FOLLOWFORKS, GETOPT_OUTPUT_SEPARATELY, - GETOPT_TS, GETOPT_PIDNS_TRANSLATION, + GETOPT_SYSCALL_LIMIT, + GETOPT_TS, GETOPT_TIPS, GETOPT_QUAL_TRACE, @@ -2301,7 +2302,7 @@ init(int argc, char *argv[]) { "instruction-pointer", no_argument, 0, 'i' }, { "interruptible", required_argument, 0, 'I' }, { "stack-traces", no_argument, 0, 'k' }, - { "syscall-limit", required_argument, 0, 'l' }, + { "syscall-limit", required_argument, 0, GETOPT_SYSCALL_LIMIT }, { "syscall-number", no_argument, 0, 'n' }, { "output", required_argument, 0, 'o' }, { "summary-syscall-overhead", required_argument, 0, 'O' }, @@ -2444,11 +2445,6 @@ init(int argc, char *argv[]) "build of strace"); #endif break; - case 'l': - syscall_limit = string_to_ulonglong(optarg); - if (syscall_limit <= 0) - error_opt_arg(c, lopt, optarg); - break; case 'n': nflag = 1; break; @@ -2559,6 +2555,11 @@ init(int argc, char *argv[]) case GETOPT_SECCOMP: seccomp_filtering = true; break; + case GETOPT_SYSCALL_LIMIT: + syscall_limit = string_to_ulonglong(optarg); + if (syscall_limit <= 0) + error_opt_arg(c, lopt, optarg); + break; case GETOPT_TIPS: if (parse_tips_arg(optarg ?: "")) error_opt_arg(c, lopt, optarg); diff --git a/tests/gen_tests.in b/tests/gen_tests.in index a1a0b7320..86189558c 100644 --- a/tests/gen_tests.in +++ b/tests/gen_tests.in @@ -1037,8 +1037,8 @@ strace--strings-in-hex-none --trace=chdir --strings-in-hex=none --columns=12 strace--syscall-limit-c +strace--syscall-limit.test -c -S syscall -U calls strace--syscall-limit-path +strace--syscall-limit.test --trace-path=invalid.dir strace--syscall-limit-status +strace--syscall-limit.test --status=failed -strace--syscall-limit-status-c +strace--syscall-limit.test --status=failed -l 4 -c -S syscall -U calls -strace--syscall-limit-status-summary +strace--syscall-limit.test --status=failed -l 4 --summary -S syscall -U calls +strace--syscall-limit-status-c +strace--syscall-limit.test --status=failed --syscall-limit=4 -c -S syscall -U calls +strace--syscall-limit-status-summary +strace--syscall-limit.test --status=failed --syscall-limit=4 --summary -S syscall -U calls strace--syscall-limit-summary +strace--syscall-limit.test -C -S syscall -U calls strace--syscall-times +strace-T_upper.test --syscall-times strace--syscall-times-ms +strace-T_upper.test --syscall-times=ms diff --git a/tests/options-syntax.test b/tests/options-syntax.test index 8667bb847..0f6f49b74 100755 --- a/tests/options-syntax.test +++ b/tests/options-syntax.test @@ -186,9 +186,9 @@ check_h "must have PROG [ARGS] or -p PID" --strings-in-hex=non-ascii check_h "invalid --strings-in-hex argument: 'al'" --strings-in-hex=al check_h "invalid --strings-in-hex argument: 'alll'" --strings-in-hex=alll check_h "invalid --strings-in-hex argument: 'ascii'" --strings-in-hex=ascii -check_h "invalid -l argument: '-5'" -l -5 +check_h "invalid --syscall-limit argument: '-5'" --syscall-limit -5 check_h "invalid --syscall-limit argument: '0'" --syscall-limit=0 -check_h "must have PROG [ARGS] or -p PID" -l2 +check_h "must have PROG [ARGS] or -p PID" --syscall-limit=2 check_h "must have PROG [ARGS] or -p PID" --syscall-limit 5 check_h "must have PROG [ARGS] or -p PID" --quiet=all check_h "must have PROG [ARGS] or -p PID" --quiet=none diff --git a/tests/strace--syscall-limit-path.c b/tests/strace--syscall-limit-path.c index 8c4c3a7b9..ed0c88330 100644 --- a/tests/strace--syscall-limit-path.c +++ b/tests/strace--syscall-limit-path.c @@ -1,5 +1,5 @@ /* - * Test -l/--syscall-limit with --trace-path option. + * Test --syscall-limit option in combination with --trace-path option. * * Copyright (c) 2023 The strace developers. * All rights reserved. diff --git a/tests/strace--syscall-limit-status.c b/tests/strace--syscall-limit-status.c index 9cd77a3be..f63fd34b1 100644 --- a/tests/strace--syscall-limit-status.c +++ b/tests/strace--syscall-limit-status.c @@ -1,5 +1,5 @@ /* - * Test -l/--syscall-limit with --status option. + * Test --syscall-limit option in combination with --status option. * * Copyright (c) 2023 The strace developers. * All rights reserved. diff --git a/tests/strace--syscall-limit.c b/tests/strace--syscall-limit.c index 3d8739224..374e3cc71 100644 --- a/tests/strace--syscall-limit.c +++ b/tests/strace--syscall-limit.c @@ -1,5 +1,5 @@ /* - * Test -l/--syscall-limit options. + * Test --syscall-limit option. * * Copyright (c) 2023 The strace developers. * All rights reserved. diff --git a/tests/strace--syscall-limit.test b/tests/strace--syscall-limit.test index bcc4a9545..00bf2c83d 100755 --- a/tests/strace--syscall-limit.test +++ b/tests/strace--syscall-limit.test @@ -1,6 +1,6 @@ #!/bin/sh -e # -# Check -l/--syscall-limit option. +# Check --syscall-limit option. # # Copyright (c) 2016-2023 The strace developers. # All rights reserved. |