Skip to main content

Image

Struct Image 

Source
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

Source

pub fn now() -> Image

Source

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.

Source

pub fn due(&self) -> bool

Stale, and the path holds an executable no exec failed on: a re-exec is worth trying.

Source

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).

Source

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.

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnsafeUnpin for Image

§

impl UnwindSafe for Image

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.