StormByte-System is the C++26 process, device and host module of the StormByte suite.
Spawn children with piped stdin/stdout/stderr, classify the medium behind a path, resolve directories and the current executable, inspect the machine, name the calling thread, and expand environment strings. POSIX and Windows stay behind one API. Failures are StormByte::Error::Fault in a per-type domain (StormByte.System.*). Nothing in this module throws.
STORMBYTE_SYSTEM_SHARED (default ON) builds the shared library. OFF is a static library; Windows consumers then do not see dllimport.
| Goal | How it is achieved |
|---|---|
| One process API | Process starts on construct; pipes are private. Errors are Fault(), not exceptions. |
| Shell-like chaining | p1 >> p2 forwards stdout to stdin on a worker thread. |
| stdin control | << writes; << System::EoF closes the write end. |
| Medium behind a path | Device probes Kind, Access, Throughput and Window on demand. |
| This process on disk | Directory and File resolve cwd, home, temp and the running image. |
| This machine | Host reports name, OS, kernel, CPU, ISA, RAM and bitness. |
| This thread | ThisThread::Sleep and Name (reject, do not truncate, if too long). |
| Environment text | Variable::Expand (VAR% on Windows, ~ on UNIX). |
Process (fork/exec or CreateProcessW)Wait / timed Wait; Suspend / ResumeDevice classification (HDD, SSD, NVMe generations, USB, Network)Directory / File locations of this processHost identity and capacityThisThread sleep and nameVariable::ExpandPipe (pipe2 / CreatePipe)| Dependency | Role |
|---|---|
| StormByte-String 1.0.0 | UTF-8 / UTF-16 text across the DLL boundary (vendors Base 2.0.0) |
| Module | Role | API |
|---|---|---|
| Base | Error/Fault, visibility, Size, Bitmask, serialization, UUID, concepts | /StormByte |
| Buffer | FIFO, SharedFIFO, Ring, Producer/Consumer and multi-stage pipelines | /StormByte-Buffer |
| Config | Human-readable text and versioned binary documents | /StormByte-Config |
| Crypto | Hash, compress, encrypt, sign and key agreement | /StormByte-Crypto |
| Database | One API over SQLite, PostgreSQL and MariaDB | /StormByte-Database |
| Logger | Stream logger with levels, headers and redaction | /StormByte-Logger |
| Multimedia | Decode, encode and containers without raw FFmpeg types | /StormByte-Multimedia |
| Network | Framed packets, Client/Server, IPv4/IPv6 TCP | /StormByte-Network |
| String | Owned UTF-8 / UTF-16 text safe across a DLL boundary | /StormByte-String |
| System | This repository | /StormByte-System |
| Name | Role |
|---|---|
Process | Spawn and talk to a child. operator bool is true only while the child is live. Fault() is StormByte.System.Process. |
Device | Medium behind a path. operator bool is probe success, not permission. Fault() is StormByte.System.Device. Throughput / Window are virtual. |
Directory | Current, Home, Temporary, CurrentExecutable. bool + out String. LastError() is TLS in this module. |
File | Temporary(prefix, suffix) (caller unlinks) and CurrentExecutable. Same bool + LastError contract. |
Host | Name, Architecture, CPU, OS, Kernel, PageSize, PhysicalMemory, AvailableMemory, LogicalProcessors, Bitness. |
ThisThread | Sleep; Name get/set. Set returns false and TooLong if the platform limit is exceeded. |
Variable | Expand environment strings to StormByte::String::String. |
System::EoF | Close process stdin. |
Pipe is private. There is no StormByte/system/exception.hxx and no generic StormByte.System error domain.
On Windows use a real binary (cmd.exe, where.exe) instead of echo if it is not on PATH the way you expect.
On Windows pass C:\\. operator bool is not “can write”. A special device node is never writable. Symlinks are followed; a dangling link is BrokenSymlink.
Windows File::Temporary only uses the first three characters of the prefix (GetTempFileNameW). The suffix is appended after the generated name.
LogicalProcessors and Bitness do not update LastError. The others do. A failed Size is zero; a failed String is empty.
On Linux/macOS the pthread name limit is 15 characters. Windows SetThreadDescription does not use that limit.
A failed Windows expand returns the original text (same idea as a missing UNIX $HOME).
Process construction starts the child immediately and does not throw. operator bool is live status only.Wait sets TimedOut and leaves the child running.SIGPIPE once process-wide so a closed pipe peer reports write failure instead of killing the host.Suspend() / Resume() snapshot the child threads; a thread created during enumeration may be missed.CreateProcessW; a short inheritance window exists during creation.Device stores only the caller accessor. Kind/Access/Throughput/Window are valid only when the Device converts to true.Directory / File / Host / ThisThread LastError() is thread_local inside this module, exposed by an exported getter. Do not put thread_local in a public header.StormByte::String::String / CString.Process waits if the child is still owned. Move invalidates the source.Enable tests in CMake (ENABLE_TEST) and run CTest from the build tree. Device, Directory, File, Host and ThisThread print probe data and always return success (the machine is not a fixture). Process tests assert error codes. Use ctest -V to see stdout.
If StormByte is useful to you, you can sponsor development on GitHub Sponsors.
Issues on GitHub. No wiki, no discussions. See CONTRIBUTING.md for coding style (StormByte flavor) and copyright assignment to the owner.
Original StormByte-System sources are dual-licensed: GNU Lesser General Public License v3 or later or a commercial license from the copyright holder.
Bundled third-party trees (including Base under thirdparty/) keep their own licenses.