diff options
author | Colin Cross <ccross@android.com> | 2013-01-28 17:14:04 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2013-06-17 16:58:09 -0700 |
commit | 81963164113f98f5917c7d7990ae2b76f2d4044e (patch) | |
tree | 6b40bfdcd84cc3581a950341d988ca201fdf7494 /toolbox | |
parent | a5a860ef20cc5e65d4fa9b57cd72231f63f6d316 (diff) | |
download | core-81963164113f98f5917c7d7990ae2b76f2d4044e.tar.gz core-81963164113f98f5917c7d7990ae2b76f2d4044e.tar.bz2 core-81963164113f98f5917c7d7990ae2b76f2d4044e.zip |
toolbox: hide property implementation from watchprops
(cherry picked from commit 91779634debc79bc75d3df4e0f59d964ad4f5f78)
Change-Id: I7a2d8aa507ac61cedc5f67c563531a7d4ec8e4c2
Diffstat (limited to 'toolbox')
-rw-r--r-- | toolbox/watchprops.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/toolbox/watchprops.c b/toolbox/watchprops.c index d3119924b..3418d6293 100644 --- a/toolbox/watchprops.c +++ b/toolbox/watchprops.c @@ -9,9 +9,6 @@ #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> - -extern prop_area *__system_property_area__; - typedef struct pwatch pwatch; struct pwatch @@ -39,33 +36,35 @@ static void announce(const prop_info *pi) int watchprops_main(int argc, char *argv[]) { - prop_area *pa = __system_property_area__; - unsigned serial = pa->serial; - unsigned count = pa->count; + unsigned serial = 0; + unsigned count; unsigned n; - if(count >= 1024) exit(1); - - for(n = 0; n < count; n++) { + for(n = 0; n < 1024; n++) { watchlist[n].pi = __system_property_find_nth(n); - watchlist[n].serial = watchlist[n].pi->serial; + if (watchlist[n].pi == 0) + break; + watchlist[n].serial = __system_property_serial(watchlist[n].pi); } - for(;;) { - do { - __futex_wait(&pa->serial, serial, 0); - } while(pa->serial == serial); + count = n; + if (count == 1024) + exit(1); - while(count < pa->count){ + for(;;) { + serial = __system_property_wait_any(serial); + while(count < 1024){ watchlist[count].pi = __system_property_find_nth(count); - watchlist[count].serial = watchlist[n].pi->serial; + if (watchlist[count].pi == 0) + break; + watchlist[count].serial = __system_property_serial(watchlist[n].pi); announce(watchlist[count].pi); count++; if(count == 1024) exit(1); } for(n = 0; n < count; n++){ - unsigned tmp = watchlist[n].pi->serial; + unsigned tmp = __system_property_serial(watchlist[n].pi); if(watchlist[n].serial != tmp) { announce(watchlist[n].pi); watchlist[n].serial = tmp; |