Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
According to the above link. If I call "/bin/ls" then in turn it is being translated to "/bin/busybox ls" (I am not sure whether my understanding is correct.).
Can someone please tell me how busybox is converting "/bin/ls" to "/bin/busybox"
Thanks
Click here to see the post LQ members have rated as the most helpful post in this thread.
There are two components to the answer.
1. For each utility that will be implemented by busybox, a filesystem link from some standard directory such as /bin, /usr/bin, /sbin, etc, will point to the busybox binary.
2. Any application in Linux can look at its argv[0], and from that see what the parent process used to invoke the application. By doing this, busybox is able to know what the parent process was expecting, and is able to provide the accordant behavior.
There are other applications, such as bash which use the same procedure to provide an alter ego, of sorts.
I'm curious, is the busybox code re-entrant in that many command calls only loads one instance of busybox or if say 2 processes call busybox ls then its loaded twice?
The reason I'm curious is that if loaded twice then isn't that actually quite inefficient as it means that two copies of a "large" program are loaded as apposed to two smaller specialised programs as busy box has to include code for every command as apposed to say ls as a standalone that could be quite small in comparison.
Also wouldn't loading one "large" program take a lot more resources and time than two smaller programs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.