Open System Services System Calls Reference Manual (G06.28+)

SPT_LOCKFILE(2) OSS System Calls Reference Manual
NAME
SPT_LOCKFILE - excludes other users from accessing a Guardian disk le
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <cextdecs.h>]
#include <spthread.h>
short SPT_LOCKFILE (
short lenum,
[ long tag ]
);
PARAMETERS
filenum species the le number of a Guardian disk le open instance that identies the
le to be locked
tag is for nowait I/O only. The tag value you dene uniquely identies the operation
associated with this call.
This parameter is supported only for program compatibility; if you provide it, it
is ignored.
DESCRIPTION
The SPT_LOCKFILE() function is the thread-aware version of the Guardian LOCKFILE pro-
cedure.
The SPT_LOCKFILE() function is used to exclude other users from accessing a le (and any
records within that le). The user is dened either as the opener of the le (identied by lenum)
if the le is not audited or as the transaction (identied by the TRANSID) if the le is audited. If
the le is currently unlocked or is locked by the current user when SPT_LOCKFILE() is called,
the le (and all its records) becomes locked, and the caller continues executing. If the le is
already locked by another user, the behavior of the system is specied by the locking mode.
There are two locking modes available:
Default The process requesting the lock is suspended (see the Considerations subsection
of this reference page).
Alternate The lock request is rejected with Guardian le-system error 73. When the alter-
nate locking mode is in effect, the process requesting the lock is not suspended
(see the Considerations subsection of this reference page).
For programming information about the LOCKFILE procedure, see the Enscribe Programmers
Guide and the Guardian Programmers Guide.
Considerations
Record locking versus file locking
A call to SPT_LOCKFILE() is not equivalent to locking all records in a le;
that is, locking all records still allows insertion of new records, but le locking
does not. File locks and record locks are queued in the order they are issued.
Nowait and SPT_LOCKFILE()
If the SPT_LOCKFILE() function is used to initiate an operation with a le
opened nowait, it must complete with a corresponding call to the Guardian
AWAITIO procedure.
7200 Hewlett-Packard Company 527186-005