History log of /system/core/init/init_parser.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/init/init_parser.cpp
1946d3bca8a3b05d2a527606c06948882940287c 09-Oct-2015 Elliott Hughes <enh@google.com> init shouldn't call DumpState by default.

The cost of generating and throwing away a bunch of stuff that no one
normally sees is high enough to be worth avoiding.

Here's AOSP ToT on N9...

init: (Parsing /system/etc/init/atrace.rc took 0.0112s.)
init: (Parsing /system/etc/init/bootanim.rc took 0.0094s.)
init: (Parsing /system/etc/init/crash_reporter.rc took 0.0103s.)
init: (Parsing /system/etc/init/debuggerd.rc took 0.0090s.)
init: (Parsing /system/etc/init/debuggerd64.rc took 0.0085s.)
init: (Parsing /system/etc/init/drmserver.rc took 0.0078s.)
init: (Parsing /system/etc/init/dumpstate.rc took 0.0073s.)
init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0063s.)
init: (Parsing /system/etc/init/installd.rc took 0.0067s.)
init: (Parsing /system/etc/init/keystore.rc took 0.0060s.)
init: (Parsing /system/etc/init/lmkd.rc took 0.0060s.)
init: (Parsing /system/etc/init/logcatd.rc took 0.0059s.)
init: (Parsing /system/etc/init/logd.rc took 0.0068s.)
init: (Parsing /system/etc/init/mdnsd.rc took 0.0057s.)
init: (Parsing /system/etc/init/mediaserver.rc took 0.0064s.)
init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0063s.)
init: (Parsing /system/etc/init/mtpd.rc took 0.0055s.)
init: (Parsing /system/etc/init/netd.rc took 0.0066s.)
init: (Parsing /system/etc/init/perfprofd.rc took 0.0057s.)
init: (Parsing /system/etc/init/racoon.rc took 0.0054s.)
init: (Parsing /system/etc/init/rild.rc took 0.0061s.)
init: (Parsing /system/etc/init/servicemanager.rc took 0.0063s.)
init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0061s.)
init: (Parsing /system/etc/init/uncrypt.rc took 0.0068s.)
init: (Parsing /system/etc/init/vdc.rc took 0.0065s.)
init: (Parsing /system/etc/init/vold.rc took 0.0063s.)

0.0112+0.0094+0.0103+0.0090+0.0085+0.0078+0.0073+0.0063+0.0067+0.0060+
0.0060+0.0059+0.0068+0.0057+0.0064+0.0063+0.0055+0.0066+0.0057+0.0054+
0.0061+0.0063+0.0061+0.0068+0.0065+0.0063 = 0.1809

And here it is again with the logging disabled:

init: (Parsing /system/etc/init/atrace.rc took 0.0021s.)
init: (Parsing /system/etc/init/bootanim.rc took 0.0006s.)
init: (Parsing /system/etc/init/crash_reporter.rc took 0.0007s.)
init: (Parsing /system/etc/init/debuggerd.rc took 0.0004s.)
init: (Parsing /system/etc/init/debuggerd64.rc took 0.0005s.)
init: (Parsing /system/etc/init/drmserver.rc took 0.0005s.)
init: (Parsing /system/etc/init/dumpstate.rc took 0.0005s.)
init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0005s.)
init: (Parsing /system/etc/init/installd.rc took 0.0005s.)
init: (Parsing /system/etc/init/keystore.rc took 0.0013s.)
init: (Parsing /system/etc/init/lmkd.rc took 0.0006s.)
init: (Parsing /system/etc/init/logcatd.rc took 0.0013s.)
init: (Parsing /system/etc/init/logd.rc took 0.0007s.)
init: (Parsing /system/etc/init/mdnsd.rc took 0.0005s.)
init: (Parsing /system/etc/init/mediaserver.rc took 0.0009s.)
init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0008s.)
init: (Parsing /system/etc/init/mtpd.rc took 0.0011s.)
init: (Parsing /system/etc/init/netd.rc took 0.0005s.)
init: (Parsing /system/etc/init/perfprofd.rc took 0.0005s.)
init: (Parsing /system/etc/init/racoon.rc took 0.0005s.)
init: (Parsing /system/etc/init/rild.rc took 0.0005s.)
init: (Parsing /system/etc/init/servicemanager.rc took 0.0005s.)
init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0005s.)
init: (Parsing /system/etc/init/uncrypt.rc took 0.0005s.)
init: (Parsing /system/etc/init/vdc.rc took 0.0005s.)
init: (Parsing /system/etc/init/vold.rc took 0.0006s.)

