clear memory for a given number of bytes
void bzero(caddr_t addr, size_t bytes);
The bzero function clears a contiguous portion of memory by
filling the memory with zeros.
It chooses the best algorithm based on address alignment
and number of bytes to clear.
Starting virtual address of memory to be cleared.
The number of bytes to clear.
There are no alignment restrictions on addr,
and no length restrictions on bytes,
other than that the address range specified
must be within the kernel address space
and must be memory resident.
No range checking is done.
Since there is no mechanism by which drivers that conform to the
rules of the DDI can obtain and use a kernel address that is not
memory resident (an address that is paged out),
DDI conforming drivers can assume
that any address to which they have access
is memory resident and therefore a valid argument to
An address within user address space is not a valid argument,
and specifying such an address
may cause the driver to corrupt the system in an
Context and synchronization
In a driver
routine, rather than clear each individual
member of its private data structure, the driver
could use bzero as shown here:
bzero(&drv_dat[chan], sizeof(struct drvr_data));
1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005