HP-UX Reference (11i v2 04/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

z
zero(7) zero(7)
NAME
zero - zero file
DESCRIPTION
/dev/zero is a zero special file. Reads from a zero special file always return characters whose value is
’0’ (\0 characters).
Data written on a zero special file is discarded or ignored.
Seeks on a zero special file will always succeed.
Private
mmap() of a zero special file is allowed (see mmap(2)). Shared mmap() is not allowed.
EXAMPLES
In the following example, the buffer ‘buf’ is filled with ‘len’ \0 characters.
fildes = open("/dev/zero",...)
read(fildes, buf, len)
In the following example, the process now has a range of ‘len’ \0 characters at memory location ‘address’:
fildes = open("/dev/zero",...)
address = mmap(0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fildes, any_offset)
FILES
/dev/zero
SEE ALSO
mmap(2), null(7).
Section 7218 Hewlett-Packard Company 1 HP-UX 11i Version 2: September 2004