needs-restarting: Get process start time by /proc/pid mtime #536
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous method of getting a process's start time was to add the boot time detected by
ProcessStart.get_boot_time
to the process'sstarttime
:man 5 proc
But the starttime is relative to the kernel start time, which does not always match the result of
ProcessStart.get_boot_time
.A simple solution might be to use the
mtime
of/proc/pid
instead. Themtime
is set to the current wall clock time when the process is started, so it should be correct for every process except PID 1, where the correct time may not yet be known.For https://issues.redhat.com/browse/RHEL-39775.