openblt

a hobby OS from the late 90s
git clone http://frotz.net/git/openblt.git
Log | Files | Refs | LICENSE

ipcdocs (2430B)


      1 
      2 typedef struct {
      3     int flags;
      4     uint32 src;
      5     uint32 dst;
      6     uint32 size;
      7     void *data;    
      8 } msg_hdr_t;
      9 
     10 int port_create(int restrict);
     11 /* Create a new port owned by the running thread.  Only allow messages from
     12  * port 'restrict' to be received.  If 'restrict' is 0, messages from any
     13  * source will be received.  Will return ERR_MEMORY if the system lacks the
     14  * resources to create the port, otherwise the port number will be returned.
     15 */
     16   
     17 int port_destroy(uint32 port);
     18 /* Destroy an existing port.
     19  * Returns ERR_RESOURCE if port is not a valid port or if there are other
     20  * ports slaved to this port.  Returns ERR_PERMISSION if the running thread
     21  * is not the owner of this port.  Returns ERR_NONE upon success/
     22 */
     23 
     24 int port_send(msg_hdr_t *mh);
     25 /* Send the message in mh->data, of length mh->size from port mh->src to port
     26  * mh->dst.  Returns mh->size upon success, ERR_MEMORY if there is a bounds
     27  * error, ERR_RESOURCE if either the source or destination ports do not exist,
     28  * ERR_PERMISSION if the source is not owned by the running thread or the
     29  * destination is not sendable from the source port.
     30 */
     31 
     32 int port_recv(msg_hdr_t *mh);
     33 /* Receive a message (in buffer mh->data, maxlen mh->size) from port mh->dst.
     34  * Upon success, mh->src will be set to the sender, mh->dst will be set to
     35  * the destination if it was a slaved port, and the number of received bytes
     36  * will be returned.  If the data or header are out of bounds, ERR_MEMORY is
     37  * returned.  If the destination port does not exist ERR_RESOURCE is returned.
     38  * If the running thread does not own the destination port, ERR_PERMISSION is
     39  * returned.  This call will block if no messages are available, unless the
     40  * port is set to NOWAIT, in which case ERR_WOULDBLOCK is returned.
     41 */
     42 
     43 int port_slave(uint32 master, uint32 slave);
     44 /* Cause the master port to receive all messages sent to the slave port.
     45  * If master is 0, the slave is released from bondage.  Returns ERR_NONE
     46  * upon success, ERR_PERMISSION if the master and slave are not both owned
     47  * by the running thread, or ERR_RESOURCE if the master or slave are not
     48  * valid ports.
     49 */
     50 
     51 int port_set_restrict(uint32 port, uint32 restrict);
     52 /* Change the restriction on a port.  Returns ERR_NONE on success, ERR_RESOURCE
     53  * if the port does not exits, or ERR_PERMISSION if the running thread does not
     54  * own the port.  A restriction of 0 allows any port to send to this port.
     55 */
     56 
     57 #endif