summaryrefslogtreecommitdiffstats
path: root/init/property_service.c
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2013-02-12 14:39:31 -0800
committerGreg Hackmann <ghackmann@google.com>2013-06-18 16:37:54 -0700
commitf14eef0c3c456bfe39f7e9d57c8f7ae4ec775972 (patch)
tree7a320641b3fb7dcc7bc99338021b7514d904229b /init/property_service.c
parent389e358017ad15485f2bd9120feebfffa489131b (diff)
downloadsystem_core-f14eef0c3c456bfe39f7e9d57c8f7ae4ec775972.zip
system_core-f14eef0c3c456bfe39f7e9d57c8f7ae4ec775972.tar.gz
system_core-f14eef0c3c456bfe39f7e9d57c8f7ae4ec775972.tar.bz2
init: move initial property area allocation into bionic
bionic's __system_property_add() now expands the property area as needed by mapping in more pages. Rather than duplicate the mapping code, move it inside bionic and have bionic's __system_property_area_init() set up the first page. Change-Id: If9917d5f775c1a82eb89be55b84635395145ca49 Signed-off-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'init/property_service.c')
-rw-r--r--init/property_service.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/init/property_service.c b/init/property_service.c
index 846a0a3..9afc756 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -112,7 +112,6 @@ struct {
};
typedef struct {
- void *data;
size_t size;
int fd;
} workspace;
@@ -120,36 +119,13 @@ typedef struct {
static int init_workspace(workspace *w, size_t size)
{
void *data;
- int fd;
-
- /* dev is a tmpfs that we can use to carve a shared workspace
- * out of, so let's do that...
- */
- fd = open(PROP_FILENAME, O_RDWR | O_CREAT | O_NOFOLLOW, 0644);
- 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;
-
- close(fd);
-
- fd = open(PROP_FILENAME, O_RDONLY | O_NOFOLLOW);
+ int fd = open(PROP_FILENAME, O_RDONLY | O_NOFOLLOW);
if (fd < 0)
return -1;
- w->data = data;
w->size = size;
w->fd = fd;
return 0;
-
-out:
- close(fd);
- return -1;
}
static workspace pa_workspace;
@@ -159,12 +135,13 @@ static int init_property_area(void)
if (property_area_inited)
return -1;
- if(init_workspace(&pa_workspace, PA_SIZE))
+ if(__system_property_area_init())
return -1;
- fcntl(pa_workspace.fd, F_SETFD, FD_CLOEXEC);
+ if(init_workspace(&pa_workspace, 0))
+ return -1;
- __system_property_area_init(pa_workspace.data);
+ fcntl(pa_workspace.fd, F_SETFD, FD_CLOEXEC);
property_area_inited = 1;
return 0;