blob: 4ee86c0c18ac32c1e9395b680efa824ebb0b5a61 [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 },
jeonghoon.lim8c0350f2012-07-03 12:04:38 -070079 { "bluetooth.", AID_SYSTEM, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040080 { "dhcp.", AID_SYSTEM, 0 },
81 { "dhcp.", AID_DHCP, 0 },
Romain Guy45fa13f2012-04-27 15:19:30 -070082 { "debug.", AID_SYSTEM, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040083 { "debug.", AID_SHELL, 0 },
84 { "log.", AID_SHELL, 0 },
85 { "service.adb.root", AID_SHELL, 0 },
Mike Lockwood58aa5b02010-12-10 09:48:41 -080086 { "service.adb.tcp.port", AID_SHELL, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040087 { "persist.sys.", AID_SYSTEM, 0 },
88 { "persist.service.", AID_SYSTEM, 0 },
Oscar Montemayoref4e2152009-11-12 12:02:24 -080089 { "persist.security.", AID_SYSTEM, 0 },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -040090 { NULL, 0, 0 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080091};
92
93/*
94 * White list of UID that are allowed to start/stop services.
95 * Currently there are no user apps that require.
96 */
97struct {
98 const char *service;
99 unsigned int uid;
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400100 unsigned int gid;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800101} control_perms[] = {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400102 { "dumpstate",AID_SHELL, AID_LOG },
Wink Savillecfa0d842010-10-03 13:30:11 -0700103 { "ril-daemon",AID_RADIO, AID_RADIO },
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400104 {NULL, 0, 0 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800105};
106
107typedef struct {
108 void *data;
109 size_t size;
110 int fd;
111} workspace;
112
113static int init_workspace(workspace *w, size_t size)
114{
115 void *data;
116 int fd;
117
Brian Swetland25b15be2010-07-13 16:43:56 -0700118 /* dev is a tmpfs that we can use to carve a shared workspace
119 * out of, so let's do that...
120 */
121 fd = open("/dev/__properties__", O_RDWR | O_CREAT, 0600);
122 if (fd < 0)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800123 return -1;
124
Brian Swetland25b15be2010-07-13 16:43:56 -0700125 if (ftruncate(fd, size) < 0)
126 goto out;
127
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800128 data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
129 if(data == MAP_FAILED)
130 goto out;
131
Brian Swetland25b15be2010-07-13 16:43:56 -0700132 close(fd);
133
134 fd = open("/dev/__properties__", O_RDONLY);
135 if (fd < 0)
136 return -1;
137
138 unlink("/dev/__properties__");
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800139
140 w->data = data;
141 w->size = size;
142 w->fd = fd;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800143 return 0;
144
145out:
146 close(fd);
147 return -1;
148}
149
150/* (8 header words + 247 toc words) = 1020 bytes */
151/* 1024 bytes header and toc + 247 prop_infos @ 128 bytes = 32640 bytes */
152
153#define PA_COUNT_MAX 247
154#define PA_INFO_START 1024
155#define PA_SIZE 32768
156
157static workspace pa_workspace;
158static prop_info *pa_info_array;
159
160extern prop_area *__system_property_area__;
161
162static int init_property_area(void)
163{
164 prop_area *pa;
165
166 if(pa_info_array)
167 return -1;
168
169 if(init_workspace(&pa_workspace, PA_SIZE))
170 return -1;
171
172 fcntl(pa_workspace.fd, F_SETFD, FD_CLOEXEC);
173
174 pa_info_array = (void*) (((char*) pa_workspace.data) + PA_INFO_START);
175
176 pa = pa_workspace.data;
177 memset(pa, 0, PA_SIZE);
178 pa->magic = PROP_AREA_MAGIC;
179 pa->version = PROP_AREA_VERSION;
180
181 /* plug into the lib property services */
182 __system_property_area__ = pa;
Colin Cross3294bbb2010-04-19 17:11:33 -0700183 property_area_inited = 1;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800184 return 0;
185}
186
187static void update_prop_info(prop_info *pi, const char *value, unsigned len)
188{
189 pi->serial = pi->serial | 1;
190 memcpy(pi->value, value, len + 1);
191 pi->serial = (len << 24) | ((pi->serial + 1) & 0xffffff);
192 __futex_wake(&pi->serial, INT32_MAX);
193}
194
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800195/*
196 * Checks permissions for starting/stoping system services.
197 * AID_SYSTEM and AID_ROOT are always allowed.
198 *
199 * Returns 1 if uid allowed, 0 otherwise.
200 */
Colin Crossd11beb22010-04-13 19:33:37 -0700201static int check_control_perms(const char *name, unsigned int uid, unsigned int gid) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800202 int i;
203 if (uid == AID_SYSTEM || uid == AID_ROOT)
204 return 1;
205
206 /* Search the ACL */
207 for (i = 0; control_perms[i].service; i++) {
208 if (strcmp(control_perms[i].service, name) == 0) {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400209 if ((uid && control_perms[i].uid == uid) ||
210 (gid && control_perms[i].gid == gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800211 return 1;
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400212 }
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800213 }
214 }
215 return 0;
216}
217
218/*
219 * Checks permissions for setting system properties.
220 * Returns 1 if uid allowed, 0 otherwise.
221 */
Colin Crossd11beb22010-04-13 19:33:37 -0700222static int check_perms(const char *name, unsigned int uid, unsigned int gid)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800223{
224 int i;
225 if (uid == 0)
226 return 1;
227
228 if(!strncmp(name, "ro.", 3))
229 name +=3;
230
231 for (i = 0; property_perms[i].prefix; i++) {
232 int tmp;
233 if (strncmp(property_perms[i].prefix, name,
234 strlen(property_perms[i].prefix)) == 0) {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400235 if ((uid && property_perms[i].uid == uid) ||
236 (gid && property_perms[i].gid == gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800237 return 1;
238 }
239 }
240 }
241
242 return 0;
243}
244
245const char* property_get(const char *name)
246{
247 prop_info *pi;
248
249 if(strlen(name) >= PROP_NAME_MAX) return 0;
250
251 pi = (prop_info*) __system_property_find(name);
252
253 if(pi != 0) {
254 return pi->value;
255 } else {
256 return 0;
257 }
258}
259
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800260static void write_persistent_property(const char *name, const char *value)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800261{
262 const char *tempPath = PERSISTENT_PROPERTY_DIR "/.temp";
263 char path[PATH_MAX];
264 int fd, length;
265
266 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, name);
267
268 fd = open(tempPath, O_WRONLY|O_CREAT|O_TRUNC, 0600);
269 if (fd < 0) {
270 ERROR("Unable to write persistent property to temp file %s errno: %d\n", tempPath, errno);
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800271 return;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800272 }
273 write(fd, value, strlen(value));
274 close(fd);
275
276 if (rename(tempPath, path)) {
277 unlink(tempPath);
278 ERROR("Unable to rename persistent property file %s to %s\n", tempPath, path);
279 }
280}
281
282int property_set(const char *name, const char *value)
283{
284 prop_area *pa;
285 prop_info *pi;
286
287 int namelen = strlen(name);
288 int valuelen = strlen(value);
289
290 if(namelen >= PROP_NAME_MAX) return -1;
291 if(valuelen >= PROP_VALUE_MAX) return -1;
292 if(namelen < 1) return -1;
293
294 pi = (prop_info*) __system_property_find(name);
295
296 if(pi != 0) {
297 /* ro.* properties may NEVER be modified once set */
298 if(!strncmp(name, "ro.", 3)) return -1;
299
300 pa = __system_property_area__;
301 update_prop_info(pi, value, valuelen);
302 pa->serial++;
303 __futex_wake(&pa->serial, INT32_MAX);
304 } else {
305 pa = __system_property_area__;
306 if(pa->count == PA_COUNT_MAX) return -1;
307
308 pi = pa_info_array + pa->count;
309 pi->serial = (valuelen << 24);
310 memcpy(pi->name, name, namelen + 1);
311 memcpy(pi->value, value, valuelen + 1);
312
313 pa->toc[pa->count] =
314 (namelen << 24) | (((unsigned) pi) - ((unsigned) pa));
315
316 pa->count++;
317 pa->serial++;
318 __futex_wake(&pa->serial, INT32_MAX);
319 }
320 /* If name starts with "net." treat as a DNS property. */
Mike Lockwoodb3779552009-05-08 14:27:42 -0400321 if (strncmp("net.", name, strlen("net.")) == 0) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800322 if (strcmp("net.change", name) == 0) {
323 return 0;
324 }
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800325 /*
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800326 * The 'net.change' property is a special property used track when any
327 * 'net.*' property name is updated. It is _ONLY_ updated here. Its value
328 * contains the last updated 'net.*' property.
329 */
330 property_set("net.change", name);
331 } else if (persistent_properties_loaded &&
Mike Lockwoodb3779552009-05-08 14:27:42 -0400332 strncmp("persist.", name, strlen("persist.")) == 0) {
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800333 /*
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800334 * Don't write properties to disk until after we have read all default properties
335 * to prevent them from being overwritten by default values.
336 */
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800337 write_persistent_property(name, value);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800338 }
339 property_changed(name, value);
340 return 0;
341}
342
Colin Crossd11beb22010-04-13 19:33:37 -0700343void handle_property_set_fd()
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800344{
345 prop_msg msg;
346 int s;
347 int r;
348 int res;
349 struct ucred cr;
350 struct sockaddr_un addr;
351 socklen_t addr_size = sizeof(addr);
352 socklen_t cr_size = sizeof(cr);
353
Colin Crossd11beb22010-04-13 19:33:37 -0700354 if ((s = accept(property_set_fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800355 return;
356 }
357
358 /* Check socket options here */
359 if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cr, &cr_size) < 0) {
360 close(s);
361 ERROR("Unable to recieve socket options\n");
362 return;
363 }
364
Mike Lockwoodd18678f2011-07-01 14:48:50 -0400365 r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), 0));
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800366 if(r != sizeof(prop_msg)) {
Mike Lockwoodd18678f2011-07-01 14:48:50 -0400367 ERROR("sys_prop: mis-match msg size recieved: %d expected: %d errno: %d\n",
368 r, sizeof(prop_msg), errno);
Brad Fitzpatrick9f1e0e32011-03-30 12:39:56 -0700369 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800370 return;
371 }
372
373 switch(msg.cmd) {
374 case PROP_MSG_SETPROP:
375 msg.name[PROP_NAME_MAX-1] = 0;
376 msg.value[PROP_VALUE_MAX-1] = 0;
377
378 if(memcmp(msg.name,"ctl.",4) == 0) {
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700379 // Keep the old close-socket-early behavior when handling
380 // ctl.* properties.
381 close(s);
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400382 if (check_control_perms(msg.value, cr.uid, cr.gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800383 handle_control_message((char*) msg.name + 4, (char*) msg.value);
384 } else {
Wink Savillecfa0d842010-10-03 13:30:11 -0700385 ERROR("sys_prop: Unable to %s service ctl [%s] uid:%d gid:%d pid:%d\n",
386 msg.name + 4, msg.value, cr.uid, cr.gid, cr.pid);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800387 }
388 } else {
Mike Lockwoodc5e7ef22009-09-02 18:08:52 -0400389 if (check_perms(msg.name, cr.uid, cr.gid)) {
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800390 property_set((char*) msg.name, (char*) msg.value);
391 } else {
392 ERROR("sys_prop: permission denied uid:%d name:%s\n",
393 cr.uid, msg.name);
394 }
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700395
396 // Note: bionic's property client code assumes that the
397 // property server will not close the socket until *AFTER*
398 // the property is written to memory.
399 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800400 }
401 break;
402
403 default:
Brad Fitzpatrick71ead182011-04-01 08:24:13 -0700404 close(s);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800405 break;
406 }
407}
408
409void get_property_workspace(int *fd, int *sz)
410{
411 *fd = pa_workspace.fd;
412 *sz = pa_workspace.size;
413}
414
415static void load_properties(char *data)
416{
417 char *key, *value, *eol, *sol, *tmp;
418
419 sol = data;
420 while((eol = strchr(sol, '\n'))) {
421 key = sol;
422 *eol++ = 0;
423 sol = eol;
424
425 value = strchr(key, '=');
426 if(value == 0) continue;
427 *value++ = 0;
428
429 while(isspace(*key)) key++;
430 if(*key == '#') continue;
431 tmp = value - 2;
432 while((tmp > key) && isspace(*tmp)) *tmp-- = 0;
433
434 while(isspace(*value)) value++;
435 tmp = eol - 2;
436 while((tmp > value) && isspace(*tmp)) *tmp-- = 0;
437
438 property_set(key, value);
439 }
440}
441
442static void load_properties_from_file(const char *fn)
443{
444 char *data;
445 unsigned sz;
446
447 data = read_file(fn, &sz);
448
449 if(data != 0) {
450 load_properties(data);
451 free(data);
452 }
453}
454
455static void load_persistent_properties()
456{
457 DIR* dir = opendir(PERSISTENT_PROPERTY_DIR);
458 struct dirent* entry;
459 char path[PATH_MAX];
460 char value[PROP_VALUE_MAX];
461 int fd, length;
462
463 if (dir) {
464 while ((entry = readdir(dir)) != NULL) {
Mike Lockwoodb3779552009-05-08 14:27:42 -0400465 if (strncmp("persist.", entry->d_name, strlen("persist.")))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800466 continue;
467#if HAVE_DIRENT_D_TYPE
468 if (entry->d_type != DT_REG)
469 continue;
470#endif
471 /* open the file and read the property value */
472 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, entry->d_name);
473 fd = open(path, O_RDONLY);
474 if (fd >= 0) {
475 length = read(fd, value, sizeof(value) - 1);
476 if (length >= 0) {
477 value[length] = 0;
478 property_set(entry->d_name, value);
479 } else {
480 ERROR("Unable to read persistent property file %s errno: %d\n", path, errno);
481 }
482 close(fd);
483 } else {
484 ERROR("Unable to open persistent property file %s errno: %d\n", path, errno);
485 }
486 }
487 closedir(dir);
488 } else {
489 ERROR("Unable to open persistent property directory %s errno: %d\n", PERSISTENT_PROPERTY_DIR, errno);
490 }
Tammo Spalink3dfe6c62009-08-26 10:13:20 +0800491
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800492 persistent_properties_loaded = 1;
493}
494
Dima Zavin88861122011-12-19 11:21:32 -0800495void property_init(void)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800496{
497 init_property_area();
Dima Zavin88861122011-12-19 11:21:32 -0800498}
499
500void property_load_boot_defaults(void)
501{
502 load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800503}
504
Colin Cross3294bbb2010-04-19 17:11:33 -0700505int properties_inited(void)
506{
507 return property_area_inited;
508}
509
Ken Sumrallc5c51032011-03-08 17:01:29 -0800510/* When booting an encrypted system, /data is not mounted when the
511 * property service is started, so any properties stored there are
512 * not loaded. Vold triggers init to load these properties once it
513 * has mounted /data.
514 */
515void load_persist_props(void)
516{
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800517#ifdef ALLOW_LOCAL_PROP_OVERRIDE
Ken Sumrallc5c51032011-03-08 17:01:29 -0800518 load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800519#endif /* ALLOW_LOCAL_PROP_OVERRIDE */
Ken Sumrallc5c51032011-03-08 17:01:29 -0800520 /* Read persistent properties after all default values have been loaded. */
521 load_persistent_properties();
522}
523
Colin Crossd11beb22010-04-13 19:33:37 -0700524void start_property_service(void)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800525{
526 int fd;
527
528 load_properties_from_file(PROP_PATH_SYSTEM_BUILD);
529 load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800530#ifdef ALLOW_LOCAL_PROP_OVERRIDE
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800531 load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
Nick Kralevich0dbda7e2012-01-18 13:38:34 -0800532#endif /* ALLOW_LOCAL_PROP_OVERRIDE */
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800533 /* Read persistent properties after all default values have been loaded. */
534 load_persistent_properties();
535
536 fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0);
Colin Crossd11beb22010-04-13 19:33:37 -0700537 if(fd < 0) return;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800538 fcntl(fd, F_SETFD, FD_CLOEXEC);
539 fcntl(fd, F_SETFL, O_NONBLOCK);
540
541 listen(fd, 8);
Colin Crossd11beb22010-04-13 19:33:37 -0700542 property_set_fd = fd;
543}
544
545int get_property_set_fd()
546{
547 return property_set_fd;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800548}