[PATCH v5 2/4] Stage output for -z and -Z options

Dmitry V. Levin ldv at altlinux.org
Mon Jul 1 23:07:15 UTC 2019


On Fri, Jun 28, 2019 at 11:34:02AM +0200, Paul Chaignon wrote:
> -z and -Z options print only successful and failing syscalls respectively.
> However, failure of syscall is only known after syscall return.  Thus, we
> end up with something like this on, e.g., ENOENT:
> 
>   open("does_not_exist", O_RDONLY <unfinished ...>
> 
> whereas the intended result is that the open(...) line is not shown at all.
> 
> This patch fixes this issue using open_memstream.  When either the -z or
> the -Z option is used, the output is staged in memory (using
> open_memstream) until we know the syscall return status.  If the
> open_memstream function is not available, these new options error out.

I have no more comments on 1/4 and 2/4.
Just a few corrections to this commit message:

> * stage_output.c: New file.
> * defs.h (tcb): Add real_outf, memfptr, memfloc fields for memstream.

(struct tcb)

> (strace_open_memstream): New prototype.
> (strace_close_memstream): New prototype.

(strace_open_memstream, strace_close_memstream): New prototypes.

> * Makefile.am: Add stage_output.c.

* Makefile.am (strace_SOURCES): Add stage_output.c.

> * configure.ac: Add open_memstream.

* configure.ac (AC_CHECK_FUNCS): Add open_memstream.


-- 
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/20190702/2f191f50/attachment.bin>


More information about the Strace-devel mailing list