https://lixiaogang03.github.io/2019/09/26/Android-NetworkControl/

源码目录:system/netd/server

启动

init进程会解析/system/etc/init/netd.rc文件,由于是class main,会被init进程启动。

service netd /system/bin/netd
    class main
    socket dnsproxyd stream 0660 root inet
    socket mdns stream 0660 root system
    socket fwmarkd stream 0660 root inet
    onrestart restart zygote
    onrestart restart zygote_secondary
    # b/121354779: netd itself is not updatable, but on startup it dlopen()s the resolver library
    # from the DNS resolver APEX. Mark it as updatable so init won't start it until all APEX
    # packages are ready.
    updatable

netd服务注册流程

https://blog.csdn.net/shijiheike/article/details/116765804

system/netd/server/main.cpp
NetdNativeService::start()调用BinderService::publish(),即会把NetdNativeService实例注册到ServiceManager中。


0 条评论

发表回复

您的电子邮箱地址不会被公开。