libcfe  0.12.1
some useful C-functions
msgqueue.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MSG_PRIORITY   1
 Indicates a message as important. More...
 
#define MSG_NOBLOCK   2
 TODO. More...
 

Functions

int send_message (int qid, int type, char *msg, int len, short flag)
 
int receive_message (int qid, int type, char **msg)
 
int remove_queue (int qid)
 
int create_queue (void)
 

Macro Definition Documentation

◆ MSG_NOBLOCK

#define MSG_NOBLOCK   2

TODO.

Definition at line 6 of file msgqueue.h.

◆ MSG_PRIORITY

#define MSG_PRIORITY   1

Indicates a message as important.

Even when the queue is full, there is some space left for important messages.

Definition at line 5 of file msgqueue.h.

Function Documentation

◆ create_queue()

int create_queue ( void  )

Create a new message queue.

Returns
A new message queue identifier.

Definition at line 116 of file msgqueue.c.

◆ receive_message()

int receive_message ( int  qid,
int  type,
char **  msg 
)

Receive a message from a message queue.

Parameters
[in]qidThe message queue to send the message to.
[in]typeType of message, must be > 0.
[in,out]msgNULL pointer, afterwards this points to the received message.
Returns
Size of message, or -1 on error.

Definition at line 86 of file msgqueue.c.

◆ remove_queue()

int remove_queue ( int  qid)

Destroy a message queue.

Parameters
[in]qidThe message queue to destroy.
Returns
return value
  • 0 succeed
  • -1 failed

Definition at line 106 of file msgqueue.c.

◆ send_message()

int send_message ( int  qid,
int  type,
char *  msg,
int  len,
short  flag 
)

function to call to send a message

Parameters
[in]qidThe message queue to send the message to.
[in]typeType of message, must be > 0.
[in]msgPointer to a string containing the actual text (terminating character is not required).
[in]lenNumber of characters to copy from 'msg' to the message queue (when 'len' == 0 it copy up to the first '\0' character).
[in]flagSet to MSG_PRIORITY to indicate this as important message, otherwise use 0.
Returns
return values:
  • 0 succeed
  • -1 message too big
  • -2 message queue does not exist
  • -3 message queue full
  • -4 other error, check errno for more details

Definition at line 24 of file msgqueue.c.