[PATCH v7 3/4] Implement -e status=set option

Dmitry V. Levin ldv at altlinux.org
Sat Jul 6 22:08:06 UTC 2019


On Sat, Jul 06, 2019 at 09:19:57AM +0200, Paul Chaignon wrote:
[...]
> +.BR select (2)
> +is called, but a different thread calls
> +.BR clock_gettime (2)
> +before
> +.BR select (2)
> +finishes:
> +.CW
> +[pid 28779] clock_gettime(CLOCK_REALTIME, {1130322148, 939977000}) = 0
> +[pid 28772] select(4, [3], NULL, NULL, NULL <unfinished ...>
> +[pid 28772] <... select resumed> )      = 1 (in [3])

I think in case of staging output this unfinished/resumed diagnostics
is redundant and could be easily avoided, e.g.

--- a/strace.c
+++ b/strace.c
@@ -605,7 +605,9 @@ printleader(struct tcb *tcp)
 
 	if (printing_tcp) {
 		set_current_tcp(printing_tcp);
-		if (printing_tcp->curcol != 0 && (followfork < 2 || printing_tcp == tcp)) {
+		if (tcp->real_outf == NULL &&
+		    printing_tcp->curcol != 0 &&
+		    (followfork < 2 || printing_tcp == tcp)) {
 			/*
 			 * case 1: we have a shared log (i.e. not -ff), and last line
 			 * wasn't finished (same or different tcb, doesn't matter).
--- a/syscall.c
+++ b/syscall.c
@@ -721,7 +721,7 @@ print_syscall_resume(struct tcb *tcp)
 	 * "strace -ff -oLOG test/threaded_execve" corner case.
 	 * It's the only case when -ff mode needs reprinting.
 	 */
-	if ((followfork < 2 && printing_tcp != tcp)
+	if ((followfork < 2 && printing_tcp != tcp && tcp->real_outf == NULL)
 	    || (tcp->flags & TCB_REPRINT)) {
 		tcp->flags &= ~TCB_REPRINT;
 		printleader(tcp);


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190707/56a18e5b/attachment.bin>


More information about the Strace-devel mailing list