diff options
author | Glenn Kasten <gkasten@google.com> | 2011-05-04 17:58:57 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2011-06-03 16:12:37 -0700 |
commit | 6af763bec7c3f4d50fee8dd0046409bb8a7fe8f6 (patch) | |
tree | aad20d1f3e7ee495b531dde5ae78626e0911790d | |
parent | ed1a9022a19a9003931ce47ff7a0a0b5564255a5 (diff) | |
download | frameworks_base-6af763bec7c3f4d50fee8dd0046409bb8a7fe8f6.zip frameworks_base-6af763bec7c3f4d50fee8dd0046409bb8a7fe8f6.tar.gz frameworks_base-6af763bec7c3f4d50fee8dd0046409bb8a7fe8f6.tar.bz2 |
Remove dead code related to gettid
The gettid system call is always available now.
Change-Id: Ib78b41781eda182dc8605daf456bbea7ff7c2dc0
-rw-r--r-- | core/jni/android_util_Process.cpp | 13 | ||||
-rw-r--r-- | media/libmedia/AudioSystem.cpp | 7 | ||||
-rw-r--r-- | media/libmedia/IMediaMetadataRetriever.cpp | 26 | ||||
-rw-r--r-- | media/libmedia/JetPlayer.cpp | 9 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.cpp | 26 | ||||
-rw-r--r-- | media/libmediaplayerservice/MetadataRetrieverClient.cpp | 12 | ||||
-rw-r--r-- | media/libmediaplayerservice/MidiFile.cpp | 9 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 7 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 7 |
9 files changed, 10 insertions, 106 deletions
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index e5c2848..0960b25 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -38,18 +38,7 @@ #include <grp.h> #include <pwd.h> #include <signal.h> - -/* desktop Linux needs a little help with gettid() */ -#if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) -#define __KERNEL__ -# include <linux/unistd.h> -#ifdef _syscall0 -_syscall0(pid_t,gettid) -#else -pid_t gettid() { return syscall(__NR_gettid);} -#endif -#undef __KERNEL__ -#endif +#include <unistd.h> #define POLICY_DEBUG 0 #define GUARD_THREAD_PRIORITY 0 diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 8a180d8..6cb3847 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -26,13 +26,6 @@ #include <system/audio.h> // ---------------------------------------------------------------------------- -// the sim build doesn't have gettid - -#ifndef HAVE_GETTID -# define gettid getpid -#endif - -// ---------------------------------------------------------------------------- namespace android { diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp index ebe821f..07152d8 100644 --- a/media/libmedia/IMediaMetadataRetriever.cpp +++ b/media/libmedia/IMediaMetadataRetriever.cpp @@ -30,26 +30,6 @@ // foreground thread. #ifndef DISABLE_GROUP_SCHEDULE_HACK -/* desktop Linux needs a little help with gettid() */ -#if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) -#define __KERNEL__ -# include <linux/unistd.h> -#ifdef _syscall0 -_syscall0(pid_t,gettid) -#else -pid_t gettid() { return syscall(__NR_gettid);} -#endif -#undef __KERNEL__ -#endif - -static int myTid() { -#ifdef HAVE_GETTID - return gettid(); -#else - return getpid(); -#endif -} - #undef LOG_TAG #define LOG_TAG "IMediaMetadataRetriever" #include <utils/Log.h> @@ -60,18 +40,18 @@ namespace android { static void sendSchedPolicy(Parcel& data) { SchedPolicy policy; - get_sched_policy(myTid(), &policy); + get_sched_policy(gettid(), &policy); data.writeInt32(policy); } static void setSchedPolicy(const Parcel& data) { SchedPolicy policy = (SchedPolicy) data.readInt32(); - set_sched_policy(myTid(), policy); + set_sched_policy(gettid(), policy); } static void restoreSchedPolicy() { - set_sched_policy(myTid(), SP_FOREGROUND); + set_sched_policy(gettid(), SP_FOREGROUND); } }; // end namespace android #endif diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp index 88157d2..8b953e0 100644 --- a/media/libmedia/JetPlayer.cpp +++ b/media/libmedia/JetPlayer.cpp @@ -23,13 +23,6 @@ #include <media/JetPlayer.h> -#ifdef HAVE_GETTID -static pid_t myTid() { return gettid(); } -#else -static pid_t myTid() { return getpid(); } -#endif - - namespace android { @@ -188,7 +181,7 @@ int JetPlayer::render() { // signal main thread that we started { Mutex::Autolock l(mMutex); - mTid = myTid(); + mTid = gettid(); LOGV("JetPlayer::render(): render thread(%d) signal", mTid); mCondition.signal(); } diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index eae93ff..54a6547 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -68,18 +68,6 @@ #include <OMX.h> -/* desktop Linux needs a little help with gettid() */ -#if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) -#define __KERNEL__ -# include <linux/unistd.h> -#ifdef _syscall0 -_syscall0(pid_t,gettid) -#else -pid_t gettid() { return syscall(__NR_gettid);} -#endif -#undef __KERNEL__ -#endif - namespace { using android::media::Metadata; using android::status_t; @@ -387,14 +375,6 @@ status_t MediaPlayerService::Client::dump(int fd, const Vector<String16>& args) return NO_ERROR; } -static int myTid() { -#ifdef HAVE_GETTID - return gettid(); -#else - return getpid(); -#endif -} - status_t MediaPlayerService::dump(int fd, const Vector<String16>& args) { const size_t SIZE = 256; @@ -426,7 +406,7 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args) } result.append(" Files opened and/or mapped:\n"); - snprintf(buffer, SIZE, "/proc/%d/maps", myTid()); + snprintf(buffer, SIZE, "/proc/%d/maps", gettid()); FILE *f = fopen(buffer, "r"); if (f) { while (!feof(f)) { @@ -446,13 +426,13 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args) result.append("\n"); } - snprintf(buffer, SIZE, "/proc/%d/fd", myTid()); + snprintf(buffer, SIZE, "/proc/%d/fd", gettid()); DIR *d = opendir(buffer); if (d) { struct dirent *ent; while((ent = readdir(d)) != NULL) { if (strcmp(ent->d_name,".") && strcmp(ent->d_name,"..")) { - snprintf(buffer, SIZE, "/proc/%d/fd/%s", myTid(), ent->d_name); + snprintf(buffer, SIZE, "/proc/%d/fd/%s", gettid(), ent->d_name); struct stat s; if (lstat(buffer, &s) == 0) { if ((s.st_mode & S_IFMT) == S_IFLNK) { diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp index 8f776b4..06fb103 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp +++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp @@ -40,18 +40,6 @@ #include "MetadataRetrieverClient.h" #include "StagefrightMetadataRetriever.h" -/* desktop Linux needs a little help with gettid() */ -#if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) -#define __KERNEL__ -# include <linux/unistd.h> -#ifdef _syscall0 -_syscall0(pid_t,gettid) -#else -pid_t gettid() { return syscall(__NR_gettid);} -#endif -#undef __KERNEL__ -#endif - namespace android { extern player_type getPlayerType(const char* url); diff --git a/media/libmediaplayerservice/MidiFile.cpp b/media/libmediaplayerservice/MidiFile.cpp index 589c625..7e04523 100644 --- a/media/libmediaplayerservice/MidiFile.cpp +++ b/media/libmediaplayerservice/MidiFile.cpp @@ -29,17 +29,12 @@ #include <libsonivox/eas_reverb.h> #include <sys/types.h> #include <sys/stat.h> +#include <unistd.h> #include <system/audio.h> #include "MidiFile.h" -#ifdef HAVE_GETTID -static pid_t myTid() { return gettid(); } -#else -static pid_t myTid() { return getpid(); } -#endif - // ---------------------------------------------------------------------------- namespace android { @@ -455,7 +450,7 @@ int MidiFile::render() { // signal main thread that we started { Mutex::Autolock l(mMutex); - mTid = myTid(); + mTid = gettid(); LOGV("render thread(%d) signal", mTid); mCondition.signal(); } diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index f806624..d4a8ddb 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -53,13 +53,6 @@ #include <media/EffectVisualizerApi.h> // ---------------------------------------------------------------------------- -// the sim build doesn't have gettid - -#ifndef HAVE_GETTID -# define gettid getpid -#endif - -// ---------------------------------------------------------------------------- namespace android { diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index ef8d957..dd91788 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -39,13 +39,6 @@ #include <hardware/audio_policy.h> #include <hardware/audio_policy_hal.h> -// ---------------------------------------------------------------------------- -// the sim build doesn't have gettid - -#ifndef HAVE_GETTID -# define gettid getpid -#endif - namespace android { static const char *kDeadlockedString = "AudioPolicyService may be deadlocked\n"; |