On Fri, May 12, 2017 at 6:22 AM, Stephen Smalley <sds@xxxxxxxxxxxxx> wrote: > On Thu, 2017-05-11 at 16:50 -0700, Tom Cherry via Selinux wrote: >> 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 <tomcherry@xxxxxxxxxx> > > 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. 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. > >> --- >> libselinux/src/procattr.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c >> index ebc0adec..48dd8aff 100644 >> --- a/libselinux/src/procattr.c >> +++ b/libselinux/src/procattr.c >> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key; >> static int destructor_key_initialized = 0; >> static __thread char 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);