Loading libs/binder/IPCThreadState.cpp +9 −5 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,10 @@ #include "Utils.h" #include "Utils.h" #include "binder_module.h" #include "binder_module.h" #if (defined(__ANDROID__) || defined(__Fuchsia__)) && !defined(BINDER_WITH_KERNEL_IPC) #error Android and Fuchsia are expected to have BINDER_WITH_KERNEL_IPC #endif #if LOG_NDEBUG #if LOG_NDEBUG #define IF_LOG_TRANSACTIONS() if (false) #define IF_LOG_TRANSACTIONS() if (false) Loading Loading @@ -1215,7 +1219,7 @@ status_t IPCThreadState::talkWithDriver(bool doReceive) std::string message = logStream.str(); std::string message = logStream.str(); ALOGI("%s", message.c_str()); ALOGI("%s", message.c_str()); } } #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0) if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0) err = NO_ERROR; err = NO_ERROR; else else Loading Loading @@ -1604,7 +1608,7 @@ void IPCThreadState::threadDestructor(void *st) IPCThreadState* const self = static_cast<IPCThreadState*>(st); IPCThreadState* const self = static_cast<IPCThreadState*>(st); if (self) { if (self) { self->flushCommands(); self->flushCommands(); #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (self->mProcess->mDriverFD >= 0) { if (self->mProcess->mDriverFD >= 0) { ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); } } Loading @@ -1620,7 +1624,7 @@ status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, uint32_t *sync_received binder_frozen_status_info info = {}; binder_frozen_status_info info = {}; info.pid = pid; info.pid = pid; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0) ret = -errno; ret = -errno; #endif #endif Loading @@ -1639,7 +1643,7 @@ status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) { info.timeout_ms = timeout_ms; info.timeout_ms = timeout_ms; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_FREEZE, &info) < 0) if (ioctl(self()->mProcess->mDriverFD, BINDER_FREEZE, &info) < 0) ret = -errno; ret = -errno; #endif #endif Loading @@ -1657,7 +1661,7 @@ void IPCThreadState::logExtendedError() { if (!ProcessState::isDriverFeatureEnabled(ProcessState::DriverFeature::EXTENDED_ERROR)) if (!ProcessState::isDriverFeatureEnabled(ProcessState::DriverFeature::EXTENDED_ERROR)) return; return; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_EXTENDED_ERROR, &ee) < 0) { if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_EXTENDED_ERROR, &ee) < 0) { ALOGE("Failed to get extended error: %s", strerror(errno)); ALOGE("Failed to get extended error: %s", strerror(errno)); return; return; Loading libs/binder/IServiceManager.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,11 @@ #include <binder/IPermissionController.h> #include <binder/IPermissionController.h> #endif #endif #ifdef __ANDROID__ #if !(defined(__ANDROID__) || defined(__FUCHSIA)) #define BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT #endif #if !defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT) #include <cutils/properties.h> #include <cutils/properties.h> #else #else #include "ServiceManagerHost.h" #include "ServiceManagerHost.h" Loading Loading @@ -902,7 +906,7 @@ std::vector<IServiceManager::ServiceDebugInfo> CppBackendShim::getServiceDebugIn return ret; return ret; } } #ifndef __ANDROID__ #if defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT) // CppBackendShim for host. Implements the old libbinder android::IServiceManager API. // CppBackendShim for host. Implements the old libbinder android::IServiceManager API. // The internal implementation of the AIDL interface android::os::IServiceManager calls into // The internal implementation of the AIDL interface android::os::IServiceManager calls into // on-device service manager. // on-device service manager. Loading libs/binder/Parcel.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -299,8 +299,13 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) { obj.handle = handle; obj.handle = handle; obj.cookie = 0; obj.cookie = 0; } else { } else { #if __linux__ int policy = local->getMinSchedulerPolicy(); int policy = local->getMinSchedulerPolicy(); int priority = local->getMinSchedulerPriority(); int priority = local->getMinSchedulerPriority(); #else int policy = 0; int priority = 0; #endif if (policy != 0 || priority != 0) { if (policy != 0 || priority != 0) { // override value, since it is set explicitly // override value, since it is set explicitly Loading libs/binder/ProcessState.cpp +5 −1 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,10 @@ #define DEFAULT_MAX_BINDER_THREADS 15 #define DEFAULT_MAX_BINDER_THREADS 15 #define DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION 1 #define DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION 1 #if defined(__ANDROID__) || defined(__Fuchsia__) #define EXPECT_BINDER_OPEN_SUCCESS #endif #ifdef __ANDROID_VNDK__ #ifdef __ANDROID_VNDK__ const char* kDefaultDriver = "/dev/vndbinder"; const char* kDefaultDriver = "/dev/vndbinder"; #else #else Loading Loading @@ -613,7 +617,7 @@ ProcessState::ProcessState(const char* driver) } } } } #ifdef __ANDROID__ #if defined(EXPECT_BINDER_OPEN_SUCCESS) LOG_ALWAYS_FATAL_IF(!opened.ok(), LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Error: %s. Terminating.", "Binder driver '%s' could not be opened. Error: %s. Terminating.", driver, error.c_str()); driver, error.c_str()); Loading Loading
libs/binder/IPCThreadState.cpp +9 −5 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,10 @@ #include "Utils.h" #include "Utils.h" #include "binder_module.h" #include "binder_module.h" #if (defined(__ANDROID__) || defined(__Fuchsia__)) && !defined(BINDER_WITH_KERNEL_IPC) #error Android and Fuchsia are expected to have BINDER_WITH_KERNEL_IPC #endif #if LOG_NDEBUG #if LOG_NDEBUG #define IF_LOG_TRANSACTIONS() if (false) #define IF_LOG_TRANSACTIONS() if (false) Loading Loading @@ -1215,7 +1219,7 @@ status_t IPCThreadState::talkWithDriver(bool doReceive) std::string message = logStream.str(); std::string message = logStream.str(); ALOGI("%s", message.c_str()); ALOGI("%s", message.c_str()); } } #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0) if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0) err = NO_ERROR; err = NO_ERROR; else else Loading Loading @@ -1604,7 +1608,7 @@ void IPCThreadState::threadDestructor(void *st) IPCThreadState* const self = static_cast<IPCThreadState*>(st); IPCThreadState* const self = static_cast<IPCThreadState*>(st); if (self) { if (self) { self->flushCommands(); self->flushCommands(); #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (self->mProcess->mDriverFD >= 0) { if (self->mProcess->mDriverFD >= 0) { ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); } } Loading @@ -1620,7 +1624,7 @@ status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, uint32_t *sync_received binder_frozen_status_info info = {}; binder_frozen_status_info info = {}; info.pid = pid; info.pid = pid; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0) ret = -errno; ret = -errno; #endif #endif Loading @@ -1639,7 +1643,7 @@ status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) { info.timeout_ms = timeout_ms; info.timeout_ms = timeout_ms; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_FREEZE, &info) < 0) if (ioctl(self()->mProcess->mDriverFD, BINDER_FREEZE, &info) < 0) ret = -errno; ret = -errno; #endif #endif Loading @@ -1657,7 +1661,7 @@ void IPCThreadState::logExtendedError() { if (!ProcessState::isDriverFeatureEnabled(ProcessState::DriverFeature::EXTENDED_ERROR)) if (!ProcessState::isDriverFeatureEnabled(ProcessState::DriverFeature::EXTENDED_ERROR)) return; return; #if defined(__ANDROID__) #if defined(BINDER_WITH_KERNEL_IPC) if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_EXTENDED_ERROR, &ee) < 0) { if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_EXTENDED_ERROR, &ee) < 0) { ALOGE("Failed to get extended error: %s", strerror(errno)); ALOGE("Failed to get extended error: %s", strerror(errno)); return; return; Loading
libs/binder/IServiceManager.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,11 @@ #include <binder/IPermissionController.h> #include <binder/IPermissionController.h> #endif #endif #ifdef __ANDROID__ #if !(defined(__ANDROID__) || defined(__FUCHSIA)) #define BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT #endif #if !defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT) #include <cutils/properties.h> #include <cutils/properties.h> #else #else #include "ServiceManagerHost.h" #include "ServiceManagerHost.h" Loading Loading @@ -902,7 +906,7 @@ std::vector<IServiceManager::ServiceDebugInfo> CppBackendShim::getServiceDebugIn return ret; return ret; } } #ifndef __ANDROID__ #if defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT) // CppBackendShim for host. Implements the old libbinder android::IServiceManager API. // CppBackendShim for host. Implements the old libbinder android::IServiceManager API. // The internal implementation of the AIDL interface android::os::IServiceManager calls into // The internal implementation of the AIDL interface android::os::IServiceManager calls into // on-device service manager. // on-device service manager. Loading
libs/binder/Parcel.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -299,8 +299,13 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) { obj.handle = handle; obj.handle = handle; obj.cookie = 0; obj.cookie = 0; } else { } else { #if __linux__ int policy = local->getMinSchedulerPolicy(); int policy = local->getMinSchedulerPolicy(); int priority = local->getMinSchedulerPriority(); int priority = local->getMinSchedulerPriority(); #else int policy = 0; int priority = 0; #endif if (policy != 0 || priority != 0) { if (policy != 0 || priority != 0) { // override value, since it is set explicitly // override value, since it is set explicitly Loading
libs/binder/ProcessState.cpp +5 −1 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,10 @@ #define DEFAULT_MAX_BINDER_THREADS 15 #define DEFAULT_MAX_BINDER_THREADS 15 #define DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION 1 #define DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION 1 #if defined(__ANDROID__) || defined(__Fuchsia__) #define EXPECT_BINDER_OPEN_SUCCESS #endif #ifdef __ANDROID_VNDK__ #ifdef __ANDROID_VNDK__ const char* kDefaultDriver = "/dev/vndbinder"; const char* kDefaultDriver = "/dev/vndbinder"; #else #else Loading Loading @@ -613,7 +617,7 @@ ProcessState::ProcessState(const char* driver) } } } } #ifdef __ANDROID__ #if defined(EXPECT_BINDER_OPEN_SUCCESS) LOG_ALWAYS_FATAL_IF(!opened.ok(), LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Error: %s. Terminating.", "Binder driver '%s' could not be opened. Error: %s. Terminating.", driver, error.c_str()); driver, error.c_str()); Loading