0.0021+0.0006+0.0007+0.0004+0.0005+0.0005+0.0005+0.0005+0.0005+0.0013+
0.0006+0.0013+0.0007+0.0005+0.0009+0.0008+0.0011+0.0005+0.0005+0.0005+
0.0005+0.0005+0.0005+0.0005+0.0005+0.0006 = 0.0181

It's less than a second, but one problem is that the cost of the current
dumping is proportional to the number of init.rc files, so the more
cleanly you factor things, the more it would cost.

Change-Id: Id96f59e7d0b082d8cfdba4bdbff43a922ba4eeee
/system/core/init/init_parser.cpp
b7349902a945903f9e36a569051f5131beb0bc24 26-Aug-2015 Tom Cherry <tomcherry@google.com> 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
/system/core/init/init_parser.cpp
4ad60fbae51ef4a0b4a4beaa5128d823063c158c 06-Aug-2015 Tom Cherry <tomcherry@google.com> init: replace strdup() in parse_config()

Previously, the action, command, and service structs contained char*s
that referenced memory within the buffer returned by the strdup() of
the input buffer of parse_config. This prevented this entire memory
region from being freed, leaking contents that would never be referenced again.

The changes to convert the previous action, command, and service
structs to C++ classes created explicit ownership of the contents within
each class in the form of std::strings. With these changes, there are
no remaining references to the memory allocated by this strdup(), which
can now be freed.

This commit replaces the strdup() with std::vector<char> to allow for
the copied string to be freed when it goes out of scope instead of
relying on the C strdup() and free() functions.

Change-Id: Id0a5f711e33363082ba201afda6b26043998cb1c
/system/core/init/init_parser.cpp
bac3299720623f4226bca103b26260052732ad30 31-Jul-2015 Tom Cherry <tomcherry@google.com> Create Service and ServiceManager classes

Change-Id: I363a5e4751ad83d2f4096882a6fbbeddca03acfe
/system/core/init/init_parser.cpp
96f67316a22bc9236aed70b198e91a5406389e5b 30-Jul-2015 Tom Cherry <tomcherry@google.com> init: use std::vector<std::string> for argument passing

Change-Id: Ie7a64e65de3a20d0c7f7d8efc0f7c1ba121d07fe
/system/core/init/init_parser.cpp
fa0c21c94ccb98bfa5cf3cc7a6b220be4a5fa378 24-Jul-2015 Tom Cherry <tomcherry@google.com> init: Create classes for Action and Command

This creates the concept of 'event_trigger' vs 'property_trigger'

Previously these were merged into one, such that 'on property:a=b &&
property:b=c' is triggered when properties a=b and b=c as expected,
however combinations such as 'on early-boot && boot' would trigger
during both early-boot and boot. Similarly, 'on early-boot &&
property:a=b' would trigger on both early-boot and again when property
a equals b.

The event trigger distinction ensures that the first example fails to
parse and the second example only triggers on early-boot if
property a equals b.

This coalesces Actions with the same triggers into a single Action object

Change-Id: I8f661d96e8a2d40236f252301bfe10979d663ea6
/system/core/init/init_parser.cpp
f13b1b31399aa501514eb9beeef303d1ae2e0e14 25-Jul-2015 Lee Campbell <leecam@google.com> init: Adding support to import directories

Support added so init scripts can now import directories.

BUG: 22721249
Change-Id: I02b566bfb50ea84469f1ea0c6ad205435a1df286
TEST: Tested importing a folder on arm64 emulator
/system/core/init/init_parser.cpp
00ede7d2626f9343d330dc6f5286bba3e99e41d0 24-Jul-2015 Yabin Cui <yabinc@google.com> init: do expand_props before calling the builtins.

Also switch expand_props to std::string.

Bug: 22654233

Change-Id: I62910d4f74e2b1a5bd2b14aea440767a2a8462b7
/system/core/init/init_parser.cpp
74edcea90e31a3795e58aa1b2bbe96032f0bcd61 24-Jul-2015 Yabin Cui <yabinc@google.com> init: Let property_get return std::string.

Bug: 22654233

Change-Id: Id6091f58432f75e966b9871256049fbe17766c10
/system/core/init/init_parser.cpp
d62f0608d9d67bf647cf15debbd163e84584fe44 13-Jun-2015 Elliott Hughes <enh@google.com> init support for cgroups.

This adds the "writepid" option that instructs init to write the child's
pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs
and/or /dev/cpuset/foreground/cgroup.procs).

Bug: http://b/21163745
Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a
/system/core/init/init_parser.cpp
17fff893c04971b519d25d52b07f51111353cba5 02-Jun-2015 Mark Salyzyn <salyzyn@google.com> init: change exec parsing to make SECLABEL optional

Allow SECLABEL to be - to denote default

Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
/system/core/init/init_parser.cpp
eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b 12-May-2015 Tom Cherry <tomcherry@google.com> Fix insmod module size

