2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include "dos_intern.h"
10 #include <dos/filesystem.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH5(BOOL
, LockRecord
,
21 AROS_LHA(BPTR
, fh
, D1
),
22 AROS_LHA(ULONG
, offset
, D2
),
23 AROS_LHA(ULONG
, length
, D3
),
24 AROS_LHA(ULONG
, mode
, D4
),
25 AROS_LHA(ULONG
, timeout
, D5
),
28 struct DosLibrary
*, DOSBase
, 45, Dos
)
32 Lock a portion of a file for exclusive access. A timeout may be specified
33 which is the maximum amount of time to wait for the record to be available.
37 fh -- file handle for the file to lock a record of
38 offset -- starting position of the lock
39 length -- length of the record in bytes
41 timeout -- timeout interval measured in ticks (may be 0)
45 Success/failure indicator.
49 Record locks are cooperative, meaning that they only affect other calls
58 LockRecords(), UnLockRecord()
62 *****************************************************************************/
66 struct IOFileSys iofs
;
67 struct FileHandle
*fileH
= fh
;
74 InitIOFS(&iofs
, FSA_LOCK_RECORD
, DOSBase
);
76 iofs
.IOFS
.io_Device
= fileH
->fh_Device
;
77 iofs
.IOFS
.io_Unit
= fileH
->fh_Unit
;
79 iofs
.io_Union
.io_RECORD
.io_Offset
= offset
;
80 iofs
.io_Union
.io_RECORD
.io_Size
= length
;
81 iofs
.io_Union
.io_RECORD
.io_RecordMode
= mode
;
82 iofs
.io_Union
.io_RECORD
.io_Timeout
= timeout
;
86 SetIoErr(iofs
.io_DosError
);
88 if (iofs
.io_DosError
!= 0)