[packages/psmisc] - up to 22.20; pstree build fix from git

arekm arekm at pld-linux.org
Thu Nov 8 13:45:56 CET 2012


commit 2cd3a20905d6e0e5c20eb84b74dff12ef2be63cb
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 8 13:45:53 2012 +0100

    - up to 22.20; pstree build fix from git

 psmisc-fakerootpid.patch |  32 ----
 psmisc-pstree.patch      | 242 +++++++++++++++++++++++++++++
 psmisc-timeout.patch     | 396 -----------------------------------------------
 psmisc.spec              |  12 +-
 4 files changed, 247 insertions(+), 435 deletions(-)
---
diff --git a/psmisc.spec b/psmisc.spec
index f1d6725..dcd6f0c 100644
--- a/psmisc.spec
+++ b/psmisc.spec
@@ -13,17 +13,16 @@ Summary(ru.UTF-8):	Утилиты работы с процессами
 Summary(tr.UTF-8):	/proc dosya sistemi için ps tipi araçlar
 Summary(uk.UTF-8):	Утиліти роботи з процесами
 Name:		psmisc
-Version:	22.16
-Release:	4
+Version:	22.20
+Release:	1
 License:	GPL v2+
 Group:		Applications/System
 Source0:	http://downloads.sourceforge.net/psmisc/%{name}-%{version}.tar.gz
-# Source0-md5:	d52caf26159c905574c2ce4bd792b9ee
+# Source0-md5:	a25fc99a6dc7fa7ae6e4549be80b401f
 Source1:	http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
 # Source1-md5:	9add7665e440bbd6b0b4f9293ba8b86d
 Patch0:		%{name}-pl.po-update.patch
-Patch1:		%{name}-timeout.patch
-Patch2:		%{name}-fakerootpid.patch
+Patch1:		%{name}-pstree.patch
 URL:		http://psmisc.sourceforge.net/
 BuildRequires:	autoconf >= 2.68
 BuildRequires:	automake >= 1:1.10
@@ -89,9 +88,8 @@ göndermek için gerekli programları içerir.
 
 %prep
 %setup -q
-%patch0 -p1
+#%patch0 -p1
 %patch1 -p1
-%patch2 -p1
 
 %build
 %{__gettextize}
