HPlogo 900 Series HP 3000 Computer Systems: MPE/iX Intrinsics Reference Manual > Chapter 4 Command Definitions

FLOCK

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

NM and CM callable.

Dynamically locks a file. If dynamically locking more than one RIN, multiple RIN (MR) capability is required.

Syntax

            I16V   U16V

   FLOCK(filenum,lockflag);

Parameters

filenum

16-bit signed integer by value (required)

Passes the file number of the file whose global resource identification number (RIN) is to be locked.

lockflag

16-bit unsigned integer by value (required)

Specify either conditional or unconditional locking by setting bit (15:1) as follows:

ValueMeaning
0Locking takes place only if the flock_semaphore of the global unique file descripter (gufd) is used to control access to the file. If the RIN is locked, control returns immediately to the calling process, with condition code CCG (0).
1Locking takes place unconditionally. If the file cannot be locked immediately, the calling process suspends until the file can be locked.

Condition Codes

The following condition codes are possible when lockflag bit (15:1)=1:

CCE (2)

Request granted.

CCG (0)

Not returned.

CCL (1)

Request denied. This file was not opened with the dynamic locking aoption bit (10:1) specified in the FOPEN/HPFOPEN intrinsic, or there was an attempt to lock more than one RIN and the calling process does not have multiple RIN (MR) capability.

The following condition codes are possible when lockflag bit (15:1)=0:

CCE (2)

Request granted.

CCG (0)

Request denied. The file was locked by another process.

CCL (1)

Request denied. This file was not opened with the dynamic locking aoption bit (10:1) specified in the FOPEN/HPFOPEN intrinsic, or there was an attempt to lock more than one RIN and the calling process does not have multiple RIN (MR) capability.

Operation Notes

On MPE/iX when a file is created (opened as a new file) with dynamic locking only one accessor (the creator) is allowed. A subsequent call to FLOCK against such a file (although unnessary) will succeed because the dynamic locking bit is not set to zero. On MPE V, when a new file is created with dynamic locking the the dynamic locking bit is set to zero. For this reason, a subsequent call to FLOCK will fail on MPE V.

Accessors that have opened a file with the dynamic locking option enabled must access the file through the FLOCK intrinsic to gain exclusive access to the file. Since the use of this intrinsic is discretionary, however, all accessors must agree to use FLOCK when writing to a file to guarantee exclusive access. File locking is advised, but is not mandated by MPE/iX.

Related Information

Intrinsics

None

Commands

None

Manuals

Resource Management Programmer's Guide (32650-90024)

Feedback to webmaster