home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / createiorequest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  2.4 KB  |  103 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: createiorequest.c,v 1.7 1997/01/01 03:46:08 ldp Exp $
  4.     $Log: createiorequest.c,v $
  5.     Revision 1.7  1997/01/01 03:46:08  ldp
  6.     Committed Amiga native (support) code
  7.  
  8.     Changed clib to proto
  9.  
  10.     Revision 1.6  1996/12/10 13:51:41  aros
  11.     Moved all #include's in the first column so makedepend can see it.
  12.  
  13.     Revision 1.5  1996/10/24 15:50:46  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.4  1996/08/13 13:55:59  digulla
  17.     Replaced AROS_LA by AROS_LHA
  18.     Replaced some AROS_LH*I by AROS_LH*
  19.     Sorted and added includes
  20.  
  21.     Revision 1.3  1996/08/01 17:41:08  digulla
  22.     Added standard header for all files
  23.  
  24.     Desc:
  25.     Lang: english
  26. */
  27. #include "exec_intern.h"
  28. #include <exec/io.h>
  29. #include <exec/ports.h>
  30. #include <exec/memory.h>
  31. #include <aros/libcall.h>
  32. #include <proto/exec.h>
  33.  
  34. /*****************************************************************************
  35.  
  36.     NAME */
  37.  
  38.     AROS_LH2(struct IORequest *, CreateIORequest,
  39.  
  40. /*  SYNOPSIS */
  41.     AROS_LHA(struct MsgPort *, ioReplyPort, A0),
  42.     AROS_LHA(ULONG,            size,        D0),
  43.  
  44. /*  LOCATION */
  45.     struct ExecBase *, SysBase, 109, Exec)
  46.  
  47. /*  FUNCTION
  48.     Create an I/O request structure bound to a given messageport.
  49.     I/O requests are normally used to communicate with exec devices
  50.     but can be used as normal messages just as well.
  51.  
  52.     INPUTS
  53.     ioReplyPort - Pointer to that one of your messageports where
  54.               the messages are replied to. A NULL port is legal
  55.               but then the function fails always.
  56.     size        - Size of the message structure including the struct
  57.               IORequest header. The minimal allowable size is that
  58.               of a struct Message.
  59.  
  60.     RESULT
  61.     Pointer to a new I/O request structure or NULL if the function
  62.     failed.
  63.  
  64.     NOTES
  65.  
  66.     EXAMPLE
  67.  
  68.     BUGS
  69.  
  70.     SEE ALSO
  71.  
  72.     INTERNALS
  73.  
  74.     HISTORY
  75.  
  76. ******************************************************************************/
  77. {
  78.     AROS_LIBFUNC_INIT
  79.  
  80.     struct IORequest *ret=NULL;
  81.  
  82.     /* A NULL ioReplyPort is legal but has no effect */
  83.     if(ioReplyPort==NULL)
  84.     return NULL;
  85.  
  86.     /* Allocate the memory */
  87.     ret=(struct IORequest *)AllocMem(size,MEMF_PUBLIC|MEMF_CLEAR);
  88.  
  89.     if(ret!=NULL)
  90.     {
  91.     /* Initialize it. */
  92.     ret->io_Message.mn_ReplyPort=ioReplyPort;
  93.  
  94.     /* This size is needed to free the memory at DeleteIORequest() time. */
  95.     ret->io_Message.mn_Length=size;
  96.     }
  97.  
  98.     /* All done. */
  99.     return ret;
  100.     AROS_LIBFUNC_EXIT
  101. } /* CreateIORequest */
  102.  
  103.