Re: perf: don't use obsolete getpagesize

From: Arnaldo Carvalho de Melo
Date: Thu Jan 14 2010 - 12:49:12 EST


Em Thu, Jan 14, 2010 at 12:43:20PM -0500, Ulrich Drepper escreveu:
> perf uses the obsolete getpagesize function. Let's do better and use the
> correct POSIX interface to get the information: sysconf.
>
>
> Signed-off-by: Ulrich Drepper <drepper@xxxxxxxxxx>

I have this already in my queue, thanks!

acme@parisc:~/git/linux-2.6-tip$ git show 578bb387c17692896a2a7c6b8bcba2c3945c33f4
commit 578bb387c17692896a2a7c6b8bcba2c3945c33f4
Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Date: Thu Jan 14 14:10:35 2010 -0200

perf tools: Convert getpagesize() uses to sysconf(_SC_GETPAGESIZE)

Using the more portable and equivalent sysconf call.

Reported-by: Aristeu Rozanski <aris@xxxxxxxxxx>
Cc: Aristeu Rozanski <aris@xxxxxxxxxx>
Cc: Frédéric Weisbecker <fweisbec@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 604e14f..1951e33 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -384,7 +384,7 @@ int perf_session__process_events(struct perf_session *self,

perf_event_ops__fill_defaults(ops);

- page_size = getpagesize();
+ page_size = sysconf(_SC_PAGESIZE);

head = self->header.data_offset;

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 407fd65..5ea8973 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -515,7 +515,7 @@ int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
write_or_die(buf, 1);

/* save page_size */
- page_size = getpagesize();
+ page_size = sysconf(_SC_PAGESIZE);
write_or_die(&page_size, 4);

read_header_files();
acme@parisc:~/git/linux-2.6-tip$
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/