blob: 79914cde5fb982c5ca8a1fab8029cc854f6f7a65 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <unistd.h>
20#include <string.h>
21#include <ctype.h>
22#include <fcntl.h>
23#include <stdarg.h>
24#include <dirent.h>
25#include <limits.h>
26#include <errno.h>
27
28#include <cutils/misc.h>
29#include <cutils/sockets.h>
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080030
31#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
32#include <sys/_system_properties.h>
33
34#include <sys/socket.h>
35#include <sys/un.h>
36#include <sys/select.h>
37#include <sys/types.h>
38#include <netinet/in.h>
39#include <sys/mman.h>
40#include <sys/atomics.h>
41#include <private/android_filesystem_config.h>
42
43#include "property_service.h"
44#include "init.h"
Colin Cross3899e9f2010-04-13 20:35:46 -070045#include "util.h"
Colin Crossed8a7d82010-04-19 17:05:34 -070046#include "log.h"
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080047
48#define PERSISTENT_PROPERTY_DIR "/data/property"
49
50static int persistent_properties_loaded = 0;
Colin Cross3294bbb2010-04-19 17:11:33 -070051static int property_area_inited = 0;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080052
Colin Crossd11beb22010-04-13 19:33:37 -070053static int property_set_fd = -1;
54
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080055/* White list of permissions for setting property services. */
56struct {
57 const char *prefix;
58 unsigned int uid;
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040059 unsigned int gid;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080060} property_perms[] = {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040061 { "net.rmnet0.", AID_RADIO, 0 },
62 { "net.gprs.", AID_RADIO, 0 },
63 { "net.ppp", AID_RADIO, 0 },
Amol Bhatkarcf015972011-02-18 17:54:17 -060064 { "net.qmi", AID_RADIO, 0 },
Benoit Goby7100f642011-07-25 18:02:06 -070065 { "net.lte", AID_RADIO, 0 },
Benoit Goby22bfc4c2011-07-28 18:09:55 -070066 { "net.cdma", AID_RADIO, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040067 { "ril.", AID_RADIO, 0 },
68 { "gsm.", AID_RADIO, 0 },
69 { "persist.radio", AID_RADIO, 0 },
70 { "net.dns", AID_RADIO, 0 },
Benoit Goby5da93582011-08-22 12:12:37 -070071 { "sys.usb.config", AID_RADIO, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040072 { "net.", AID_SYSTEM, 0 },
73 { "dev.", AID_SYSTEM, 0 },
74 { "runtime.", AID_SYSTEM, 0 },
75 { "hw.", AID_SYSTEM, 0 },
76 { "sys.", AID_SYSTEM, 0 },
77 { "service.", AID_SYSTEM, 0 },
78 { "wlan.", AID_SYSTEM, 0 },
79 { "dhcp.", AID_SYSTEM, 0 },
80 { "dhcp.", AID_DHCP, 0 },
Romain Guy45fa13f2012-04-27 15:19:30 -070081 { "debug.", AID_SYSTEM, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040082 { "debug.", AID_SHELL, 0 },
83 { "log.", AID_SHELL, 0 },
84 { "service.adb.root", AID_SHELL, 0 },
Mike Lockwood58aa5b02010-12-10 09:48:41 -080085 { "service.adb.tcp.port", AID_SHELL, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040086 { "persist.sys.", AID_SYSTEM, 0 },
87 { "persist.service.", AID_SYSTEM, 0 },
Oscar Montemayoref4e2152009-11-12 12:02:24 -080088 { "persist.security.", AID_SYSTEM, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040089 { NULL, 0, 0 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080090};
91
92/*
93 * White list of UID that are allowed to start/stop services.
94 * Currently there are no user apps that require.
95 */
96struct {
97 const char *service;
98 unsigned int uid;
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040099 unsigned int gid;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100} control_perms[] = {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400101 { "dumpstate",AID_SHELL, AID_LOG },
Wink Savillecfa0d842010-10-03 13:30:11 -0700102 { "ril-daemon",AID_RADIO, AID_RADIO },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400103 {NULL, 0, 0 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800104};
105
106typedef struct {
107 void *data;
108 size_t size;
109 int fd;
110} workspace;
111
112static int init_workspace(workspace *w, size_t size)
113{
114 void *data;
115 int fd;
116
Brian Swetland25b15be2010-07-13 16:43:56 -0700117 /* dev is a tmpfs that we can use to carve a shared workspace
118 * out of, so let's do that...
119 */
120 fd = open("/dev/__properties__", O_RDWR | O_CREAT, 0600);
121 if (fd < 0)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800122 return -1;
123
Brian Swetland25b15be2010-07-13 16:43:56 -0700124 if (ftruncate(fd, size) < 0)
125 goto out;
126
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800127 data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
128 if(data == MAP_FAILED)
129 goto out;
130
Brian Swetland25b15be2010-07-13 16:43:56 -0700131 close(fd);
132
133 fd = open("/dev/__properties__", O_RDONLY);
134 if (fd < 0)
135 return -1;
136
137 unlink("/dev/__properties__");
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800138
139 w->data = data;
140 w->size = size;
141 w->fd = fd;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800142 return 0;
143
144out:
145 close(fd);
146 return -1;
147}
148
149/* (8 header words + 247 toc words) = 1020 bytes */
150/* 1024 bytes header and toc + 247 prop_infos @ 128 bytes = 32640 bytes */
151
152#define PA_COUNT_MAX 247
153#define PA_INFO_START 1024
154#define PA_SIZE 32768
155
156static workspace pa_workspace;
157static prop_info *pa_info_array;
158
159extern prop_area *__system_property_area__;
160
161static int init_property_area(void)
162{
163 prop_area *pa;
164
165 if(pa_info_array)
166 return -1;
167
168 if(init_workspace(&pa_workspace, PA_SIZE))
169 return -1;
170
171 fcntl(pa_workspace.fd, F_SETFD, FD_CLOEXEC);
172
173 pa_info_array = (void*) (((char*) pa_workspace.data) + PA_INFO_START);
174
175 pa = pa_workspace.data;
176 memset(pa, 0, PA_SIZE);
177 pa->magic = PROP_AREA_MAGIC;
178 pa->version = PROP_AREA_VERSION;
179
180 /* plug into the lib property services */
181 __system_property_area__ = pa;
Colin Cross3294bbb2010-04-19 17:11:33 -0700182 property_area_inited = 1;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800183 return 0;
184}
185
186static void update_prop_info(prop_info *pi, const char *value, unsigned len)
187{
188 pi->serial = pi->serial | 1;
189 memcpy(pi->value, value, len + 1);
190 pi->serial = (len << 24) | ((pi->serial + 1) & 0xffffff);
191 __futex_wake(&pi->serial, INT32_MAX);
192}
193
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800194/*
195 * Checks permissions for starting/stoping system services.
196 * AID_SYSTEM and AID_ROOT are always allowed.
197 *
198 * Returns 1 if uid allowed, 0 otherwise.
199 */
Colin Crossd11beb22010-04-13 19:33:37 -0700200static int check_control_perms(const char *name, unsigned int uid, unsigned int gid) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800201 int i;
202 if (uid == AID_SYSTEM || uid == AID_ROOT)
203 return 1;
204
205 /* Search the ACL */
206 for (i = 0; control_perms[i].service; i++) {
207 if (strcmp(control_perms[i].service, name) == 0) {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400208 if ((uid && control_perms[i].uid == uid) ||
209 (gid && control_perms[i].gid == gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800210 return 1;
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400211 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800212 }
213 }
214 return 0;
215}
216
217/*
218 * Checks permissions for setting system properties.
219 * Returns 1 if uid allowed, 0 otherwise.
220 */
Colin Crossd11beb22010-04-13 19:33:37 -0700221static int check_perms(const char *name, unsigned int uid, unsigned int gid)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800222{
223 int i;
224 if (uid == 0)
225 return 1;
226
227 if(!strncmp(name, "ro.", 3))
228 name +=3;
229
230 for (i = 0; property_perms[i].prefix; i++) {
231 int tmp;
232 if (strncmp(property_perms[i].prefix, name,
233 strlen(property_perms[i].prefix)) == 0) {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400234 if ((uid && property_perms[i].uid == uid) ||
235 (gid && property_perms[i].gid == gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800236 return 1;
237 }
238 }
239 }
240
241 return 0;
242}
243
244const char* property_get(const char *name)
245{
246 prop_info *pi;
247
248 if(strlen(name) >= PROP_NAME_MAX) return 0;
249
250 pi = (prop_info*) __system_property_find(name);
251
252 if(pi != 0) {
253 return pi->value;
254 } else {
255 return 0;
256 }
257}
258
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800259static void write_persistent_property(const char *name, const char *value)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800260{
261 const char *tempPath = PERSISTENT_PROPERTY_DIR "/.temp";
262 char path[PATH_MAX];
263 int fd, length;
264
265 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, name);
266
267 fd = open(tempPath, O_WRONLY|O_CREAT|O_TRUNC, 0600);
268 if (fd < 0) {
269 ERROR("Unable to write persistent property to temp file %s errno: %d\n", tempPath, errno);
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800270 return;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800271 }
272 write(fd, value, strlen(value));
273 close(fd);
274
275 if (rename(tempPath, path)) {
276 unlink(tempPath);
277 ERROR("Unable to rename persistent property file %s to %s\n", tempPath, path);
278 }
279}
280
281int property_set(const char *name, const char *value)
282{
283 prop_area *pa;
284 prop_info *pi;
285
286 int namelen = strlen(name);
287 int valuelen = strlen(value);
288
289 if(namelen >= PROP_NAME_MAX) return -1;
290 if(valuelen >= PROP_VALUE_MAX) return -1;
291 if(namelen < 1) return -1;
292
293 pi = (prop_info*) __system_property_find(name);
294
295 if(pi != 0) {
296 /* ro.* properties may NEVER be modified once set */
297 if(!strncmp(name, "ro.", 3)) return -1;
298
299 pa = __system_property_area__;
300 update_prop_info(pi, value, valuelen);
301 pa->serial++;
302 __futex_wake(&pa->serial, INT32_MAX);
303 } else {
304 pa = __system_property_area__;
305 if(pa->count == PA_COUNT_MAX) return -1;
306
307 pi = pa_info_array + pa->count;
308 pi->serial = (valuelen << 24);
309 memcpy(pi->name, name, namelen + 1);
310 memcpy(pi->value, value, valuelen + 1);
311
312 pa->toc[pa->count] =
313 (namelen << 24) | (((unsigned) pi) - ((unsigned) pa));
314
315 pa->count++;
316 pa->serial++;
317 __futex_wake(&pa->serial, INT32_MAX);
318 }
319 /* If name starts with "net." treat as a DNS property. */
Mike Lockwoodb3779552009-05-08 14:27:42 -0400320 if (strncmp("net.", name, strlen("net.")) == 0) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800321 if (strcmp("net.change", name) == 0) {
322 return 0;
323 }
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800324 /*
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800325 * The 'net.change' property is a special property used track when any
326 * 'net.*' property name is updated. It is _ONLY_ updated here. Its value
327 * contains the last updated 'net.*' property.
328 */
329 property_set("net.change", name);
330 } else if (persistent_properties_loaded &&
Mike Lockwoodb3779552009-05-08 14:27:42 -0400331 strncmp("persist.", name, strlen("persist.")) == 0) {
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800332 /*
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800333 * Don't write properties to disk until after we have read all default properties
334 * to prevent them from being overwritten by default values.
335 */
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800336 write_persistent_property(name, value);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800337 }
338 property_changed(name, value);
339 return 0;
340}
341
Colin Crossd11beb22010-04-13 19:33:37 -0700342void handle_property_set_fd()
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800343{
344 prop_msg msg;
345 int s;
346 int r;
347 int res;
348 struct ucred cr;
349 struct sockaddr_un addr;
350 socklen_t addr_size = sizeof(addr);
351 socklen_t cr_size = sizeof(cr);
352
Colin Crossd11beb22010-04-13 19:33:37 -0700353 if ((s = accept(property_set_fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800354 return;
355 }
356
357 /* Check socket options here */
358 if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cr, &cr_size) < 0) {
359 close(s);
360 ERROR("Unable to recieve socket options\n");
361 return;
362 }
363
Mike Lockwoodd18678f2011-07-01 14:48:50 -0400364 r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), 0));
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800365 if(r != sizeof(prop_msg)) {
Mike Lockwoodd18678f2011-07-01 14:48:50 -0400366 ERROR("sys_prop: mis-match msg size recieved: %d expected: %d errno: %d\n",
367 r, sizeof(prop_msg), errno);
Brad Fitzpatrick9f1e0e32011-03-30 12:39:56 -0700368 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800369 return;
370 }
371
372 switch(msg.cmd) {
373 case PROP_MSG_SETPROP:
374 msg.name[PROP_NAME_MAX-1] = 0;
375 msg.value[PROP_VALUE_MAX-1] = 0;
376
377 if(memcmp(msg.name,"ctl.",4) == 0) {
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700378 // Keep the old close-socket-early behavior when handling
379 // ctl.* properties.
380 close(s);
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400381 if (check_control_perms(msg.value, cr.uid, cr.gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800382 handle_control_message((char*) msg.name + 4, (char*) msg.value);
383 } else {
Wink Savillecfa0d842010-10-03 13:30:11 -0700384 ERROR("sys_prop: Unable to %s service ctl [%s] uid:%d gid:%d pid:%d\n",
385 msg.name + 4, msg.value, cr.uid, cr.gid, cr.pid);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800386 }
387 } else {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400388 if (check_perms(msg.name, cr.uid, cr.gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800389 property_set((char*) msg.name, (char*) msg.value);
390 } else {
391 ERROR("sys_prop: permission denied uid:%d name:%s\n",
392 cr.uid, msg.name);
393 }
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700394
395 // Note: bionic's property client code assumes that the
396 // property server will not close the socket until *AFTER*
397 // the property is written to memory.
398 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800399 }
400 break;
401
402 default:
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700403 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800404 break;
405 }
406}
407
408void get_property_workspace(int *fd, int *sz)
409{
410 *fd = pa_workspace.fd;
411 *sz = pa_workspace.size;
412}
413
414static void load_properties(char *data)
415{
416 char *key, *value, *eol, *sol, *tmp;
417
418 sol = data;
419 while((eol = strchr(sol, '\n'))) {
420 key = sol;
421 *eol++ = 0;
422 sol = eol;
423
424 value = strchr(key, '=');
425 if(value == 0) continue;
426 *value++ = 0;
427
428 while(isspace(*key)) key++;
429 if(*key == '#') continue;
430 tmp = value - 2;
431 while((tmp > key) && isspace(*tmp)) *tmp-- = 0;
432
433 while(isspace(*value)) value++;
434 tmp = eol - 2;
435 while((tmp > value) && isspace(*tmp)) *tmp-- = 0;
436
437 property_set(key, value);
438 }
439}
440
441static void load_properties_from_file(const char *fn)
442{
443 char *data;
444 unsigned sz;
445
446 data = read_file(fn, &sz);
447
448 if(data != 0) {
449 load_properties(data);
450 free(data);
451 }
452}
453
454static void load_persistent_properties()
455{
456 DIR* dir = opendir(PERSISTENT_PROPERTY_DIR);
457 struct dirent* entry;
458 char path[PATH_MAX];
459 char value[PROP_VALUE_MAX];
460 int fd, length;
461
462 if (dir) {
463 while ((entry = readdir(dir)) != NULL) {
Mike Lockwoodb3779552009-05-08 14:27:42 -0400464 if (strncmp("persist.", entry->d_name, strlen("persist.")))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800465 continue;
466#if HAVE_DIRENT_D_TYPE
467 if (entry->d_type != DT_REG)
468 continue;
469#endif
470 /* open the file and read the property value */
471 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, entry->d_name);
472 fd = open(path, O_RDONLY);
473 if (fd >= 0) {
474 length = read(fd, value, sizeof(value) - 1);
475 if (length >= 0) {
476 value[length] = 0;
477 property_set(entry->d_name, value);
478 } else {
479 ERROR("Unable to read persistent property file %s errno: %d\n", path, errno);
480 }
481 close(fd);
482 } else {
483 ERROR("Unable to open persistent property file %s errno: %d\n", path, errno);
484 }
485 }
486 closedir(dir);
487 } else {
488 ERROR("Unable to open persistent property directory %s errno: %d\n", PERSISTENT_PROPERTY_DIR, errno);
489 }
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800490
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800491 persistent_properties_loaded = 1;
492}
493
Dima Zavin88861122011-12-19 11:21:32 -0800494void property_init(void)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800495{
496 init_property_area();
Dima Zavin88861122011-12-19 11:21:32 -0800497}
498
499void property_load_boot_defaults(void)
500{
501 load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800502}
503
Colin Cross3294bbb2010-04-19 17:11:33 -0700504int properties_inited(void)
505{
506 return property_area_inited;
507}
508
Ken Sumrallc5c51032011-03-08 17:01:29 -0800509/* When booting an encrypted system, /data is not mounted when the
510 * property service is started, so any properties stored there are
511 * not loaded. Vold triggers init to load these properties once it
512 * has mounted /data.
513 */
514void load_persist_props(void)
515{
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800516#ifdef ALLOW_LOCAL_PROP_OVERRIDE
Ken Sumrallc5c51032011-03-08 17:01:29 -0800517 load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800518#endif /* ALLOW_LOCAL_PROP_OVERRIDE */
Ken Sumrallc5c51032011-03-08 17:01:29 -0800519 /* Read persistent properties after all default values have been loaded. */
520 load_persistent_properties();
521}
522
Colin Crossd11beb22010-04-13 19:33:37 -0700523void start_property_service(void)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800524{
525 int fd;
526
527 load_properties_from_file(PROP_PATH_SYSTEM_BUILD);
528 load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800529#ifdef ALLOW_LOCAL_PROP_OVERRIDE
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800530 load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800531#endif /* ALLOW_LOCAL_PROP_OVERRIDE */
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800532 /* Read persistent properties after all default values have been loaded. */
533 load_persistent_properties();
534
535 fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0);
Colin Crossd11beb22010-04-13 19:33:37 -0700536 if(fd < 0) return;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800537 fcntl(fd, F_SETFD, FD_CLOEXEC);
538 fcntl(fd, F_SETFL, O_NONBLOCK);
539
540 listen(fd, 8);
Colin Crossd11beb22010-04-13 19:33:37 -0700541 property_set_fd = fd;
542}
543
544int get_property_set_fd()
545{
546 return property_set_fd;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800547}