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

# rt\_mq\_init(2)

create a message queue

## NAME

rt\_mq\_init - create a message queue

## 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\_init(rt\_mq\_t \****mq***, int** *max\_msgs***, int** *msg\_size***);**

## DESCRIPTION

**rt\_mq\_init** is called to initialize a real-time message queue.  A message queue can be used for communicating data among real-time tasks.  Communication between Linux processes and real-time tasks is done using the standard Real-Time Linux RT-FIFO facilities.

*mq* must point to a statically allocated structure. *max\_msgs* is the maximum number of messages allowed, and *msg\_size* is the size of each message.

## RETURN VALUE

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

## ERRORS

- **-EINVAL**

  *msg\_size* is negative, or *max\_msgs* is less than one.

- **-ENOMEM**

  Space could not be allocated for the message queue.

## BUGS

Priority inheritance is not currently supported.

## AUTHOR

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

## SEE ALSO

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