- To: Sydney Linux Users Group <slug@xxxxxxxxxxx>
- Subject: Re: [SLUG] Quick Unixy Q.
- From: Ken Yap <ken@xxxxxxxxxx>
- Date: Thu Nov 23 02:02:06 2000
- Reply-to: ken@xxxxxxxxxx (Ken Yap)
>Here's a quick one... What is /dev/zero used for, and what are a few good
>examples?
Here's a couple Makefile rules I used to pad a target file to the right
number of bytes:
# rules to make a LILO-bootable image
%.lilo: %.rom $(LILOPREFIX)
cat $(LILOPREFIX) $< /dev/zero | head -c 64k > $@
%.lzlilo: %.lzrom $(LILOPREFIX)
cat $(LILOPREFIX) $< /dev/zero | head -c 64k > $@
Essentially I'm using it as an inexhaustible source of nul bytes.
I *think* the dynamic loader uses it to null fill memory areas, which is
why removing /dev/zero stops executables that use shared libs from
working.