TheLoneJoker
TheLoneJoker

Reputation: 1629

Android reboot command - Who calls reboot_main()?

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

int reboot_main(int argc, char *argv[])

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

Thanks, vj

Upvotes: 0

Views: 479

Answers (1)

Joe
Joe

Reputation: 42646

They are all compiled into one overall executable, with main in https://android.googlesource.com/platform/system/core.git/+/android-4.2.2_r1/toolbox/toolbox.c

Then, based on the actual program name invoked (usually argv[0]) it calls the appropriate method.

The commands are part of the build via the

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

macro in toolbox.c which is used in the Android.mk file to generate tools.h.

Upvotes: 1

Related Questions