Skip to content

Instantly share code, notes, and snippets.

@grahamking
grahamking / systemd_alloc.rs
Created January 10, 2024 01:55
Rust allocator backed by systemd fd store. See darkcoding.net blog post for details.
#![allow(dead_code)]
use anyhow::Context;
use std::alloc::AllocError;
use std::alloc::{Allocator, Layout};
use std::ffi::{c_char, c_uint, CStr, CString};
use std::io;
use std::mem::MaybeUninit;
use std::os::fd::AsRawFd;
use std::process;