All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Michael Neuling <mikey@neuling.org>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [PATCH] Documentation: fix getdelays.c example -l option and segv
Date: Wed, 15 Aug 2007 12:32:29 +0530	[thread overview]
Message-ID: <46C2A505.7040008@linux.vnet.ibm.com> (raw)
In-Reply-To: <18240.1186734285@neuling.org>

Michael Neuling wrote:
> Fix a couple of minor issues with the getdelays.c example code. 
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
>  Documentation/accounting/getdelays.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> Index: linux-2.6-ozlabs/Documentation/accounting/getdelays.c
> ===================================================================
> --- linux-2.6-ozlabs.orig/Documentation/accounting/getdelays.c
> +++ linux-2.6-ozlabs/Documentation/accounting/getdelays.c
> @@ -196,7 +196,7 @@ void print_delayacct(struct taskstats *t
>  	       "IO    %15s%15s\n"
>  	       "      %15llu%15llu\n"
>  	       "MEM   %15s%15s\n"
> -	       "      %15llu%15llu\n"
> +	       "      %15llu%15llu\n",

This change looks good!

>  	       "count", "real total", "virtual total", "delay total",
>  	       t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total,
>  	       t->cpu_delay_total,
> @@ -335,17 +335,17 @@ int main(int argc, char *argv[])
>  		}
>  	}
> 
> -	if (tid) {
> -		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
> -			      cmd_type, &tid, sizeof(__u32));
> -		PRINTF("Sent pid/tgid, retval %d\n", rc);
> -		if (rc < 0) {
> -			fprintf(stderr, "error sending tid/tgid cmd\n");
> -			goto done;
> +	do {
> +		if (tid) {
> +			rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
> +				      cmd_type, &tid, sizeof(__u32));
> +			PRINTF("Sent pid/tgid, retval %d\n", rc);
> +			if (rc < 0) {
> +				fprintf(stderr, "error sending tid/tgid cmd\n");
> +				goto done;
> +			}
>  		}
> -	}
> 
> -	do {
>  		int i;
> 
>  		rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
> @@ -430,6 +430,7 @@ int main(int argc, char *argv[])
>  			}
>  			na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
>  		}
> +		sleep(2);

Is this really required? a sleep() in the code. Why do we do multiple send_cmd()'s
in the do loop? I'll test and get back.

>  	} while (loop);
>  done:
>  	if (maskset) {
> 
> 
> 
> 


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

  parent reply	other threads:[~2007-08-15  7:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10  8:24 [PATCH] Documentation: fix getdelays.c example -l option and segv Michael Neuling
2007-08-10  8:33 ` Andrew Morton
2007-08-10  8:53   ` Michael Neuling
2007-08-15  7:02 ` Balbir Singh [this message]
2007-08-15  8:13   ` Michael Neuling
2007-08-15 11:20     ` Balbir Singh
2007-08-15 12:00       ` Michael Neuling
2007-08-15 12:08       ` [PATCH] Documentation: fix getdelays.c printf bug Michael Neuling
2007-08-15 13:15         ` Balbir Singh

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=46C2A505.7040008@linux.vnet.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikey@neuling.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.