{
{ The purpose of this request is to lock a catalog segment. This allows
{ multiple tasks to coordinate access to a shared read/write catalog segment.
{ A catalog segment may be locked for either read or write access. Multiple
{ readers or one writer may have a catalog segment locked. The request supports
{ a 'wait' option to allow the task to either reject or queue for a segment if
{ the lock cannot be immediately set. Queuing is done in a FIFO manner
{ according to the following algorithm:
{     - task requesting READ access
{          - IF segment not locked for write AND
{                  no tasks are queued for WRITE access THEN
{              lock segment for user
{            ELSEIF WAIT selected THEN
{              queue task for segment
{            ELSE reject request with error code
{
{     - task requesting WRITE access
{            IF segment not locked THEN
{              lock segment for task
{            ELSEIF WAIT selected THEN
{              queue task for segment
{            ELSE reject request with error code
{
{ NOTES:
{   . All queuing is done via table structures. No 'polling' or 'cycling' is
{     done for a task that is waiting for a lock. If a task is queued for a
{     lock, and the task is readied by another task, the task is removed from
{     the queue. It does NOT have the segment locked.
{   . Queuing is guaranteed to be done in a FIFO manner. This reduces the
{     maximum time required to set a lock.
{   . Although multiple readers may have a lock set concurrently, once a writer
{     has been queued for a segment, additional readers will be queued/rejected
{     until the writer has been granted access to the segment.
{   . Pages of a segment that are locked for WRITE will not be aged to disk
{     by memory manager nor will they be recovered if the system crashes.
{     Mmp$write_modified_pages may be used to cause pages to be written to
{     disk.
{     In addition the task may cause IO when the segment is unlocked. See the
{     mmp$unlock_segment request for additional details.
{   . Automatic unlocking of a segment will be done when the segment is
{     closed. All modified pages will be discarded.
{   . Jobs with tasks queued for segments are swappable. The swapin process
{     will be initiated (subject to resource availability) when interlock
{     contention no longer exists.
{   . The mmp$lock_catalog_segment differs from the mmp$lock_segment request
{     only in the type of lock that is set.  In mmp$lock_segment if the ring
{     of the caller is less than or equal to 3 a major lock will be set.  The
{     mmp$lock_catalog_segment was created for use by the permanent file code
{     to create a minor system lock even though the interface is called from
{     ring 2.  By setting a minor lock the permanent file code may keep a segment
{     locked longer without causing problems associated with having a higher CPU
{     dispacthing priority and escaped allocation.
{
{ ->IMPORTANT NOTE: This request is intended to be used by permanent file code
{     for locking catalog segments only.
{
{
{        MMP$LOCK_CATALOG_SEGMENT (PVA, ACCESS, WAIT, STATUS)
{
{ PVA: (input) This parameter specifies the segment to be locked
{
{ ACCESS: (input) This parameter specifies whether the task requires READ or
{          WRITE access to the segment.
{
{ WAIT: (input) This parameter specifies whether to queue or reject if the lock
{        cannot be set.
{
{ STATUS: (output) This parameter specifies the request status.
{        The possible error codes are:
{              dfe$server_has_terminated
{              mme$invalid_pva
{              mme$ref_to_unrecovered_file
{              mme$segment_locked_by_task
{              mme$volume_unavailable
{
