adbd
adbd copied to clipboard
Add a flat-file implementation of property_set / property_get.
For non-android systems, implement property_set() and property_get() in terms of operations on a flat file of key=value pairs. The path is hard-coded in include.mk to $sysconfdir/adb.properties.
The implementation is not particularly efficient, but designed to be safe against updates from multiple threads and processes.
In addition to the changes mentioned, I'd really like to have 1) room in the implementation to define some properties programmatically (quite a few of them should be provided by systemd and co.) 2) have an example file with a list of properties with a nice default value, if only to show the syntax.
Do you have an example of something that we could implement programmatically that adbd needs? It seems like most of the ro.* it reads just don't matter for the non-android case. I believe that ro.*
Hmm, an example file is a little tricky because while the file is flat:
- It doesn't support comments
- It is ordered by key value
- It gets updated by changing existing lines and inserting lines between existing lines
It's basically human readable but only human writable at an emergency. I suppose I can move to more human friendly:
- Ignore initial whitespace, and lines beginning with #
- Drop the ordering by key value - it allows future efficient bsearch lookups, but that doesn't matter
- Insert all programmatically added lines at the end of the file
then we could ship an example adb.properties with a commented out service.adb.tcp.port and a comment about syntax.
"I believe that ro.*" - meant to say that the "ro." properties are android build time, as far as I can determine - system properties aren't used for dynamic system information.
Updated my patches to:
- merge the PROP_* constants with the existing ADB_NON_ANDROID block
- make the file format human editable (commnents, no including trailing whitespace into values, etc.)
- install a sample file