procattr.c: Use __BIONIC__ instead of __ANDROID__
PATCH 1/1 procattr.c: Use __BIONIC__ instead of __ANDROID__
This check is not specific to Android devices. If libselinux were used with Bionic on a normal Linux system this check would still be needed.
--- libselinux/src/procattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libselinux/src/procattr.c +2 -2
@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;static int destructor_key_initialized =0 ;static __threadchar destructor_initialized; -#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static pid_t gettid (void ) {return syscall (__NR_gettid);
Signature · 1 line
2.13.0.rc2.291.g57267f2277-goog
Quoted 24 lines · Tom Cherry via Selinux
This check is not specific to Android devices. If libselinux were used with Bionic on a normal Linux system this check would still be needed.
Signed-off-by Tom Cherry <[email protected] <javascript:;>>--- libselinux/src/procattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/procattr.c +2
-3@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;static int destructor_key_initialized =0 ;static __threadchar destructor_initialized; -#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static pid_t gettid (void ) {return syscall (__NR_gettid); --
Quoted 1 line
2.13.0.rc2.291.g57267f2277-goog
Ack.. thanks for this. There might be other places I used Android when I should have used bionic
Signature · 3 lines
Respectfully, William C Roberts
don't feel bad: the Android tree has the same problem --- even bionic itself didn't always get this right :-)
we're spotting these now because we're actually trying to use bionic on non-Android Linux too.
Quoted 43 lines · William Roberts
Quoted 25 lines · Tom Cherry via Selinux
This check is not specific to Android devices. If libselinux were used with Bionic on a normal Linux system this check would still be needed.
Signed-off-by Tom Cherry <[email protected]>--- libselinux/src/procattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/procattr.c +2
-3@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;static int destructor_key_initialized =0 ;static __threadchar destructor_initialized; -#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static pid_t gettid (void ) {return syscall (__NR_gettid); --Quoted 1 line
2.13.0.rc2.291.g57267f2277-goog
Ack.. thanks for this. There might be other places I used Android when I should have used bionic
--
Respectfully,William C Roberts
Signature · 2 lines
Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Android native code/tools questions? Mail me/drop by/add me as a reviewer.
Quoted 6 lines · Tom Cherry via Selinux
This check is not specific to Android devices. If libselinux were used
with Bionic on a normal Linux system this check would still be needed.Signed-off-by Tom Cherry <[email protected]>
Thanks, applied. This was actually switched from ANDROID to _ANDROID__
by nnk in 044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
to have any other uses of __ANDROID__, but we do have a number of uses of ANDROID. Offhand though these other uses of ANDROID don't appear to be related to bionic but instead reflect differences in SELinux userspace integration in Android vs GNU/Linux. If however your bionic/Linux system integrates SELinux support in an Android-like manner (e.g. kernel policy file is /sepolicy, no /etc/selinux/config, ...), then you might need to generalize those as well.
Quoted 19 lines
---
libselinux/src/procattr.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/procattr.c +0
-0@@ -22,8 +22,8 @@ static pthread_key_t destructor_key; static int destructor_key_initialized = 0; static __thread char destructor_initialized;libselinux/src/procattr.c +2
-2-#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static
pid_tgettid(void)
{
returnsyscall(__NR_gettid);
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Tom Cherry via Selinux
This check is not specific to Android devices. If libselinux were used
with Bionic on a normal Linux system this check would still be needed.Signed-off-by Tom Cherry <[email protected]>
Quoted 9 lines
Thanks, applied. This was actually switched from ANDROID to _ANDROID__
by nnk in044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
to have any other uses of__ANDROID__, but we do have a number of uses of ANDROID. Offhand though these other uses of ANDROID don't appear to be related to bionic but instead reflect differences in SELinux userspace integration in Android vs GNU/Linux. If however your bionic/Linux system integrates SELinux support in an Android-like manner (e.g. kernel policy file is /sepolicy, no/etc/selinux/config, ...), then you might need to generalize those as well.
Thanks! I took a look at the other ANDROID ifdefs in the code and I'm not sure how or if they would need to be changed. This change is needed to get libselinux building with bionic on the host which is just the first step.
Quoted 20 lines
Quoted 20 lines
--- libselinux/src/procattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/procattr.c +2
-2@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;static int destructor_key_initialized =0 ;static __threadchar destructor_initialized; -#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static pid_t gettid (void ) {return syscall (__NR_gettid);
Quoted 20 lines · Tom Cherry
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Tom Cherry via Selinux
This check is not specific to Android devices. If libselinux were used
with Bionic on a normal Linux system this check would still be needed.Signed-off-by Tom Cherry <[email protected]>Quoted 9 lines
Thanks, applied. This was actually switched from ANDROID to _ANDROID__
by nnk in044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
to have any other uses of__ANDROID__, but we do have a number of uses of ANDROID. Offhand though these other uses of ANDROID don't appear to be related to bionic but instead reflect differences in SELinux userspace integration in Android vs GNU/Linux. If however your bionic/Linux system integrates SELinux support in an Android-like manner (e.g. kernel policy file is /sepolicy, no/etc/selinux/config, ...), then you might need to generalize those as well.
Quoted 5 lines
Thanks! I took a look at the other ANDROID ifdefs in the code and I'm not sure
how or if they would need to be changed. This change is needed to get libselinux building with bionic on the host which is just the first step.
Thanks for checking, and I am glad (and surprised) this was the only issue to get
it to build for a host using bionic.
Quoted 22 lines
Quoted 21 lines
Quoted 21 lines
--- libselinux/src/procattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/procattr.c +2
-2@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;static int destructor_key_initialized =0 ;static __threadchar destructor_initialized; -#ifndef __ANDROID__ -/* Android declares this in unistd.h and has a definition for it */ +#ifndef __BIONIC__ +/* Bionic declares this in unistd.h and has a definition for it */ static pid_t gettid (void ) {return syscall (__NR_gettid);
Signature · 3 lines
Respectfully, William C Roberts