In-depth init of android 4.3 framework

Source: Internet
Author: User

Init. c (system/core/init. c)

The first process of user space in Linux. The main function mainly parses two configuration files, init. for rc and hardware-related configuration files, the parsing calls init_parse_config_file. In the Parse_config of Ueventd_Parser.c, locate the section of the configuration file. Different sections are parsed in different ways, section indicates the section when symbol is on or service, and the import keyword is added to section 4.3. rc

On init: on keyword, corresponding section name is init

Analyze the init. rc file

1. The content of a section starts from the identifier and ends with the end of the next section.

2. boot and init are in the on section,

Parse service section:

In init. h, the service struct is used to fill the content of the configuration file in the service struct through parse_service and parse_line_service in Initparse. c.

Init Control Service:

1. Start zygote. When the init process is executed to do_class_start, the service is started. Because the classname of zygote is default. in rc # class_start is default, in init. zygote in c

You can use fork to create a sub-thread and execve to execve a new service.

2. Restart zygote in init. in the rc poll event, there is a SVC_RESTARTING identifier, set it, execute the onrestart command in the service, in the init. in the for loop of c, execute restart_processes and restart all services marked as SVC_RESTARTING.


Property service, similar to the Registry. After restart, the key value still exists.

1. Attribute Service initialization. init_property_aera () initializes the bucket. PA_SIZE contains 32768 bytes and PA_INFO_START (1024) bytes stores the header information.

2. The init is created on the shared memory, and the shared memory can be used across processes (init_workspace). The client can directly read the attribute space with only the read permission.

3. The client needs to interact with each other through the property server to set properties. The client sends a request through property_set. The init process starts the service by start_property_service and creates a socket for receiving the request, call handle_property_set_fd to check whether permissions are available. If yes, call property_set to modify the attribute value.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.