2023-01-03 10:56:48 +01:00
|
|
|
# functions
|
|
|
|
|
|
|
|
var received_fd = @as(i32, cmsg.dataPtr().*);
|
|
|
|
|
|
|
|
std.mem.copy(u8, buffer, &msg_buffer);
|
|
|
|
|
|
|
|
@ptrCast(*std.x.os.Socket.Message, &m)
|
|
|
|
|
|
|
|
os.exit(0xff);
|
|
|
|
|
2023-01-03 12:07:55 +01:00
|
|
|
var network_envvar = std.process.getEnvVarOwned(fba, "IPC_NETWORK") catch |err| switch(err) {
|
|
|
|
// error{ OutOfMemory, EnvironmentVariableNotFound, InvalidUtf8 } (ErrorSet)
|
|
|
|
.EnvironmentVariableNotFound => { return; }, // no need to contact IPCd
|
|
|
|
else => { return err; },
|
|
|
|
};
|
|
|
|
|
2023-01-03 10:56:48 +01:00
|
|
|
# Functions done
|
|
|
|
|
|
|
|
receive_fd
|
|
|
|
send_fd
|
2023-01-03 12:07:55 +01:00
|
|
|
|
|
|
|
# Test stuff
|
|
|
|
|
|
|
|
zig test src/main.zig
|
|
|
|
|
|
|
|
# Documentation
|
|
|
|
|
|
|
|
zig build-exe -femit-docs -fno-emit-bin src/main.zig
|
|
|
|
|
|
|
|
ACCESS_LOGS ?= ./access.log
|
|
|
|
servedoc:
|
|
|
|
darkhttpd docs/ --addr 127.0.0.1 --port 35000 --log $(ACCESS_LOGS)
|
2023-01-08 12:46:56 +01:00
|
|
|
|
|
|
|
# Errors
|
|
|
|
|
|
|
|
Double returning type => no need for specific return structures.
|
2023-01-08 20:06:59 +01:00
|
|
|
|
|
|
|
# Timer
|
|
|
|
|
|
|
|
const Timer = std.time.Timer;
|
|
|
|
var timer = try Timer.start();
|
|
|
|
var duration = timer.read() / 1000000; // ns -> ms
|
2023-01-11 16:05:39 +01:00
|
|
|
|
|
|
|
var value = db.get(key) orelse return error.notHere;
|
|
|
|
|
|
|
|
# There is still room for improvement.
|
|
|
|
|
|
|
|
When the result actually is a single value (anonymous hash).
|
|
|
|
src/switch.zig:125:37: error: binary operator `|` has whitespace on one side, but not the other.
|
|
|
|
self.db.fetchSwapRemove(fd) |k,v|{
|