android_get_control_socket 获取 UNIX 域套接字 FD

Netd 中的 “netd” 套接字

SocketListener::startListener 在启动监听的过程中需要查询到套接字,调用了 android_get_control_socket,传入了参数 “netd”,其查询细节如下面讲解分析。

startListener 的调用发生在 main.cpp 中 main 函数里面的 CommandListener 的启动:

    /*
     * Now that we're up, we can respond to commands. Starting the listener also tells
     * NetworkManagementService that we are up and that our binder interface is ready.
     */
    if (cl.startListener()) {
        ALOGE("Unable to start CommandListener (%s)", strerror(errno));
        exit(1);
    }

而其域套接字何时创建的呢?

猜测是在 service 创建的时候,后面在分析

Android get control socket

/hardware/ril/libril/ril.cpp下有如下代码:

s_fdListen = android_get_control_socket(SOCKET_NAME_RIL);
if (s_fdListen < 0) {
    LOGE("Failed to get socket '" SOCKET_NAME_RIL "'");
    exit(-1);
}

if (listen(s_fdListen, 4)) {
    exit(1);
}
s_fdComman
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值