2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
5 Desc: Change the mode of a filehandle or lock.
8 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH3(BOOL
, ChangeMode
,
22 AROS_LHA(ULONG
, type
, D1
),
23 AROS_LHA(BPTR
, object
, D2
),
24 AROS_LHA(ULONG
, newmode
, D3
),
27 struct DosLibrary
*, DOSBase
, 75, Dos
)
30 Try to change the access mode of a lock or filehandle.
33 type - CHANGE_FH or CHANGE_LOCK.
34 object - Filehandle or lock.
35 newmode - New mode, either SHARED_LOCK or EXCLUSIVE_LOCK.
38 != 0 if all went well, otherwise 0. IoErr() gives additional
39 information in the latter case.
50 Since filehandles and locks are identical under AROS the type
53 *****************************************************************************/
57 /* Get pointer to filehandle */
58 struct FileHandle
*fh
= (struct FileHandle
*)BADDR(object
);
59 struct FileLock
*fl
= (struct FileLock
*)BADDR(object
);
62 if (type
!= CHANGE_LOCK
&& type
!= CHANGE_FH
) {
63 SetIoErr(ERROR_BAD_NUMBER
);
66 D(bug("[ChangeMode] %d %x %d\n", type
, fh
, newmode
));
67 ret
= dopacket3(DOSBase
, NULL
, type
== CHANGE_LOCK
? fl
->fl_Task
: fh
->fh_Type
, ACTION_CHANGE_MODE
, type
, object
, newmode
);