Skip to content

Commit

Permalink
needs-restarting: Get process start time by /proc/pid mtime
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode committed Jun 5, 2024
1 parent a054dcb commit 5f2442d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions plugins/needs_restarting.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,7 @@ def get_sc_clk_tck():
return os.sysconf(os.sysconf_names['SC_CLK_TCK'])

def __call__(self, pid):
stat_fn = '/proc/%d/stat' % pid
with open(stat_fn) as stat_file:
stats = stat_file.read().strip().split()
ticks_after_boot = int(stats[21])
secs_after_boot = ticks_after_boot // self.sc_clk_tck
return self.boot_time + secs_after_boot
return int(os.stat(f"/proc/{pid}").st_mtime)


@dnf.plugin.register_command
Expand Down

0 comments on commit 5f2442d

Please sign in to comment.