[PATCH v2] Add -m flag to list system calls of a class.

Dmitry V. Levin ldv at altlinux.org
Fri Jul 15 09:40:58 UTC 2016


On Fri, Jul 15, 2016 at 08:48:53AM +0200, Amin Khorsandi wrote:
> On Thu, Jul 14, 2016 at 7:43 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> 
> > On Tue, Jul 12, 2016 at 03:30:37PM +0200, Amin Khorsandiaghai wrote:
> > > ---
> > >  strace.1  |  5 +++++
> > >  strace.c  |  6 +++++-
> > >  syscall.c | 21 +++++++++++++++++++++
> > >  3 files changed, 31 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/strace.1 b/strace.1
> > > index b7dddc0..5f5c1cc 100644
> > > --- a/strace.1
> > > +++ b/strace.1
> > > @@ -488,6 +488,11 @@ When strace can be interrupted by signals (such as
> > pressing ^C).
> > >  4: fatal signals and SIGTSTP (^Z) are always blocked (useful to make
> > >  strace -o FILE PROG not stop on ^Z).
> > >  .TP
> > > +.BI "\-m " traceclass
> > > +List all system calls in a trace class. For example
> > > +.BR "\-m file"
> > > +prints the list of all system calls in file class.
> > > +.TP
> >
> > Why -m?
> >
> > It was not taken already! :P
> May I choose something like -e class=file?

All currently supported "-e expr" options are modifiers what/how to trace.
Unlike them, this option doesn't support expressions, it just
lists something and exits.

If you really to extend "-e expr" syntax, it has to support everything
that "-e trace=set1,set2,.." supports.

For example, -e list_syscalls=set1,set2,..

> > > @@ -1601,6 +1601,10 @@ init(int argc, char *argv[])
> > >               case 'e':
> > >                       qualify(optarg);
> > >                       break;
> > > +             case 'm':
> > > +                     print_trace_class(optarg);
> >
> > The code shouldn't cause compilation warnings.
> >
> > I did not get any warnings when doing make!

A global function has to be declared before use.

> What is the line length limit?

80.

> Also do you know how can I filter out the duplicated system calls which are
> shared between
> personalities? Should I implement a solution for it or is there already a
> way for this?
> For example open system call exist in all three personalities available in
> x86_64 systems.
> I want to only print one of them.

For example, you can first filter all requested syscalls,
then sort the list of filtered syscall names,
then remove duplicated names and print them.


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


More information about the Strace-devel mailing list