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 file
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 filenum,
[ long tag ]
);
PARAMETERS
filenum specifies the file number of a Guardian disk file open instance that identifies the
file to be locked
tag is for nowait I/O only. The tag value you define uniquely identifies 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 file (and any
records within that file). The user is defined either as the opener of the file (identified by filenum)
if the file is not audited or as the transaction (identified by the TRANSID) if the file is audited. If
the file is currently unlocked or is locked by the current user when SPT_LOCKFILE() is called,
the file (and all its records) becomes locked, and the caller continues executing. If the file is
already locked by another user, the behavior of the system is specified 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 file-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 Programmer’s
Guide and the Guardian Programmer’s Guide.
Considerations
Record locking versus file locking
A call to SPT_LOCKFILE() is not equivalent to locking all records in a file;
that is, locking all records still allows insertion of new records, but file 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 file
opened nowait, it must complete with a corresponding call to the Guardian
AWAITIO procedure.
7−200 Hewlett-Packard Company 527186-005