home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / exec / createiorequest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  2.3 KB  |  97 lines

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