Added missing properties.
[AROS.git] / rom / dos / dopkt.c
blob5d49e94388ca8fbee04423a8b5060708c5eff7e6
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <aros/debug.h>
11 #include "dos_intern.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH7I(SIPTR, DoPkt,
20 /* SYNOPSIS */
21 AROS_LHA(struct MsgPort *, port, D1),
22 AROS_LHA(LONG , action, D2),
23 AROS_LHA(SIPTR , arg1, D3),
24 AROS_LHA(SIPTR , arg2, D4),
25 AROS_LHA(SIPTR , arg3, D5),
26 AROS_LHA(SIPTR , arg4, D6),
27 AROS_LHA(SIPTR , arg5, D7),
29 /* LOCATION */
30 struct DosLibrary *, DOSBase, 40, Dos)
32 /* FUNCTION
33 Send a dos packet to a filesystem and wait for the action to complete.
35 INPUTS
37 RESULT
39 NOTES
40 Callable from a task.
42 This function should NOT be used; it's only here for AmigaOS
43 compatibility.
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 return dopacket(NULL, port, action, arg1, arg2, arg3, arg4, arg5, 0, 0);
59 AROS_LIBFUNC_EXIT
63 * All Amiga kickstart versions accept most dos packet dos calls without dosbase in A6.
64 * So we have this internal routine here for compatibility purposes.
66 SIPTR dopacket(SIPTR *res2, struct MsgPort *port, LONG action, SIPTR arg1, SIPTR arg2, SIPTR arg3, SIPTR arg4, SIPTR arg5, SIPTR arg6, SIPTR arg7)
68 SIPTR res;
69 struct Process *me = (struct Process *)FindTask(NULL);
70 struct DosPacket *dp;
71 struct MsgPort *replyPort;
73 ASSERT_VALID_PROCESS(me);
75 if (port == NULL)
77 /* NIL: */
78 D(bug("NULL port => handling NIL:\n"));
79 return handleNIL(action, arg1, arg2, arg3);
82 /* First I create a regular dos packet */
83 dp = allocdospacket();
84 if (NULL == dp)
85 return FALSE;
87 if (__is_process(me))
88 replyPort = &me->pr_MsgPort;
89 else
92 * Make sure that tasks can use DoPkt().
93 * This is needed, for example, by Dos/Init()
94 * when creating the initial Shell.
96 replyPort = CreateMsgPort();
98 if (NULL == replyPort)
100 freedospacket(dp);
101 return FALSE;
105 D(bug("dp=0x%p act=%d port=0x%p reply=0x%p proc=%d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx '%s'\n",
106 dp, action, port, replyPort, __is_process(me), arg1, arg2, arg3, arg4, arg5, arg6, arg7, me->pr_Task.tc_Node.ln_Name));
107 dp->dp_Type = action;
108 dp->dp_Arg1 = arg1;
109 dp->dp_Arg2 = arg2;
110 dp->dp_Arg3 = arg3;
111 dp->dp_Arg4 = arg4;
112 dp->dp_Arg5 = arg5;
113 dp->dp_Arg6 = arg6;
114 dp->dp_Arg7 = arg7;
115 dp->dp_Res1 = 0;
116 dp->dp_Res2 = 0;
118 internal_SendPkt(dp, port, replyPort);
120 /* Did we get different packet back? System is in unstable state. */
121 if (internal_WaitPkt(replyPort) != dp)
122 Alert(AN_AsyncPkt);
124 D(bug("res1=%x res2=%x\n", dp->dp_Res1, dp->dp_Res2));
126 res = dp->dp_Res1;
127 if (res2)
128 *res2 = dp->dp_Res2;
130 if (__is_process(me))
131 me->pr_Result2 = dp->dp_Res2;
132 else
133 DeleteMsgPort(replyPort);
135 freedospacket(dp);
136 return res;