.TH SV_ALLOC() "" "" "DDI/DKI Kernel Routine"
.PC "Create a synchronization variable"
.B "#include <sys/kmem.h>"
.B "#include <sys/ksynch.h>"
\fBsv_t *SV_ALLOC(\fIflag\^\fB)\fR
\fBint \fIflag\^\fB;\fR
.PP
.B SV_ALLOC()
allocates and initializes a synchronization variable.
.I flag
specifies whether the caller can sleep,
should insufficient memory not be available to create the variable:
.B KM_SLEEP
indicates that the caller can sleep until enough memory becomes
available;
.B KM_NOSLEEP
indicates that it cannot.
.PP
.B SV_ALLOC()
returns the address of the newly created synchronization variable.
If not enough memory is available to hold a synchronization variable
and
.I flag
equals
.BR KM_NOSLEEP ,
it returns NULL.
.SH "See Also"
.B
DDI/DKI kernel routines
.R
.SH Notes
If
.I flag
equals
.BR KM_NOSLEEP ,
.B SV_ALLOC()
has base or interrupt level and cannot sleep;
if it is sett to
.BR KM_SLEEP ,
it has base level only and can sleep.
.PP
If
.I flag
equals
.BR KM_NOSLEEP ,
a driver can hold a
driver-defined basic lock or read/write lock across a call to this function;
if
.I flag
equals
.BR KM_SLEEP ,
it cannot.
It can hold a
driver-defined sleep lock regardless of the value of
.IR flag .
