dmn.c
dmn.c - IPC Daemon Manager
dmn.c provides a small C library and CLI for daemonizing named application processes behind local IPC endpoints. Applications can register a command under a name, keep it resident, relay stdin/stdout through it, list active registrations, and remove them.
On POSIX, dmn.c uses Unix Domain Sockets. On Windows, it uses Named Pipes. The CLI keeps the direct named-runtime workflow and is implemented on top of libdmn.
CLI
Examples
Start or update a daemon:
dmn mydaemon /bin/cat
Relay stdin to a daemon:
printf 'hello\n' | dmn mydaemon
Resident backends keep their process state across relays. A backend may emit EOT (ASCII 4) to mark the end of one response while staying alive for the next request.
List all daemons:
dmn --list
dmn mydaemon --list
Remove a daemon:
dmn --delete mydaemon
dmn mydaemon --delete
Parameters
| Command/Flag | Description |
|---|---|
<name> <cmd> | Start or update a resident daemon command. Replaces any existing one. |
<name> -d, <name> --delete | Remove a daemon if it exists. |
<name> -l, <name> --list | List one daemon if it exists. |
-l, --list | List all daemons as name<TAB>socket. |
<name> | Relay standard input to a daemon. |
-h, --help | Show help and usage. |
-v, --version | Show version. |
Public API
#include "dmn.h"
kc_dmn_t *ctx = kc_dmn_open();
kc_dmn_update(ctx, "app", "/bin/cat");
kc_dmn_list(ctx, "app");
kc_dmn_delete(ctx, "app");
kc_dmn_close(ctx);
Lifecycle
kc_dmn_open()- resolves runtime state and returns a context owned by the caller.kc_dmn_update()- starts or replaces a named resident daemon command.kc_dmn_relay()- relays stdin/stdout through a named daemon.kc_dmn_list()- lists all daemon registrations or one named registration.kc_dmn_delete()- removes a named daemon registration and terminates its process.kc_dmn_path()- returns the resolved runtime directory for diagnostics.kc_dmn_close()- releases the context.
Build
Compiled artifacts are generated under bin/{arch}/{platform}/ for the host architecture running the build.
make clean && make
Multiarch Builds
The project is prepared to build artifacts for multiple architectures under bin/{arch}/{platform}/. A plain make builds only the current host architecture, while the targets below build the full matrix or a specific target.
make all
make x86_64/linux
make x86_64/windows
make i686/linux
make i686/windows
make aarch64/linux
make aarch64/android
make armv7/linux
make armv7/android
make armv7hf/linux
make riscv64/linux
make powerpc64le/linux
make mips/linux
make mipsel/linux
make mips64el/linux
make s390x/linux
make loongarch64/linux
License
This project is distributed under the GNU General Public License version 3 (GPLv3).
Repo
GitHub: kaisarcode/dmn.c
