/dev/null
Stephen J. Muir
stephen at dcl-cs.UUCP
Sat Nov 23 09:12:48 AEST 1985
>Seeing that /dev/mem and /dev/kmem are "windows" into the physical memory space
>of the computer, I wonder if /dev/null is implemented as a "window" into a
>nonexistent section of physical memory, or what?
cp /etc/motd /dev/null
panic: segmentation violation
What happens is that all writes map onto the "write" system call (write(2)).
The code (off the top of my head) goes like:
write (filedes, buffer, nbytes)
char *buffer
{ if (major_minor (filedes) == that_of ("/dev/null"))
return (nbytes);
else
go_do_the_REAL_write (filedes, buffer, nbytes);
}
So the "write" system call just returns success and does nothing!
--
UUCP: ...!seismo!mcvax!ukc!dcl-cs!stephen
DARPA: stephen%comp.lancs.ac.uk at ucl-cs | Post: University of Lancaster,
JANET: stephen at uk.ac.lancs.comp | Department of Computing,
Phone: +44 524 65201 Ext. 4599 | Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution | LA1 4YR
More information about the Comp.unix.wizards
mailing list