AnsweredAssumed Answered

Questions about Android init.rc

Question asked by eddie huang on Oct 5, 2015

Recently, I started to look into the code parsing init.rc, which is in $(android_source_root)/system/core/init/ folder. I wrote a statement for creating a folder in init.rc on the "on post-of-data" action, "mkdir /data/test_dir 0770 system system" for instance. After booting, the directory is actually created.

 

My problem is, when I traced the code, I realized the commands in init.rc file are actually recognized by init.c and they are parsed in parse_config function. There is an array for mapping all the commands with their functions and I noticed mkdir command is actually implemented by do_mkdir function. The tricky thing is, I wrote some codes to log the folder path do_mkdir gonna to create and found "/data/test_dir" is not logged but this folder is actually created. So which function really creates folders that we write in init.rc file? Thanks.

Outcomes