]> granicus.if.org Git - psmisc/commitdiff
Use --enable-timeout-stat as well as --enable-timeout-stat=static
authorWerner Fink <werner@suse.de>
Tue, 13 Mar 2012 15:15:43 +0000 (16:15 +0100)
committerWerner Fink <werner@suse.de>
Tue, 13 Mar 2012 15:15:43 +0000 (16:15 +0100)
for a static background process which does the final stat system calls

Signed-off-by: Werner Fink <werner@suse.de>
ChangeLog
configure.ac
src/Makefile.am
src/fuser.c

index bde0f6fc14fec699bcc4972674412c5703eabf31..baba19e6526fadd324cc7394d02fd403382d07ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+       * Make it possible to use --enable-timeout-stat as well as
+         --enable-timeout-stat=static for a static background process which
+         does the final stat system calls
+       * Do not mix HAVE_TIMEOUT_STAT with WITH_TIMEOUT_STAT
        * Add timeout.c/timeout.h for static background process which is able
          to read the file name from pipe, does the stat(2) system call, and
          writes the result back to a pipe.
index 0615f5f04ebb479d5a53ca99c6c005b6d9afc414..9265d822a1e8e69825c45167f1a4b146fe711e73 100644 (file)
@@ -30,12 +30,16 @@ AC_SUBST([SELINUX_LIB])
 # Call fork before all stat calls to stop hanging on NFS mounts
 AC_SUBST([WITH_TIMEOUT_STAT])
 AC_ARG_ENABLE([timeout_stat],
-  [AS_HELP_STRING([--enable-timeout-stat], [Use a timeout on stat calls])],
+  [AS_HELP_STRING([--enable-timeout-stat], [Use a timeout on stat calls (optional with argument "static" for a static background process)])],
   [enable_timeout_stat=$enableval],
   [enable_timeout_stat="no"])
 if test "$enable_timeout_stat" = "yes"; then
   AC_DEFINE([WITH_TIMEOUT_STAT], [1], [Use timeout on stat calls])
 fi
+if test "$enable_timeout_stat" = "static"; then
+  AC_DEFINE([WITH_TIMEOUT_STAT], [2], [Use timeout on stat calls])
+fi
+AM_CONDITIONAL([WANT_TIMEOUT_STAT], [test "$enable_timeout_stat" = "static"])
 
 # Enable hardened compile and link flags
 AC_ARG_ENABLE([harden_flags],
index d511f242895681fa27e6f0af133863ac7744f584..a28af7dd4e001ddf1d1570de650bb66fe325b73a 100644 (file)
@@ -24,6 +24,9 @@ if WANT_PEEKFD_MIPS
 endif
 
 fuser_SOURCES = fuser.c comm.h signals.c signals.h i18n.h fuser.h lists.h
+if WANT_TIMEOUT_STAT
+  fuser_SOURCES += timeout.c timeout.h
+endif
 
 fuser_LDADD = @LIBINTL@
 
index e4081ebb7832f5f30c195e0f762dc1a2d64942ae..09548ffa57dae7e5158f278823ba51e385538dfd 100644 (file)
@@ -111,9 +111,13 @@ static dev_t device(const char *path);
 #endif
 static char *expandpath(const char *path);
 
-typedef int (*stat_t)(const char*, struct stat*);
 #ifdef WITH_TIMEOUT_STAT
+# if (WITH_TIMEOUT_STAT == 2)
+#  include "timeout.h"
+# else
+typedef int (*stat_t)(const char*, struct stat*);
 static int timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds);
+# endif
 #else
 #define timeout(func,path,buf,dummy) (func)((path),(buf))
 #endif /* WITH_TIMEOUT_STAT */
@@ -1783,7 +1787,7 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
  * Execute stat(2) system call with timeout to avoid deadlock
  * on network based file systems.
  */
-#ifdef HAVE_TIMEOUT_STAT
+#if defined(WITH_TIMEOUT_STAT) && (WITH_TIMEOUT_STAT == 1)
 
 static sigjmp_buf jenv;