lkml.org 
[lkml]   [2013]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 14/16] perf kvm: reuse some code of perf_kvm__timerfd_create()

    btw., I tried to build perf on a really old distro that has no timerfd.h,
    and got:

    builtin-kvm.c:22:25: error: sys/timerfd.h: No such file or directory
    cc1: warnings being treated as errors
    builtin-kvm.c: In function ‘perf_kvm__timerfd_create’:
    builtin-kvm.c:967: warning: implicit declaration of function ‘timerfd_create’
    builtin-kvm.c:967: warning: nested extern declaration of ‘timerfd_create’
    builtin-kvm.c:967: error: ‘TFD_NONBLOCK’ undeclared (first use in this function)
    builtin-kvm.c:967: error: (Each undeclared identifier is reported only once
    builtin-kvm.c:967: error: for each function it appears in.)
    builtin-kvm.c:978: warning: implicit declaration of function ‘timerfd_settime’
    builtin-kvm.c:978: warning: nested extern declaration of ‘timerfd_settime’
    make: *** [builtin-kvm.o] Error 1
    make: *** Waiting for unfinished jobs....

    The quick patch below made it build - but it's incomplete, I have not
    filled in the config/* details to generate HAVE_TIMERFD, I only made
    builtin-kvm.o build.

    Thanks,

    Ingo

    diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
    index 935d522..5cae8f2 100644
    --- a/tools/perf/builtin-kvm.c
    +++ b/tools/perf/builtin-kvm.c
    @@ -19,7 +19,22 @@
    #include "util/top.h"

    #include <sys/prctl.h>
    -#include <sys/timerfd.h>
    +#ifdef HAVE_TIMERFD
    +# include <sys/timerfd.h>
    +#else
    +# define TFD_NONBLOCK -1
    +static int timerfd_create(clockid_t __clock_id __maybe_unused, int __flags __maybe_unused)
    +{
    + return -1;
    +}
    +static int timerfd_settime(int __ufd __maybe_unused, int __flags __maybe_unused,
    + const struct itimerspec *__utmr __maybe_unused,
    + struct itimerspec *__otmr __maybe_unused)
    +{
    + return -1;
    +}
    +
    +#endif

    #include <termios.h>
    #include <semaphore.h>
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2013-09-12 15:21    [W:2.991 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site