comparison src/memline.c @ 25155:a37cf57980f9 v8.2.3114

patch 8.2.3114: Amiga-like systems: build error using stat() Commit: https://github.com/vim/vim/commit/599a6e5b3629d943a795cd69e4d3d19886f86405 Author: =?UTF-8?q?Ola=20S=C3=B6der?= <rolfkopman@gmail.com> Date: Tue Jul 6 20:15:46 2021 +0200 patch 8.2.3114: Amiga-like systems: build error using stat() Problem: Amiga-like systems: build error using stat(). Solution: Only build swapfile_process_running() on systems where it is actually used. (Ola S?der, closes #8519)
author Bram Moolenaar <Bram@vim.org>
date Tue, 06 Jul 2021 20:30:03 +0200
parents 7ef7a211f6bf
children 1919361a53da
comparison
equal deleted inserted replaced
25154:99d63a6a2e20 25155:a37cf57980f9
1102 1102
1103 #if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO_UPTIME) 1103 #if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO_UPTIME)
1104 # include <sys/sysinfo.h> 1104 # include <sys/sysinfo.h>
1105 #endif 1105 #endif
1106 1106
1107 #if defined(UNIX) || defined(MSWIN)
1107 /* 1108 /*
1108 * Return TRUE if the process with number "b0p->b0_pid" is still running. 1109 * Return TRUE if the process with number "b0p->b0_pid" is still running.
1109 * "swap_fname" is the name of the swap file, if it's from before a reboot then 1110 * "swap_fname" is the name of the swap file, if it's from before a reboot then
1110 * the result is FALSE; 1111 * the result is FALSE;
1111 */ 1112 */
1112 static int 1113 static int
1113 swapfile_process_running(ZERO_BL *b0p, char_u *swap_fname UNUSED) 1114 swapfile_process_running(ZERO_BL *b0p, char_u *swap_fname UNUSED)
1114 { 1115 {
1115 #ifdef HAVE_SYSINFO_UPTIME 1116 # ifdef HAVE_SYSINFO_UPTIME
1116 stat_T st; 1117 stat_T st;
1117 struct sysinfo sinfo; 1118 struct sysinfo sinfo;
1118 1119
1119 // If the system rebooted after when the swap file was written then the 1120 // If the system rebooted after when the swap file was written then the
1120 // process can't be running now. 1121 // process can't be running now.
1121 if (mch_stat((char *)swap_fname, &st) != -1 1122 if (mch_stat((char *)swap_fname, &st) != -1
1122 && sysinfo(&sinfo) == 0 1123 && sysinfo(&sinfo) == 0
1123 && st.st_mtime < time(NULL) - ( 1124 && st.st_mtime < time(NULL) - (
1124 # ifdef FEAT_EVAL 1125 # ifdef FEAT_EVAL
1125 override_sysinfo_uptime >= 0 ? override_sysinfo_uptime : 1126 override_sysinfo_uptime >= 0 ? override_sysinfo_uptime :
1126 # endif 1127 # endif
1127 sinfo.uptime)) 1128 sinfo.uptime))
1128 return FALSE; 1129 return FALSE;
1129 #endif 1130 # endif
1130 return mch_process_running(char_to_long(b0p->b0_pid)); 1131 return mch_process_running(char_to_long(b0p->b0_pid));
1131 } 1132 }
1133 #endif
1132 1134
1133 /* 1135 /*
1134 * Try to recover curbuf from the .swp file. 1136 * Try to recover curbuf from the .swp file.
1135 * If "checkext" is TRUE, check the extension and detect whether it is 1137 * If "checkext" is TRUE, check the extension and detect whether it is
1136 * a swap file. 1138 * a swap file.