compat.libsystemd
#includePublic systemd client library for Linux
#include <systemd/sd-daemon.h>
mcpp add compat.libsystemd@262.2
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
#ifdef __linux__
#include <dlfcn.h>
#include <systemd/sd-daemon.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <string_view>
int main() {
namespace fs = std::filesystem;
const auto deployed = fs::read_symlink("/proc/self/exe").parent_path() / "lib/libsystemd.so.0";
Dl_info library{};
std::error_code error;
if (dladdr(dlsym(RTLD_DEFAULT, "sd_notify"), &library) == 0 ||
!fs::equivalent(library.dli_fname, deployed, error)) {
// …
tests/examples/libsystemd/tests/notify.cpp · 项目 tests/examples/libsystemd
构建
- targets
systemd_binding (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
include
源文件 (1)
mcpp_generated/libsystemd_anchor.c
生成的文件
mcpp_generated/libsystemd_anchor.c
版本
| 版本 | 平台 | 镜像 | sha256 |
|---|---|---|---|
262.2 最新 |
Linux | 源站 | 116432ee9dce… |