DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

lockb(D4oddi)


lockb -- lock structure

Syntax

   #include <sys/ci/cilock.h>
   

Description

The lockb structure indicates the address of the lock and is used with all SCO OpenServer lock functions.

Structure definition

The lockb structure is defined as:
   struct lockb {
   	unsigned char ciflag;
   	unsigned char ciowner;
   };

Structure members

The members are defined as:

ciflag
lock flag

ciowner
processor that owns the lock

Usage

The following example illustrates how to code this declaration; xx is the driver prefix:
   struct lockb lock_xxtab = {0,0}
A driver may define as many individual lock_xxtab[0...n] structures as necessary. Spacing the locks apart is recommended to avoid cache thrashing. In most cases, just having other declarations in between the lockb declarations is adequate. When declaring a large number of locks in one place (such as happens in the kernel's space.c file), use the LOCKVAR macro to declare the lock to avoid any thrashing.

The lockb structure can be padded for performance to make it a 16-byte entry. This allows the hardware cache mechanism to execute optimally. Padding can be implemented as follows:

   char jnkl[12] = {0};
   struct lockb lock_xxtab = {0,0};
   char jnk2[12] = 0;

A driver must never directly read or modify the lockb structure.

Hardware applicability

All

Version applicability

oddi: 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

SVR5 DDI compatibility

See ``Spin locks (DDI)'' in HDK Technical Reference for information about the functions and structures used to implement spin locks in DDI drivers.

References

clockb(D3oddi), ilockb(D3oddi), lockb(D3oddi)

``Spin locks (ODDI)'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005