SVR5
bzero(D3)
bzero --
clear memory for a given number of bytes
Synopsis
#include <sys/types.h>
#include <sys/ddi.h>
void bzero(caddr_t addr, size_t bytes);
Description
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.
Arguments
addr-
Starting virtual address of memory to be cleared.
bytes-
The number of bytes to clear.
Return values
None
Usage
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
bzero( ).
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
unpredictable way.
Context and synchronization
All
contexts.
Examples
In a driver
close(D2)
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));
Hardware applicability
All
Version applicability
ddi:
1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
References
bcopy(D3),
clrbuf(D3),
kmem_zalloc(D3)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005