init.rc中的mount等命令执行时调用的源码位置

来源:互联网 发布:linux如何开启ftp服务 编辑:程序博客网 时间:2024/05/17 08:30


以mount命令为例

在Android启动时,init进程会解析init.rc文件,对于init.rc中定义的mount这个command,如

on fs

    mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000

执行这个mount操作的源码在

system/core/init/builtins.cpp的do_mount函数中,在do_mount中会最终调用mount来完成init.rc中mount命令的执行




system/core/init/builtins.cpp

#include <sys/mount.h>


/* mount <type> <device> <path> <flags ...> <options> */
static int do_mount(const std::vector<std::string>& args) {


在builtins.cpp中还可以看到do_mkdir,do_insmod,do_loglevel,do_chmod等函数,这写函数都是init.rc下对应command的实现。

0 0
原创粉丝点击