diff --git a/psmisc-fakerootpid.patch b/psmisc-fakerootpid.patch
deleted file mode 100644
index 02a8ecd..0000000
--- a/psmisc-fakerootpid.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -urN psmisc-22.16.org/src/pstree.c psmisc-22.16/src/pstree.c
---- psmisc-22.16.org/src/pstree.c	2012-02-20 00:07:14.000000000 +0100
-+++ psmisc-22.16/src/pstree.c	2012-03-21 19:37:30.000000000 +0100
-@@ -363,12 +363,27 @@
-         ppid = 0;
-     if (isthread)
-       this->flags |= PFLAG_THREAD;
--    if (!(parent = find_proc(ppid)))
-+    if (!(parent = find_proc(ppid))) {
- #ifdef WITH_SELINUX
-         parent = new_proc("?", ppid, 0, scontext);
- #else                                /*WITH_SELINUX */
-         parent = new_proc("?", ppid, 0);
- #endif                                /*WITH_SELINUX */
-+	/* When using kernel 3.3 with hidepid feature enabled on /proc
-+	 * then we need fake root pid */
-+	if (!isthread && pid != 1) {
-+		PROC *root;
-+		if (!(root = find_proc(1))) {
-+#ifdef WITH_SELINUX
-+			root = new_proc("?", 1, 0, scontext);
-+#else                                /*WITH_SELINUX */
-+			root = new_proc("?", 1, 0);
-+#endif
-+		}
-+		add_child(root, parent);
-+		parent->parent = root;
-+	}
-+    }
-     add_child(parent, this);
-     this->parent = parent;
- }
diff --git a/psmisc-pstree.patch b/psmisc-pstree.patch
new file mode 100644
index 0000000..4381cc9
--- /dev/null
+++ b/psmisc-pstree.patch
@@ -0,0 +1,242 @@
+diff --git a/src/pstree.c b/src/pstree.c
+index db57244..b9a01cf 100644
+--- a/src/pstree.c
++++ b/src/pstree.c
+@@ -47,6 +47,8 @@
+ 
+ #ifdef WITH_SELINUX
+ #include <selinux/selinux.h>
++#else
++typedef void* security_context_t; /* DUMMY to remove most ifdefs */
+ #endif                                /*WITH_SELINUX */
+ 
+ extern const char *__progname;
+@@ -81,9 +83,7 @@ typedef struct _proc {
+     pid_t pid;
+     pid_t pgid;
+     uid_t uid;
+-#ifdef WITH_SELINUX
+     security_context_t scontext;
+-#endif                                /*WITH_SELINUX */
+     char flags;
+     struct _child *children;
+     struct _proc *parent;
+@@ -131,16 +131,14 @@ static int *more = NULL;
+ 
+ static int print_args = 0, compact = 1, user_change = 0, pids = 0, pgids = 0,
+     show_parents = 0, by_pid = 0, trunc = 1, wait_end = 0;
+-#ifdef WITH_SELINUX
+ static int show_scontext = 0;
+-#endif                                /*WITH_SELINUX */
+ static int output_width = 132;
+ static int cur_x = 1;
+ static char last_char = 0;
+ static int dumped = 0;                /* used by dump_by_user */
+ static int charlen = 0;                /* length of character */
+ 
+-static void fix_orphans(void);
++static void fix_orphans(security_context_t scontext);
+ /*
+  * Allocates additional buffer space for width and more as needed.
+  * The first call will allocate the first buffer.
+@@ -229,15 +227,12 @@ static int out_int(int x)
+     return digits;
+ }
+ 
+-#ifdef WITH_SELINUX
+ static void out_scontext(security_context_t scontext)
+ {
+     out_string("`");
+     out_string(scontext);
+     out_string("'");
+ }
+-#endif                                /*WITH_SELINUX */
+-
+ 
+ static void out_newline(void)
+ {
+@@ -259,12 +254,8 @@ static PROC *find_proc(pid_t pid)
+ 	return NULL;
+ }
+ 
+-#ifdef WITH_SELINUX
+ static PROC *new_proc(const char *comm, pid_t pid, uid_t uid,
+                       security_context_t scontext)
+-#else                                /*WITH_SELINUX */
+-static PROC *new_proc(const char *comm, pid_t pid, uid_t uid)
+-#endif                                /*WITH_SELINUX */
+ {
+     PROC *new;
+ 
+@@ -279,9 +270,7 @@ static PROC *new_proc(const char *comm, pid_t pid, uid_t uid)
+     new->flags = 0;
+     new->argc = 0;
+     new->argv = NULL;
+-#ifdef WITH_SELINUX
+     new->scontext = scontext;
+-#endif                                /*WITH_SELINUX */
+     new->children = NULL;
+     new->parent = NULL;
+     new->next = list;
+@@ -364,24 +353,14 @@ rename_proc(PROC *this, const char *comm, uid_t uid)
+ 		}
+ 	}
+ }
+-#ifdef WITH_SELINUX
+ static void
+ add_proc(const char *comm, pid_t pid, pid_t ppid, pid_t pgid, uid_t uid,
+          const char *args, int size, char isthread, security_context_t scontext)
+-#else                                /*WITH_SELINUX */
+-static void
+-add_proc(const char *comm, pid_t pid, pid_t ppid, pid_t pgid, uid_t uid,
+-         const char *args, int size, char isthread)
+-#endif                                /*WITH_SELINUX */
+ {
+     PROC *this, *parent;
+ 
+     if (!(this = find_proc(pid)))
+-#ifdef WITH_SELINUX
+         this = new_proc(comm, pid, uid, scontext);
+-#else                                /*WITH_SELINUX */
+-        this = new_proc(comm, pid, uid);
+-#endif                                /*WITH_SELINUX */
+     else {
+ 	    rename_proc(this, comm, uid);
+     }
+@@ -393,11 +372,7 @@ add_proc(const char *comm, pid_t pid, pid_t ppid, pid_t pgid, uid_t uid,
+     if (isthread)
+       this->flags |= PFLAG_THREAD;
+     if (!(parent = find_proc(ppid))) {
+-#ifdef WITH_SELINUX
+         parent = new_proc("?", ppid, 0, scontext);
+-#else                                /*WITH_SELINUX */
+-        parent = new_proc("?", ppid, 0);
+-#endif
+     }
+     if (pid != 0) {
+       add_child(parent, this);
+@@ -494,12 +469,10 @@ dump_tree(PROC * current, int level, int rep, int leaf, int last,
+         else
+             (void) out_int(current->uid);
+     }
+-#ifdef WITH_SELINUX
+     if (show_scontext) {
+         out_char(info++ ? ',' : '(');
+         out_scontext(current->scontext);
+     }
+-#endif                                /*WITH_SELINUX */
+     if ((swapped && print_args && current->argc < 0) || (!swapped && info))
+         out_char(')');
+     if ((current->flags & PFLAG_HILIGHT) && (tmp = tgetstr("me", NULL)))
+@@ -520,11 +493,7 @@ dump_tree(PROC * current, int level, int rep, int leaf, int last,
+             }
+         }
+     }
+-#ifdef WITH_SELINUX
+     if (show_scontext || print_args || !current->children)
+-#else                                /*WITH_SELINUX */
+-    if (print_args || !current->children)
+-#endif                                /*WITH_SELINUX */
+     {
+         while (closing--)
+             out_char(']');
+@@ -533,11 +502,7 @@ dump_tree(PROC * current, int level, int rep, int leaf, int last,
+     ensure_buffer_capacity(level);
+     more[level] = !last;
+ 
+-#ifdef WITH_SELINUX
+     if (show_scontext || print_args)
+-#else                                /*WITH_SELINUX */
+-    if (print_args)
+-#endif                                /*WITH_SELINUX */
+     {
+         width[level] = swapped + (comm_len > 1 ? 0 : -1);
+         count=0;
+@@ -653,8 +618,8 @@ static void read_proc(void)
+   pid_t pid, ppid, pgid;
+   int fd, size;
+   int empty;
+-#ifdef WITH_SELINUX
+   security_context_t scontext = NULL;
++#ifdef WITH_SELINUX
+   int selinux_enabled = is_selinux_enabled() > 0;
+ #endif                /*WITH_SELINUX */
+ 
+@@ -726,21 +691,12 @@ static void read_proc(void)
+                 while ((dt = readdir(taskdir)) != NULL) {
+                   if ((thread = atoi(dt->d_name)) != 0) {
+                     if (thread != pid) {
+-#ifdef WITH_SELINUX
+                       if (print_args)
+                         add_proc(threadname, thread, pid, pgid, st.st_uid, 
+                             threadname, strlen (threadname) + 1, 1,scontext);
+                       else
+                         add_proc(threadname, thread, pid, pgid, st.st_uid, 
+                             NULL, 0, 1, scontext);
+-#else                /*WITH_SELINUX */
+-                      if (print_args)
+-                        add_proc(threadname, thread, pid, pgid, st.st_uid,
+-                            threadname, strlen (threadname) + 1, 1);
+-                      else
+-                        add_proc(threadname, thread, pid, pgid, st.st_uid,
+-                            NULL, 0, 1);
+-#endif                /*WITH_SELINUX */
+                       }
+                     }
+                   }
+@@ -749,11 +705,7 @@ static void read_proc(void)
+                 }
+               free(taskpath);
+               if (!print_args)
+-#ifdef WITH_SELINUX
+                 add_proc(comm, pid, ppid, pgid, st.st_uid, NULL, 0, 0, scontext);
+-#else                /*WITH_SELINUX */
+-                add_proc(comm, pid, ppid, pgid, st.st_uid, NULL, 0, 0);
+-#endif                /*WITH_SELINUX */
+               else {
+                 sprintf(path, "%s/%d/cmdline", PROC_BASE, pid);
+                 if ((fd = open(path, O_RDONLY)) < 0) {
+@@ -770,13 +722,8 @@ static void read_proc(void)
+                   size--;
+                 if (size)
+                   buffer[size++] = 0;
+-#ifdef WITH_SELINUX
+                 add_proc(comm, pid, ppid, pgid, st.st_uid,
+                      buffer, size, 0, scontext);
+-#else                /*WITH_SELINUX */
+-                add_proc(comm, pid, ppid, pgid, st.st_uid,
+-                     buffer, size, 0);
+-#endif                /*WITH_SELINUX */
+               }
+             }
+           }
+@@ -787,7 +734,7 @@ static void read_proc(void)
+     }
+   }
+   (void) closedir(dir);
+-  fix_orphans();
++  fix_orphans(scontext);
+   if (print_args)
+     free(buffer);
+   if (empty) {
+@@ -796,7 +743,7 @@ static void read_proc(void)
+   }
+ }
+ 
+-static void fix_orphans(void)
++static void fix_orphans(security_context_t scontext)
+ {
+   /* When using kernel 3.3 with hidepid feature enabled on /proc
+    * then we need fake root pid and gather all the orphan processes
+@@ -807,11 +754,7 @@ static void fix_orphans(void)
+   PROC *root, *walk;
+ 
+   if (!(root = find_proc(ROOT_PID))) {
+-#ifdef WITH_SELINUX
+     root = new_proc("?", ROOT_PID, 0, scontext);
+-#else                                /*WITH_SELINUX */
+-    root = new_proc("?", ROOT_PID, 0);
+-#endif
+   }
+   for (walk = list; walk; walk = walk->next) {
+ 	if (walk->pid == 1 || walk->pid == 0)
diff --git a/psmisc-timeout.patch b/psmisc-timeout.patch
deleted file mode 100644
index a81493d..0000000
--- a/psmisc-timeout.patch
+++ /dev/null
@@ -1,396 +0,0 @@
-commit 54033e94bb8e038655f3241524da5616cb344435
-Author: Werner Fink <werner at suse.de>
-Date:   Tue Mar 13 14:49:52 2012 +0100
-
-    Add timeout.c/timeout.h for static background process for doing the stat system calls
-    
-    Signed-off-by: Werner Fink <werner at suse.de>
-
-diff --git a/src/timeout.c b/src/timeout.c
-new file mode 100644
-index 0000000..1fe0354
---- /dev/null
-+++ b/src/timeout.c
-@@ -0,0 +1,267 @@
-+/*
-+ * 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 at suse.de>, 2011
-+ */
-+
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE
-+#endif
-+
-+#ifndef USE_SOCKETPAIR
-+# define USE_SOCKETPAIR		1
-+#endif
-+
-+#ifdef _FEATURES_H
-+# error Include local config.h before any system header file
-+#endif
-+#include "config.h"		/* For _FILE_OFFSET_BITS */
-+
-+#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>
-+
-+#include <unistd.h>
-+#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
-+#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
-+# ifndef  packed
-+#  define packed		__packed__
-+# endif
-+# 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
-+
-+#if defined __GNUC__
-+# undef strcpy
-+# define strcpy(d,s)		__builtin_strcpy((d),(s))   /* Without boundary check please */
-+#endif
-+
-+/*
-+ * The structure used for communication between the processes
-+ */
-+typedef struct _handle {
-+	int errcode;
-+	struct stat argument;
-+	stat_t function;
-+	size_t len;
-+	char path[0];
-+} attribute((packed)) handle_t;
-+
-+/*
-+ * 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};
-+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;
-+}
-+
-+static void attribute((constructor)) start(void)
-+{
-+	sigset_t sigset, oldset;
-+	struct sigaction act;
-+	ssize_t in;
-+
-+	if (pipes[1] >= 0) close(pipes[1]);
-+	if (pipes[2] >= 0) close(pipes[2]);
-+
-+	if (pipe(&pipes[0]))
-+		goto error;
-+	if (pipe(&pipes[2]))
-+		goto error;
-+
-+	memset(&act, 0, sizeof(act));
-+	sigemptyset(&act.sa_mask);
-+	act.sa_flags = SA_RESTART;
-+	act.sa_handler = sigchild;
-+	sigaction(SIGCHLD, &act, 0);
-+
-+	if ((active = fork()) < 0)
-+		goto error;
-+
-+	if (active) {
-+		close(pipes[0]);
-+		close(pipes[3]);
-+		pipes[0] = pipes[3] = -1;
-+		return;
-+	}
-+
-+	sigemptyset(&sigset);
-+	sigaddset(&sigset, SIGALRM);
-+	sigprocmask(SIG_BLOCK, &sigset, &oldset);
-+
-+	act.sa_handler = SIG_DFL;
-+	sigaction(SIGCHLD, &act, 0);
-+
-+	close(pipes[1]);
-+	close(pipes[2]);
-+	dup2(pipes[0], STDIN_FILENO);
-+	dup2(pipes[3], STDOUT_FILENO);
-+	close(pipes[0]);
-+	close(pipes[3]);
-+	pipes[1] = pipes[2] = -1;
-+	pipes[0] = pipes[3] = -1;
-+
-+	{
-+		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));
-+			memset(handle, 0, sizeof(handle_t));
-+		}
-+	}
-+	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)
-+{
-+	if (active && waitpid(active, NULL, WNOHANG|WUNTRACED) == 0)
-+		kill(active, SIGKILL);
-+}
-+
-+static sigjmp_buf jenv;
-+static void sigjump(int sig attribute((unused)))
-+{
-+	siglongjmp(jenv, 1);
-+}
-+
-+/*
-+ * External routine
-+ */
-+int timeout(stat_t function, const char *path, struct stat *restrict argument, time_t seconds)
-+{
-+	handle_t *restrict handle = (void*)&buf[0];
-+	struct sigaction alrm_act, pipe_act, new_act;
-+	sigset_t sigset, oldset;
-+
-+	if (active <= 0)	/* Oops, last one failed therefore clear status and restart */
-+		start();
-+
-+	memset(handle, 0, sizeof(handle_t));
-+	handle->len = strlen(path) + 1;
-+	if (handle->len >= PATH_MAX) {
-+		errno = ENAMETOOLONG;
-+		goto error;
-+	}
-+	handle->errcode = 0;
-+	handle->argument = *argument;
-+	handle->function = function;
-+	strcpy(handle->path, path);
-+
-+	sigemptyset(&sigset);
-+	sigaddset(&sigset, SIGALRM);
-+	sigaddset(&sigset, SIGPIPE);
-+	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;
-+
-+	new_act.sa_handler = sigjump;
-+	sigaction(SIGALRM, &new_act, &alrm_act);
-+	sigaction(SIGPIPE, &new_act, &pipe_act);
-+	alarm(seconds);
-+
-+	write(pipes[1], handle, sizeof(handle_t)+handle->len);
-+	read(pipes[2], &handle->errcode, sizeof(handle->errcode)+sizeof(handle->argument));
-+
-+	alarm(0);
-+	sigaction(SIGPIPE, &pipe_act, NULL);
-+	sigaction(SIGALRM, &alrm_act, NULL);
-+
-+	if (handle->errcode) {
-+		errno = handle->errcode;
-+		goto error;
-+	}
-+
-+	*argument = handle->argument;
-+	sigprocmask(SIG_SETMASK, &oldset, NULL);
-+
-+	return 0;
-+timed:
-+	(void) alarm(0);
-+	sigaction(SIGPIPE, &pipe_act, NULL);
-+	sigaction(SIGALRM, &alrm_act, NULL);
-+	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
-new file mode 100644
-index 0000000..546c13b
---- /dev/null
-+++ b/src/timeout.h
-@@ -0,0 +1,36 @@
-+/*
-+ * 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 at suse.de>, 2011
-+ */
-+
-+#ifndef _TIMEOUT_H
-+#define _TIMEOUT_H
-+
-+#include "config.h"		/* For _FILE_OFFSET_BITS */
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <time.h>
-+#include <limits.h>
-+
-+#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
-commit 378eea8bd5db4ed8244ce1a3f416137f131acdd5
-Author: Werner Fink <werner at suse.de>
-Date:   Tue Mar 13 16:15:43 2012 +0100
-
-    Use --enable-timeout-stat as well as --enable-timeout-stat=static
-    for a static background process which does the final stat system calls
-    
-    Signed-off-by: Werner Fink <werner at suse.de>
-
-diff --git a/configure.ac b/configure.ac
-index 0615f5f..9265d82 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -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],
-diff --git a/src/Makefile.am b/src/Makefile.am
-index d511f24..a28af7d 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -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@
- 
-diff --git a/src/fuser.c b/src/fuser.c
-index e4081eb..09548ff 100644
---- a/src/fuser.c
-+++ b/src/fuser.c
-@@ -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;
- 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/psmisc.git/commitdiff/2cd3a20905d6e0e5c20eb84b74dff12ef2be63cb



More information about the pld-cvs-commit mailing list