Compare commits
No commits in common. "e96ba1dca103f6fd5e10049f929d37e61f4fe93e" and "18e3ab2a044b9c6048e85c241144e3d7ba785332" have entirely different histories.
e96ba1dca1
...
18e3ab2a04
16 changed files with 369 additions and 876 deletions
|
@ -1,10 +0,0 @@
|
||||||
[target.'cfg(feature = "cargo-clippy")']
|
|
||||||
rustflags = [
|
|
||||||
"-Dwarnings",
|
|
||||||
"-Dclippy::pedantic",
|
|
||||||
"-Dclippy::nursery",
|
|
||||||
"-Dclippy::cargo",
|
|
||||||
]
|
|
||||||
|
|
||||||
[registries]
|
|
||||||
staging = { index = "https://github.com/rust-lang/staging.crates.io-index" }
|
|
18
CHANGELOG.md
18
CHANGELOG.md
|
@ -1,18 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a
|
|
||||||
Changelog](https://keepachangelog.com/en/1.0.0/), and this project
|
|
||||||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Update to the latext version of **env_logger**.
|
|
||||||
- Update to the latext version of **nix**.
|
|
||||||
- Fix several clippy findings in preperation to enable several lint
|
|
||||||
groups.
|
|
||||||
- Update to the latest version of **clap**.
|
|
||||||
- Update all dependencies that should not break SemVer.
|
|
550
Cargo.lock
generated
550
Cargo.lock
generated
|
@ -4,108 +4,47 @@ version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.2"
|
version = "0.7.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android-tzdata"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android_system_properties"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstream"
|
|
||||||
version = "0.6.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"anstyle-parse",
|
|
||||||
"anstyle-query",
|
|
||||||
"anstyle-wincon",
|
|
||||||
"colorchoice",
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle"
|
|
||||||
version = "1.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-parse"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
|
|
||||||
dependencies = [
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-query"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
|
|
||||||
dependencies = [
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-wincon"
|
|
||||||
version = "3.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.75"
|
version = "1.0.51"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atty"
|
||||||
|
version = "0.2.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi",
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.4.0"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bumpalo"
|
|
||||||
version = "3.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.83"
|
version = "1.0.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
|
@ -115,104 +54,84 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.31"
|
version = "0.4.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"libc",
|
||||||
"iana-time-zone",
|
"num-integer",
|
||||||
"js-sys",
|
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"wasm-bindgen",
|
"time",
|
||||||
"windows-targets",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.4.6"
|
version = "3.0.0-beta.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956"
|
checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"atty",
|
||||||
|
"bitflags",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
]
|
"indexmap",
|
||||||
|
"lazy_static",
|
||||||
[[package]]
|
"os_str_bytes",
|
||||||
name = "clap_builder"
|
|
||||||
version = "4.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45"
|
|
||||||
dependencies = [
|
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
|
||||||
"clap_lex",
|
|
||||||
"strsim",
|
"strsim",
|
||||||
|
"termcolor",
|
||||||
|
"textwrap",
|
||||||
|
"unicase",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.4.2"
|
version = "3.0.0-beta.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
|
"proc-macro-error",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "env_logger"
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colorchoice"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.8.4"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_logger"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"atty",
|
||||||
"humantime",
|
"humantime",
|
||||||
"is-terminal",
|
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
"regex",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "hashbrown"
|
||||||
version = "0.3.5"
|
version = "0.11.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
|
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.1"
|
version = "0.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-segmentation",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.3.3"
|
version = "0.1.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
|
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humantime"
|
name = "humantime"
|
||||||
|
@ -221,71 +140,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "indexmap"
|
||||||
version = "0.1.57"
|
version = "1.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
|
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"autocfg",
|
||||||
"core-foundation-sys",
|
"hashbrown",
|
||||||
"iana-time-zone-haiku",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"windows",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone-haiku"
|
name = "lazy_static"
|
||||||
version = "0.1.2"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is-terminal"
|
|
||||||
version = "0.4.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"rustix",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.64"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.149"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "linux-raw-sys"
|
|
||||||
version = "0.4.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.20"
|
version = "0.4.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.6.4"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mqrs"
|
name = "mqrs"
|
||||||
|
@ -303,29 +201,44 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.27.1"
|
version = "0.21.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
|
checksum = "77d9f3521ea8e0641a153b3cddaf008dcbf26acd4ed739a2517295e0760d12c7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
|
"memoffset",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.17"
|
version = "0.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "os_str_bytes"
|
||||||
version = "1.18.0"
|
version = "4.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "posixmq"
|
name = "posixmq"
|
||||||
|
@ -337,40 +250,52 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro-error"
|
||||||
version = "1.0.69"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"proc-macro-error-attr",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-error-attr"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.33"
|
version = "1.0.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.10.1"
|
version = "1.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aaac441002f822bc9705a681810a4dd2963094b9ca0ddc41cb963a4c189189ea"
|
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||||
dependencies = [
|
|
||||||
"aho-corasick",
|
|
||||||
"memchr",
|
|
||||||
"regex-automata",
|
|
||||||
"regex-syntax",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-automata"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5011c7e263a695dc8ca064cddb722af1be54e517a280b12a5356f98366899e5d"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
@ -379,22 +304,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.8.2"
|
version = "0.6.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustix"
|
|
||||||
version = "0.38.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"errno",
|
|
||||||
"libc",
|
|
||||||
"linux-raw-sys",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
|
@ -404,13 +316,13 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.38"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"unicode-ident",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -424,27 +336,36 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.3.0"
|
version = "1.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
|
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "textwrap"
|
||||||
version = "1.0.49"
|
version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4"
|
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.49"
|
version = "1.0.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
|
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -452,70 +373,54 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "time"
|
||||||
version = "1.0.12"
|
version = "0.1.44"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utf8parse"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen"
|
|
||||||
version = "0.2.87"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"libc",
|
||||||
"wasm-bindgen-macro",
|
"wasi",
|
||||||
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "unicase"
|
||||||
version = "0.2.87"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
|
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"version_check",
|
||||||
"log",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "unicode-segmentation"
|
||||||
version = "0.2.87"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "unicode-width"
|
||||||
version = "0.2.87"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "unicode-xid"
|
||||||
version = "0.2.87"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.10.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
|
@ -535,9 +440,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-util"
|
name = "winapi-util"
|
||||||
version = "0.1.6"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
@ -547,78 +452,3 @@ name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows"
|
|
||||||
version = "0.48.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-sys"
|
|
||||||
version = "0.48.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-targets"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
|
||||||
dependencies = [
|
|
||||||
"windows_aarch64_gnullvm",
|
|
||||||
"windows_aarch64_msvc",
|
|
||||||
"windows_i686_gnu",
|
|
||||||
"windows_i686_msvc",
|
|
||||||
"windows_x86_64_gnu",
|
|
||||||
"windows_x86_64_gnullvm",
|
|
||||||
"windows_x86_64_msvc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_gnullvm"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_gnu"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnu"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnullvm"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|
||||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -11,13 +11,13 @@ keywords = ["message_queue", "mq", "mqueue", "queue"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.51"
|
anyhow = "1.0"
|
||||||
chrono = "0.4.31"
|
clap = "3.0.0-beta.2"
|
||||||
clap = { version = "4.4.6", features = ["derive"] }
|
posixmq = "1.0"
|
||||||
env_logger = "0.10.0"
|
chrono = "0.4"
|
||||||
humantime = "2.1"
|
humantime = "2.1"
|
||||||
log = "0.4.14"
|
log = "0.4"
|
||||||
posixmq = "1.0.0"
|
env_logger = "0.8"
|
||||||
sysvmq = { path = "sysvmq" }
|
sysvmq = { path = "sysvmq" }
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{ArgAction, Parser};
|
use clap::{crate_authors, crate_version, AppSettings, Parser};
|
||||||
|
|
||||||
mod posix;
|
mod posix;
|
||||||
mod sysv;
|
mod sysv;
|
||||||
|
@ -34,13 +34,15 @@ enum SysvCommand {
|
||||||
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
#[clap(
|
#[clap(
|
||||||
arg_required_else_help = true,
|
version = crate_version!(),
|
||||||
infer_subcommands = true,
|
author = crate_authors!(", "),
|
||||||
subcommand_required = true
|
setting = AppSettings::SubcommandRequiredElseHelp,
|
||||||
|
global_setting = AppSettings::PropagateVersion,
|
||||||
|
global_setting = AppSettings::InferSubcommands,
|
||||||
)]
|
)]
|
||||||
struct Opts {
|
struct Opts {
|
||||||
/// Produce verbose output, multiple -v options increase the verbosity (max. 3)
|
/// Produce verbose output, multiple -v options increase the verbosity (max. 3)
|
||||||
#[clap(short, long, global = true, action = ArgAction::Count)]
|
#[clap(short, long, global = true, parse(from_occurrences))]
|
||||||
verbose: u32,
|
verbose: u32,
|
||||||
/// Backend to be used
|
/// Backend to be used
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
|
|
|
@ -22,13 +22,17 @@ pub struct Create {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn msgsize_default() -> usize {
|
fn msgsize_default() -> usize {
|
||||||
fs::read_to_string("/proc/sys/fs/mqueue/msgsize_default")
|
match fs::read_to_string("/proc/sys/fs/mqueue/msgsize_default") {
|
||||||
.map_or(8192, |m| m.trim().parse::<usize>().expect("can never fail"))
|
Ok(m) => m.trim().parse::<usize>().expect("can never fail"),
|
||||||
|
_ => 8192,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn msg_default() -> usize {
|
fn msg_default() -> usize {
|
||||||
fs::read_to_string("/proc/sys/fs/mqueue/msg_default")
|
match fs::read_to_string("/proc/sys/fs/mqueue/msg_default") {
|
||||||
.map_or(10, |m| m.trim().parse::<usize>().expect("can never fail"))
|
Ok(m) => m.trim().parse::<usize>().expect("can never fail"),
|
||||||
|
_ => 10,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Create {
|
impl Create {
|
||||||
|
|
|
@ -14,13 +14,12 @@ pub struct List {
|
||||||
|
|
||||||
impl List {
|
impl List {
|
||||||
pub fn run(&self) -> Result<()> {
|
pub fn run(&self) -> Result<()> {
|
||||||
if self.all {
|
match self.all {
|
||||||
println!(
|
false => println!("Name"),
|
||||||
|
true => println!(
|
||||||
"{0: <10} {1: <10} {2: <12} {3: <26} {4: <26}",
|
"{0: <10} {1: <10} {2: <12} {3: <26} {4: <26}",
|
||||||
"Name", "Size", "Permissions", "Modified", "Accessed",
|
"Name", "Size", "Permissions", "Modified", "Accessed",
|
||||||
);
|
),
|
||||||
} else {
|
|
||||||
println!("Name");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for mq in fs::read_dir("/dev/mqueue")? {
|
for mq in fs::read_dir("/dev/mqueue")? {
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn print_message(priority: u32, length: usize, timestamp: bool, msg: &str) {
|
||||||
println!("{}", Local::now());
|
println!("{}", Local::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{msg}");
|
println!("{}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Recv {
|
impl Recv {
|
||||||
|
|
|
@ -3,8 +3,7 @@ use clap::Parser;
|
||||||
use log::info;
|
use log::info;
|
||||||
use sysvmq::SysvMq;
|
use sysvmq::SysvMq;
|
||||||
|
|
||||||
#[allow(clippy::doc_markdown)]
|
/// Create a SysV message queue
|
||||||
/// Create a SysV IPC message queue
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
pub struct Create {
|
pub struct Create {
|
||||||
/// Permissions (octal) to create the queue with (default: 0644)
|
/// Permissions (octal) to create the queue with (default: 0644)
|
||||||
|
|
|
@ -17,8 +17,8 @@ pub struct Info {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_line(line: &str) {
|
fn print_line(line: &str) {
|
||||||
for field in line.split_whitespace() {
|
for field in line.split_whitespace().collect::<Vec<&str>>() {
|
||||||
print!("{field: <10}");
|
print!("{0: <10}", field);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
|
|
|
@ -10,11 +10,10 @@ use std::{
|
||||||
pub struct List {}
|
pub struct List {}
|
||||||
|
|
||||||
impl List {
|
impl List {
|
||||||
#[allow(clippy::unused_self)]
|
|
||||||
pub fn run(&self) -> Result<()> {
|
pub fn run(&self) -> Result<()> {
|
||||||
for line in BufReader::new(File::open("/proc/sysvipc/msg")?).lines() {
|
for line in BufReader::new(File::open("/proc/sysvipc/msg")?).lines() {
|
||||||
for field in line?.split_whitespace() {
|
for field in line?.split_whitespace().collect::<Vec<&str>>() {
|
||||||
print!("{field: <10}");
|
print!("{0: <10}", field);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a
|
|
||||||
Changelog](https://keepachangelog.com/en/1.0.0/), and this project
|
|
||||||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- Basic tests to create, send, receive and delete a message queue as
|
|
||||||
well as changing the mode of a queue.
|
|
||||||
- The functions `SysvMq::stat()`, `SysvMq::info()`,
|
|
||||||
`SysvMq::msg_stat()` and `SysvMq::msg_info()` are added to receive
|
|
||||||
parameters of a queue.
|
|
||||||
- The function `new()` passes now a key which is used for the new
|
|
||||||
message queue.
|
|
||||||
- A basic test to test the happy path of a queue.
|
|
||||||
- The function `get()` to gather facts from a message queue.
|
|
||||||
- The function `set()` to set facts of a message queue.
|
|
||||||
- The function `create()` to create a message queue.
|
|
||||||
- The functions `send()` and `SysvMq::send()` to send messages to a
|
|
||||||
queue.
|
|
||||||
- The functions `recv()` and `SysvMq::recv()` to receive messages from
|
|
||||||
a queue.
|
|
||||||
- The function `SysvMq::delete()` to delete a queue.
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- The function `SysvMq::mode()` now also updates the message queue
|
|
||||||
accordingly.
|
|
||||||
- Remove `PhantomData` from the `SysvMq` struct.
|
|
||||||
- The function `SysvMq::create()` is replaced by `SysvMq::new()`.
|
|
||||||
- Remove generic type for `SysvMq`.
|
|
||||||
- Rename `unlink_id()` to `delete()`.
|
|
||||||
- Update to the latest verscion of `nix`.
|
|
||||||
- Fix several clippy findings in preperation to enable several lint
|
|
||||||
groups.
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
- The function `id_from_key()` was removed.
|
|
|
@ -1,17 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "sysvmq"
|
name = "sysvmq"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2018"
|
||||||
authors = ["finga <mqrs@onders.org>"]
|
authors = ["finga <mqrs@onders.org>"]
|
||||||
repository = "https://git.onders.org/finga/mqrs"
|
repository = "https://git.onders.org/finga/mqrs"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
description = "A simple API for SysV IPC message queues."
|
|
||||||
homepage = "https://git.onders.org/finga/mqrs/sysvmq"
|
|
||||||
readme = "README.md"
|
|
||||||
keywords = ["message_queue", "mq", "mqueue", "queue", "sysv", "ipc"]
|
|
||||||
categories = ["os"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.98"
|
libc = "0.2.98"
|
||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
nix = "0.27.1"
|
nix = "0.21.0"
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Sysvmq
|
|
||||||
|
|
||||||
This library provides a convenient and easy usable API for SysV IPC
|
|
||||||
message queues.
|
|
||||||
|
|
||||||
```rust
|
|
||||||
use sysvmq::{SysvMq, SysvMqError};
|
|
||||||
|
|
||||||
fn example() -> Result<(), SysvMqError> {
|
|
||||||
let mut mq = SysvMq::new(0)?;
|
|
||||||
let mut buf = [0u8; 11];
|
|
||||||
|
|
||||||
mq.send(b"hello queue")?;
|
|
||||||
mq.recv(&mut buf)?;
|
|
||||||
mq.delete()?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
```
|
|
|
@ -1,355 +1,179 @@
|
||||||
#![allow(clippy::doc_markdown)]
|
|
||||||
//! This library provides a convenient API to SysV IPC message queues.
|
|
||||||
//!
|
|
||||||
//! # Example
|
|
||||||
//!
|
|
||||||
//! ```rust
|
|
||||||
//! use sysvmq::{SysvMq, SysvMqError};
|
|
||||||
//!
|
|
||||||
//! fn example() -> Result<(), SysvMqError> {
|
|
||||||
//! let mut mq = SysvMq::new(0)?;
|
|
||||||
//! let mut buf = [0u8; 11];
|
|
||||||
//!
|
|
||||||
//! mq.send(b"hello queue")?;
|
|
||||||
//! mq.recv(&mut buf)?;
|
|
||||||
//! mq.delete()?;
|
|
||||||
//!
|
|
||||||
//! Ok(())
|
|
||||||
//! }
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
use libc::{
|
use libc::{
|
||||||
c_void, msgctl, msgget, msgrcv, msgsnd, msqid_ds, IPC_CREAT, IPC_NOWAIT, IPC_RMID, IPC_SET,
|
msgctl, msgget, msginfo, msqid_ds, IPC_CREAT, IPC_EXCL, IPC_INFO, IPC_NOWAIT, IPC_PRIVATE,
|
||||||
|
IPC_RMID, IPC_SET, IPC_STAT, MSG_COPY, MSG_EXCEPT, MSG_INFO, MSG_NOERROR, MSG_STAT,
|
||||||
};
|
};
|
||||||
pub use libc::{IPC_INFO, IPC_STAT, MSG_INFO, MSG_STAT};
|
|
||||||
use nix::errno::{errno, Errno};
|
use nix::errno::{errno, Errno};
|
||||||
use std::{convert::TryFrom, mem::MaybeUninit, ptr};
|
use std::{marker::PhantomData, mem::MaybeUninit, ptr};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
/// An enum containing all errors
|
|
||||||
pub enum SysvMqError {
|
pub enum SysvMqError {
|
||||||
#[error("SysV message queue: {0}")]
|
#[error("SysV message queue: {0}")]
|
||||||
ErrnoError(&'static str),
|
ErrnoError(&'static str),
|
||||||
#[error("Cannot convert integer")]
|
|
||||||
From(#[from] std::num::TryFromIntError),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Low level function to create a new SysV IPC message queue.
|
/// IPC bit flags
|
||||||
///
|
#[repr(i32)]
|
||||||
/// # Example
|
pub enum Flags {
|
||||||
///
|
/// Create key if key does not exist.
|
||||||
/// ```rust
|
CreateKey = IPC_CREAT,
|
||||||
/// # use sysvmq::delete;
|
/// Fail if key exists.
|
||||||
/// use sysvmq::{create, SysvMqError};
|
Exclusive = IPC_EXCL,
|
||||||
///
|
/// Return error on wait.
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
NoWait = IPC_NOWAIT,
|
||||||
/// let mq_id = create(0, 0o644)?;
|
/// No error if message is too big.
|
||||||
/// println!("new queue: {mq_id}");
|
NoError = MSG_NOERROR,
|
||||||
/// # delete(mq_id)?;
|
/// Receive any message except of specified type.
|
||||||
///
|
Except = MSG_EXCEPT,
|
||||||
/// Ok(())
|
/// Copy (not remove) all queue messages.
|
||||||
/// }
|
Copy = MSG_COPY,
|
||||||
/// ```
|
/// Private key (Special key value).
|
||||||
///
|
Private = IPC_PRIVATE,
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the queue cannot be created.
|
|
||||||
pub fn create(key: i32, mode: i32) -> Result<i32, SysvMqError> {
|
|
||||||
let mq = unsafe { msgget(key, IPC_CREAT | mode) };
|
|
||||||
|
|
||||||
match mq {
|
|
||||||
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
|
||||||
id => Ok(id),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Low level function to send a message to a SysV IPC message queue.
|
/// Commands for `msgctl()`
|
||||||
///
|
#[repr(i32)]
|
||||||
/// # Example
|
pub enum ControlCommands {
|
||||||
///
|
/// Remove identifier (Control command for `msgctl`, `semctl`, and `shmctl`).
|
||||||
/// ```rust
|
Remove = IPC_RMID,
|
||||||
/// # use sysvmq::{delete};
|
/// Set `ipc_perm` options (Control command for `msgctl`, `semctl`, and `shmctl`).
|
||||||
/// use sysvmq::{create, send, SysvMqError};
|
SetPerm = IPC_SET,
|
||||||
///
|
/// Get `ipc_perm` options (Control command for `msgctl`, `semctl`, and `shmctl`).
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
GetPerm = IPC_STAT,
|
||||||
/// let mq_id = create(0, 0o644)?;
|
/// See ipcs (Control command for `msgctl`, `semctl`, and `shmctl`).
|
||||||
/// let msg = b"hello queue";
|
IpcInfo = IPC_INFO,
|
||||||
/// send(mq_id, msg, 0)?;
|
/// IPCS control command.
|
||||||
/// # delete(mq_id)?;
|
Stat = MSG_STAT,
|
||||||
///
|
/// IPCS control command.
|
||||||
/// Ok(())
|
MsgInfo = MSG_INFO,
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the message cannot be sent to the queue.
|
|
||||||
pub fn send(id: i32, msg: &[u8], mask: i32) -> Result<(), SysvMqError> {
|
|
||||||
match unsafe { msgsnd(id, msg.as_ptr().cast::<c_void>(), msg.len(), mask) } {
|
|
||||||
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
|
||||||
_ => Ok(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Low level function to receive a message from a SysV IPC message
|
pub fn unlink_id(id: i32) -> Result<(), SysvMqError> {
|
||||||
/// queue.
|
let res = unsafe {
|
||||||
///
|
msgctl(
|
||||||
/// # Example
|
id,
|
||||||
///
|
ControlCommands::Remove as i32,
|
||||||
/// ```rust
|
ptr::null::<msqid_ds>() as *mut msqid_ds,
|
||||||
/// # use sysvmq::{delete, send};
|
)
|
||||||
/// use sysvmq::{create, recv, SysvMqError};
|
|
||||||
///
|
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
|
||||||
/// let mq_mask = 0o644;
|
|
||||||
/// let mq_id = create(0, mq_mask)?;
|
|
||||||
/// let mut buf = [0u8; 32];
|
|
||||||
/// # let msg = b"hello queue";
|
|
||||||
/// # send(mq_id, msg, 0)?;
|
|
||||||
/// recv(mq_id, &mut buf, mq_mask)?;
|
|
||||||
/// println!("received message: {:?}", buf);
|
|
||||||
/// # delete(mq_id)?;
|
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the message cannot be received from the
|
|
||||||
/// queue.
|
|
||||||
pub fn recv(id: i32, msg: &mut [u8], mask: i32) -> Result<(), SysvMqError> {
|
|
||||||
match unsafe { msgrcv(id, msg.as_mut_ptr().cast::<c_void>(), msg.len(), 0, mask) } {
|
|
||||||
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
|
||||||
_ => Ok(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Low level function to get parameters of a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Example
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// # use sysvmq::{delete};
|
|
||||||
/// use sysvmq::{create, get, IPC_STAT, SysvMqError};
|
|
||||||
///
|
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
|
||||||
/// let mq_id = create(0, 0o644)?;
|
|
||||||
/// let mq_stat = get(mq_id, IPC_STAT)?;
|
|
||||||
/// println!("received message: {:?}", mq_stat);
|
|
||||||
/// # delete(mq_id)?;
|
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the parameters cannot be gathered.
|
|
||||||
pub fn get(id: i32, cmd: i32) -> Result<msqid_ds, SysvMqError> {
|
|
||||||
let mut ipc_info = MaybeUninit::<msqid_ds>::uninit();
|
|
||||||
let ret;
|
|
||||||
|
|
||||||
let ipc_info = unsafe {
|
|
||||||
ret = msgctl(id, cmd, ipc_info.as_mut_ptr());
|
|
||||||
ipc_info.assume_init()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
match ret {
|
|
||||||
0 => Ok(ipc_info),
|
|
||||||
_ => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Low level function to set parameters of a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Example
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// # use sysvmq::{delete};
|
|
||||||
/// use sysvmq::{create, get, IPC_STAT, set, SysvMqError};
|
|
||||||
///
|
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
|
||||||
/// let mq_id = create(0, 0o644)?;
|
|
||||||
/// let mut mq_stat = get(mq_id, IPC_STAT)?;
|
|
||||||
/// mq_stat.msg_perm.mode = 0o666;
|
|
||||||
/// set(mq_id, &mut mq_stat)?;
|
|
||||||
/// # delete(mq_id)?;
|
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the parameters cannot be set.
|
|
||||||
pub fn set(id: i32, data: &mut msqid_ds) -> Result<(), SysvMqError> {
|
|
||||||
match unsafe { msgctl(id, IPC_SET, data) } {
|
|
||||||
0 => Ok(()),
|
|
||||||
_ => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Low level function to delete a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Example
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// use sysvmq::{create, delete, SysvMqError};
|
|
||||||
///
|
|
||||||
/// fn main() -> Result<(), SysvMqError> {
|
|
||||||
/// let mq_id = create(0, 0o644)?;
|
|
||||||
/// delete(mq_id)?;
|
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when no queue with the given key can be
|
|
||||||
/// found.
|
|
||||||
pub fn delete(id: i32) -> Result<(), SysvMqError> {
|
|
||||||
let res = unsafe { msgctl(id, IPC_RMID, ptr::null::<msqid_ds>().cast_mut()) };
|
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
||||||
_ => Ok(()),
|
_ => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
pub fn id_from_key(key: i32) -> Result<i32, SysvMqError> {
|
||||||
/// Struct representation of a Message Queue
|
let id = unsafe { msgget(key, 0) };
|
||||||
pub struct SysvMq {
|
|
||||||
pub key: i32,
|
match id {
|
||||||
|
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
||||||
|
id => Ok(id),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ipc_info(id: i32) -> Result<(), SysvMqError> {
|
||||||
|
let mut msginfo = MaybeUninit::<msginfo>::uninit();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
msgctl(
|
||||||
|
id,
|
||||||
|
ControlCommands::IpcInfo as i32,
|
||||||
|
msginfo.as_mut_ptr() as *mut msqid_ds,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let msginfo = unsafe { msginfo.assume_init() };
|
||||||
|
|
||||||
|
println!("info: {:?}", msginfo);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn stat_info(id: i32) -> Result<(), SysvMqError> {
|
||||||
|
let mut msginfo = MaybeUninit::<msqid_ds>::uninit();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
msgctl(id, ControlCommands::Stat as i32, msginfo.as_mut_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
|
let msginfo = unsafe { msginfo.assume_init() };
|
||||||
|
|
||||||
|
println!("info: {:?}", msginfo);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn msg_info(id: i32) -> Result<(), SysvMqError> {
|
||||||
|
let mut msginfo = MaybeUninit::<msginfo>::uninit();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
msgctl(
|
||||||
|
id,
|
||||||
|
ControlCommands::MsgInfo as i32,
|
||||||
|
msginfo.as_mut_ptr() as *mut msqid_ds,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let msginfo = unsafe { msginfo.assume_init() };
|
||||||
|
|
||||||
|
println!("info: {:?}", msginfo);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SysvMq<T> {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub mask: i32,
|
pub key: i32,
|
||||||
pub mode: i32,
|
message_mask: i32,
|
||||||
|
mode: i32,
|
||||||
|
types: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SysvMq {
|
impl<T> SysvMq<T> {
|
||||||
fn default() -> Self {
|
pub fn create(&mut self, key: i32) -> Result<&Self, SysvMqError> {
|
||||||
Self {
|
self.key = key;
|
||||||
key: 0,
|
self.id = unsafe { msgget(self.key, Flags::CreateKey as i32 | self.mode) };
|
||||||
id: -1,
|
|
||||||
mask: 0,
|
match self.id {
|
||||||
mode: 0o644,
|
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
||||||
}
|
_ => Ok(self),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SysvMq {
|
pub fn open(mut self, key: i32) -> Result<Self, SysvMqError> {
|
||||||
/// Create a new message SysV IPC message queue with the given
|
self.key = key;
|
||||||
/// key.
|
self.id = unsafe { msgget(self.key, self.mode) };
|
||||||
///
|
|
||||||
/// # Errors
|
match self.id {
|
||||||
///
|
-1 => Err(SysvMqError::ErrnoError(Errno::from_i32(errno()).desc())),
|
||||||
/// Return `SysvMqError` when the queue cannot be created.
|
_ => Ok(self),
|
||||||
pub fn new(key: i32) -> Result<Self, SysvMqError> {
|
}
|
||||||
let mut mq = Self::default();
|
|
||||||
mq.key = key;
|
|
||||||
mq.id = create(mq.key, mq.mode)?;
|
|
||||||
Ok(mq)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Open an existing SysV IPC message queye with the given key.
|
pub fn mode(&mut self, mode: i32) -> &Self {
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the queue cannot be opened.
|
|
||||||
pub fn open(key: i32, id: i32) -> Result<Self, SysvMqError> {
|
|
||||||
let mut mq = Self::default();
|
|
||||||
mq.key = key;
|
|
||||||
mq.id = id;
|
|
||||||
mq.mode = i32::from(get(mq.id, IPC_STAT)?.msg_perm.mode);
|
|
||||||
Ok(mq)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the mode of a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the mode of the queue cannot be set.
|
|
||||||
pub fn mode(&mut self, mode: i32) -> Result<(), SysvMqError> {
|
|
||||||
self.mode = mode;
|
self.mode = mode;
|
||||||
let mut stats = get(self.id, IPC_STAT)?;
|
self
|
||||||
stats.msg_perm.mode = u16::try_from(self.mode)?;
|
|
||||||
set(self.id, &mut stats)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the mask of a SysV IPC message queue to nonblocking
|
pub fn nonblocking(&mut self) -> &Self {
|
||||||
/// (`IPC_NOWAIT`).
|
self.message_mask |= Flags::NoWait as i32;
|
||||||
pub fn nonblocking(&mut self) {
|
self
|
||||||
self.mask |= IPC_NOWAIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send a message to a SysV IPC message queue.
|
pub fn new() -> Self {
|
||||||
///
|
SysvMq {
|
||||||
/// # Errors
|
id: -1,
|
||||||
///
|
key: 0,
|
||||||
/// Return `SysvMqError` when the message cannot be sent to the queue.
|
message_mask: 0,
|
||||||
pub fn send(&mut self, msg: &[u8]) -> Result<(), SysvMqError> {
|
mode: 0o644,
|
||||||
send(self.id, msg, self.mask)
|
types: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Receive a message from a SysV IPC message queue.
|
impl<T> Default for SysvMq<T> {
|
||||||
///
|
fn default() -> Self {
|
||||||
/// # Errors
|
Self::new()
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the message cannot be received from the
|
|
||||||
/// queue.
|
|
||||||
pub fn recv(&mut self, msg: &mut [u8]) -> Result<(), SysvMqError> {
|
|
||||||
recv(self.id, msg, self.mask)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Receive stats from a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the stats cannot be gathered from
|
|
||||||
/// the queue.
|
|
||||||
pub fn stat(&self) -> Result<msqid_ds, SysvMqError> {
|
|
||||||
get(self.id, IPC_STAT)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Receive info from a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the info cannot be gathered from the
|
|
||||||
/// queue.
|
|
||||||
pub fn info(&self) -> Result<msqid_ds, SysvMqError> {
|
|
||||||
get(self.id, IPC_INFO)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Receive message stats from a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the message stats cannot be gathered
|
|
||||||
/// from the queue.
|
|
||||||
pub fn msg_stat(&self) -> Result<msqid_ds, SysvMqError> {
|
|
||||||
get(self.id, MSG_STAT)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Receive message info from a SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return `SysvMqError` when the message info cannot be gathered
|
|
||||||
/// from the queue.
|
|
||||||
pub fn msg_info(&self) -> Result<msqid_ds, SysvMqError> {
|
|
||||||
get(self.id, MSG_INFO)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Delete an existing SysV IPC message queue.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// Return an `SysvMqError` when no queue with the given key can be
|
|
||||||
/// found.
|
|
||||||
pub fn delete(&mut self) -> Result<(), SysvMqError> {
|
|
||||||
delete(self.id)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
use sysvmq::SysvMq;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn new_send_recv_delete() {
|
|
||||||
let mut mq = SysvMq::new(0).expect("could not create SysV message queue with key 0");
|
|
||||||
let msg = b"this is a test";
|
|
||||||
let mut buf = [0u8; 14];
|
|
||||||
mq.send(msg)
|
|
||||||
.expect("could not send message to SysV message queue");
|
|
||||||
mq.recv(&mut buf)
|
|
||||||
.expect("could not receive message from SysV message queue");
|
|
||||||
mq.delete().expect("could not destroy SysV message queue");
|
|
||||||
assert_eq!(msg, &buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn separate_send_recv_clone() {
|
|
||||||
let mut sender = SysvMq::new(0).expect("could not create SysV message queue with key 0");
|
|
||||||
let mut receiver = sender.clone();
|
|
||||||
let msg = b"this is another test";
|
|
||||||
let mut buf = [0u8; 20];
|
|
||||||
sender
|
|
||||||
.send(msg)
|
|
||||||
.expect("could not send message to SysV message queue");
|
|
||||||
receiver
|
|
||||||
.recv(&mut buf)
|
|
||||||
.expect("could not receive message from SysV message queue");
|
|
||||||
sender
|
|
||||||
.delete()
|
|
||||||
.expect("could not destroy SysV message queue");
|
|
||||||
assert_eq!(msg, &buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn separate_send_recv_open() {
|
|
||||||
let mut sender = SysvMq::new(0).expect("could not create SysV message queue with key 0");
|
|
||||||
let mut receiver = SysvMq::open(sender.key, sender.id)
|
|
||||||
.expect("could not create second handle to SysV message queue");
|
|
||||||
let msg = b"this is another test";
|
|
||||||
let mut buf = [0u8; 20];
|
|
||||||
sender
|
|
||||||
.send(msg)
|
|
||||||
.expect("could not send message to SysV message queue");
|
|
||||||
receiver
|
|
||||||
.recv(&mut buf)
|
|
||||||
.expect("could not receive message from SysV message queue");
|
|
||||||
sender
|
|
||||||
.delete()
|
|
||||||
.expect("could not destroy SysV message queue");
|
|
||||||
assert_eq!(msg, &buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn change_mode() {
|
|
||||||
let mut mq = SysvMq::new(0).expect("could not create SysV message queue with key 0");
|
|
||||||
let init_stats = mq
|
|
||||||
.stat()
|
|
||||||
.expect("could not get stats from SysV message queue");
|
|
||||||
mq.mode(0o666)
|
|
||||||
.expect("could not set mode of SysV message queue");
|
|
||||||
let new_stats = mq
|
|
||||||
.stat()
|
|
||||||
.expect("could not get stats from SysV message queue");
|
|
||||||
mq.delete().expect("could not destroy SysV message queue");
|
|
||||||
|
|
||||||
assert_eq!(0o644, init_stats.msg_perm.mode);
|
|
||||||
assert_eq!(0o666, new_stats.msg_perm.mode);
|
|
||||||
}
|
|
Loading…
Reference in a new issue