[Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
We define gettid() using syscall() because glibc does not provide a wrapper. Android's bionic got the syscall covered though. Signed-off-by: Arkadiusz Hiler--- lib/igt_aux.h | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/igt_aux.h b/lib/igt_aux.h index e62858e..54b9716 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -43,7 +43,12 @@ extern int num_trash_bos; #define NSEC_PER_SEC (1000*USEC_PER_SEC) /* signal interrupt helpers */ +#ifdef ANDROID +#include /* on Android bionic has this implemented */ +#else #define gettid() syscall(__NR_gettid) +#endif + #define sigev_notify_thread_id _sigev_un._tid /* auxialiary igt helpers from igt_aux.c */ -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
On Wed, Apr 19, 2017 at 05:23:46PM +0300, Jani Nikula wrote: > On Wed, 19 Apr 2017, Arkadiusz Hilerwrote: > > On Wed, Apr 19, 2017 at 03:22:19PM +0300, Jani Nikula wrote: > >> On Wed, 19 Apr 2017, Arkadiusz Hiler wrote: > >> > We define gettid() using syscall() because glibc does not provide a > >> > wrapper. > >> > > >> > Android's bionic got the syscall covered though. > >> > > >> > Signed-off-by: Arkadiusz Hiler > >> > --- > >> > lib/igt_aux.h | 5 + > >> > 1 file changed, 5 insertions(+) > >> > > >> > diff --git a/lib/igt_aux.h b/lib/igt_aux.h > >> > index e62858e..54b9716 100644 > >> > --- a/lib/igt_aux.h > >> > +++ b/lib/igt_aux.h > >> > @@ -43,7 +43,12 @@ extern int num_trash_bos; > >> > #define NSEC_PER_SEC (1000*USEC_PER_SEC) > >> > > >> > /* signal interrupt helpers */ > >> > +#ifdef ANDROID > >> > >> Seems like this should be something like HAVE_GETTID, defined by > >> configure or by android makefiles? > > > > Yeah, but that's not that easy (yet) and that's not the only area which > > would use it - notice the thing with cairo from the cover letter. > > > > config.h is generated in a ugly way for Android - lib/Android.mk does > > that. Also if you ./configure it stops compiling for Android causing > > confusing error. > > > > Whole area could use some heavy reworking. > > > > One approach would be to mimic what other projects do: > > > > * have config_android.h with set of sane #defines (as environment is > >more static and there is no ac/am) > > > > * don't define HAVE_CONFIG_H and just `-include config_android.h` on... > >Android > > > > * add gettid() discovery via ac for Linux (I don't think that any > >libc other than bionic wraps that call though) > > > > > > But that would made a whole series. > > I would like to go with #ifdef ANDROID for now. > > Fair enough. > > It's just that I cringe seeing #ifdef instead of #ifdef > , when and are not interchangeable or > 1:1. For example, glibc might include gettid later. > > BR, > Jani. I completetly get that, I had mixed feeling adding the ifdef. ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
On Wed, 19 Apr 2017, Arkadiusz Hilerwrote: > On Wed, Apr 19, 2017 at 03:22:19PM +0300, Jani Nikula wrote: >> On Wed, 19 Apr 2017, Arkadiusz Hiler wrote: >> > We define gettid() using syscall() because glibc does not provide a >> > wrapper. >> > >> > Android's bionic got the syscall covered though. >> > >> > Signed-off-by: Arkadiusz Hiler >> > --- >> > lib/igt_aux.h | 5 + >> > 1 file changed, 5 insertions(+) >> > >> > diff --git a/lib/igt_aux.h b/lib/igt_aux.h >> > index e62858e..54b9716 100644 >> > --- a/lib/igt_aux.h >> > +++ b/lib/igt_aux.h >> > @@ -43,7 +43,12 @@ extern int num_trash_bos; >> > #define NSEC_PER_SEC (1000*USEC_PER_SEC) >> > >> > /* signal interrupt helpers */ >> > +#ifdef ANDROID >> >> Seems like this should be something like HAVE_GETTID, defined by >> configure or by android makefiles? > > Yeah, but that's not that easy (yet) and that's not the only area which > would use it - notice the thing with cairo from the cover letter. > > config.h is generated in a ugly way for Android - lib/Android.mk does > that. Also if you ./configure it stops compiling for Android causing > confusing error. > > Whole area could use some heavy reworking. > > One approach would be to mimic what other projects do: > > * have config_android.h with set of sane #defines (as environment is >more static and there is no ac/am) > > * don't define HAVE_CONFIG_H and just `-include config_android.h` on... >Android > > * add gettid() discovery via ac for Linux (I don't think that any >libc other than bionic wraps that call though) > > > But that would made a whole series. > I would like to go with #ifdef ANDROID for now. Fair enough. It's just that I cringe seeing #ifdef instead of #ifdef , when and are not interchangeable or 1:1. For example, glibc might include gettid later. BR, Jani. -- Jani Nikula, Intel Open Source Technology Center ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
On Wed, Apr 19, 2017 at 03:22:19PM +0300, Jani Nikula wrote: > On Wed, 19 Apr 2017, Arkadiusz Hilerwrote: > > We define gettid() using syscall() because glibc does not provide a > > wrapper. > > > > Android's bionic got the syscall covered though. > > > > Signed-off-by: Arkadiusz Hiler > > --- > > lib/igt_aux.h | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/lib/igt_aux.h b/lib/igt_aux.h > > index e62858e..54b9716 100644 > > --- a/lib/igt_aux.h > > +++ b/lib/igt_aux.h > > @@ -43,7 +43,12 @@ extern int num_trash_bos; > > #define NSEC_PER_SEC (1000*USEC_PER_SEC) > > > > /* signal interrupt helpers */ > > +#ifdef ANDROID > > Seems like this should be something like HAVE_GETTID, defined by > configure or by android makefiles? Yeah, but that's not that easy (yet) and that's not the only area which would use it - notice the thing with cairo from the cover letter. config.h is generated in a ugly way for Android - lib/Android.mk does that. Also if you ./configure it stops compiling for Android causing confusing error. Whole area could use some heavy reworking. One approach would be to mimic what other projects do: * have config_android.h with set of sane #defines (as environment is more static and there is no ac/am) * don't define HAVE_CONFIG_H and just `-include config_android.h` on... Android * add gettid() discovery via ac for Linux (I don't think that any libc other than bionic wraps that call though) But that would made a whole series. I would like to go with #ifdef ANDROID for now. -- Cheers, Arek > > +#include /* on Android bionic has this implemented */ > > +#else > > #define gettid() syscall(__NR_gettid) > > +#endif > > + > > #define sigev_notify_thread_id _sigev_un._tid > > > > /* auxialiary igt helpers from igt_aux.c */ ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
On Wed, 19 Apr 2017, Arkadiusz Hilerwrote: > We define gettid() using syscall() because glibc does not provide a > wrapper. > > Android's bionic got the syscall covered though. > > Signed-off-by: Arkadiusz Hiler > --- > lib/igt_aux.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/lib/igt_aux.h b/lib/igt_aux.h > index e62858e..54b9716 100644 > --- a/lib/igt_aux.h > +++ b/lib/igt_aux.h > @@ -43,7 +43,12 @@ extern int num_trash_bos; > #define NSEC_PER_SEC (1000*USEC_PER_SEC) > > /* signal interrupt helpers */ > +#ifdef ANDROID Seems like this should be something like HAVE_GETTID, defined by configure or by android makefiles? BR, Jani. > +#include /* on Android bionic has this implemented */ > +#else > #define gettid() syscall(__NR_gettid) > +#endif > + > #define sigev_notify_thread_id _sigev_un._tid > > /* auxialiary igt helpers from igt_aux.c */ -- Jani Nikula, Intel Open Source Technology Center ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android
We define gettid() using syscall() because glibc does not provide a wrapper. Android's bionic got the syscall covered though. Signed-off-by: Arkadiusz Hiler--- lib/igt_aux.h | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/igt_aux.h b/lib/igt_aux.h index e62858e..54b9716 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -43,7 +43,12 @@ extern int num_trash_bos; #define NSEC_PER_SEC (1000*USEC_PER_SEC) /* signal interrupt helpers */ +#ifdef ANDROID +#include /* on Android bionic has this implemented */ +#else #define gettid() syscall(__NR_gettid) +#endif + #define sigev_notify_thread_id _sigev_un._tid /* auxialiary igt helpers from igt_aux.c */ -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx