Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bcopy(9F)

clrbuf(9F)

kmem_zalloc(9F)

bzero(9F)

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 starting at addr.

INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI). 

DESCRIPTION

bzero() clears a contiguous portion of memory by filling it with zeros.

RETURN VALUES

Under normal conditions, a 0 is returned.  Otherwise, a -1 is returned. 

CONTEXT

bzero() can be called from user or interrupt context.

EXAMPLE

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

WARNINGS

The address range specified must be within the kernel space.  No range checking is done.  If an address outside of the kernel space is selected, the driver may corrupt the system in an unpredictable way. 

SEE ALSO

bcopy(9F), clrbuf(9F), kmem_zalloc(9F)

SunOS 5.1/SPARC  —  Last change: 11 Apr 1991

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