pub struct Image { /* private fields */ }Expand description
What a long-lived process’s image was started from (now, at its start): whether it is the binary
installed now.
Implementations§
Source§impl Image
impl Image
pub fn now() -> Image
Sourcepub fn stale(&self) -> bool
pub fn stale(&self) -> bool
The path names another file than at the start (or none), or the running binary was deleted: this image is old code.
Sourcepub fn due(&self) -> bool
pub fn due(&self) -> bool
Stale, and the path holds an executable no exec failed on: a re-exec is worth trying.
Sourcepub fn reexec(
&mut self,
lock: &File,
stopped: impl Fn() -> bool,
) -> Result<(), ReexecError>
pub fn reexec( &mut self, lock: &File, stopped: impl Fn() -> bool, ) -> Result<(), ReexecError>
For a waiter (listen.rs): replaces this process’s image by the file at its path, same pid, argv
and environment, stdout and stderr flushed, the stop signals blocked across (stopped looked at
once more after they are), lock’s open file description passed on as a duplicate without
close-on-exec (ADOPT_FD). Returns only when it did not happen: Ok when a stop came (the caller
ends as stopped), Err with why the exec failed (the path is not tried again until it changes).
§Errors
The dup or the exec failed (ReexecError).
Sourcepub fn restart(&mut self) -> Result<(), String>
pub fn restart(&mut self) -> Result<(), String>
For the mesh daemon, once it stopped serving: replaces its image by the file at its path, stdout
and stderr flushed, same pid, argv and environment, with SIGINT, SIGHUP and SIGTERM blocked
across; a stop trap_stops saw first returns Ok (the caller ends as stopped), one that comes
later stays pending for the new image (trap_stops there). Only a
file whose probe says it unblocks them there (takes_restart) is exec’d. On Linux it first
waits up to ALONE_WAIT for its other threads to end, so none can take a stop meanwhile (the
daemon’s are gone once its runtime shut down). Err with what the engineer does now.