[vim/vim] Check uptime to override process_still_running (#7947)

10 views
Skip to first unread message

Hugo van der Sanden

unread,
Mar 10, 2021, 11:12:38 AM3/10/21
to vim/vim, Subscribed

The (D)elete option has this in the docs: "On Unix this choice is only offered when the process that created the swap file does not appear to be running." This only checks for the existence of the PID though, and in some circumstances can have a high chance of false positives (eg after a reboot).

I believe that at least on most Linux and *BSD systems it would be cheap and safe to check whether the modification time of the swap file is earlier than the last reboot, and override process_still_running to 0 in that case - it looks like it has been available via sysinfo(2) for at least 15 years (linux kernels >= 2.6, maybe more).

uptime checks for most other Unix systems appear to rely on utmp/wtmp records, or hacks to check elapsed running time of init(1), which may not be either as cheap or as safe.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Mar 10, 2021, 2:30:29 PM3/10/21
to vim/vim, Subscribed

I like the idea. We can use a configure check for sysinfo.uptime.

Bram Moolenaar

unread,
Mar 10, 2021, 3:27:20 PM3/10/21
to vim/vim, Subscribed

Closed #7947 via f52f060.

Reply all
Reply to author
Forward
0 new messages