All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] tools: add tst_ncpus/_max api to get number of CPUS
Date: Wed, 17 Oct 2012 00:31:22 -0400	[thread overview]
Message-ID: <201210170031.23266.vapier@gentoo.org> (raw)
In-Reply-To: <1350443616-20186-1-git-send-email-gaowanlong@cn.fujitsu.com>


[-- Attachment #1.1: Type: Text/Plain, Size: 873 bytes --]

On Tuesday 16 October 2012 23:13:36 Wanlong Gao wrote:
> --- a/tools/apicmds/ltpapicmd.c
> +++ b/tools/apicmds/ltpapicmd.c
> @@ -266,6 +266,12 @@ int main(int argc, char *argv[])
>  		else if (exit_value > 0)
>  			exit_value = 2;
>  		exit(exit_value);
> +	} else if (strcmp(cmd_name, "tst_ncpus") == 0) {
> +		long exit_ncpus = tst_ncpus();
> +		exit(exit_ncpus);
> +	} else if (strcmp(cmd_name, "tst_ncpus_max") == 0) {
> +		long exit_ncpus_max = tst_ncpus_max();
> +		exit(exit_ncpus_max);
>  	}

i'm afraid exit() won't work.  the value is anded with 0xff which means if you 
have a system with 4096 cpus, these will exit(0) and obviously that isn't what 
you want :).  plus, extracting the value from the exit status is not normal 
behavior in the shell scripting world.

simply write it to stdout instead:
	printf("%li\n", tst_ncpus());
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 240 bytes --]

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2012-10-17  4:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1349679654-16708-1-git-send-email-GuoJian.Zhou@windriver.com>
     [not found] ` <201210150014.47389.vapier@gentoo.org>
     [not found]   ` <507B9964.8070905@windriver.com>
     [not found]     ` <201210151332.57424.vapier@gentoo.org>
2012-10-15 18:18       ` [LTP] [PATCH] There was no "processor" key word in the "cpuinfo" on the non-SMP ARM Platforms. So the tracing "ftrace_buffer_size.sh" script would report "division by 0" error, then it would exit soon. The tracing test would check failed when it could not find this script running chrubis
2012-10-15 18:21         ` chrubis
     [not found]           ` <1350443616-20186-1-git-send-email-gaowanlong@cn.fujitsu.com>
2012-10-17  4:31             ` Mike Frysinger [this message]
2012-10-17  7:13               ` [LTP] [PATCH] tools: add tst_ncpus/_max api to get number of CPUS Wanlong Gao
2012-10-17 14:09               ` chrubis
2012-10-17 13:00             ` chrubis

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=201210170031.23266.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=ltp-list@lists.sourceforge.net \
    /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.