diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:29:04 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:29:04 -0800 |
commit | e54eebbf1a908d65ee8cf80bab62821c05666d70 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /toolbox/watchprops.c | |
parent | a1e1c1b106423de09bc918502e7a51d4ffe5a4ae (diff) | |
download | core-e54eebbf1a908d65ee8cf80bab62821c05666d70.tar.gz core-e54eebbf1a908d65ee8cf80bab62821c05666d70.tar.bz2 core-e54eebbf1a908d65ee8cf80bab62821c05666d70.zip |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'toolbox/watchprops.c')
-rw-r--r-- | toolbox/watchprops.c | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/toolbox/watchprops.c b/toolbox/watchprops.c deleted file mode 100644 index d3119924b..000000000 --- a/toolbox/watchprops.c +++ /dev/null @@ -1,76 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <time.h> - -#include <cutils/properties.h> - -#include <sys/atomics.h> - -#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ -#include <sys/_system_properties.h> - - -extern prop_area *__system_property_area__; - -typedef struct pwatch pwatch; - -struct pwatch -{ - const prop_info *pi; - unsigned serial; -}; - -static pwatch watchlist[1024]; - -static void announce(const prop_info *pi) -{ - char name[PROP_NAME_MAX]; - char value[PROP_VALUE_MAX]; - char *x; - - __system_property_read(pi, name, value); - - for(x = value; *x; x++) { - if((*x < 32) || (*x > 127)) *x = '.'; - } - - fprintf(stderr,"%10d %s = '%s'\n", (int) time(0), name, value); -} - -int watchprops_main(int argc, char *argv[]) -{ - prop_area *pa = __system_property_area__; - unsigned serial = pa->serial; - unsigned count = pa->count; - unsigned n; - - if(count >= 1024) exit(1); - - for(n = 0; n < count; n++) { - watchlist[n].pi = __system_property_find_nth(n); - watchlist[n].serial = watchlist[n].pi->serial; - } - - for(;;) { - do { - __futex_wait(&pa->serial, serial, 0); - } while(pa->serial == serial); - - while(count < pa->count){ - watchlist[count].pi = __system_property_find_nth(count); - watchlist[count].serial = watchlist[n].pi->serial; - announce(watchlist[count].pi); - count++; - if(count == 1024) exit(1); - } - - for(n = 0; n < count; n++){ - unsigned tmp = watchlist[n].pi->serial; - if(watchlist[n].serial != tmp) { - announce(watchlist[n].pi); - watchlist[n].serial = tmp; - } - } - } - return 0; -} |