r50/
lib.rs

1/*
2==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
3
4R50
5
6Copyright (C) 2018-2019, 2021-2025  Anonymous
7
8There are several releases over multiple years,
9they are listed as ranges, such as: "2018-2019".
10
11This program is free software: you can redistribute it and/or modify
12it under the terms of the GNU Lesser General Public License as published by
13the Free Software Foundation, either version 3 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19GNU Lesser General Public License for more details.
20
21You should have received a copy of the GNU Lesser General Public License
22along with this program.  If not, see <https://www.gnu.org/licenses/>.
23
24::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
25*/
26
27//! # R50
28//!
29//! ## Project
30//!
31//! - License: GNU Lesser General Public License, either version 3, or (at your option) any later version.
32//! - _This project follows [Semantic Versioning 2.0.0]_
33//!
34//! ## Features
35//!
36//! This project helps with resource management of process(es) running on personal Linux machines.
37//!
38//! It provides 2 programs: a server, and a client.
39//!
40//! - The server program binds to an abstract Linux socket, then listens for clients.
41//! - Each client is expected to send:
42//!
43//!     + One single command (with optional arguments).
44//!     + Its credentials: process ID, user ID, group ID.
45//!     + Its standard streams: input, output, error.
46//!     + Its current working directory and environment variables.
47//!
48//! The command will be run by server under client's credentials, with standard streams routed to client's. The new process ID will be sent
49//! back to client. So when the user uses Ctrl-C, client can *forward* it to that process ID.
50//!
51//! The idea is to group client processes under one single process: the server. This helps with resource management.
52//!
53//! ## Notes
54//!
55//! - Nightly Rust is required.
56//!
57//! - Due to technical requirements, currently only Linux is supported. Because:
58//!
59//!     + Linux supports abstract sockets.
60//!     + Linux supports sending credentials between processes, via Unix domain socket. Some BSD systems also support this feature, but
61//!       implementation details differ -- and currently this project only supports Linux's implementation.
62//!
63//!     For details, see `unix(7)`.
64//!
65//! [Semantic Versioning 2.0.0]: https://semver.org/spec/v2.0.0.html
66
67#![warn(missing_docs)]
68#![cfg(any(target_os = "linux", target_os = "l4re"))]
69
70// ╔═════════════════╗
71// ║   IDENTIFIERS   ║
72// ╚═════════════════╝
73
74macro_rules! code_name  { () => { "r50" }}
75macro_rules! version    { () => { "0.18.6" }}
76
77/// # Crate name
78pub const NAME: &str = "R50";
79
80/// # Crate code name
81pub const CODE_NAME: &str = code_name!();
82
83/// # ID of this crate
84pub const ID: &str = concat!(
85    "98178d52-766c26f2-76cdae3f-95c0bc79-6baef9dc-7e754cb8-bd3e8a6f-fa4f119d-",
86    "7e6a00f1-e4f881d0-260a988d-5bf8eb58-b4e49fc0-74cfb1fc-4f4b2671-12d89845",
87);
88
89/// # Crate version
90pub const VERSION: &str = version!();
91
92/// # Crate release date (year/month/day)
93pub const RELEASE_DATE: (u16, u8, u8) = (2025, 3, 24);
94
95/// # Tag, which can be used for logging...
96pub const TAG: &str = concat!(code_name!(), "::98178d52::", version!());
97
98// ╔════════════════════╗
99// ║   IMPLEMENTATION   ║
100// ╚════════════════════╝
101
102pub mod version_info;
103
104#[test]
105fn test_crate_version() {
106    assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
107}
108
109/// # Result type used in this crate
110pub type Result<T> = std::io::Result<T>;