public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] runner: Add signal sender name when dying
Date: Wed, 18 Sep 2019 13:45:33 +0300	[thread overview]
Message-ID: <20190918104533.GW4019@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20190918103518.22012-1-chris@chris-wilson.co.uk>

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@chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala@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.



-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-09-18 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 10:35 [igt-dev] [PATCH i-g-t] runner: Add signal sender name when dying Chris Wilson
2019-09-18 10:45 ` Petri Latvala [this message]
2019-09-18 10:49   ` Chris Wilson
2019-09-18 11:23     ` Petri Latvala
2019-09-18 12:41 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190918104533.GW4019@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox