System Process zygote (2) -- zygote. rc Script, zygotezygote. rc
The sunset is fading down. Who can draw the beauty of the evening? Where is my home and my home? My lover, I think about you like this. Do you have the slightest concern? -- Xu Zhimo's dream of the seaside
Ilocker: Follow Android Security (New entry, 0 basics) QQ: 2597294287
In the previous note, the zygote process was started as a service by the init process according to the commands in the zygote. rc Script.
In linux, a service is usually a daemon program. It is usually started at system startup and runs on the background until the system is stopped. For example, the httpd daemon of the Apache server keeps listening to port 80 for http requests. Service programs usually start or stop using service commands.
There are four startup scripts related to zygote in the \ system \ core \ rootdir directory:
Because android 5 has started to support 64-bit programs, different scripts are introduced in init. rc based on the system attribute ro. zygote values:
Therefore, the ro. zygote attribute values can be: zygote32, zygote64, zygote32_64, and zygote64_32.
These scripts are mainly different:
- Init. zygote32.rc: The execution program corresponding to the zygote process is app_process (pure 32bit mode)
- Init. zygote64.rc: The execution program corresponding to the zygote process is app_process64 (in pure 64bit mode)
- Init. zygote32_64.rc: Start two zygote processes (named zygote and zygote_secondary). The corresponding execution programs are app_process32 (master mode) and app_process64.
- Init. zygote64_32.rc: Start two zygote processes (named zygote and zygote_secondary). The corresponding execution programs are app_process64 (master mode) and app_process32.
The content of init. zygote32_64.rc is shown below:
1 service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote 2 class main 3 socket zygote stream 660 root system 4 onrestart write /sys/android_power/request_state wake 5 onrestart write /sys/power/state on 6 onrestart restart media 7 onrestart restart netd 8 9 service zygote_secondary /system/bin/app_process64 -Xzygote /system/bin --zygote --socket-name=zygote_secondary10 class main11 socket zygote_secondary stream 660 root system12 onrestart restart zygote
If you do not understand the script content, see \ system \ core \ init \ readme.txt.
The source code of app_process is located in the \ frameworks \ base \ cmds \ app_process path. There is only one app_main.cpp file, and the entry function is main.
(1) http://blog.csdn.net/luoshengyang/article/details/6768304 (2) in-depth analysis of Android 5.0 System