I am looking at the source for the android shell reboot command.

int reboot_main(int argc, char *argv[])
  • What I am not clear about is if this is a standalone binary, who calls reboot_main() ?
  • In a standard glibc linked binary, I was expecting to find a "main()" as the entry point for the program.

What am I missing here, could someone help me understand what is going on ?

Thanks, vj

有帮助吗?

解决方案

它们都被编译为一个总体可执行文件, mainhttps://android.googlesource.com/platform/system/core.git/+/android-4.2.2_r1/toolbox/toolbox.c

然后,根据调用的实际程序名称(通常 argv[0])它调用适当的方法。

命令是通过

#define TOOL(name) int name##_main(int, char**);

宏入 toolbox.cAndroid.mk 文件生成 tools.h.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top