Why is the file /bin/false so large?
anothermindbomb at gmail.com
Tue Feb 9 16:09:43 UTC 2010
On Tue, Feb 9, 2010 at 2:38 PM, Chris Jones <jonesc at hep.phy.cam.ac.uk> wrote:
> I'm also not sure what the concern is over the size of /bin/false, but
> I'm willing to bet those that know best have made it as optimal as
> possible, and fiddling will only cause problems...
There is an often used program on MVS mainframes called IEFBR14.
The BR14 part of the name decribes what it does. In this case, it's
Branch to the address in Register 14. Upon program invocation,
register 14 contains the address of the calling code. That is to say,
it's where you should return to when you're complete.
Writing a program which does nothing more than "return" should take 2
bytes. One byte for the Branch instruction and one byte to indicate
which register to use for the address. In this case, Register 14. A
two byte program.
With all of the extra code added by the compiler to ensure the code
was set up in a valid evironment, parsed any input flags (of which
there are none) and cleanly set the return code (in Register 15) the
resultant executable was quite a bit more than two bytes.
You can get around this, but altering compiler flags, but most of the
time it's just not worth it.
On a similar theme, any remember the Amiga 500 with it's internal
floppy drive which would click every 2 seconds or so, as part of it's
disk insertion detection routine. Used to drive people nuts. A quick
dig through the Rom Kernel Reference Manuals suggested a way to turn
this annoying "click" off.
Writing this code was quite straightforward, but them compiling it
would result in a 40K program, thanks to the SAS compiler adding in
all of the usual "helper" code to parse input flags and so forth. With
some tweaking, some sneaky coding, adjusting the compiler flags,
linking with a different startup library and such like, you could get
this down to around 200 bytes - maybe smaller - it was a long, long
time ago in a glalaxy far, far away...
It's rare that people bother to tune code to this level or extent now
as often "it's good enough"... I of course discount the assembler
coders who delight in this kind of thing! :)
When one person suffers from a delusion it is insanity. When many
people suffer from a delusion it is called religion.
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
More information about the ubuntu-users