Linux Embedded Learning-Remote procedure Call-binder system

Source: Internet
Author: User

Example of C program use for binder systems
Ipc:inter-process Communication, interprocess communication
Rpc:remote Procedure Call, remote procedure calls

Here we use only the BINDRT system that has been implemented in the Android system directly.

The specific source code is in the Frameworks\native\cmds\servicemanager\ directory.


Service_manager.c:
A. Binder_open
B. Binder_become_context_manager
C. Binder_loop (BS, Svcmgr_ handler);
   C.1 res = IOCTL (BS->FD, Binder_write_read, &BWR);
   C.2 Binder_parse
         //parsing
          //Processing  : Svcmgr_handler
                        svc_mgr_get_ Service/svc_mgr_check_service: Get Service
                        Svc_mgr_add_service: Registration Services           
         //reply           

Bctest.c
Procedures for registering a service:
A. Binder_open
B. Binder_call (BS, &msg, &reply, 0, Svc_mgr_add_service)
Name containing the service
It will contain the data of ServiceManager reply
0 = ServiceManager
Code: Indicates that you want to invoke the "AddService function" in ServiceManager


Procedure for getting a service:
A. Binder_open
B. Binder_call (BS, &msg, &reply, Target, Svc_mgr_check_service)
Name containing the service
It will contain the data of the ServiceManager reply, indicating the process of providing the service
0 = ServiceManager
Code: Indicates that you want to invoke the "GetService function" in ServiceManager

BINDER.C (packed C function)

Linux Embedded Learning-Remote procedure Call-binder system

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.