2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __CUTILS_PROPERTIES_H
18 #define __CUTILS_PROPERTIES_H
24 /* System properties are *small* name value pairs managed by the
25 ** property service. If your data doesn't fit in the provided
26 ** space it is not appropriate for a system property.
28 ** WARNING: system/bionic/include/sys/system_properties.h also defines
29 ** these, but with different names. (TODO: fix that)
31 #define PROPERTY_KEY_MAX 32
32 #define PROPERTY_VALUE_MAX 92
34 /* property_get: returns the length of the value which will never be
35 ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
36 ** (the length does not include the terminating zero).
38 ** If the property read fails or returns an empty value, the default
39 ** value is used (if nonnull).
41 int property_get(const char *key
, char *value
, const char *default_value
);
43 /* property_set: returns 0 on success, < 0 on failure
45 int property_set(const char *key
, const char *value
);
47 /* property_set_sync: returns 0 on success, < 0 on failure
49 ** symbol needed for Motorola RILs. Calls property_set
51 int property_set_sync(const char *key
, const char *value
);
53 int property_list(void (*propfn
)(const char *key
, const char *value
, void *cookie
), void *cookie
);
56 #ifdef HAVE_SYSTEM_PROPERTY_SERVER
58 * We have an external property server instead of built-in libc support.
59 * Used by the simulator.
61 #define SYSTEM_PROPERTY_PIPE_NAME "/tmp/android-sysprop"
64 kSystemPropertyUnknown
= 0,
69 #endif /*HAVE_SYSTEM_PROPERTY_SERVER*/