bzero(D3) bzero(D3)
NAME
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);
Arguments
addr Starting virtual address of memory to be cleared.
bytes The number of bytes to clear.
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.
Return Values
None
USAGE
There are no alignment restrictions on addr, and no length
restrictions on bytes, other than 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/DKI can obtain and use a kernel address that is not memory
resident (an address that is paged out), DDI/DKI 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.
Level
Initialization, Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
Copyright 1994 Novell, Inc. Page 1
bzero(D3) bzero(D3)
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((caddr_t)&drv_dat[getminor(dev)], sizeof(struct drvr_data));
REFERENCES
bcopy(D3), clrbuf(D3), kmem_zalloc(D3)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2