|
1 | | -/* |
2 | | - * Copyright (C) 2008 The Android Open Source Project |
3 | | - * All rights reserved. |
4 | | - * |
5 | | - * Redistribution and use in source and binary forms, with or without |
6 | | - * modification, are permitted provided that the following conditions |
7 | | - * are met: |
8 | | - * * Redistributions of source code must retain the above copyright |
9 | | - * notice, this list of conditions and the following disclaimer. |
10 | | - * * Redistributions in binary form must reproduce the above copyright |
11 | | - * notice, this list of conditions and the following disclaimer in |
12 | | - * the documentation and/or other materials provided with the |
13 | | - * distribution. |
14 | | - * |
15 | | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
16 | | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
17 | | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
19 | | - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
20 | | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
21 | | - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 | | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
23 | | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
24 | | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | | - */ |
26 | | - |
27 | | -#ifndef _INCLUDE_SYS__SYSTEM_PROPERTIES_H |
28 | | -#define _INCLUDE_SYS__SYSTEM_PROPERTIES_H |
29 | | - |
30 | | -#include <stdint.h> |
31 | | - |
32 | | -#ifndef _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ |
33 | | -#error "You should #include <sys/system_properties.h> instead." |
34 | | -#endif |
35 | | - |
36 | 1 | #include <sys/system_properties.h> |
37 | | - |
38 | | -#ifdef __cplusplus |
39 | | -extern "C" { |
40 | | -#endif |
41 | | - |
42 | | -#define PROP_SERVICE_NAME "property_service" |
43 | | -#define PROP_FILENAME "/dev/__properties__" |
44 | | - |
45 | | -#define PROP_MSG_SETPROP 1 |
46 | | -#define PROP_MSG_SETPROP2 0x00020001 |
47 | | - |
48 | | -#define PROP_SUCCESS 0 |
49 | | -#define PROP_ERROR_READ_CMD 0x0004 |
50 | | -#define PROP_ERROR_READ_DATA 0x0008 |
51 | | -#define PROP_ERROR_READ_ONLY_PROPERTY 0x000B |
52 | | -#define PROP_ERROR_INVALID_NAME 0x0010 |
53 | | -#define PROP_ERROR_INVALID_VALUE 0x0014 |
54 | | -#define PROP_ERROR_PERMISSION_DENIED 0x0018 |
55 | | -#define PROP_ERROR_INVALID_CMD 0x001B |
56 | | -#define PROP_ERROR_HANDLE_CONTROL_MESSAGE 0x0020 |
57 | | -#define PROP_ERROR_SET_FAILED 0x0024 |
58 | | - |
59 | | -/** |
60 | | - * This was previously for testing, but now that SystemProperties is its own |
61 | | - * testable class, there is never a reason to call this function and its |
62 | | - * implementation simply returns -1. |
63 | | - */ |
64 | | -int __system_property_set_filename(const char* __filename); |
65 | | - |
66 | | -/** |
67 | | - * Initialize the area to be used to store properties. Can only be done by a |
68 | | - * single process that has write access to the property area. |
69 | | - */ |
70 | | -int __system_property_area_init(void); |
71 | | - |
72 | | -/** |
73 | | - * Read the global serial number of the system properties. |
74 | | - * |
75 | | - * Called to predict if a series of cached __system_property_find objects will |
76 | | - * have seen __system_property_serial values change. Also helps determine if a |
77 | | - * failed __system_property_find could now find a new object. |
78 | | - * |
79 | | - * Returns the serial number on success, -1 on error. |
80 | | - */ |
81 | | -uint32_t __system_property_area_serial(void); |
82 | | - |
83 | | -/** |
84 | | - * Add a new system property. Can only be done by a single process with write |
85 | | - * access to the property area, ensuring the property does not already exist. |
86 | | - * |
87 | | - * Returns 0 on success, -1 if the property area is full. |
88 | | - */ |
89 | | -int __system_property_add(const char* __name, unsigned int __name_length, |
90 | | - const char* __value, unsigned int __value_length); |
91 | | - |
92 | | -/** |
93 | | - * Update the value of a system property returned by __system_property_find. |
94 | | - * Can only be done by a single process with write access to the property area. |
95 | | - * |
96 | | - * Returns 0 on success, -1 if the parameters are incorrect. |
97 | | - */ |
98 | | -int __system_property_update(prop_info* __pi, const char* __value, |
99 | | - unsigned int __value_length); |
100 | | - |
101 | | -/** |
102 | | - * Read the serial number of a system property returned by __system_property_find. |
103 | | - * |
104 | | - * Returns the serial number on success, -1 on error. |
105 | | - */ |
106 | | -uint32_t __system_property_serial(const prop_info* __pi); |
107 | | - |
108 | | -/** |
109 | | - * Initialize the system properties area in read-only mode. Should be done by |
110 | | - * all processes that need to read system properties. |
111 | | - * |
112 | | - * Returns 0 on success, -1 otherwise. |
113 | | - */ |
114 | | -int __system_properties_init(void); |
115 | | - |
116 | | -/** |
117 | | - * Deprecated: use __system_property_wait instead. |
118 | | - */ |
119 | | -uint32_t __system_property_wait_any(uint32_t __old_serial); |
120 | | - |
121 | | -#ifdef __cplusplus |
122 | | -} |
123 | | -#endif |
124 | | - |
125 | | -#endif // _INCLUDE_SYS__SYSTEM_PROPERTIES_H |
0 commit comments