diff options
-rw-r--r-- | include/private/android_filesystem_config.h | 2 | ||||
-rw-r--r-- | include/utils/AndroidThreads.h | 2 | ||||
-rw-r--r-- | include/utils/Mutex.h | 4 | ||||
-rw-r--r-- | include/utils/Thread.h | 4 | ||||
-rw-r--r-- | include/utils/Trace.h | 6 | ||||
-rw-r--r-- | libcutils/iosched_policy.c | 6 | ||||
-rw-r--r-- | libcutils/process_name.c | 8 | ||||
-rw-r--r-- | libcutils/sched_policy.c | 4 | ||||
-rw-r--r-- | libcutils/sockets.c | 4 | ||||
-rw-r--r-- | libnativebridge/native_bridge.cc | 4 | ||||
-rw-r--r-- | libnativebridge/tests/PreInitializeNativeBridge_test.cpp | 4 | ||||
-rw-r--r-- | libnetutils/ifc_utils.c | 4 | ||||
-rw-r--r-- | libutils/SystemClock.cpp | 4 | ||||
-rw-r--r-- | libutils/Threads.cpp | 21 | ||||
-rw-r--r-- | libutils/Timers.cpp | 2 |
15 files changed, 36 insertions, 43 deletions
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h index 0c071ca53..9046fbe65 100644 --- a/include/private/android_filesystem_config.h +++ b/include/private/android_filesystem_config.h @@ -26,7 +26,7 @@ #include <sys/types.h> #include <stdint.h> -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) #include <linux/capability.h> #else #include "android_filesystem_capability.h" diff --git a/include/utils/AndroidThreads.h b/include/utils/AndroidThreads.h index aad1e82cb..4c2dd49f6 100644 --- a/include/utils/AndroidThreads.h +++ b/include/utils/AndroidThreads.h @@ -73,7 +73,7 @@ extern void androidSetCreateThreadFunc(android_create_thread_fn func); // ------------------------------------------------------------------ // Extra functions working with raw pids. -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) // Change the priority AND scheduling group of a particular thread. The priority // should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION // if the priority set failed, else another value if just the group set failed; diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h index 757519b08..f027c799f 100644 --- a/include/utils/Mutex.h +++ b/include/utils/Mutex.h @@ -59,7 +59,7 @@ public: // lock if possible; returns 0 on success, error otherwise status_t tryLock(); -#if HAVE_ANDROID_OS +#if defined(__ANDROID__) // lock the mutex, but don't wait longer than timeoutMilliseconds. // Returns 0 on success, TIMED_OUT for failure due to timeout expiration. // @@ -128,7 +128,7 @@ inline void Mutex::unlock() { inline status_t Mutex::tryLock() { return -pthread_mutex_trylock(&mMutex); } -#if HAVE_ANDROID_OS +#if defined(__ANDROID__) inline status_t Mutex::timedLock(nsecs_t timeoutNs) { const struct timespec ts = { /* .tv_sec = */ static_cast<time_t>(timeoutNs / 1000000000), diff --git a/include/utils/Thread.h b/include/utils/Thread.h index 28839fded..1532b7e0c 100644 --- a/include/utils/Thread.h +++ b/include/utils/Thread.h @@ -70,7 +70,7 @@ public: // Indicates whether this thread is running or not. bool isRunning() const; -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) // Return the thread's kernel ID, same as the thread itself calling gettid(), // or -1 if the thread is not running. pid_t getTid() const; @@ -101,7 +101,7 @@ private: volatile bool mExitPending; volatile bool mRunning; sp<Thread> mHoldSelf; -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) // legacy for debugging, not used by getTid() as it is set by the child thread // and so is not initialized until the child reaches that point pid_t mTid; diff --git a/include/utils/Trace.h b/include/utils/Trace.h index 6ee343d79..6ba68f61c 100644 --- a/include/utils/Trace.h +++ b/include/utils/Trace.h @@ -17,7 +17,7 @@ #ifndef ANDROID_TRACE_H #define ANDROID_TRACE_H -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) #include <fcntl.h> #include <stdint.h> @@ -59,11 +59,11 @@ private: }; // namespace android -#else // HAVE_ANDROID_OS +#else // !__ANDROID__ #define ATRACE_NAME(...) #define ATRACE_CALL() -#endif // HAVE_ANDROID_OS +#endif // __ANDROID__ #endif // ANDROID_TRACE_H diff --git a/libcutils/iosched_policy.c b/libcutils/iosched_policy.c index 8946d3c14..71bc94b25 100644 --- a/libcutils/iosched_policy.c +++ b/libcutils/iosched_policy.c @@ -23,7 +23,7 @@ #include <cutils/iosched_policy.h> -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) #include <linux/ioprio.h> #include <sys/syscall.h> #define __android_unused @@ -32,7 +32,7 @@ #endif int android_set_ioprio(int pid __android_unused, IoSchedClass clazz __android_unused, int ioprio __android_unused) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) if (syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, ioprio | (clazz << IOPRIO_CLASS_SHIFT))) { return -1; } @@ -41,7 +41,7 @@ int android_set_ioprio(int pid __android_unused, IoSchedClass clazz __android_un } int android_get_ioprio(int pid __android_unused, IoSchedClass *clazz, int *ioprio) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) int rc; if ((rc = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, pid)) < 0) { diff --git a/libcutils/process_name.c b/libcutils/process_name.c index cc931ebaf..5d28b6ff2 100644 --- a/libcutils/process_name.c +++ b/libcutils/process_name.c @@ -25,19 +25,19 @@ #include <unistd.h> #include <cutils/process_name.h> -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) #include <cutils/properties.h> #endif #define PROCESS_NAME_DEVICE "/sys/qemu_trace/process_name" static const char* process_name = "unknown"; -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) static int running_in_emulator = -1; #endif void set_process_name(const char* new_name) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) char propBuf[PROPERTY_VALUE_MAX]; #endif @@ -59,7 +59,7 @@ void set_process_name(const char* new_name) { } #endif -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) // If we know we are not running in the emulator, then return. if (running_in_emulator == 0) { return; diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c index dfc877752..103ff66b3 100644 --- a/libcutils/sched_policy.c +++ b/libcutils/sched_policy.c @@ -37,7 +37,7 @@ static inline SchedPolicy _policy(SchedPolicy p) return p == SP_DEFAULT ? SP_SYSTEM_DEFAULT : p; } -#if defined(HAVE_ANDROID_OS) +#if defined(__ANDROID__) #include <pthread.h> #include <sched.h> @@ -142,7 +142,7 @@ static void __initialize(void) { */ static int getSchedulerGroup(int tid, char* buf, size_t bufLen) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) char pathBuf[32]; char lineBuf[256]; FILE *fp; diff --git a/libcutils/sockets.c b/libcutils/sockets.c index 15ede2b5b..d43878258 100644 --- a/libcutils/sockets.c +++ b/libcutils/sockets.c @@ -17,7 +17,7 @@ #include <cutils/sockets.h> #include <log/log.h> -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) /* For the socket trust (credentials) check */ #include <private/android_filesystem_config.h> #define __android_unused @@ -27,7 +27,7 @@ bool socket_peer_is_trusted(int fd __android_unused) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) struct ucred cr; socklen_t len = sizeof(cr); int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len); diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc index a9671a97a..32a65ea04 100644 --- a/libnativebridge/native_bridge.cc +++ b/libnativebridge/native_bridge.cc @@ -295,13 +295,13 @@ bool PreInitializeNativeBridge(const char* app_data_dir_in, const char* instruct // so we save the extra file existence check. char cpuinfo_path[1024]; -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) snprintf(cpuinfo_path, sizeof(cpuinfo_path), "/system/lib" #ifdef __LP64__ "64" #endif // __LP64__ "/%s/cpuinfo", instruction_set); -#else // !HAVE_ANDROID_OS +#else // !__ANDROID__ // To be able to test on the host, we hardwire a relative path. snprintf(cpuinfo_path, sizeof(cpuinfo_path), "./cpuinfo"); #endif diff --git a/libnativebridge/tests/PreInitializeNativeBridge_test.cpp b/libnativebridge/tests/PreInitializeNativeBridge_test.cpp index cec26ce50..d3bbebefd 100644 --- a/libnativebridge/tests/PreInitializeNativeBridge_test.cpp +++ b/libnativebridge/tests/PreInitializeNativeBridge_test.cpp @@ -32,8 +32,8 @@ static constexpr const char* kTestData = "PreInitializeNativeBridge test."; TEST_F(NativeBridgeTest, PreInitializeNativeBridge) { ASSERT_TRUE(LoadNativeBridge(kNativeBridgeLibrary, nullptr)); -#ifndef __APPLE__ // Mac OS does not support bind-mount. -#ifndef HAVE_ANDROID_OS // Cannot write into the hard-wired location. +#if !defined(__APPLE__) // Mac OS does not support bind-mount. +#if !defined(__ANDROID__) // Cannot write into the hard-wired location. // Try to create our mount namespace. if (unshare(CLONE_NEWNS) != -1) { // Create a dummy file. diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c index 7d2a5fbf2..956ed30c3 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c @@ -50,7 +50,7 @@ #define ALOGW printf #endif -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) /* SIOCKILLADDR is an Android extension. */ #define SIOCKILLADDR 0x8939 #endif @@ -596,7 +596,7 @@ int ifc_disable(const char *ifname) int ifc_reset_connections(const char *ifname, const int reset_mask) { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) int result, success; in_addr_t myaddr = 0; struct ifreq ifr; diff --git a/libutils/SystemClock.cpp b/libutils/SystemClock.cpp index 64204a8e8..1fca2b293 100644 --- a/libutils/SystemClock.cpp +++ b/libutils/SystemClock.cpp @@ -19,7 +19,7 @@ * System clock functions. */ -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) #include <linux/ioctl.h> #include <linux/rtc.h> #include <utils/Atomic.h> @@ -107,7 +107,7 @@ static inline void checkTimeStamps(int64_t timestamp, */ int64_t elapsedRealtimeNano() { -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) struct timespec ts; int result; int64_t timestamp; diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index c3666e4b4..6dda6b573 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -45,7 +45,7 @@ #include <cutils/sched_policy.h> -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) # define __android_unused #else # define __android_unused __attribute__((__unused__)) @@ -132,7 +132,7 @@ int androidCreateRawThreadEtc(android_thread_func_t entryFunction, pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); -#ifdef HAVE_ANDROID_OS /* valgrind is rejecting RT-priority create reqs */ +#if defined(__ANDROID__) /* valgrind is rejecting RT-priority create reqs */ if (threadPriority != PRIORITY_DEFAULT || threadName != NULL) { // Now that the pthread_t has a method to find the associated // android_thread_id_t (pid) from pthread_t, it would be possible to avoid @@ -176,7 +176,7 @@ int androidCreateRawThreadEtc(android_thread_func_t entryFunction, return 1; } -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) static pthread_t android_thread_id_t_to_pthread(android_thread_id_t thread) { return (pthread_t) thread; @@ -302,12 +302,10 @@ void androidSetCreateThreadFunc(android_create_thread_fn func) gCreateThreadFn = func; } -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) int androidSetThreadPriority(pid_t tid, int pri) { int rc = 0; - -#if !defined(_WIN32) int lasterr = 0; if (pri >= ANDROID_PRIORITY_BACKGROUND) { @@ -325,17 +323,12 @@ int androidSetThreadPriority(pid_t tid, int pri) } else { errno = lasterr; } -#endif return rc; } int androidGetThreadPriority(pid_t tid) { -#if !defined(_WIN32) return getpriority(PRIO_PROCESS, tid); -#else - return ANDROID_PRIORITY_NORMAL; -#endif } #endif @@ -658,7 +651,7 @@ Thread::Thread(bool canCallJava) mLock("Thread::mLock"), mStatus(NO_ERROR), mExitPending(false), mRunning(false) -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) , mTid(-1) #endif { @@ -728,7 +721,7 @@ int Thread::_threadLoop(void* user) wp<Thread> weak(strong); self->mHoldSelf.clear(); -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) // this is very useful for debugging with gdb self->mTid = gettid(); #endif @@ -839,7 +832,7 @@ bool Thread::isRunning() const { return mRunning; } -#ifdef HAVE_ANDROID_OS +#if defined(__ANDROID__) pid_t Thread::getTid() const { // mTid is not defined until the child initializes it, and the caller may need it earlier diff --git a/libutils/Timers.cpp b/libutils/Timers.cpp index fb70e1588..201bc412c 100644 --- a/libutils/Timers.cpp +++ b/libutils/Timers.cpp @@ -23,7 +23,7 @@ #include <sys/time.h> #include <time.h> -#if defined(HAVE_ANDROID_OS) +#if defined(__ANDROID__) nsecs_t systemTime(int clock) { static const clockid_t clocks[] = { |