Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@polymtl.ca (Mathieu Desnoyers)
Subject: [ltt-dev] [RFC UST] ustctl return value
Date: Tue, 7 Sep 2010 17:04:07 -0400	[thread overview]
Message-ID: <20100907210407.GB13695@Krystal> (raw)
In-Reply-To: <1283892002-2728-1-git-send-email-david.goulet@polymtl.ca>

* David Goulet (david.goulet at polymtl.ca) wrote:
> ---
>  ustctl/ustctl.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/ustctl/ustctl.c b/ustctl/ustctl.c
> index d290975..152fc07 100644
> --- a/ustctl/ustctl.c
> +++ b/ustctl/ustctl.c
> @@ -170,6 +170,7 @@ int main(int argc, char *argv[])
>  {
>  	pid_t *pidit;
>  	int result;
> +	int retval = EXIT_SUCCESS;
>  	char *tmp;
>  	struct ust_opts opts;
>  
> @@ -256,6 +257,7 @@ int main(int argc, char *argv[])
>  					fprintf(stderr,
>  						"error while trying to list markers for"
>  						" PID %u\n", (unsigned int) *pidit);
> +					retval = EXIT_FAILURE;
> /* I'm just not sure about the right thing to do here. Let's use a simple
>  * test case. We use ustctl to list markers for a certain PID
>  * but this process died before we were able to list markers. Right now,
>  * ustctl is returning 0 even if the command fails. So, is it good to return
>  * an EXIT_FAILURE value here or not? It's not quite ustctl that failed... so...?
>  *
>  * I'm asking because, as now, there is NO way of knowing if the command
>  * pass to ustctl was successful without "analysing" the error message
>  * on stderr (string manip). For scripting, it's not good nor cool...
>  */

I think it is important to let ustctl continue if there is an error (so
a bogus parameter on command line with multiple options won't stop the
marshalling). What you propose here looks good: continue marshalling,
but raise an error returned when it exits.

We should probably audit the other commands in this switch, which seem
to simply ignore the return values of what they call.

Thanks,

Mathieu

>  					break;
>  				}
>  				unsigned int i = 0;
> @@ -356,6 +358,6 @@ int main(int argc, char *argv[])
>  		free(opts.regex);
>  	}
>  
> -	return 0;
> +	return retval;
>  }
>  
> -- 
> 1.7.2.2
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




      reply	other threads:[~2010-09-07 21:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07 20:40 David Goulet
2010-09-07 21:04 ` Mathieu Desnoyers [this message]

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=20100907210407.GB13695@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    /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