[[package]]
name = "autocfg"
-version = "1.0.1"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
"log",
"memchr",
"mime",
+ "nix",
"parking_lot",
"pin-project-lite",
"regex",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
+[[package]]
+name = "memoffset"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "mime"
version = "0.3.16"
"tempfile",
]
+[[package]]
+name = "nix"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
+dependencies = [
+ "autocfg",
+ "bitflags",
+ "cfg-if",
+ "libc",
+ "memoffset",
+ "pin-utils",
+]
+
[[package]]
name = "ntapi"
version = "0.3.6"
--- /dev/null
+// Copyright 2021-2022 Ian Jackson and contributors to Hippotat
+// SPDX-License-Identifier: GPL-3.0-or-later
+// There is NO WARRANTY.
+
+#![allow(unused_imports)]
+#![allow(dead_code)]
+
+use std::io::IoSlice;
+
+use extend::ext;
+
+use nix::errno::*;
+use nix::unistd::*;
+use nix::sys::uio::*;
+
+pub struct Daemoniser {
+}
+
+fn crashv(ms: &[IoSlice<'_>]) -> ! {
+ unsafe {
+ let _ = writev(2, ms);
+ libc::_exit(18);
+ }
+}
+
+macro_rules! crashv { { $( $m:expr ),* $(,)? } => { {
+ let ms = [
+ "hippotatd: ",
+ $( $m, )*
+ "\n",
+ ];
+ let ms = ms.map(|m| IoSlice::new(m.as_bytes()));
+ crashv(&ms)
+} } }
+
+fn crash(m: &str) -> ! {
+ crashv!(m)
+}
+fn crashe(m: &str, en: Errno) -> ! {
+ crashv!(m, ": ", en.desc())
+}
+
+#[ext]
+impl<T> nix::Result<T> {
+ fn context(self, m: &str) -> T {
+ match self {
+ Ok(y) => y,
+ Err(en) => crashe(m, en),
+ }
+ }
+}
+
+impl Daemoniser {
+/*
+ pub fn phase1() -> Self {
+ unsafe {
+ let (st_read, st_write) = pipe().context("pipe");
+
+ mstch fork().context("fork (1)") {
+ ForkResult::Parent { child } => {
+ let _ = close(st_write);
+ let mut buf = [0u8];
+ loop {
+ match read(st_read, &mut buf) {
+ Ok(0) => {
+
+
+ let r =
+ },
+
+ ForkResult::Child => { }
+ }
+ }
+*/
+}