Lines Matching refs:pi
143 uint32_t SystemProperties::ReadMutablePropertyValue(const prop_info* pi, char* value) { in ReadMutablePropertyValue() argument
145 uint32_t new_serial = load_const_atomic(&pi->serial, memory_order_acquire); in ReadMutablePropertyValue()
153 prop_area* pa = contexts_->GetPropAreaForName(pi->name); in ReadMutablePropertyValue()
156 memcpy(value, pi->value, len + 1); in ReadMutablePropertyValue()
159 new_serial = load_const_atomic(&pi->serial, memory_order_relaxed); in ReadMutablePropertyValue()
174 int SystemProperties::Read(const prop_info* pi, char* name, char* value) { in Read() argument
175 uint32_t serial = ReadMutablePropertyValue(pi, value); in Read()
177 size_t namelen = strlcpy(name, pi->name, PROP_NAME_MAX); in Read()
183 pi->name, PROP_NAME_MAX - 1, name); in Read()
186 if (is_read_only(pi->name) && pi->is_long()) { in Read()
192 pi->name, strlen(pi->long_value())); in Read()
197 void SystemProperties::ReadCallback(const prop_info* pi, in ReadCallback() argument
203 if (is_read_only(pi->name)) { in ReadCallback()
204 uint32_t serial = load_const_atomic(&pi->serial, memory_order_relaxed); in ReadCallback()
205 if (pi->is_long()) { in ReadCallback()
206 callback(cookie, pi->name, pi->long_value(), serial); in ReadCallback()
208 callback(cookie, pi->name, pi->value, serial); in ReadCallback()
214 uint32_t serial = ReadMutablePropertyValue(pi, value_buf); in ReadCallback()
215 callback(cookie, pi->name, value_buf, serial); in ReadCallback()
219 const prop_info* pi = Find(name); in Get() local
221 if (pi != nullptr) { in Get()
222 return Read(pi, nullptr, value); in Get()
229 int SystemProperties::Update(prop_info* pi, const char* value, unsigned int len) { in Update() argument
242 prop_area* pa = contexts_->GetPropAreaForName(pi->name); in Update()
244 async_safe_format_log(ANDROID_LOG_ERROR, "libc", "Could not find area for \"%s\"", pi->name); in Update()
248 uint32_t serial = atomic_load_explicit(&pi->serial, memory_order_relaxed); in Update()
255 memcpy(pa->dirty_backup_area(), pi->value, old_len + 1); in Update()
258 atomic_store_explicit(&pi->serial, serial, memory_order_relaxed); in Update()
259 strlcpy(pi->value, value, len + 1); in Update()
263 atomic_store_explicit(&pi->serial, (len << 24) | ((serial + 1) & 0xffffff), memory_order_relaxed); in Update()
264 __futex_wake(&pi->serial, INT32_MAX); // Fence by side effect in Update()
318 bool SystemProperties::Wait(const prop_info* pi, uint32_t old_serial, uint32_t* new_serial_ptr, in Wait() argument
322 if (pi == nullptr) { in Wait()
334 serial_ptr = const_cast<atomic_uint_least32_t*>(&pi->serial); in Wait()
358 static void fn(const prop_info* pi, void* ptr) { in FindNth()
360 if (self->current++ == self->sought) self->result = pi; in FindNth()
367 int SystemProperties::Foreach(void (*propfn)(const prop_info* pi, void* cookie), void* cookie) { in Foreach() argument