init: don't skip starting a service with no domain if permissive Requires external/libselinux change as well Change-Id: I3f2887930e15d09014c2594141ba4acbbc8d6d9d
init: Run restorecon_recursive asynchronously restorecon_recursive may take a long time if there are a lot of files on the volume. This can trigger a watchdog timeout in any process that tries to set a property while it is running. Fix this by running restorecon_recursive in its own process. See https://jira.lineageos.org/browse/BUGBASH-555 Change-Id: I2ce26ff2b5bfc9a133ea42f4dbac50a3ac289c04
Fix clang-tidy performance warnings in syste/core. * Use const reference type for parameters to avoid unnecessary copy. * Suppress warning of not using faster overloaded string find function. Bug: 30407689 Bug: 30411878 Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee Test: build with WITH_TIDY=1 Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
init: expand arguments of services when they start Arguments of commands are expanded based on properties if they contain ${property.name}, however this is not currently done for arguments of services. This patch makes it that arguments of services are expanded each time that the service starts at the point immediately before execve(). Bug: 28788401 Change-Id: Iba581a8377e25a6478d4d2ec2e8b29e181d8640c
Remove undocumented functionality from init. Bug: http://b/28151340 Change-Id: I5360502c79d9113a13055bf017b39c099033e947
init: fix writepid wrong pid written in file(s) When child (pid==0) executes fork branch 'pid_str' will always be 0 writting wrong value to file(s). Fix by utilizing getpid() to obtain correct pid. Tracker link provides some insight on why use cases aren't broken. Bug: https://code.google.com/p/android/issues/detail?id=200392 Change-Id: I29989365a8bac94502c090918fa30e5cc88eb1ea Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
init: Allows shutting down cleanly. When ro.build.shutdown_timeout is set, init will send a SIGTERM signal to all services on reboot. The normal shutdown process will continue once all services have exited or after the shutdown timeout (ro.build.shutdown_timeout). If ro.build.shutdown_timeout is not set, we assume a 0s timeout. Bug: 26216447 Test: manual: Ask to reboot. All services exit cleanly. Change-Id: If921f6e8d87211e500ac9fa86f3e1eabe02d18cf
Remove property_area_initialized This is deadcode as property_init() will only ever be called once and the only remaining caller of properties_initialized() is Service::NotifyStateChange() which can only be called after properties have been initialized. Change-Id: Ie071af84fcdbead72d259890fc8fb8db624282e7
Merge "Remove ANDROID_PROPERTY_WORKSPACE"
Track rename of base/ to android-base/. Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
Remove ANDROID_PROPERTY_WORKSPACE Bug 23290008 Change-Id: I95babe735444ada10c67594ace700cae5d1ec0b3
init: Use classes for parsing and clean up memory allocations Create a Parser class that uses multiple SectionParser interfaces to handle parsing the different sections of an init rc. Create an ActionParser and ServiceParser that implement SectionParser and parse the sections corresponding to Action and Service classes. Remove the legacy keyword structure and replace it with std::map's that map keyword -> (minimum args, maximum args, function pointer) for Commands and Service Options. Create an ImportParser that implements SectionParser and handles the import 'section'. Clean up the unsafe memory handling of the Action class by using std::unique_ptr. Change-Id: Ic5ea5510cb956dbc3f78745a35096ca7d6da7085
Add missing includes. Leaky header cleanup in libc++ means we don't get unistd.h transitively any more. Change-Id: I596c24eff418302b19afab6ad3caa55f52241e7c
Create Service and ServiceManager classes Change-Id: I363a5e4751ad83d2f4096882a6fbbeddca03acfe