[igt-dev] [PATCH i-g-t] runner: Add signal sender name when dying

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 18 10:49:57 UTC 2019


Quoting Petri Latvala (2019-09-18 11:45:33)
> On Wed, Sep 18, 2019 at 11:35:18AM +0100, Chris Wilson wrote:
> > We want to know who sent us the fatal signal, for there are plenty of
> > fingers to go around.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Petri Latvala <petri.latvala at intel.com>
> > ---
> >  runner/executor.c | 29 +++++++++++++++++++++++++++--
> >  1 file changed, 27 insertions(+), 2 deletions(-)
> > 
> > diff --git a/runner/executor.c b/runner/executor.c
> > index c1cfcce83..f7183293d 100644
> > --- a/runner/executor.c
> > +++ b/runner/executor.c
> > @@ -609,6 +609,26 @@ static bool kill_child(int sig, pid_t child)
> >       return true;
> >  }
> >  
> > +static const char *get_cmdline(pid_t pid, char *buf, size_t len)
> > +{
> > +     int fd;
> > +
> > +     if (snprintf(buf, len, "/proc/%d/cmdline", pid) > len)
> > +             return "unknown";
> > +
> > +     fd = open(buf, O_RDONLY);
> > +     if (fd < 0)
> > +             return "unknown";
> > +
> > +     len = read(fd, buf, len - 1);
> > +     close(fd);
> > +     if (len < 0)
> > +             return "unknown";
> > +
> > +     buf[len] = '\0';
> > +     return buf;
> > +}
> 
> Are you intentionally only printing argv[0]? argv items are
> \0-separated in /proc/*/cmdline.

Yes, we only want a human friendly process name, or do we need the full
cmdline because it's java??? If it's java, I'm running away.
-Chris


More information about the igt-dev mailing list