read_file() used to append a new line character to the end of the buffer it
returns, because parse_config() isn't able to cope with input that's not
'\n'-terminated. Fix read_file() to be less insane, and push the workarounds
into the parse_config() callers.

Longer term we should rewrite parse_config().

Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
/system/core/init/init_parser.cpp
e5ce30fed81d1918a259be092dcd8bfffc3c2649 07-May-2015 Elliott Hughes <enh@google.com> Clean up init /proc/cmdline handling.

Helped debug a problem where the N9 bootloader incorrectly
concatenated the various command lines.

Bug: http://b/20906691
Change-Id: I0580b06f4185129c7eedf0bdf74b5ce17f88bf9c
/system/core/init/init_parser.cpp
c7ca9dd6c87d69c73706ddc5d739dd9d71314b62 24-Apr-2015 Elliott Hughes <enh@google.com> Revert "Revert "Remove now-unusable 'setcon' command.""

This reverts commit b862bd00a4192d48c3ae82156d8c35b32283e9e4.

This change was fine but an earlier change it depended on was broken.
That change has been fixed and resubmitted.

Bug: http://b/19702273
Change-Id: I17e565721026e48e2a73526f729f2481d4d6edb5
/system/core/init/init_parser.cpp
b862bd00a4192d48c3ae82156d8c35b32283e9e4 24-Apr-2015 Nick Kralevich <nnk@google.com> Revert "Remove now-unusable 'setcon' command."

Temporarily revert because device isn't booting.

This reverts commit 7b15ac99f3bfef33c82ea109487c99a77b41ebfb.

Change-Id: Ice986bac62e20c70f7bedf1744a617b97392ae8c
/system/core/init/init_parser.cpp
7b15ac99f3bfef33c82ea109487c99a77b41ebfb 24-Apr-2015 Elliott Hughes <enh@google.com> Remove now-unusable 'setcon' command.

Bug: http://b/19702273
Change-Id: Icd340c80ba074476dcc63f1c1dd5c61a5c768893
/system/core/init/init_parser.cpp
ae392cf609536e3d57ffcfefec82064347f0259e 13-Apr-2015 Tom Cherry <tomcherry@google.com> Fix memory leak in parse_action

Change-Id: I3ed1da5674ae0b4ac50c1925e4f63af7f1748483
/system/core/init/init_parser.cpp
e2837a9107f8a68a790908d609c0c8dab17d7bdd 03-Apr-2015 Elliott Hughes <enh@google.com> Remove execonce.

Use 'exec' instead.

Change-Id: I1320d1971f7cd8b23753c27aa87089006e112a11
/system/core/init/init_parser.cpp
a57fb596f31ae415446841b35dd8aefe8273b409 01-Apr-2015 Elliott Hughes <enh@google.com> Merge "Remove no-op "capabilities"."
b022b8428c98ec41224813070d5561258a46495a 01-Apr-2015 Elliott Hughes <enh@google.com> Remove no-op "capabilities".

This never worked, and implementing it would just be an attempt to cling to
the pre-SELinux past.

Change-Id: Iecba2affa50ee49ccf62677a607bfae95cb0aaf7
/system/core/init/init_parser.cpp
b8c9d273a07f3fc45780e763bb3f7f6266b8cab7 26-Mar-2015 Paul Lawrence <paullawrence@google.com> Revert "Revert "Adding e4crypt support""

Fix build break caused by original change

This reverts commit 84b0bab58fcc7f225e9a17a15c531b0c2fc509c5.

Change-Id: I99fbd7c3d1ed92db1f546033c8493bb71a327924
/system/core/init/init_parser.cpp
da40c00137f75543a69972f1be506e2d14a41845 28-Mar-2015 Elliott Hughes <enh@google.com> Log more timing information from init.

Also make important events in init's life NOTICE rather than INFO,
and ensure that NOTICE events actually make it to the kernel log.

Also fix the logging so that if you have a printf format string
error, the compiler now catches it.

