public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: a.p.zijlstra@chello.nl, eranian@google.com, fweisbec@gmail.com,
	linux-kernel@vger.kernel.org, lizf@cn.fujitsu.com, mingo@elte.hu,
	paulus@samba.org
Subject: Re: perf: don't use obsolete getpagesize
Date: Thu, 14 Jan 2010 15:48:23 -0200	[thread overview]
Message-ID: <20100114174823.GA2600@ghostprotocols.net> (raw)
In-Reply-To: <201001141743.o0EHhKUV023427@hs20-bc2-1.build.redhat.com>

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@redhat.com>

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@redhat.com>
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@redhat.com>
    Cc: Aristeu Rozanski <aris@redhat.com>
    Cc: Frédéric Weisbecker <fweisbec@gmail.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Paul Mackerras <paulus@samba.org>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

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$

      reply	other threads:[~2010-01-14 17:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 17:43 perf: don't use obsolete getpagesize Ulrich Drepper
2010-01-14 17:48 ` Arnaldo Carvalho de Melo [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=20100114174823.GA2600@ghostprotocols.net \
    --to=acme@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=drepper@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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