2011-09-12 17:50:38 +02:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
|
|
index 6177975..d54f0ad 100644
|
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
|
|
|
@@ -26,12 +26,12 @@ AC_SUBST([SELINUX_LIB])
|
|
|
|
|
|
|
|
dnl Call fork before all stat calls to stop hanging on NFS mounts
|
|
|
|
AC_SUBST([WITH_TIMEOUT_STAT])
|
|
|
|
-AC_ARG_ENABLE([TIMEOUT_STAT],
|
|
|
|
+AC_ARG_ENABLE([timeout_stat],
|
|
|
|
[AS_HELP_STRING([--enable-timeout-stat], [Use a timeout on stat calls])],
|
|
|
|
[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])
|
|
|
|
+ AC_DEFINE([WITH_TIMEOUT_STAT], [1], [Use timeout on stat calls])
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl ipv4 only option
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
|
index 4398631..bbe9170 100644
|
|
|
|
--- a/src/Makefile.am
|
|
|
|
+++ b/src/Makefile.am
|
|
|
|
@@ -23,7 +23,7 @@ if WANT_PEEKFD_MIPS
|
|
|
|
AM_CFLAGS += -DMIPS
|
|
|
|
endif
|
|
|
|
|
|
|
|
-fuser_SOURCES = fuser.c comm.h signals.c signals.h i18n.h fuser.h lists.h
|
|
|
|
+fuser_SOURCES = fuser.c comm.h signals.c signals.h timeout.c i18n.h fuser.h lists.h timeout.h
|
|
|
|
|
|
|
|
fuser_LDADD = @LIBINTL@
|
|
|
|
|
|
|
|
diff --git a/src/fuser.c b/src/fuser.c
|
|
|
|
index 476fdf1..374a17d 100644
|
|
|
|
--- a/src/fuser.c
|
|
|
|
+++ b/src/fuser.c
|
|
|
|
@@ -111,9 +111,8 @@ 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
|
|
|
|
-static int timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds);
|
|
|
|
+#include "timeout.h"
|
|
|
|
#else
|
|
|
|
#define timeout(func,path,buf,dummy) (func)((path),(buf))
|
|
|
|
#endif /* WITH_TIMEOUT_STAT */
|
|
|
|
@@ -1779,70 +1778,6 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
-/*
|
|
|
|
- * Execute stat(2) system call with timeout to avoid deadlock
|
|
|
|
- * on network based file systems.
|
|
|
|
- */
|
|
|
|
-static sigjmp_buf jenv;
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
-sigalarm(int sig)
|
|
|
|
-{
|
|
|
|
- if (sig == SIGALRM)
|
|
|
|
- siglongjmp(jenv, 1);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-#ifdef HAVE_TIMEOUT_STAT
|
|
|
|
-static int
|
|
|
|
-timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds)
|
|
|
|
-{
|
|
|
|
- pid_t pid = 0;
|
|
|
|
- int ret = 0, pipes[4];
|
|
|
|
- ssize_t len;
|
|
|
|
-
|
|
|
|
- if (pipe(&pipes[0]) < 0)
|
|
|
|
- goto err;
|
|
|
|
- switch ((pid = fork ())) {
|
|
|
|
- case -1:
|
|
|
|
- close(pipes[0]);
|
|
|
|
- close(pipes[1]);
|
|
|
|
- goto err;
|
|
|
|
- case 0:
|
|
|
|
- (void) signal(SIGALRM, SIG_DFL);
|
|
|
|
- close(pipes[0]);
|
|
|
|
- if ((ret = func(path, buf)) == 0)
|
|
|
|
- do len = write(pipes[1], buf, sizeof(struct stat));
|
|
|
|
- while (len < 0 && errno == EINTR);
|
|
|
|
- close(pipes[1]);
|
|
|
|
- exit(ret);
|
|
|
|
- default:
|
|
|
|
- close(pipes[1]);
|
|
|
|
- if (sigsetjmp(jenv, 1)) {
|
|
|
|
- (void) alarm(0);
|
|
|
|
- (void) signal(SIGALRM, SIG_DFL);
|
|
|
|
- if (waitpid(0, (int*)0, WNOHANG) == 0)
|
|
|
|
- kill(pid, SIGKILL);
|
|
|
|
- errno = ETIMEDOUT;
|
|
|
|
- seconds = 1;
|
|
|
|
- goto err;
|
|
|
|
- }
|
|
|
|
- (void) signal(SIGALRM, sigalarm);
|
|
|
|
- (void) alarm(seconds);
|
|
|
|
- if (read(pipes[0], buf, sizeof(struct stat)) == 0) {
|
|
|
|
- errno = EFAULT;
|
|
|
|
- ret = -1;
|
|
|
|
- }
|
|
|
|
- (void) alarm(0);
|
|
|
|
- (void) signal(SIGALRM, SIG_DFL);
|
|
|
|
- close(pipes[0]);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- return ret;
|
|
|
|
-err:
|
|
|
|
- return -1;
|
|
|
|
-}
|
|
|
|
-#endif /* HAVE_TIMEOUT_STAT */
|
|
|
|
-
|
|
|
|
#ifdef _LISTS_H
|
|
|
|
/*
|
|
|
|
* Use /proc/self/mountinfo of modern linux system to determine
|
|
|
|
diff --git a/src/timeout.c b/src/timeout.c
|
2011-10-07 16:12:00 +02:00
|
|
|
index e69de29..e79774b 100644
|
2011-09-12 17:50:38 +02:00
|
|
|
--- a/src/timeout.c
|
|
|
|
+++ b/src/timeout.c
|
2011-10-07 16:12:00 +02:00
|
|
|
@@ -0,0 +1,260 @@
|
2011-09-12 17:50:38 +02:00
|
|
|
+/*
|
|
|
|
+ * timout.c Advanced timeout handling for file system calls
|
|
|
|
+ * to avoid deadlocks on remote file shares.
|
|
|
|
+ *
|
|
|
|
+ * Version: 0.1 07-Sep-2011 Fink
|
|
|
|
+ *
|
|
|
|
+ * Copyright 2011 Werner Fink, 2011 SUSE LINUX Products GmbH, Germany.
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
|
|
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ * (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * Author: Werner Fink <werner@suse.de>, 2011
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#ifndef _GNU_SOURCE
|
2011-10-07 16:12:00 +02:00
|
|
|
+# define _GNU_SOURCE
|
2011-09-12 17:50:38 +02:00
|
|
|
+#endif
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+#ifndef USE_SOCKETPAIR
|
|
|
|
+# define USE_SOCKETPAIR 1
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef _FEATURES_H
|
|
|
|
+# error Include local config.h before any system header file
|
|
|
|
+#endif
|
2011-10-05 11:49:25 +02:00
|
|
|
+#include "config.h" /* For _FILE_OFFSET_BITS */
|
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+#include <errno.h>
|
|
|
|
+#include <pthread.h>
|
|
|
|
+#include <setjmp.h>
|
|
|
|
+#include <signal.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include <sys/time.h>
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <sys/select.h>
|
|
|
|
+#include <sys/stat.h>
|
2011-10-07 16:12:00 +02:00
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+#include <unistd.h>
|
2011-10-07 16:12:00 +02:00
|
|
|
+#if USE_SOCKETPAIR
|
|
|
|
+# include <sys/socket.h>
|
|
|
|
+# include <netdb.h>
|
|
|
|
+# include <netinet/in.h>
|
|
|
|
+# ifndef SHUT_RD
|
|
|
|
+# define SHUT_RD 0
|
|
|
|
+# endif
|
|
|
|
+# ifndef SHUT_WR
|
|
|
|
+# define SHUT_WR 1
|
|
|
|
+# endif
|
|
|
|
+# undef pipe
|
|
|
|
+# define pipe(v) (((socketpair(AF_UNIX,SOCK_STREAM,0,v) < 0) || \
|
|
|
|
+ (shutdown((v)[1],SHUT_RD) < 0) || (shutdown((v)[0],SHUT_WR) < 0)) ? -1 : 0)
|
|
|
|
+#endif
|
2011-09-12 17:50:38 +02:00
|
|
|
+#include <wait.h>
|
|
|
|
+
|
|
|
|
+#include "timeout.h"
|
|
|
|
+
|
|
|
|
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
|
|
|
+# ifndef destructor
|
|
|
|
+# define destructor __destructor__
|
|
|
|
+# endif
|
|
|
|
+# ifndef constructor
|
|
|
|
+# define constructor __constructor__
|
|
|
|
+# endif
|
2011-10-05 11:49:25 +02:00
|
|
|
+# ifndef packed
|
|
|
|
+# define packed __packed__
|
|
|
|
+# endif
|
2011-09-12 17:50:38 +02:00
|
|
|
+# ifndef inline
|
|
|
|
+# define inline __inline__
|
|
|
|
+# endif
|
|
|
|
+# ifndef unused
|
|
|
|
+# define unused __unused__
|
|
|
|
+# endif
|
|
|
|
+# ifndef volatile
|
|
|
|
+# define volatile __volatile__
|
|
|
|
+# endif
|
|
|
|
+#endif
|
|
|
|
+#ifndef attribute
|
|
|
|
+# define attribute(attr) __attribute__(attr)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * The structure used for communication between the processes
|
|
|
|
+ */
|
|
|
|
+typedef struct _handle {
|
|
|
|
+ int errcode;
|
|
|
|
+ struct stat argument;
|
|
|
|
+ stat_t function;
|
2011-10-07 16:12:00 +02:00
|
|
|
+ size_t len;
|
|
|
|
+ char path[0];
|
2011-10-05 11:49:25 +02:00
|
|
|
+} attribute((packed)) handle_t;
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Using a forked process for doing e.g. stat(2) system call as this
|
|
|
|
+ * allows us to send e.g. SIGKILL to this process if it hangs in `D'
|
|
|
|
+ * state on a file share due a stalled NFS server. This does not work
|
|
|
|
+ * with (p)threads as SIGKILL would kill all threads including main.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static volatile pid_t active;
|
|
|
|
+static int pipes[4] = {-1, -1, -1, -1};
|
2011-10-07 16:12:00 +02:00
|
|
|
+static char buf[PATH_MAX + sizeof(handle_t) + 1];
|
|
|
|
+
|
|
|
|
+static void sigchild(int sig attribute((unused)))
|
|
|
|
+{
|
|
|
|
+ pid_t pid = waitpid(active, NULL, WNOHANG|WUNTRACED);
|
|
|
|
+ if (pid <= 0)
|
|
|
|
+ return;
|
|
|
|
+ if (errno == ECHILD)
|
|
|
|
+ return;
|
|
|
|
+ active = 0;
|
|
|
|
+}
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
|
|
|
+static void attribute((constructor)) start(void)
|
|
|
|
+{
|
|
|
|
+ sigset_t sigset, oldset;
|
2011-10-07 16:12:00 +02:00
|
|
|
+ struct sigaction act;
|
2011-09-12 17:50:38 +02:00
|
|
|
+ ssize_t in;
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ if (pipes[1] >= 0) close(pipes[1]);
|
|
|
|
+ if (pipes[2] >= 0) close(pipes[2]);
|
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ if (pipe(&pipes[0]))
|
|
|
|
+ goto error;
|
|
|
|
+ if (pipe(&pipes[2]))
|
|
|
|
+ goto error;
|
2011-10-07 16:12:00 +02:00
|
|
|
+
|
|
|
|
+ memset(&act, 0, sizeof(act));
|
|
|
|
+ sigemptyset(&act.sa_mask);
|
|
|
|
+ act.sa_flags = SA_RESTART;
|
|
|
|
+ act.sa_handler = sigchild;
|
|
|
|
+ sigaction(SIGCHLD, &act, 0);
|
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ if ((active = fork()) < 0)
|
|
|
|
+ goto error;
|
2011-10-07 16:12:00 +02:00
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ if (active) {
|
|
|
|
+ close(pipes[0]);
|
|
|
|
+ close(pipes[3]);
|
|
|
|
+ pipes[0] = pipes[3] = -1;
|
|
|
|
+ return;
|
|
|
|
+ }
|
2011-10-07 16:12:00 +02:00
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ sigemptyset(&sigset);
|
|
|
|
+ sigaddset(&sigset, SIGALRM);
|
|
|
|
+ sigprocmask(SIG_BLOCK, &sigset, &oldset);
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ act.sa_handler = SIG_DFL;
|
|
|
|
+ sigaction(SIGCHLD, &act, 0);
|
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ close(pipes[1]);
|
|
|
|
+ close(pipes[2]);
|
2011-10-07 16:12:00 +02:00
|
|
|
+ dup2(pipes[0], STDIN_FILENO);
|
|
|
|
+ dup2(pipes[3], STDOUT_FILENO);
|
2011-09-12 17:50:38 +02:00
|
|
|
+ close(pipes[0]);
|
|
|
|
+ close(pipes[3]);
|
|
|
|
+ pipes[1] = pipes[2] = -1;
|
|
|
|
+ pipes[0] = pipes[3] = -1;
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ {
|
|
|
|
+ handle_t *restrict handle = (void*)&buf[0];
|
|
|
|
+
|
|
|
|
+ while ((in = read(STDIN_FILENO, handle, sizeof(buf))) > sizeof(handle_t)) {
|
|
|
|
+ if (handle->function(handle->path, &handle->argument) < 0)
|
|
|
|
+ handle->errcode = errno;
|
|
|
|
+ write(STDOUT_FILENO, &handle->errcode, sizeof(handle->errcode)+sizeof(handle->argument));
|
|
|
|
+ }
|
2011-09-12 17:50:38 +02:00
|
|
|
+ }
|
|
|
|
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
|
|
|
|
+ exit(0);
|
|
|
|
+error:
|
|
|
|
+ if (pipes[0] >= 0) close(pipes[0]);
|
|
|
|
+ if (pipes[1] >= 0) close(pipes[1]);
|
|
|
|
+ if (pipes[2] >= 0) close(pipes[2]);
|
|
|
|
+ if (pipes[3] >= 0) close(pipes[3]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void /* attribute((destructor)) */ stop(void)
|
|
|
|
+{
|
2011-10-07 16:12:00 +02:00
|
|
|
+ if (active && waitpid(active, NULL, WNOHANG|WUNTRACED) == 0)
|
2011-09-12 17:50:38 +02:00
|
|
|
+ kill(active, SIGKILL);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static sigjmp_buf jenv;
|
2011-10-07 16:12:00 +02:00
|
|
|
+static void sigjump(int sig attribute((unused)))
|
2011-09-12 17:50:38 +02:00
|
|
|
+{
|
|
|
|
+ siglongjmp(jenv, 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * External routine
|
|
|
|
+ */
|
|
|
|
+int timeout(stat_t function, const char *path, struct stat *restrict argument, time_t seconds)
|
|
|
|
+{
|
2011-10-07 16:12:00 +02:00
|
|
|
+ handle_t *restrict handle = (void*)&buf[0];
|
|
|
|
+ struct sigaction alrm_act, pipe_act, new_act;
|
2011-09-12 17:50:38 +02:00
|
|
|
+ sigset_t sigset, oldset;
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ if (active <= 0) /* Oops, last one failed therefore clear status and restart */
|
2011-09-12 17:50:38 +02:00
|
|
|
+ start();
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ handle->len = strlen(path) + 1;
|
|
|
|
+ if (handle->len >= PATH_MAX) {
|
2011-10-05 11:49:25 +02:00
|
|
|
+ errno = ENAMETOOLONG;
|
|
|
|
+ goto error;
|
|
|
|
+ }
|
2011-10-07 16:12:00 +02:00
|
|
|
+ handle->errcode = 0;
|
|
|
|
+ handle->argument = *argument;
|
|
|
|
+ handle->function = function;
|
|
|
|
+ strcpy(handle->path, path);
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
|
|
|
+ sigemptyset(&sigset);
|
|
|
|
+ sigaddset(&sigset, SIGALRM);
|
2011-10-07 16:12:00 +02:00
|
|
|
+ sigaddset(&sigset, SIGPIPE);
|
2011-09-12 17:50:38 +02:00
|
|
|
+ sigprocmask(SIG_UNBLOCK, &sigset, &oldset);
|
|
|
|
+
|
|
|
|
+ memset(&new_act, 0, sizeof(new_act));
|
|
|
|
+ sigemptyset(&new_act.sa_mask);
|
|
|
|
+ new_act.sa_flags = SA_RESETHAND;
|
|
|
|
+
|
|
|
|
+ if (sigsetjmp(jenv, 1))
|
|
|
|
+ goto timed;
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ new_act.sa_handler = sigjump;
|
|
|
|
+ sigaction(SIGALRM, &new_act, &alrm_act);
|
|
|
|
+ sigaction(SIGPIPE, &new_act, &pipe_act);
|
2011-09-12 17:50:38 +02:00
|
|
|
+ alarm(seconds);
|
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ write(pipes[1], handle, sizeof(handle_t)+handle->len);
|
|
|
|
+ read(pipes[2], &handle->errcode, sizeof(handle->errcode)+sizeof(handle->argument));
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
|
|
|
+ alarm(0);
|
2011-10-07 16:12:00 +02:00
|
|
|
+ sigaction(SIGPIPE, &pipe_act, NULL);
|
|
|
|
+ sigaction(SIGALRM, &alrm_act, NULL);
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ if (handle->errcode) {
|
|
|
|
+ errno = handle->errcode;
|
2011-09-12 17:50:38 +02:00
|
|
|
+ goto error;
|
|
|
|
+ }
|
2011-10-05 11:49:25 +02:00
|
|
|
+
|
2011-10-07 16:12:00 +02:00
|
|
|
+ *argument = handle->argument;
|
2011-09-12 17:50:38 +02:00
|
|
|
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
|
2011-10-05 11:49:25 +02:00
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+ return 0;
|
|
|
|
+timed:
|
|
|
|
+ (void) alarm(0);
|
2011-10-07 16:12:00 +02:00
|
|
|
+ sigaction(SIGPIPE, &pipe_act, NULL);
|
|
|
|
+ sigaction(SIGALRM, &alrm_act, NULL);
|
2011-09-12 17:50:38 +02:00
|
|
|
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
|
|
|
|
+ stop();
|
|
|
|
+ errno = ETIMEDOUT;
|
|
|
|
+error:
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * End of timeout.c
|
|
|
|
+ */
|
|
|
|
diff --git a/src/timeout.h b/src/timeout.h
|
2011-10-07 16:12:00 +02:00
|
|
|
index e69de29..546c13b 100644
|
2011-09-12 17:50:38 +02:00
|
|
|
--- a/src/timeout.h
|
|
|
|
+++ b/src/timeout.h
|
2011-10-05 11:49:25 +02:00
|
|
|
@@ -0,0 +1,36 @@
|
2011-09-12 17:50:38 +02:00
|
|
|
+/*
|
|
|
|
+ * timout.h Advanced timeout handling for file system calls
|
|
|
|
+ * to avoid deadlocks on remote file shares.
|
|
|
|
+ *
|
|
|
|
+ * Version: 0.1 07-Sep-2011 Fink
|
|
|
|
+ *
|
|
|
|
+ * Copyright 2011 Werner Fink, 2011 SUSE LINUX Products GmbH, Germany.
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
|
|
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ * (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * Author: Werner Fink <werner@suse.de>, 2011
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#ifndef _TIMEOUT_H
|
|
|
|
+#define _TIMEOUT_H
|
|
|
|
+
|
2011-10-05 11:49:25 +02:00
|
|
|
+#include "config.h" /* For _FILE_OFFSET_BITS */
|
|
|
|
+
|
2011-09-12 17:50:38 +02:00
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <sys/stat.h>
|
|
|
|
+#include <time.h>
|
2011-10-05 11:49:25 +02:00
|
|
|
+#include <limits.h>
|
2011-09-12 17:50:38 +02:00
|
|
|
+
|
|
|
|
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
|
|
|
+# ifndef restrict
|
|
|
|
+# define restrict __restrict__
|
|
|
|
+# endif
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+typedef int (*stat_t)(const char *, struct stat *restrict);
|
|
|
|
+extern int timeout(stat_t, const char *, struct stat *restrict, time_t);
|
|
|
|
+
|
|
|
|
+#endif
|