lock_alloc Kernel Service

Purpose

Allocates system memory for a simple or complex lock.

Syntax

#include <sys/lock_def.h>
#include <sys/lock_alloc.h>

void lock_alloc ( lock_addr,  flags,  class,  occurrence)
void *lock_addr;
int flags;
short class;
short occurrence;

Parameters

Item Description
lock_addr Specifies a valid simple or complex lock address.
flags Specifies whether the memory allocated is to be pinned or pageable. Set this parameter as follows:
LOCK_ALLOC_PIN
Allocate pinned memory; use if it is not permissible to take a page fault while calling a locking kernel service for this lock.
LOCK_ALLOC_PAGED
Allocate pageable memory; use if it is permissible to take a page fault while calling a locking kernel service for this lock.
Item Description
class Specifies the family which the lock belongs to.
occurrence Identifies the instance of the lock within the family. If only one instance of the lock is defined, this parameter should be set to -1.

Description

The lock_alloc kernel service allocates system memory for a simple or complex lock. The lock_alloc kernel service must be called for each simple or complex before the lock is initialized and used. The memory allocated is for internal lock instrumentation use, and is not returned to the caller; no memory is allocated if instrumentation is not used.

Execution Environment

The lock_alloc kernel service can be called from the process environment only.

Return Values

The lock_alloc kernel service has no return values.