Previous section.

Protocols for Interworking: XNFS, Version 3W
Copyright © 1998 The Open Group


NLM_LOCK - Establish a Lock

Call Arguments

struct nlm_lockargs { netobj cookie; bool block; bool exclusive; struct nlm_lock alock; bool reclaim; int state; };

Return Arguments

struct nlm_res { netobj cookie; nlm_stat stat; };

RPC Procedure Description

nlm_res NLM_LOCK(nlm_lockargs) = 2;


This procedure attempts to establish a monitored lock described in "alock".

If "block" is true, then if the lock request cannot be granted immediately the server will return a status of "LCK_BLOCKED" for this procedure call. When the request can be granted, the server will make a call-back to the client with the NLM_GRANTED procedure call. If "block" is set to false, and the lock cannot be granted immediately, the procedure will return with a status of LCK_DENIED, and no NLM_GRANTED call-back will be made.

If "reclaim" is true, then the server will assume this is a request to re-establish a previous lock (for example, after the server has crashed and rebooted). During the grace period the server will only accept locks with "reclaim" set to true.

"state" contains the state of the client's NSM. This information is kept by the server implementation, so if the client crashes, the server can determine which locks to discard by checking this state against the state in the crash notification (SM_NOTIFY) sent by the NSM. See File Locking over XNFS .

Return Codes

When the procedure returns, "stat" will be set to one of the following values:

Indicates that the procedure completed successfully, the lock was granted.

Indicates that the procedure failed because the request conflicted with existing lock reservations for the file.


Indicates that the procedure failed because the server NLM could not allocate the resources needed to process the request.

Indicates the blocking request cannot be granted immediately. The server NLM will make a call-back to the client with an NLM_GRANTED procedure when the lock can be granted.


Indicates that the procedure failed because the server host has recently been rebooted and the server NLM is re-establishing existing locks, and is not yet ready to accept normal service requests.

Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index