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

System Functions (s and S) SPT_LOCKFILE(2)
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 input/output (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. Two
locking modes are available:
Default The process requesting the lock is suspended. See the Considerations subsec-
tion 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 in which they are
issued.
527186-007 Hewlett-Packard Company 7203