Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bzero(D3DK) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

bzero(D3DK)  —  

.IX \f4bzero\fP(D3DK)
.IX memory, clear

NAME

bzero − clear memory for a given number of bytes

SYNOPSIS

#include <sys/types.h>
void bzero(caddr_t addr, size_t bytes);

ARGUMENTS

addrStarting virtual address of memory to be cleared. 

bytesThe 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 VALUE

None. 

LEVEL

Base or Interrupt. 

NOTES

Does not sleep. 

Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function. 

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. 

SEE ALSO

bcopy(D3DK), clrbuf(D3DK), kmem_zalloc(D3DK)

EXAMPLE

In a driver close(D2DK) 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));

DDI/DKI

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026