Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
Shared Environment Routines / Locking and Unlocking File Ranges


PBUnlockRange

You can use the PBUnlockRange function to unlock a portion of a file that was previously locked by a call to PBLockRange.

FUNCTION PBUnlockRange (paramBlock: ParmBlkPtr; async: Boolean): 
                        OSErr;
paramBlock
A pointer to a basic File Manager parameter block.
async
A Boolean value that specifies asynchronous (TRUE) or synchronous (FALSE) execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe result code of the function.
-->ioRefNumIntegerA file reference number.
-->ioReqCountLongIntThe number of bytes in the range.
-->ioPosModeIntegerThe positioning mode.
-->ioPosOffsetLongIntThe positioning offset.

DESCRIPTION
The PBUnlockRange function unlocks a portion of a file that you locked with PBLockRange. You specify the range by filling in the ioReqCount, ioPosMode,
and ioPosOffset fields as described in the preceding discussion of PBLockRange. The range of bytes to be unlocked must be the exact same range locked by a previous
call to PBLockRange.

If for some reason you need to unlock a range whose beginning or length is unknown, you can simply close the file. When a file is closed, all locked ranges held by the user
are unlocked.

SPECIAL CONSIDERATIONS
The PBUnlockRange function does nothing if the file specified in the ioRefNum field is open with shared read/write permission but is not located on a remote server volume or is not located under a share point on a local volume.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for PBUnlockRange are
Trap macroSelector
_HFSDispatch$0011

RESULT CODES
noErr0No error
ioErr-36I/O error
fnOpnErr-38File not open
eofErr-39Logical end-of-file reached
paramErr-50Negative ioReqCount
rfNumErr-51Bad reference number
extFSErr-58External file system
volGoneErr-124Server volume has been disconnected
afpRangeNotLocked-5020Specified range was not locked

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996