Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Typedefs | Functions
mqueue.h File Reference
#include <sys/types.h>
#include <common/list.h>
Include dependency graph for mqueue.h:

Go to the source code of this file.

Data Structures

struct  mq_attr
 

Typedefs

typedef uint32_t mqd_t
 

Functions

int mq_getattr (mqd_t mqdes, struct mq_attr *attr)
 Retrieve atributes of the message queue referred to by the message queue descriptor mqdes. More...
 
int mq_setattr (mqd_t mqdes, const struct mq_attr *newattr, struct mq_attr *oldattr)
 Modify attributes of the message queue referred to by the message queue descriptor mqdes. More...
 
mqd_t mq_open (const char *name, int oflag, struct mq_attr *attr)
 Create a new message queue or open an existing queue. More...
 
int mq_close (mqd_t mqdes)
 Close the message queue descriptor. More...
 
int mq_unlink (const char *name)
 
ssize_t mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio)
 Remove the oldest message with highest priority from the message queue referred to by the message queue descriptor mqdes and places it in the buffer pointed to by msg_ptr. More...
 
int mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio)
 Add the message pointed to by msg_ptr to the message queue referred to by the message queue descriptor mqdes. More...
 

Function Documentation

◆ mq_close()

int mq_close ( mqd_t  mqdes)

Close the message queue descriptor.

Parameters
mqdesThe message queue descriptor to provide.
Return values
int0 on success and nonzero error number on error.

◆ mq_getattr()

int mq_getattr ( mqd_t  mqdes,
struct mq_attr attr 
)

Retrieve atributes of the message queue referred to by the message queue descriptor mqdes.

Parameters
mqdesThe message queue descriptor to provide.
newattrPointer to the new attribute.
oldattrPointer to the memory space for storing old attributes.
Return values
int0 on success and nonzero error number on error.

◆ mq_open()

mqd_t mq_open ( const char *  name,
int  oflag,
struct mq_attr attr 
)

Create a new message queue or open an existing queue.

Parameters
nameThe name of the message queue.
oflagThe flags for opening the message queue.
attrThe attribute object for setting the message queue.
Return values
mqd_tThe message queue descriptor to return.

◆ mq_receive()

ssize_t mq_receive ( mqd_t  mqdes,
char *  msg_ptr,
size_t  msg_len,
unsigned int *  msg_prio 
)

Remove the oldest message with highest priority from the message queue referred to by the message queue descriptor mqdes and places it in the buffer pointed to by msg_ptr.

Parameters
mqdesThe message queue descriptor to provide.
msg_ptrThe buffer for storing the received message.
msg_lenThe length of the buffer pointed to by msg_ptr.
msg_prioThe priority of the received message.
Return values
ssize_tThe size of the received message in bytes.

◆ mq_send()

int mq_send ( mqd_t  mqdes,
const char *  msg_ptr,
size_t  msg_len,
unsigned int  msg_prio 
)

Add the message pointed to by msg_ptr to the message queue referred to by the message queue descriptor mqdes.

Parameters
mqdesThe message queue descriptor to provide.
msg_ptrThe message to send.
msg_lenThe size of the message in bytes.
msg_prioThe priority of the message to send.
Return values
int0 on success and nonzero error number on error.

◆ mq_setattr()

int mq_setattr ( mqd_t  mqdes,
const struct mq_attr newattr,
struct mq_attr oldattr 
)

Modify attributes of the message queue referred to by the message queue descriptor mqdes.

Parameters
mqdesThe message queue descriptor to provide.
attrThe memory space for retrieving message queue attributes.
Return values
int0 on success and nonzero error number on error.