handle xlat styles ioprio

shankarapailoor shankarapailoor at gmail.com
Sun Feb 17 16:23:53 UTC 2019


Hi Dmitry,

Sorry for the late reply.

>Why do you handle XLAT_STYLE_VERBOSE as XLAT_STYLE_RAW here?

Good question. I think I handled both cases the same because I didn't know
if verbose should print the auxiliary string after the return value. If you
think it should then I'm ok with leaving it back in.

>The check for XLAT_STYLE_RAW seems to be redundant here.

Sorry but I don't see how it is. If I don't include the check, then under
XLAT_STYLE_RAW, we will call tprints(sprint_ioprio(tcp->u_arg[2]) after
printing the raw value which seems wrong.

On Fri, Feb 8, 2019 at 7:37 PM Dmitry V. Levin <ldv at altlinux.org> wrote:

> Hi,
>
> On Fri, Jan 11, 2019 at 09:02:50PM -0800, shankarapailoor wrote:
> > Hi,
> >
> > I noticed that strace doesn't properly handle xlat_styles when
> > decoding the ioprio_who field in ioprio_set. This patch fixes that.
> >
> > Regards,
> > Shankara Pailoor
>
> > From 842f09d4f91b6b9fae82f9e6eb81d4b241f9e546 Mon Sep 17 00:00:00 2001
> > From: Shankara Pailoor <shankarapailoor at gmail.com>
> > Date: Fri, 11 Jan 2019 20:59:00 -0800
> > Subject: [PATCH v1] handle xlat_styles when decoding ioprio_get and set
> >
> > * ioprio.c (ioprio_get, SYS_FUNC(ioprio_set)): Only print auxstring in
> abbrev.
> > Handle xlat_styles.
> > * tests/ioprio.c: Add xlat macros.
> > * tests/ioprio-Xabbrev.c: New test.
> > * tests/ioprio-Xraw.c: Likewise.
> > * tests/ioprio-Xverbose.c: Likewise.
> > * tests/pure_executables.list: Add new tests ioprio-Xabbrev, ioprio-Xraw,
> > ioprio-Xverbose.
> > * tests/gen_tests.in: Likewise.
> > * tests/.gitignore: Likewise.
> > ---
> >  ioprio.c                    | 16 ++++++++++---
> >  tests/.gitignore            |  3 +++
> >  tests/gen_tests.in          |  3 +++
> >  tests/ioprio-Xabbrev.c      |  1 +
> >  tests/ioprio-Xraw.c         |  2 ++
> >  tests/ioprio-Xverbose.c     |  2 ++
> >  tests/ioprio.c              | 47 +++++++++++++++++++++++++++++++++----
> >  tests/pure_executables.list |  3 +++
> >  8 files changed, 69 insertions(+), 8 deletions(-)
> >  create mode 100644 tests/ioprio-Xabbrev.c
> >  create mode 100644 tests/ioprio-Xraw.c
> >  create mode 100644 tests/ioprio-Xverbose.c
> >
> > diff --git a/ioprio.c b/ioprio.c
> > index 2d7c4f6a..9b378450 100644
> > --- a/ioprio.c
> > +++ b/ioprio.c
> > @@ -45,8 +45,11 @@ SYS_FUNC(ioprio_get)
> >       } else {
> >               if (syserror(tcp))
> >                       return 0;
> > -
> > -             tcp->auxstr = sprint_ioprio(tcp->u_rval);
> > +             if ((xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) ||
> > +                 (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE))
> > +                     tcp->auxstr = NULL;
> > +             else
> > +                     tcp->auxstr = sprint_ioprio(tcp->u_rval);
> >               return RVAL_STR;
>
> Why do you handle XLAT_STYLE_VERBOSE as XLAT_STYLE_RAW here?
>
> >       }
> >  }
> > @@ -58,7 +61,14 @@ SYS_FUNC(ioprio_set)
> >       /* int who */
> >       tprintf(", %d, ", (int) tcp->u_arg[1]);
> >       /* int ioprio */
> > -     tprints(sprint_ioprio(tcp->u_arg[2]));
> > +     if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
> > +             tprintf("%d", (int) tcp->u_arg[2]);
> > +
> > +     if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
> > +             return RVAL_DECODED;
> > +
> > +     (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE
> > +             ? tprints_comment : tprints)(sprint_ioprio(tcp->u_arg[2]));
> >
> >       return RVAL_DECODED;
>
> The check for XLAT_STYLE_RAW seems to be redundant here.
>
>
> --
> ldv
> --
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel
>


-- 
Regards,
Shankara Pailoor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190217/7712dcba/attachment.html>


More information about the Strace-devel mailing list