debug.library: use quick sort to sort the segments
[AROS.git] / rom / dos / lockrecord.c
blobb61e08e17682129ceaae30130f602205481e856b
1 /*
2 Copyright © 1995-2013, 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
30 Lock a portion of a file for exclusive access. A timeout may be
31 specified which is the maximum amount of time to wait for the record
32 to be available.
34 INPUTS
35 fh - file handle for the file to lock a record of
36 offset - starting position of the lock
37 length - length of the record in bytes
38 mode - lock type
39 timeout - timeout interval measured in ticks (may be 0)
41 RESULT
42 Success/failure indicator.
44 NOTES
45 Record locks are cooperative, meaning that they only affect other calls
46 to LockRecord().
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 LockRecords(), UnLockRecord()
55 INTERNALS
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 LONG status;
62 struct FileHandle *fileH = BADDR(fh);
64 if (fh == BNULL)
66 return DOSFALSE;
69 status = dopacket5(DOSBase, NULL, fileH->fh_Type, ACTION_LOCK_RECORD, fileH->fh_Arg1, offset, length, mode, timeout);
71 return status;
73 AROS_LIBFUNC_EXIT
74 } /* LockRecord */