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: Show more elements of the signaler's argv[]
Date: Mon, 23 Sep 2019 16:08:50 +0300	[thread overview]
Message-ID: <20190923130850.GC4019@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20190923112011.18491-1-chris@chris-wilson.co.uk>

On Mon, Sep 23, 2019 at 12:20:11PM +0100, Chris Wilson wrote:
> /proc/$pid/cmdline is the entire argv[] including NUL-terminator.
> Replace the NULs with spaces so we get a better idea of who the
> signaler was, as often it is a subprocess (such as a child of sudo,
> or worse java).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala@intel.com>

Reviewed-by: Petri Latvala <petri.latvala@intel.com>



> ---
>  runner/executor.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/runner/executor.c b/runner/executor.c
> index f7183293d..91e8a7b20 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -625,7 +625,12 @@ static const char *get_cmdline(pid_t pid, char *buf, size_t len)
>  	if (len < 0)
>  		return "unknown";
>  
> -	buf[len] = '\0';
> +	/* cmdline is the whole argv[], completed with NUL-terminators */
> +	for (size_t i = 0; i < len; i++)
> +		if (buf[i] == '\0')
> +			buf[i] = ' ';
> +
> +	buf[len] = '\0'; /* but make sure that we return a valid string! */
>  	return buf;
>  }
>  
> @@ -907,7 +912,7 @@ static int monitor_output(pid_t child,
>  			} else {
>  				/* We're dying, so we're taking them with us */
>  				if (settings->log_level >= LOG_LEVEL_NORMAL) {
> -					char comm[80];
> +					char comm[120];
>  
>  					outf("Abort requested by %s [%d] via %s, terminating children\n",
>  					     get_cmdline(siginfo.ssi_pid, comm, sizeof(comm)),
> -- 
> 2.23.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-09-23 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 11:20 [igt-dev] [PATCH i-g-t] runner: Show more elements of the signaler's argv[] Chris Wilson
2019-09-23 12:27 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-09-23 13:08 ` Petri Latvala [this message]
2019-09-23 18:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20190923130850.GC4019@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