Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / dopkt.c
blob84d90f960f4ecf13d99d7fdfa248a9ca1812c723
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #ifdef DEBUG
9 #undef DEBUG
10 #endif
11 #define DEBUG 1
12 #include <aros/debug.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH7(LONG, DoPkt,
22 /* SYNOPSIS */
23 AROS_LHA(struct MsgPort *, port, D1),
24 AROS_LHA(LONG , action, D2),
25 AROS_LHA(LONG , arg1, D3),
26 AROS_LHA(LONG , arg2, D4),
27 AROS_LHA(LONG , arg3, D5),
28 AROS_LHA(LONG , arg4, D6),
29 AROS_LHA(LONG , arg5, D7),
31 /* LOCATION */
32 struct DosLibrary *, DOSBase, 40, Dos)
34 /* FUNCTION
36 Send a dos packet to a filesystem and wait for the action to complete.
38 INPUTS
40 RESULT
42 NOTES
44 Callable from a task.
46 This function should NOT be used; it's only here for AmigaOS compatibility.
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
59 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
62 * First I create a regular dos packet and then let
63 * SendPkt rewrite it.
66 LONG res;
67 struct Process *me = (struct Process *)FindTask(NULL);
68 struct DosPacket *dp = (struct DosPacket *)AllocDosObject(DOS_STDPKT,
69 NULL);
70 struct MsgPort *replyPort;
71 struct IOFileSys *iofs = NULL;
73 BOOL i_am_process = TRUE;
75 if (NULL == dp)
77 return FALSE;
80 kprintf("Allocated packet %p\n", dp);
82 if (__is_process(me))
84 replyPort = &me->pr_MsgPort;
86 else
88 /* Make sure that tasks can use DoPkt(). */
89 replyPort = CreateMsgPort();
91 if (NULL == replyPort)
93 return FALSE;
96 i_am_process = FALSE;
99 dp->dp_Type = action;
100 dp->dp_Arg1 = arg1;
101 dp->dp_Arg2 = arg2;
102 dp->dp_Arg3 = arg3;
103 dp->dp_Arg4 = arg4;
104 dp->dp_Arg5 = arg5;
106 SendPkt(dp, port, replyPort);
108 internal_WaitPkt(replyPort, DOSBase);
110 SetIoErr(iofs->io_DosError);
112 res = dp->dp_Res1;
114 if (FALSE == i_am_process)
116 DeleteMsgPort(replyPort);
119 FreeDosObject(DOS_STDPKT, dp);
121 return res;
123 AROS_LIBFUNC_EXIT
124 } /* DoPkt */