75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/bzero @(#)bzero 43.9 of 11/27/92
|
|
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
|
|
.TH bzero D3
|
|
.IX "\f4bzero\fP(D3)"
|
|
.IX "memory, clear"
|
|
.SH NAME
|
|
\f4bzero\f1 \- clear memory for a given number of bytes
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/types.h>
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
void bzero(caddr_t \f2addr\fP, size_t \f2bytes\fP);
|
|
.ft 1
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2addr\f1" 10n
|
|
Starting virtual address of memory to be cleared.
|
|
.IP "\f2bytes\f1" 10n
|
|
The number of bytes to clear.
|
|
.RE
|
|
.SH DESCRIPTION
|
|
The \f4bzero\f1 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.
|
|
.SS "Return Values"
|
|
None
|
|
.SH USAGE
|
|
There are no alignment restrictions on \f2addr\fP, and no length restrictions
|
|
on \f2bytes\fP, 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 \f4bzero\f1.
|
|
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.
|
|
.SS Level
|
|
Initialization, Base or Interrupt.
|
|
.SS "Synchronization Constraints"
|
|
Does not sleep.
|
|
.P
|
|
Driver-defined basic locks, read/write locks, and sleep locks
|
|
may be held across calls to this function.
|
|
.SS Examples
|
|
In a driver \f4close\f1(D2) routine, rather than clear each individual
|
|
member of its private data structure, the driver
|
|
could use \f4bzero\f1 as shown here:
|
|
.sp 0.4
|
|
.nf
|
|
.ft 4
|
|
.in +3n
|
|
.ps 9
|
|
bzero((caddr_t)&drv_dat[getminor(dev)], sizeof(struct drvr_data));
|
|
.ps
|
|
.in
|
|
.ft 1
|
|
.fi
|
|
.sp 0.4
|
|
.SH REFERENCES
|
|
.na
|
|
\f4bcopy\fP(D3),
|
|
\f4clrbuf\fP(D3),
|
|
\f4kmem_zalloc\fP(D3)
|
|
.ad
|