summaryrefslogtreecommitdiffstats
path: root/init/property_service.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-04-13 19:33:37 -0700
committerColin Cross <ccross@android.com>2010-04-13 22:52:10 -0700
commitd11beb2b1516144327c3f730f75e6b4bc65f1374 (patch)
tree0eb9e4c17c8d2f5ca3b2021c7f25f4b633e6d3a4 /init/property_service.c
parentca7648ddfb46347c60014a849b0150a74df4e1d2 (diff)
downloadsystem_core-d11beb2b1516144327c3f730f75e6b4bc65f1374.zip
system_core-d11beb2b1516144327c3f730f75e6b4bc65f1374.tar.gz
system_core-d11beb2b1516144327c3f730f75e6b4bc65f1374.tar.bz2
init: Move property_set_fd to property_service.c
Change-Id: Ic7a19073eae8f353d48cabee80fa9722b35a82b5
Diffstat (limited to 'init/property_service.c')
-rw-r--r--init/property_service.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/init/property_service.c b/init/property_service.c
index d2505dd..28160f8 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -48,6 +48,8 @@
static int persistent_properties_loaded = 0;
+static int property_set_fd = -1;
+
/* White list of permissions for setting property services. */
struct {
const char *prefix;
@@ -187,7 +189,7 @@ static int property_write(prop_info *pi, const char *value)
*
* Returns 1 if uid allowed, 0 otherwise.
*/
-static int check_control_perms(const char *name, int uid, int gid) {
+static int check_control_perms(const char *name, unsigned int uid, unsigned int gid) {
int i;
if (uid == AID_SYSTEM || uid == AID_ROOT)
return 1;
@@ -208,7 +210,7 @@ static int check_control_perms(const char *name, int uid, int gid) {
* Checks permissions for setting system properties.
* Returns 1 if uid allowed, 0 otherwise.
*/
-static int check_perms(const char *name, unsigned int uid, int gid)
+static int check_perms(const char *name, unsigned int uid, unsigned int gid)
{
int i;
if (uid == 0)
@@ -344,7 +346,7 @@ static int property_list(void (*propfn)(const char *key, const char *value, void
return 0;
}
-void handle_property_set_fd(int fd)
+void handle_property_set_fd()
{
prop_msg msg;
int s;
@@ -355,7 +357,7 @@ void handle_property_set_fd(int fd)
socklen_t addr_size = sizeof(addr);
socklen_t cr_size = sizeof(cr);
- if ((s = accept(fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
+ if ((s = accept(property_set_fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
return;
}
@@ -493,7 +495,7 @@ void property_init(void)
load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT);
}
-int start_property_service(void)
+void start_property_service(void)
{
int fd;
@@ -504,10 +506,15 @@ int start_property_service(void)
load_persistent_properties();
fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0);
- if(fd < 0) return -1;
+ if(fd < 0) return;
fcntl(fd, F_SETFD, FD_CLOEXEC);
fcntl(fd, F_SETFL, O_NONBLOCK);
listen(fd, 8);
- return fd;
+ property_set_fd = fd;
+}
+
+int get_property_set_fd()
+{
+ return property_set_fd;
}