X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=common%2Fos_posix.cpp;h=7d39d8ada5e0ffafc0f730bcdd3e913744f734d2;hb=537c507874cdde0b507d306ac058767f506da8e2;hp=e4de967b045fd67c3ff5837127a5ddc18ccf055a;hpb=b4c584d31d7795428a8a30e353c3f4bc02c5ae5e;p=apitrace diff --git a/common/os_posix.cpp b/common/os_posix.cpp index e4de967..7d39d8a 100644 --- a/common/os_posix.cpp +++ b/common/os_posix.cpp @@ -46,10 +46,6 @@ #ifdef ANDROID #include -#include -#include -#include -#include #endif #ifndef PATH_MAX @@ -101,68 +97,6 @@ getProcessName(void) return path; } -#ifdef ANDROID -static String -getZygoteProcessName(void) -{ - String path; - size_t size = PATH_MAX; - char *buf = path.buf(size); - ssize_t len; - - int fd = open("/proc/self/cmdline", O_RDONLY); - - assert(fd >= 0); - len = read(fd, buf, size - 1); - close(fd); - path.truncate(len); - - return path; -} - -static bool isZygoteProcess(void) -{ - os::String proc_name; - - proc_name = getProcessName(); - proc_name.trimDirectory(); - - return strcmp(proc_name, "app_process") == 0; -} - -bool apitrace_enabled(void) -{ - static pid_t cached_pid; - static bool enabled; - pid_t pid; - - pid = getpid(); - if (cached_pid == pid) - return enabled; - cached_pid = pid; - - if (!isZygoteProcess()) { - os::log("apitrace[%d]: enabled for standalone %s", pid, - (const char *)getProcessName()); - enabled = true; - return true; - } - - char target_proc_name[PROP_VALUE_MAX] = ""; - os::String proc_name; - - proc_name = getZygoteProcessName(); - proc_name.trimDirectory(); - - __system_property_get("debug.apitrace.procname", target_proc_name); - enabled = !strcmp(target_proc_name, proc_name); - os::log("apitrace[%d]: %s for %s", - pid, enabled ? "enabled" : "disabled", (const char *)proc_name); - - return enabled; -} -#endif - String getCurrentDir(void) {