Merge "cutils: Add property_get_bool, _get_int32, _get_int64"
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index 725fd54..952b58e 100755
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -343,8 +343,9 @@
}
}
-static void dump_map(log_t* log, const backtrace_map_t* map) {
- _LOG(log, logtype::MAPS, " %" PRIPTR "-%" PRIPTR " %c%c%c %s\n", map->start, map->end,
+static void dump_map(log_t* log, const backtrace_map_t* map, bool fault_addr) {
+ _LOG(log, logtype::MAPS, "%s%" PRIPTR "-%" PRIPTR " %c%c%c %s\n",
+ (fault_addr? "--->" : " "), map->start, map->end,
(map->flags & PROT_READ) ? 'r' : '-', (map->flags & PROT_WRITE) ? 'w' : '-',
(map->flags & PROT_EXEC) ? 'x' : '-', map->name.c_str());
}
@@ -366,10 +367,18 @@
return;
}
- _LOG(log, logtype::MAPS, "\nmemory map:\n");
+ _LOG(log, logtype::MAPS, "\nmemory map: (fault address prefixed with --->)\n");
+ bool found_map = false;
for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) {
- dump_map(log, &*it);
+ bool in_map = addr >= (*it).start && addr < (*it).end;
+ dump_map(log, &*it, in_map);
+ if(in_map) {
+ found_map = true;
+ }
+ }
+ if(!found_map) {
+ _LOG(log, logtype::ERROR, "\nFault address was not in any map!");
}
}
diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp
index 9b84c3e..d30e771 100644
--- a/healthd/healthd.cpp
+++ b/healthd/healthd.cpp
@@ -126,7 +126,7 @@
KLOG_ERROR(LOG_TAG, "uevent_init: uevent_open_socket failed\n");
}
-#define UEVENT_MSG_LEN 1024
+#define UEVENT_MSG_LEN 2048
static void uevent_event(void) {
char msg[UEVENT_MSG_LEN+2];
char *cp;
diff --git a/init/devices.c b/init/devices.c
index 02698ef..ea9a4b2 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -15,6 +15,7 @@
*/
#include <errno.h>
+#include <fnmatch.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -77,6 +78,7 @@
unsigned int uid;
unsigned int gid;
unsigned short prefix;
+ unsigned short wildcard;
};
struct perm_node {
@@ -97,7 +99,8 @@
int add_dev_perms(const char *name, const char *attr,
mode_t perm, unsigned int uid, unsigned int gid,
- unsigned short prefix) {
+ unsigned short prefix,
+ unsigned short wildcard) {
struct perm_node *node = calloc(1, sizeof(*node));
if (!node)
return -ENOMEM;
@@ -116,6 +119,7 @@
node->dp.uid = uid;
node->dp.gid = gid;
node->dp.prefix = prefix;
+ node->dp.wildcard = wildcard;
if (attr)
list_add_tail(&sys_perms, &node->plist);
@@ -140,6 +144,9 @@
if (dp->prefix) {
if (strncmp(upath, dp->name + 4, strlen(dp->name + 4)))
continue;
+ } else if (dp->wildcard) {
+ if (fnmatch(dp->name + 4, upath, FNM_PATHNAME) != 0)
+ continue;
} else {
if (strcmp(upath, dp->name + 4))
continue;
@@ -180,6 +187,9 @@
if (dp->prefix) {
if (strncmp(path, dp->name, strlen(dp->name)))
continue;
+ } else if (dp->wildcard) {
+ if (fnmatch(dp->name, path, FNM_PATHNAME) != 0)
+ continue;
} else {
if (strcmp(path, dp->name))
continue;
diff --git a/init/devices.h b/init/devices.h
index a84fa58..5d0fe88 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -23,6 +23,7 @@
extern void device_init(void);
extern int add_dev_perms(const char *name, const char *attr,
mode_t perm, unsigned int uid,
- unsigned int gid, unsigned short prefix);
+ unsigned int gid, unsigned short prefix,
+ unsigned short wildcard);
int get_device_fd();
#endif /* _INIT_DEVICES_H */
diff --git a/init/ueventd.c b/init/ueventd.c
index 662196d..4ad0cb9 100644
--- a/init/ueventd.c
+++ b/init/ueventd.c
@@ -122,6 +122,7 @@
uid_t uid;
gid_t gid;
int prefix = 0;
+ int wildcard = 0;
char *endptr;
int ret;
char *tmp = 0;
@@ -154,9 +155,13 @@
name = tmp;
} else {
int len = strlen(name);
- if (name[len - 1] == '*') {
+ char *wildcard_chr = strchr(name, '*');
+ if ((name[len - 1] == '*') &&
+ (wildcard_chr == (name + len - 1))) {
prefix = 1;
name[len - 1] = '\0';
+ } else if (wildcard_chr) {
+ wildcard = 1;
}
}
@@ -183,6 +188,6 @@
}
gid = ret;
- add_dev_perms(name, attr, perm, uid, gid, prefix);
+ add_dev_perms(name, attr, perm, uid, gid, prefix, wildcard);
free(tmp);
}