diff options
author | Brian Swetland <swetland@google.com> | 2010-07-13 17:18:42 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-07-13 17:18:42 -0700 |
commit | 335cc39928ba4ff8daca360376bc2d7fd241122d (patch) | |
tree | a9dbbb0f555ce21eaef736284b15ef88e98a1024 /init | |
parent | 587c286f988a99469b8961f024c3be13f43c847a (diff) | |
parent | 62a54f3b1343043528b7e93c1a4311a5e9d5f358 (diff) | |
download | system_core-335cc39928ba4ff8daca360376bc2d7fd241122d.zip system_core-335cc39928ba4ff8daca360376bc2d7fd241122d.tar.gz system_core-335cc39928ba4ff8daca360376bc2d7fd241122d.tar.bz2 |
am 62a54f3b: am 25b15be9: init: use tmpfs/ftruncate for properties backing store instead of ashmem
Merge commit '62a54f3b1343043528b7e93c1a4311a5e9d5f358'
* commit '62a54f3b1343043528b7e93c1a4311a5e9d5f358':
init: use tmpfs/ftruncate for properties backing store instead of ashmem
Diffstat (limited to 'init')
-rw-r--r-- | init/property_service.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/init/property_service.c b/init/property_service.c index e35cd38..d8fea56 100644 --- a/init/property_service.c +++ b/init/property_service.c @@ -27,7 +27,6 @@ #include <cutils/misc.h> #include <cutils/sockets.h> -#include <cutils/ashmem.h> #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> @@ -110,21 +109,31 @@ static int init_workspace(workspace *w, size_t size) void *data; int fd; - fd = ashmem_create_region("system_properties", size); - if(fd < 0) + /* dev is a tmpfs that we can use to carve a shared workspace + * out of, so let's do that... + */ + fd = open("/dev/__properties__", O_RDWR | O_CREAT, 0600); + if (fd < 0) return -1; + if (ftruncate(fd, size) < 0) + goto out; + data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if(data == MAP_FAILED) goto out; - /* allow the wolves we share with to do nothing but read */ - ashmem_set_prot_region(fd, PROT_READ); + close(fd); + + fd = open("/dev/__properties__", O_RDONLY); + if (fd < 0) + return -1; + + unlink("/dev/__properties__"); w->data = data; w->size = size; w->fd = fd; - return 0; out: |