aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-05-04 18:37:50 -0500
committerRob Landley <rob@landley.net>2016-05-04 18:37:50 -0500
commit454eea52f806141137ff62abaf78302ea3d7c9c0 (patch)
treec65d7c1c84cc098e52af4c23b48716eafdef2ef4
parent5c8f3d7d2b03c0c6ba8ce244783cb88b29108a4d (diff)
downloadtoybox-454eea52f806141137ff62abaf78302ea3d7c9c0.tar.gz
Simplify ps android scheduling policy fetch slightly.
-rw-r--r--lib/portability.c6
-rw-r--r--lib/portability.h5
-rw-r--r--toys/posix/ps.c2
3 files changed, 3 insertions, 10 deletions
diff --git a/lib/portability.c b/lib/portability.c
index f4354a86..78e500b1 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -92,9 +92,3 @@ int clearenv(void)
return 0;
}
#endif
-
-#if !defined(__ANDROID__)
-// No-op implementations of <cutils/sched_policy.h>.
-int get_sched_policy(int tid, SchedPolicy *policy) { return 0; }
-const char *get_sched_policy_name(SchedPolicy policy) { return "unknown"; }
-#endif
diff --git a/lib/portability.h b/lib/portability.h
index 87258fa9..afe02c1c 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -273,7 +273,6 @@ pid_t xfork(void);
#ifdef __ANDROID__
#include <cutils/sched_policy.h>
#else
-typedef int SchedPolicy;
-int get_sched_policy(int tid, SchedPolicy *policy);
-const char *get_sched_policy_name(SchedPolicy policy);
+static inline int get_sched_policy(int tid, void *policy) {return 0;}
+static inline char *get_sched_policy_name(int policy) {return "unknown";}
#endif
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index c0d382f6..7843ffa5 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -680,7 +680,7 @@ static int get_ps(struct dirtree *new)
}
// Do we need Android scheduling policy?
- if (TT.bits&_PS_PCY) get_sched_policy(*slot, (SchedPolicy *)&slot[SLOT_pcy]);
+ if (TT.bits&_PS_PCY) get_sched_policy(*slot, (void *)&slot[SLOT_pcy]);
// Fetch string data while parentfd still available, appending to buf.
// (There's well over 3k of toybuf left. We could dynamically malloc, but