'\"macro stdmacro
.if n .pH ddi_dki.kmem_zalloc @(#)kmem_zalloc	40.6 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} kmem_zalloc D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} kmem_zalloc D3DK "" "DDI/DKI"
.if \nX=2 .ds x} kmem_zalloc D3DK "" "\&"
.if \nX=3 .ds x} kmem_zalloc "" "" "\&"
.TH \*(x}
.SH NAME
\f4kmem_zalloc\f1 \- allocate and clear space from kernel free memory
.IX "\f4kmem_zalloc\fP(D3DK)"
.SH SYNOPSIS
.nf
.na
\f4#include <sys/types.h>
#include <sys/kmem.h>
.sp 0.5
_VOID *kmem_zalloc(unsigned long \f2size, \f4unsigned long \f2flag\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 10
.IP "\f2size\f1" 10n
Number of bytes to allocate.
.IP "\f2flag\f1" 10n
Determines if caller may sleep to wait for free space.  Possible flags
are \f4KM_SLEEP\f1 to sleep while waiting for free space, and
\f4KM_NOSLEEP\f1 to return NULL if space is not available.
.RE
.SH DESCRIPTION
This function allocates \f2size\f1 of storage from kernel free space,
clears it, and returns a pointer to the allocated memory.  If \f2flag\f1
has \f4KM_SLEEP\f1 set, the caller may sleep until free space is
available.  If \f2flag\f1 has \f4KM_NOSLEEP\f1 set and space is not
available, \f4NULL\f1 will be returned.
.P
\f3NOTE:\f1
Memory allocated by \f4kmem_zalloc\f1 is not paged.
Available memory is therefore limited.  Excessive use of this memory is
likely to affect overall system performance.
.SH RETURN VALUE
\f4kmem_zalloc\f1 returns \f4NULL\f1 if memory cannot be allocated.
Otherwise, it returns a pointer to the allocated space.
.SH LEVEL
Base (interrupt only if \f4KM_NOSLEEP\f1 is set in \f2flag\f1)
.SH SEE ALSO
.na
\f4freerbuf\f1(D3DK),
\f4getrbuf\f1(D3DK),
\f4kmem_alloc\f1(D3DK),
\f4kmem_free\f1(D3DK),
\f4rmalloc\f1(D3DK),
\f4rmfree\f1(D3DK),
\f4rminit\f1(D3DK),
\f4rmsetwant\f1(D3DK),
\f4rmwant\f1(D3DK)
.ad
