mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Han Pingtian <phan@redhat.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] perftools: Fix return values checking and build on older glibc
Date: Tue, 25 Jan 2011 07:39:00 +0800	[thread overview]
Message-ID: <20110124233900.GA3443@epc900.nay.redhat.com> (raw)

Just like 57b84e53171ce, port the fixing to test__open_syscall_event_on_all_cpus() to
test__basic_mmap(). And check to right return values.

Signed-off-by: Han Pingtian <phan@redhat.com>
---
 tools/perf/builtin-test.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 4b0ef5f..4fac856 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -456,8 +456,7 @@ static int test__basic_mmap(void)
 		.sample_type	= PERF_SAMPLE_ID,
 		.watermark	= 0,
 	};
-	cpu_set_t *cpu_set;
-	size_t cpu_set_size;
+	cpu_set_t cpu_set;
 	const char *syscall_names[] = { "getsid", "getppid", "getpgrp",
 					"getpgid", };
 	pid_t (*syscalls[])(void) = { (void *)getsid, getppid, getpgrp,
@@ -488,26 +487,17 @@ static int test__basic_mmap(void)
 	}
 
 	cpus = cpu_map__new(NULL);
-	if (threads == NULL) {
-		pr_debug("thread_map__new\n");
+	if (cpus == NULL) {
+		pr_debug("cpu_map__new\n");
 		goto out_free_threads;
 	}
 
-	cpu_set = CPU_ALLOC(cpus->nr);
-
-	if (cpu_set == NULL) {
-		pr_debug("thread_map__new\n");
-		goto out_free_cpus;
-	}
-
-	cpu_set_size = CPU_ALLOC_SIZE(cpus->nr);
-	CPU_ZERO_S(cpu_set_size, cpu_set);
-	CPU_SET(cpus->map[0], cpu_set);
-	sched_setaffinity(0, cpu_set_size, cpu_set);
-	CPU_FREE(cpu_set);
+	CPU_ZERO(&cpu_set);
+	CPU_SET(cpus->map[0], &cpu_set);
+	sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
 
 	evlist = perf_evlist__new();
-	if (threads == NULL) {
+	if (evlist == NULL) {
 		pr_debug("perf_evlist__new\n");
 		goto out_free_cpus;
 	}
-- 
1.7.3.4

             reply	other threads:[~2011-01-24 23:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 23:39 Han Pingtian [this message]
2011-01-28 21:05 ` [tip:perf/core] perf test: Fix return values checking tip-bot for Han Pingtian

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=20110124233900.GA3443@epc900.nay.redhat.com \
    --to=phan@redhat.com \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®