BUF_LOCK(9r)BUF_LOCK(9r)NAME
BUF_LOCK - General: Locks the specified I/O buffer
SYNOPSIS
void BUF_LOCK(
struct buf *bp );
ARGUMENTS
Specifies a pointer to a buf structure.
DESCRIPTION
The BUF_LOCK routine locks the specified I/O buffer. The routine masks all disk and tape controller interrupts (by calling the splbio rou-
tine). It sets the mutual exclusion buffer lock member, b_lock, of the specified buf structure pointer.
The BUF_LOCK routine then sets the b_flags member of the specified buf structure pointer to B_BUSY to indicate that this buffer is being
used. Finally, BUF_LOCK resets the CPU priority level (by calling the splx routine).
NOTES
You should design in your kernel modules to hold the I/O buffer lock for as short a period of time as possible to allow maximum concur-
rency. You should also release the I/O buffer lock by calling the BUF_UNLOCK routine before returning from the module's entry point.
RETURN VALUES
None
SEE ALSO
Routines: BUF_UNLOCK(9r)BUF_LOCK(9r)
Check Out this Related Man Page
lock_read(9r)lock_read(9r)NAME
lock_read - General: Asserts a complex lock with read-only access
SYNOPSIS
#include <kern/lock.h>
void lock_read(
lock_t lock_structptr );
ARGUMENTS
Specifies a pointer to the complex lock structure, lock. This is the lock structure associated with the resource on which you want to
assert a complex lock with read-only access. The lock structure is an opaque data structure; that is, its associated members are referenced
and manipulated by the operating system and not by the user of the complex lock mechanism.
DESCRIPTION
The lock_read routine asserts a lock with read-only access for the resource associated with the specified lock structure pointer. The
lock_read routine allows multiple kernel threads to access the resource read-only at the same time. When a read lock is asserted, the pro-
tected resource is guaranteed not to change.
To release a previously asserted read lock, call the lock_done routine.
NOTES
You must call lock_init (once only) prior to calling lock_read to initialize the lock structure pointer for the resource. A resource, from
the kernel module's standpoint, is data that more than one kernel thread can manipulate. You can store the resource in global variables and
in data structure members.
RETURN VALUES
None
FILES SEE ALSO
Routines: lock_done(9r), lock_terminate(9r), lock_try_read(9r), lock_try_write(9r), lock_write(9r)
Data Structures: lock(9s)lock_read(9r)
Hi Folks,
Today hasn't been the best one of my career in IT.
I've been a contractor for a major utility company for a number of years, on a number of seperate IT contracts mostly Unix. The company had 10 different flavours of unix and multiple different varsions of most of them.
At the... (3 Replies)