Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (s and S) SPT_LOCKFILE(2)
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 input/output (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. 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 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 in which they are
issued.
527186-023 Hewlett-Packard Company 7−283