Detabbed
[AROS.git] / rom / dos / lockrecord.c
blobc99cb19f98b3d1d10132a009554038fd9b60f9d2
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "dos_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH5(BOOL, LockRecord,
19 /* SYNOPSIS */
20 AROS_LHA(BPTR , fh, D1),
21 AROS_LHA(ULONG, offset, D2),
22 AROS_LHA(ULONG, length, D3),
23 AROS_LHA(ULONG, mode, D4),
24 AROS_LHA(ULONG, timeout, D5),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 45, Dos)
29 /* FUNCTION
31 Lock a portion of a file for exclusive access. A timeout may be specified
32 which is the maximum amount of time to wait for the record to be available.
34 INPUTS
36 fh -- file handle for the file to lock a record of
37 offset -- starting position of the lock
38 length -- length of the record in bytes
39 mode -- lock type
40 timeout -- timeout interval measured in ticks (may be 0)
42 RESULT
44 Success/failure indicator.
46 NOTES
48 Record locks are cooperative, meaning that they only affect other calls
49 to LockRecord().
51 EXAMPLE
53 BUGS
55 SEE ALSO
57 LockRecords(), UnLockRecord()
59 INTERNALS
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 LONG status;
66 struct FileHandle *fileH = BADDR(fh);
68 if (fh == BNULL)
70 return DOSFALSE;
73 status = dopacket5(DOSBase, NULL, fileH->fh_Type, ACTION_LOCK_RECORD, fileH->fh_Arg1, offset, length, mode, timeout);
75 return status;
77 AROS_LIBFUNC_EXIT
78 } /* LockRecord */