Skip to main content

Module exit

Module exit 

Source
Expand description

Why a daemon process stopped, recorded beside its socket.

A control daemon or guardian that disappears without a trace forces a post-mortem from process lists alone. Every planned exit path (the winx.shutdown RPC, a termination signal, a listener failure) records a small JSON file next to the socket and logs the reason once, so doctor and the control daemon’s reaper can tell a planned restart from a crash. A hard kill still leaves no record, which is itself the signal: a stale socket with no exit record means the process did not get to say goodbye.

Structs§

ExitRecord
What a daemon wrote when it last exited on purpose.

Enums§

ExitReason
Why the process is exiting.

Functions§

install
Remember who this process is and arm the signal handlers that turn a termination signal into a recorded exit. Later calls are ignored: one process binds one socket.
leave
Record reason for this process and exit with status 0. Callers use it only after the in-flight response has been written.
read_record
Read the exit record beside socket, if the daemon left one.
record_current
Record reason for this process without exiting (listener failures that propagate an error to main).
record_path
Path of the exit record kept beside socket.
take_record
Remove the exit record beside socket, returning what it said.
write_record
Write the exit record for socket atomically (temp file plus rename).