Removed __startup attribute. It is already present in AROS_SHxx definition, and doubl...
[AROS.git] / rom / exec / createiorequest.c
blob1311d1bf953fc2db09a64398fc429933fe384a8c
1 /*
2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create an I/O request.
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <exec/io.h>
10 #include <exec/ports.h>
11 #include <exec/memory.h>
12 #include <aros/libcall.h>
13 #include <proto/exec.h>
15 /*****************************************************************************
17 NAME */
19 AROS_LH2(APTR, CreateIORequest,
21 /* SYNOPSIS */
22 AROS_LHA(struct MsgPort *, ioReplyPort, A0),
23 AROS_LHA(ULONG, size, D0),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 109, Exec)
28 /* FUNCTION
29 Create an I/O request structure bound to a given messageport.
30 I/O requests are normally used to communicate with exec devices
31 but can be used as normal messages just as well.
33 INPUTS
34 ioReplyPort - Pointer to that one of your messageports where
35 the messages are replied to. A NULL port is legal
36 but then the function fails always.
37 size - Size of the message structure including the struct
38 IORequest header. The minimal allowable size is that
39 of a struct Message.
41 RESULT
42 Pointer to a new I/O request structure or NULL if the function
43 failed.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 INTERNALS
55 ******************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct IORequest *ret=NULL;
61 /* A NULL ioReplyPort is legal but has no effect */
62 if(ioReplyPort==NULL)
63 return NULL;
65 /* Allocate the memory */
66 ret=(struct IORequest *)AllocMem(size,MEMF_PUBLIC|MEMF_CLEAR);
68 if(ret!=NULL)
70 /* Initialize it. */
71 ret->io_Message.mn_ReplyPort=ioReplyPort;
73 /* This size is needed to free the memory at DeleteIORequest() time. */
74 ret->io_Message.mn_Length=size;
77 /* All done. */
78 return ret;
79 AROS_LIBFUNC_EXIT
80 } /* CreateIORequest */