lkml.org 
[lkml]   [2009]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf tools: add compatibility with libelf 0.8 and autodetect

* Lucas De Marchi <lucas.de.marchi@gmail.com> wrote:

> On Fri, Oct 23, 2009 at 19:48, Marti Raudsepp <marti@juffo.org> wrote:
> > On Sat, Oct 24, 2009 at 12:02 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >> Mind doing a small change:
> >>
> >> I think we want a small cleanup here: a perf_elf_begin() wrapper in a
> >> header file to hide this #ifdef. (That's how Git wraps environmental
> >> libraries as well.)
> >
> Why don't you do something like?:
>
> #ifdef LIBELF_NO_MMAP
> #define ELF_C_READ_MMAP ELF_C_READ
> #endif
> + changes to Makefile
>
> or:
>
> #ifndef ELF_C_READ_MMAP
> #define ELF_C_READ_MMAP ELF_C_READ
> #endif

Makes sense - i'd suggest to prefix it with PERF_ in that case, to make
sure all callsites are aware of the wrapped nature of this constant.

I.e. something like this:

/*
* libelf 0.8 and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
*/
#ifndef ELF_C_READ_MMAP
# define PERF_ELF_C_READ_MMAP ELF_C_READ
#endif

Ingo


\
 
 \ /
  Last update: 2009-10-24 10:33    [W:0.055 / U:1.796 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site