pidfile
Module: pidfile
Section titled “Module: pidfile”Contents
Section titled “Contents”Functions
mtime- Return pidfile modification time if the file exists.read- Read a pid file.remove- Remove a pid file if present.write- Write a pid file, publishing it by rename.
firma_runtime_state::pidfile::mtime
Section titled “firma_runtime_state::pidfile::mtime”Function
Return pidfile modification time if the file exists.
Errors
Section titled “Errors”Returns filesystem metadata errors other than not-found.
fn mtime(path: &std::path::Path) -> crate::error::Result<Option<std::time::SystemTime>>firma_runtime_state::pidfile::read
Section titled “firma_runtime_state::pidfile::read”Function
Read a pid file.
Errors
Section titled “Errors”Returns filesystem errors other than not-found, or an error unless the file contains one canonical non-zero decimal process ID followed by one newline.
fn read(path: &std::path::Path) -> crate::error::Result<Option<crate::process_id::UserProcessId>>firma_runtime_state::pidfile::remove
Section titled “firma_runtime_state::pidfile::remove”Function
Remove a pid file if present.
Errors
Section titled “Errors”Returns filesystem errors other than not-found.
fn remove(path: &std::path::Path) -> crate::error::Result<()>firma_runtime_state::pidfile::write
Section titled “firma_runtime_state::pidfile::write”Function
Write a pid file, publishing it by rename.
The pid is written to a flushed temporary file in the same directory and
then renamed over path. On Unix the rename is atomic and the parent
directory is flushed afterwards, so a concurrent reader observes either the
previous file or the complete new one, and the replacement survives a crash.
On Windows the rename goes through MoveFileEx with replace semantics, which
still avoids a truncate/append window but is not guaranteed to be atomic
against a reader holding the destination open.
Errors
Section titled “Errors”Returns filesystem errors.
fn write(path: &std::path::Path, pid: crate::process_id::UserProcessId) -> crate::error::Result<()>