Index Index for
Section 3
Index Alphabetical
listing for I
Bottom of page Bottom of
page

imc_lkalloc(3)

NAME

imc_lkalloc - Creates a lock set

LIBRARY

Memory Channel API library (libimc.a)

SYNOPSIS

#include <sys/imc.h> int imc_lkalloc ( imc_key_t key, int *count, imc_perm_t perm, int flag, imc_lkid_t *lock );

PARAMETERS

key Identifies the lock set to be allocated. count Specifies the number of locks created in the lock set, and returns the number of locks actually created. perm Specifies the access permission for the lock set. The permission code is similar to the UNIX permission convention, except that there is no execute flag. The value of the perm parameter is obtained by carrying out a logical OR operation on the following values: IMC_LKU User access to locks IMC_LKG Group access to locks IMC_LKO Other access to locks flag Specifies the creation flag for the lock set. The flag parameter has one of the following values: IMC_CREATOR If the lock set does not already exist on the cluster, allocate the lock set and atomically acquire the first lock (that is, lock zero (0)) in the set. If the IMC_CREATOR flag is specified for a lock set that already exists, an error condition will result. NULL Allocate the lock set without attempting to acquire the first lock in the set. lock Returns a value that uniquely identifies the allocated lock set. If the imc_lkalloc function fails to allocate a lock set, the value of the lock parameter is undefined.

DESCRIPTION

The imc_lkalloc() function creates a set of locks that enable applications to coordinate access to clusterwide resources. The number of locks in the lock set is specified by the count parameter. The maximum number of locks that a set can contain is specified by the IMC_MAXNUMLOCKS value in the Memory Channel API library header file. The imc_lkalloc() function provides a feature that allows a process to atomically (that is, in a single operation) allocate a lock set and acquire the first lock in the set. You can use this feature to coordinate application initialization in a cluster. To atomically allocate the lock set and acquire the first lock, specify the value IMC_CREATOR for the flag parameter. The method for establishing a relationship between a lock and a resource is application-specific, and is beyond the scope of the Memory Channel API library. All lock sets allocated by a process are automatically deallocated when the process exits.

RETURN VALUES

The imc_lkalloc() function returns one of the following values: IMC_SUCCESS Normal successful completion. IMC_BADPARM An invalid parameter was specified in the call to the imc_lkalloc() function. IMC_BADSIZE The lock set is already allocated on the cluster, and the size of the set as specified in this call to the imc_lkalloc() function does not match the size specified in the previous call. IMC_EXISTS The lock set already exists on the cluster. IMC_MAPENTRIES An attempt has been made to exceed the maximum number of process map entries. This maximum is set by the vm-mapentries parameter. IMC_MCFULL There is not enough Memory Channel address space available to allocate the lock set. IMC_NOMEM There is insufficient local memory available to allocate the lock set. IMC_NORESOURCES There are insufficient Memory Channel data structures available to allocate the lock set. IMC_NOTINIT This host has not been initialized to use the Memory Channel Application Programming Interface (API) library. IMC_PERMIT The lock set is already allocated, with a permission code that is incompatible with the code specified in the perm parameter. IMC_PRIOR The lock set has already been allocated by the calling process.

RELATED INFORMATION

Introduction: imc(3) Commands: imc_init(1), imcs(1) Functions: imc_api_init(3), imc_lkacquire(3), imc_lkdealloc(3), imc_lkrelease(3) Cluster Highly Available Applications

Index Index for
Section 3
Index Alphabetical
listing for I
Top of page Top of
page