SLEEP_ALLOC(D3)SLEEP_ALLOC(D3)NAME
SLEEP_ALLOC, SLEEP_INIT - sleep lock initialization
SYNOPSIS
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
sleep_t *SLEEP_ALLOC(int arg, lkinfo_t *lkinfop, int flag);
void SLEEP_INIT(sleep_t *lockp, int arg, lkinfo_t *lkinfop);
Arguments
lockp Pointer to uninitialized sleep lock.
arg Reserved for future use (must be equal to zero).
lkinfop Reserved for future use (must be equal to -1).
flag Specifies whether the caller is willing to sleep waiting for
memory.
DESCRIPTIONSLEEP_ALLOC dynamically allocates and initializes an instance of a sleep
lock. SLEEP_INIT initializes an instance of a sleep lock. The lock is
initialized to the unlocked state.
If flag is set to KM_SLEEP, the caller will sleep if necessary until
sufficient memory is available. If flag is set to KM_NOSLEEP, the caller
will not sleep, but SLEEP_ALLOC will return NULL if sufficient memory is
not immediately available.
Return Values
Upon successful completion, SLEEP_ALLOC returns a pointer to the newly
allocated lock. If KM_NOSLEEP is specified and sufficient memory is not
immediately available, SLEEP_ALLOC returns a NULL pointer.
USAGE
Level
Base or Initialization.
Synchronization Constraints
May sleep if flag is set to KM_SLEEP.
Driver-defined basic locks and read/write locks may be held across calls
to this function if flag is KM_NOSLEEP but may not be held if flag is
KM_SLEEP.
Driver-defined sleep locks may be held across calls to this function
regardless of the value of flag.
Page 1
SLEEP_ALLOC(D3)SLEEP_ALLOC(D3)REFERENCESSLEEP_DEALLOC(D3), SLEEP_DESTROY(D3), SLEEP_LOCK(D3), SLEEP_LOCK_SIG(D3),
SLEEP_LOCKAVAIL(D3), SLEEP_TRYLOCK(D3), SLEEP_UNLOCK(D3)
Page 2