---
name: "rt_mq_send"
section: "2"
platform: "linux"
package: "rtlinux"
version: "2.0rel-1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/rt_mq_send"
---

# rt\_mq\_send(2)

message queue 'send' operation

## NAME

rt\_mq\_send - message queue 'send' operation

## SYNOPSIS

```
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include rt_ipc.h
```

**int rt\_mq\_send(rt\_mq\_t \****mq***, char \****msg***, RT\_MQ\_PRIO** *prio***, RTIME** *wait***);**

## DESCRIPTION

**rt\_mq\_send** enqueues the data *msg* on the message queue *mq*. The data is assumed to be of the size with which **rt\_mq\_init** was called.  If *prio* is RT\_MQ\_NORMAL, the data is queued at the end. If *prio* is RT\_MQ\_URGENT, the data is forced to the front of the queue. An optional timeout can be specified.  If  *wait* is RT\_WAIT\_FOREVER, the function does not time out.  If *wait* is RT\_NO\_WAIT and the semaphore is not available, **rt\_mq\_send** returns immediately.  If *wait* is any other value, it represent a time at which the call to **rt\_mq\_send** should time out.  If that time is reached, **rt\_mq\_send** returns with -ETIME.

## RETURN VALUE

On success, 0 is returned.  On failure, a negative value is returned as described below.

## ERRORS

- **-ETIME**

  The timeout period expired.

- **-EAGAIN**

  *wait* was RT\_NO\_WAIT, and no space was available on the queue.

- **-EINVAL**

  *mq* does not point to a valid rt\_mq\_t.

## AUTHOR

Jerry Epplin \<JerryEpplin@worldnet.att.net\>

## SEE ALSO

[**rt\_mq\_destroy**(2)](/rt_mq_destroy/2.md), [**rt\_mq\_init**(2)](/rt_mq_init/2.md), [**rt\_mq\_receive**(2)](/rt_mq_receive/2.md), [**rt\_task\_ipc\_delete**(2)](/rt_task_ipc_delete/2.md), [**rt\_task\_ipc\_init**(2)](/rt_task_ipc_init/2.md)