Also give messages from init, ueventd, and watchdogd distinct tags.
(Previously they'd all call themselves "init", and dmesg doesn't
include pids, so you couldn't untangle them.)

Also include the tag in SELinux messages.

Bug: 19544788
Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe
/system/core/init/init_parser.cpp
7a3d66c9ebdc58c165f5f71b13c971bed872da1c 24-Mar-2015 Mark Salyzyn <salyzyn@google.com> init: missing break statement

Change-Id: Iac4a19c404590c3faba6021c7e537b01805c2d45
/system/core/init/init_parser.cpp
acbf9bef43bc650ed84ba891183ebdf689dafb64 19-Mar-2015 Sami Tolvanen <samitolvanen@google.com> Add init command to set verified properties

Add a command that updates dm-verity state and sets partition.%.verified
properties used by adb remount.

This is needed in init since fs_mgr cannot set properties:
I6a28cccb1ccce960841af20a4b20c32d424b5524

Change-Id: I0fdf5bc29c56690dcadff9d0eb216d3c68483538
/system/core/init/init_parser.cpp
7010301933d428874a2a0dee083a4030e64bcc14 18-Mar-2015 Elliott Hughes <enh@google.com> Remove chroot from init.

This is not obviously useful. Let's wait until we have an actual need.

Change-Id: I2c75c96314b281e89df25b6ed202b3dd5dfdaf15
/system/core/init/init_parser.cpp
641d3e8ea066beaed6f8ad8a3e71f1737bffc0cc 15-Mar-2015 Elliott Hughes <enh@google.com> Remove chdir from init.

Change-Id: Ib2880c6cb18db613deac04ee3b06b9719f5248b9
/system/core/init/init_parser.cpp
5878aa92cd4cac69aedbebea336e94cce7d3bf28 13-Mar-2015 Elliott Hughes <enh@google.com> Remove obsolete setkey.

It's undocumented and unused.

Change-Id: I685dc900adbc14f2e8b4eeebb1e4d111782f141d
/system/core/init/init_parser.cpp
d4b2d8923f9f85f5691aac1e230449052d56c1fd 13-Mar-2015 Stephen Smalley <sds@tycho.nsa.gov> Remove getsebool/setsebool from init and toolbox.

These were leftovers from the SELinux boolean support that
was originally merged. Since Android prohibits SELinux policy
booleans, we can just drop it.

Change-Id: I02f646a7d8db65e153702205b082b87a73f60d73
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
/system/core/init/init_parser.cpp
cee683e290244be9a0e89e8a2996f228cafb4389 12-Mar-2015 Nick Kralevich <nnk@google.com> builtins: remove setenforce command

Adding "setenforce 0" to init.rc isn't a supported way to turn off
SELinux, and doesn't work with AOSP SELinux policy. Remove the code
from init.

Change-Id: If8c8149560789c9a7ba518a0a100e6033bb68898
/system/core/init/init_parser.cpp
a4d98484a2b64d215d1d35830693a16cf2873308 11-Mar-2015 Elliott Hughes <enh@google.com> Merge "Implement exec."
8ff0190835c89cf6d48221cca68d41a105f67a7b 16-Feb-2015 Sami Tolvanen <samitolvanen@google.com> Add init support for dm-verity logging mode

Add a built-in command for loading verity state. If dm-verity
will be started in logging mode, trigger verity-logging.

Needs changes from
Ibb82953594d234f81ad21c40f524190b88e4ac8f

Change-Id: I5af4918f2f14fdd4d07f51c55837e08111fd3748
/system/core/init/init_parser.cpp
8d82ea05cb0945ba6cb8bf321b9ffbd0b6932745 07-Feb-2015 Elliott Hughes <enh@google.com> Implement exec.

Change-Id: I20329bc9b378479d745b498d6a00eca0872cd5ab
/system/core/init/init_parser.cpp
a197ff12dd336a9945ad1164402980296f9c235c 05-Dec-2014 Yongqin Liu <yongqin.liu@linaro.org> bootchart: fix bootchart can not be triggered problem

bootchart uses a file on the data partition to decide if it should collect
data for bootchart, but the data partition will be mounted by the mount_all
command in the "on fs" section, and it will be only added into the action
queue when command "trigger fs" is executed, but that's after the
bootchart_init action (late_init).

This change makes bootchart_init a builtin command of init,
and make it executed as the first command of "on post-fs" section
which will be triggered after the "on fs" section.

This change also refactors the bootchart code to all be in bootchart.cpp.

Change-Id: Ia74aa34ca5b785f51fcffdd383075a549b2a99d9
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
/system/core/init/init_parser.cpp
f682b4786a4093efb23bf80d69bf80eb274b145b 06-Feb-2015 Elliott Hughes <enh@google.com> Clean up reading and writing in init.

This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.

I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...

Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
/system/core/init/init_parser.cpp
c0e919c92062360a69b771722677d041c9998403 04-Feb-2015 Elliott Hughes <enh@google.com> Stop using #if for conditional compilation.

Use regular 'if' to prevent bitrot.

Also remove remaining typedefs.

Change-Id: I2e6ca928e2db29b88b643cf990ff05cfb0be94a6
/system/core/init/init_parser.cpp
f3cf438714aa1284d8a58e2f3b108ba93f6d3abb 04-Feb-2015 Elliott Hughes <enh@google.com> Build init as C++.

This is just the minimal change to keep it building.

Change-Id: I245c5b8413a1db114576c81462eb5737f5ffcef2
/system/core/init/init_parser.cpp