From: David Ahern <dsahern@gmail.com>
To: Pekka Enberg <penberg@kernel.org>,
Bernhard Rosenkraenzer <bernhard.rosenkranzer@linaro.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCHv2 1/1] perf: Port to Android
Date: Thu, 23 Aug 2012 15:32:50 -0600 [thread overview]
Message-ID: <5036A182.7030707@gmail.com> (raw)
In-Reply-To: <CAOJsxLFgvqJUwwnrtH8b9eOfNzUEZDmQGP1FVvToitD6ayYP0g@mail.gmail.com>
On 8/23/12 2:51 PM, Pekka Enberg wrote:
>> +#ifdef ANDROID
>> +/* While stdlib.h has a prototype for it,
>> + Bionic doesn't actually implement on_exit() */
>> +#ifndef ATEXIT_MAX
>> +#define ATEXIT_MAX 32
>> +#endif
>> +static int __on_exit_count = 0;
>> +typedef void (*on_exit_func_t)(int, void*);
>> +static on_exit_func_t __on_exit_funcs[ATEXIT_MAX];
>> +static void *__on_exit_args[ATEXIT_MAX];
>> +static int __exitcode = 0;
>> +static void __handle_on_exit_funcs();
>> +static int on_exit(on_exit_func_t function, void *arg);
>> +#define exit(x) (exit)(__exitcode = (x))
>> +
>> +static int on_exit(on_exit_func_t function, void *arg) {
>> + if(__on_exit_count == ATEXIT_MAX)
>> + return ENOMEM;
>> + else if(__on_exit_count == 0)
>> + atexit(__handle_on_exit_funcs);
>> + __on_exit_funcs[__on_exit_count] = function;
>> + __on_exit_args[__on_exit_count++] = arg;
>> + return 0;
>> +}
>> +
>> +static void __handle_on_exit_funcs() {
>> + for(int i=0; i<__on_exit_count; i++) {
>> + __on_exit_funcs[i](__exitcode, __on_exit_args[i]);
>> + }
>> +}
>> +#endif
>> +
Why not add support for the missing functions (on_exit, getsid, psignal
and getline) to Bionic instead of perf?
>> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
>> index 0f99f39..77c5ced 100644
>> --- a/tools/perf/util/util.h
>> +++ b/tools/perf/util/util.h
>> @@ -70,15 +70,19 @@
>> #include <sys/socket.h>
>> #include <sys/ioctl.h>
>> #include <sys/select.h>
>> +#ifndef ANDROID
>> #include <netinet/in.h>
>> #include <netinet/tcp.h>
>> #include <arpa/inet.h>
>> +#endif
>> #include <netdb.h>
netinet/*, arpa/inet.h,netdb.h and sys/socket.h can be removed from util.h
David
next prev parent reply other threads:[~2012-08-23 21:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 15:01 [PATCHv2 1/1] perf: Port to Android Bernhard Rosenkraenzer
2012-08-23 20:51 ` Pekka Enberg
2012-08-23 21:32 ` David Ahern [this message]
2012-08-24 4:08 ` Matthew Garrett
2012-08-24 8:35 ` Ingo Molnar
2012-08-24 12:30 ` Alan Cox
2012-08-24 18:02 ` Ingo Molnar
2012-08-24 9:02 ` Namhyung Kim
2012-08-24 9:09 ` Namhyung Kim
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=5036A182.7030707@gmail.com \
--to=dsahern@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=bernhard.rosenkranzer@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@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