2021-06-20 17:12:05 +02:00
|
|
|
# mqrs
|
|
|
|
`mqrs` is a small cli application to handle POSIX message queues.
|
|
|
|
|
|
|
|
## Installation
|
2021-06-20 17:39:22 +02:00
|
|
|
To build `mqrs` a rust toolchain is necessary.
|
2021-06-20 17:12:05 +02:00
|
|
|
|
|
|
|
### Install Rust
|
|
|
|
Install the Rust toolchain from [rustup.rs](https://rustup.rs).
|
|
|
|
|
|
|
|
### Build `mqrs`
|
|
|
|
`mqrs` can be built for development:
|
2021-06-20 17:39:22 +02:00
|
|
|
```sh
|
|
|
|
cargo b
|
2021-06-20 17:12:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
or for releasing:
|
2021-06-20 17:39:22 +02:00
|
|
|
```sh
|
|
|
|
cargo b --release
|
|
|
|
```
|
|
|
|
|
|
|
|
### Build the `mqrs` Debian package
|
2021-07-07 19:30:18 +02:00
|
|
|
For that [`cargo-deb`](https://github.com/mmstick/cargo-deb) is
|
|
|
|
required, which can be installed with:
|
|
|
|
```sh
|
|
|
|
cargo install cargo-deb
|
|
|
|
```
|
|
|
|
|
|
|
|
A Debian package can be built with:
|
2021-06-20 17:39:22 +02:00
|
|
|
```sh
|
|
|
|
cargo deb
|
2021-06-20 17:12:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Install `mqrs`
|
|
|
|
When a Rust toolchain installed you can also install `mqrs`
|
|
|
|
directly without cloning it manually:
|
|
|
|
``` sh
|
2021-06-20 17:39:22 +02:00
|
|
|
cargo install --git https://git.onders.org/finga/mqrs.git mqrs
|
2021-06-20 17:12:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
or from within the project:
|
2021-06-20 17:39:22 +02:00
|
|
|
```sh
|
|
|
|
cargo install mqrs
|
2021-06-20 17:12:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Run `mqrs`
|
|
|
|
`mqrs` can either be run from the project directory with:
|
2021-06-20 17:39:22 +02:00
|
|
|
```sh
|
|
|
|
cargo b
|
2021-06-20 17:12:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
or you can copy the produced binary somewhere else or link to them
|
2021-07-07 19:30:18 +02:00
|
|
|
from `target/{debug,release}/mqrs` depending on which one you built.
|
2021-06-20 17:12:05 +02:00
|
|
|
|
|
|
|
## Using `mqrs`
|
2021-07-07 19:19:19 +02:00
|
|
|
Depending on which backend you want to use there are different subsets
|
|
|
|
of subcommands. Following backends are supported:
|
|
|
|
- `posix`: Uses POSIX message queues
|
|
|
|
- `sysv`: Uses SysV IPC message queues
|
2021-06-22 01:36:57 +02:00
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
If a command is clearly distinguishable from all the others,
|
|
|
|
it does not have to be completed further.
|
|
|
|
|
|
|
|
### POSIX message queues
|
|
|
|
The POSIX backend supports six commands: `create`, `info`, `list`,
|
|
|
|
`unlink`, `send` and `recv`.
|
|
|
|
|
|
|
|
#### Create a message queue
|
2021-06-22 01:36:57 +02:00
|
|
|
Use the `create` command to create a new POSIX message queue. Following
|
|
|
|
optional arguments are supported:
|
|
|
|
- `-c`, `--capacity`: Maximum number of messages in the queue
|
|
|
|
- `-p`, `--permissions`: Permissions (octal) to create the queue with
|
|
|
|
- `-s`, `--msgsize`: Message size in bytes
|
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
#### Print information about a message queue
|
2021-06-22 01:36:57 +02:00
|
|
|
Use the `info` command to print further information about a message
|
|
|
|
queue.
|
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
#### List all message queues
|
2021-07-07 18:27:41 +02:00
|
|
|
Use the `list` command to print a list of all message
|
|
|
|
queues. Following option argument is supported:
|
|
|
|
- `-a`, `--all`: Print all available information
|
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
#### Delete a message queue
|
2021-06-22 01:36:57 +02:00
|
|
|
Use the `unlink` command to delete a message queue.
|
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
#### Send a message to a queue
|
2021-06-22 01:36:57 +02:00
|
|
|
Use the `send` command to send a message to a message queue. Following
|
|
|
|
optional arguments are supported:
|
|
|
|
- `-n`, `--non-blocking`: Do not block
|
|
|
|
- `-d`, `--deadline <deadline>`: Deadline until messages are sent
|
|
|
|
(format: `%Y-%m-%d %H:%M:%S`)
|
2021-06-27 02:56:31 +02:00
|
|
|
- `-p`, `--priority <priority>`: Set a different priority than
|
|
|
|
default, priority >= 0 [default: 0]
|
2021-06-27 02:39:22 +02:00
|
|
|
- `-o`, `--timeout <timeout>`: As for example in "5h 23min 42ms"
|
2021-06-22 01:36:57 +02:00
|
|
|
|
2021-07-07 19:19:19 +02:00
|
|
|
#### Receive a message from a queue
|
2021-06-22 01:36:57 +02:00
|
|
|
Use the `recv` command to receive one or more messages from a message
|
|
|
|
queue. Following optional arguments are supported:
|
|
|
|
- `-f`, `--follow`: Print messages as they are received
|
|
|
|
- `-n`, `--non-blocking`: Do not block
|
|
|
|
- `-t`, `--timestamp`: Print a timestamp before each message
|
|
|
|
- `-d`, `--deadline <deadline>`: Deadline until messages are received
|
|
|
|
(format: `%Y-%m-%d %H:%M:%S`)
|
2021-06-27 02:39:22 +02:00
|
|
|
- `-o,` `--timeout <timeout>`: As for example in "5h 23min 42ms"
|
2021-07-07 19:19:19 +02:00
|
|
|
|
|
|
|
### SysV IPC message queues
|
|
|
|
The SysV IPC backend supports no commands yet.
|