{
{ The purpose of this request is to lock a segment. This allows multiple tasks
{ to coordinate access to a shared read/write segment. A segment
{ may be locked for either read or write access. Multiple readers or one
{ writer may have a 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.
{
{ ->IMPORTANT NOTE: This request is intended to be used carefully by privileged
{     subsystem writers ONLY. Jobs with segments locked run at a higher CPU
{     dispatching priority and are NOT good candidates to be swapped. Incorrect
{     usage of this request could result in hung jobs or system.
{
{
{        MMP$LOCK_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
{
