rpms/lsof/devel lsof_4.80-threads.patch, NONE, 1.1 .cvsignore, 1.13, 1.14 lsof.spec, 1.40, 1.41 sources, 1.14, 1.15 upstream2downstream.sh, 1.1, 1.2 lsof_4.78C-inode.patch, 1.2, NONE lsof_4.78C-selinux.patch, 1.1, NONE lsof_4.78C-threads.patch, 1.2, NONE
Karel Zak (kzak)
fedora-extras-commits at redhat.com
Mon May 19 23:50:52 UTC 2008
- Previous message (by thread): rpms/perl-Math-BigInt-GMP/devel perl-Math-BigInt-GMP.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/ruby-openid/F-7 .cvsignore, 1.2, 1.3 ruby-openid.spec, 1.1, 1.2 sources, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: kzak
Update of /cvs/pkgs/rpms/lsof/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5721
Modified Files:
.cvsignore lsof.spec sources upstream2downstream.sh
Added Files:
lsof_4.80-threads.patch
Removed Files:
lsof_4.78C-inode.patch lsof_4.78C-selinux.patch
lsof_4.78C-threads.patch
Log Message:
* Tue May 20 2008 Karel Zak <kzak at redhat.com> 4.80-1
- upgrade to 4.80
- lsof_4.78C-inode.patch - merged upstream
- lsof_4.78C-selinux.patch - merged upstream
- lsof_4.78C-threads.patch - rebased
lsof_4.80-threads.patch:
--- NEW FILE lsof_4.80-threads.patch ---
diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dproc.c
--- lsof_4.80-rh/dialects/linux/dproc.c.th 2008-04-15 15:32:34.000000000 +0200
+++ lsof_4.80-rh/dialects/linux/dproc.c 2008-05-20 01:21:39.000000000 +0200
@@ -84,7 +84,8 @@ _PROTOTYPE(static void process_proc_map,
_PROTOTYPE(static int process_id,(char *idp, int idpl, char *cmd, UID_ARG uid,
int pid, int ppid, int pgid));
_PROTOTYPE(static int statEx,(char *p, struct stat *s, int *ss));
-
+_PROTOTYPE(static int get_other_thread,(int pid, char **tid));
+
#if defined(HASSELINUX)
_PROTOTYPE(static int cmp_cntx_eq,(char *pcntx, char *ucntx));
@@ -154,6 +155,7 @@ gather_proc_info()
struct dirent *dp;
struct stat sb;
int lwp, n, nl, pgid, pid, ppid, rv, tx;
+ char *tid = NULL;
static char *lwppath = (char *)NULL;
static int lwppathl = 0;
static char *path = (char *)NULL;
@@ -246,6 +248,13 @@ gather_proc_info()
while ((dp = readdir(ps))) {
if (nm2id(dp->d_name, &pid, &n))
continue;
+
+ tid = NULL;
+ if (get_other_thread(pid, &tid) < 0)
+ continue;
+ if (tid)
+ n += sizeof("task/") + strlen(tid);
+
/*
* Build path to PID's directory.
*/
@@ -259,7 +268,14 @@ gather_proc_info()
Exit(1);
}
}
- (void) snpf(pidpath + pidx, pidpathl - pidx, "%s/", dp->d_name);
+ if (tid) {
+ /* /proc/<pid> is useless (zombie), we have to use /proc/<pid>/task/<tid>
+ * where is still running thread
+ */
+ (void) snpf(pidpath + pidx, pidpathl - pidx, "%s/task/%s/", dp->d_name, tid);
+ free(tid);
+ } else
+ (void) snpf(pidpath + pidx, pidpathl - pidx, "%s/", dp->d_name);
n += (pidx + 1);
/*
* Process the PID's stat info.
@@ -1016,6 +1032,64 @@ process_id(idp, idpl, cmd, uid, pid, ppi
return(0);
}
+/* fill tid if the initial thread is zombie,
+ * but other thread still alive
+ *
+ * returns -1=error, 0=nothing, 1=ok
+ */
+static int
+get_other_thread(pid, tid)
+ int pid;
+ char **tid;
+{
+ char path[MAXPATHLEN];
+ DIR *tdp;
+ struct dirent *td;
+ char pstate;
+ FILE *f;
+ int _pid;
+ int re = 0, x;
+
+ snpf(path, sizeof(path), "%s/%d/stat", PROCFS, pid);
+ if (!(f = fopen(path, "r")))
+ return -1;
+ x = fscanf(f, "%d %*s %c", &_pid, &pstate);
+ fclose(f);
+ if (x!=2)
+ return -1;
+ if (_pid != pid)
+ return -1; /* corrupted /proc? */
+ if (pstate!='Z')
+ return 0; /* ignore normal proceses */
+
+ snpf(path, sizeof(path), "%s/%d/task", PROCFS, pid);
+
+ /* open /proc/<pid>/task */
+ if (!(tdp = opendir(path)))
+ return 0; /* kernel < 2.6.x */
+
+ /* look for first alive thread */
+ while ((td = readdir(tdp))) {
+ if (strcmp(td->d_name, ".")==0 || strcmp(td->d_name, "..")==0)
+ continue;
+
+ /* /proc/<pid>/task/<tid>/stat */
+ snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name);
+ if (!(f = fopen(path, "r")))
+ continue;
+ x = fscanf(f, "%*d %*s %c", &pstate);
+ fclose(f);
+ if (x!=1)
+ continue;
+ if (pstate!='Z') {
+ re = 1;
+ *tid = strdup(td->d_name);
+ break;
+ }
+ }
+ closedir(tdp);
+ return re;
+}
/*
* process_proc_map() - process the memory map of a process
@@ -1259,12 +1333,6 @@ read_id_stat(ty, p, id, cmd, ppid, pgid)
return(1);
}
/*
- * Convert the first field to an integer; its conversion must match the
- * ID argument.
- */
- if (!fp[0] || (atoi(fp[0]) != id))
- return(1);
-/*
* Get the command name from the second field. Strip a starting '(' and
* an ending ')'. Allocate space to hold the result and return the space
* pointer.
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/lsof/devel/.cvsignore,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- .cvsignore 12 Jun 2006 21:26:52 -0000 1.13
+++ .cvsignore 19 May 2008 23:50:03 -0000 1.14
@@ -1 +1 @@
-lsof_4.78C-rh.tar.bz2
+lsof_4.80-rh.tar.bz2
Index: lsof.spec
===================================================================
RCS file: /cvs/pkgs/rpms/lsof/devel/lsof.spec,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- lsof.spec 19 Feb 2008 10:36:00 -0000 1.40
+++ lsof.spec 19 May 2008 23:50:03 -0000 1.41
@@ -1,7 +1,7 @@
Summary: A utility which lists open files on a Linux/UNIX system
Name: lsof
-Version: 4.78
-Release: 8%{?dist}
+Version: 4.80
+Release: 1%{?dist}
License: Distributable
Group: Development/Debuggers
@@ -11,7 +11,7 @@
# The script you can found in CVS or download from:
# http://cvs.fedoraproject.org/viewcvs/rpms/lsof/devel/upstream2downstream.sh
#
-%define lsofrh lsof_4.78C-rh
+%define lsofrh lsof_4.80-rh
Source0: %{lsofrh}.tar.bz2
URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
@@ -19,9 +19,7 @@
BuildRequires: libselinux-devel
-Patch1: lsof_4.78C-threads.patch
-Patch2: lsof_4.78C-inode.patch
-Patch3: lsof_4.78C-selinux.patch
+Patch1: lsof_4.80-threads.patch
%description
Lsof stands for LiSt Open Files, and it does just that: it lists
@@ -32,10 +30,6 @@
%setup -q -n %{lsofrh}
# 184338 - allow lsof access nptl threads
%patch1 -p1
-# 243976 - mmap'd files with large inode numbers confuse lsof
-%patch2 -p1
-# 280651 - lsof prints entries in multiple lines when SElinux is disabled
-%patch3 -p1
%build
LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux
@@ -59,6 +53,12 @@
%{_mandir}/man*/*
%changelog
+* Tue May 20 2008 Karel Zak <kzak at redhat.com> 4.80-1
+- upgrade to 4.80
+ - lsof_4.78C-inode.patch - merged upstream
+ - lsof_4.78C-selinux.patch - merged upstream
+ - lsof_4.78C-threads.patch - rebased
+
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 4.78-8
- Autorebuild for GCC 4.3
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/lsof/devel/sources,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- sources 12 Jun 2006 21:26:52 -0000 1.14
+++ sources 19 May 2008 23:50:03 -0000 1.15
@@ -1 +1 @@
-6a604dacc4544486634d5421f7d6d31b lsof_4.78C-rh.tar.bz2
+f5db1a8e2cb8337ed043ca68178955e6 lsof_4.80-rh.tar.bz2
Index: upstream2downstream.sh
===================================================================
RCS file: /cvs/pkgs/rpms/lsof/devel/upstream2downstream.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- upstream2downstream.sh 2 Oct 2007 22:52:57 -0000 1.1
+++ upstream2downstream.sh 19 May 2008 23:50:03 -0000 1.2
@@ -10,13 +10,13 @@
#
UPSTREAM="$1"
-NAME=$(basename $UPSTREAM .tar.gz)
+NAME=$(basename $UPSTREAM .tar.bz2)
MYPWD=$(pwd)
TMP=$(mktemp -d)
echo
echo -n "Extracting upstream code..."
-tar -zxf $UPSTREAM -C $TMP
+tar -jxf $UPSTREAM -C $TMP
cd $TMP/$NAME
tar xf "$NAME"_src.tar
echo " done."
--- lsof_4.78C-inode.patch DELETED ---
--- lsof_4.78C-selinux.patch DELETED ---
--- lsof_4.78C-threads.patch DELETED ---
- Previous message (by thread): rpms/perl-Math-BigInt-GMP/devel perl-Math-BigInt-GMP.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/ruby-openid/F-7 .cvsignore, 1.2, 1.3 ruby-openid.spec, 1.1, 1.2 sources, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list