[PATCH v3 2/3] The -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:

Kohl, Burkhard burkhard.kohl at intel.com
Mon May 27 07:28:07 UTC 2019


> From: Paul Chaignon [mailto:paul.chaignon at gmail.com]
> Sent: Friday, May 24, 2019 21:55
> To: Dmitry V. Levin <ldv at altlinux.org>
> Cc: strace development discussions <strace-devel at lists.strace.io>; Kohl, Burkhard
> <burkhard.kohl at intel.com>
> Subject: Re: [PATCH v3 2/3] The -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:
>
> On Wed, May 22, 2019 at 01:13PM, Dmitry V. Levin wrote:
> > On Mon, May 13, 2019 at 04:00:31PM +0000, Kohl, Burkhard wrote:
> > [...]
> > > > > diff --git a/strace.1.in b/strace.1.in index 76a74119..6ab95836
> > > > > 100644
> > > > > --- a/strace.1.in
> > > > > +++ b/strace.1.in
> > > > > @@ -771,6 +771,13 @@ Print unabbreviated versions of environment, stat, termios, etc.
> > > > >  calls.  These structures are very common in calls and so the
> > > > > default behavior displays a reasonable subset of structure
> > > > > members.  Use  this option to get all of the gory details.
> > > > > +.TP
> > > > > +.B \-z
> > > > > +Print successful syscalls only.
> > > >
> > > > It might be better to be precise here regarding what we mean by
> > > > "successful" exactly.  Maybe "Print only syscalls that did not return an error code"?
> > >
> > > Seems there are 3 possible outcomes for a syscall:
> > > - zero/successful
> > > - non-zero/not successful
> > > - void
> >
> > Strictly speaking, there are more than 3 possible outcomes for a syscall:
> > - syscall returns with an error
> > - syscall returns without an error
> > - syscall returns but strace fails to fetch error status (see e.g.
> > <unavailable>)
> > - syscall does not return because of PTRACE_EVENT_EXIT (see
> > print_event_exit)
> > - syscall does not return because of process disappearance (e.g. due
> > to execve in a neighbour thread)
> > - strace detaches after entering syscall
> >
> > I'm inclined to think that -z/-Z options are not versatile enough to
> > cover this diversity.
> >
> > Should we implement a more flexible syntax instead?
> > For example, we could have a traditional -e qualifier=set syntax,
> > where set is a subset of all, successful, failed, exited, unavailable,
> > unfinished, detached.
>
> I'll have to figure out how to test each case, but it makes sense to me.
>
> What about -e status=set for the syntax?  Should we also keep -z/-Z as aliases for successful and failed
> respectively?  These two are likely to be more common options.
>
> Paul

I also think that -z/-Z will cover the majority of use cases and therefore might worth to be kept.

Burkhard
> >
> >
> > --
> > ldv
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928



More information about the Strace-devel mailing list