- upgrade to 4.81

- lsof_4.80-threads.patch - rebased
This commit is contained in:
kzak 2008-12-02 12:16:44 +00:00
parent a02b060122
commit a7e8a17b77
5 changed files with 28 additions and 24 deletions

View File

@ -1 +1 @@
lsof_4.80-rh.tar.bz2 lsof_4.81-rh.tar.bz2

View File

@ -1,7 +1,7 @@
Summary: A utility which lists open files on a Linux/UNIX system Summary: A utility which lists open files on a Linux/UNIX system
Name: lsof Name: lsof
Version: 4.80 Version: 4.81
Release: 2%{?dist} Release: 1%{?dist}
License: zlib License: zlib
Group: Development/Debuggers Group: Development/Debuggers
@ -11,7 +11,7 @@ Group: Development/Debuggers
# The script you can found in CVS or download from: # The script you can found in CVS or download from:
# http://cvs.fedoraproject.org/viewcvs/rpms/lsof/devel/upstream2downstream.sh # http://cvs.fedoraproject.org/viewcvs/rpms/lsof/devel/upstream2downstream.sh
# #
%define lsofrh lsof_4.80-rh %define lsofrh lsof_4.81-rh
Source0: %{lsofrh}.tar.bz2 Source0: %{lsofrh}.tar.bz2
URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
@ -19,7 +19,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
Patch1: lsof_4.80-threads.patch # 184338 - allow lsof access nptl threads
Patch1: lsof_4.81-threads.patch
%description %description
Lsof stands for LiSt Open Files, and it does just that: it lists Lsof stands for LiSt Open Files, and it does just that: it lists
@ -28,7 +29,6 @@ UNIX system.
%prep %prep
%setup -q -n %{lsofrh} %setup -q -n %{lsofrh}
# 184338 - allow lsof access nptl threads
%patch1 -p1 %patch1 -p1
%build %build
@ -53,6 +53,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Tue Dec 2 2008 Karel Zak <kzak@redhat.com> 4.81-1
- upgrade to 4.81
- lsof_4.80-threads.patch - rebased
* Thu Aug 7 2008 Tom "spot" Callaway <tcallawa@redhat.com> 4.80-2 * Thu Aug 7 2008 Tom "spot" Callaway <tcallawa@redhat.com> 4.80-2
- fix license tag - fix license tag

View File

@ -1,7 +1,7 @@
diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dproc.c diff -up lsof_4.81-rh/dialects/linux/dproc.c.kzak lsof_4.81-rh/dialects/linux/dproc.c
--- lsof_4.80-rh/dialects/linux/dproc.c.th 2008-04-15 15:32:34.000000000 +0200 --- lsof_4.81-rh/dialects/linux/dproc.c.kzak 2008-10-21 18:17:25.000000000 +0200
+++ lsof_4.80-rh/dialects/linux/dproc.c 2008-05-20 01:21:39.000000000 +0200 +++ lsof_4.81-rh/dialects/linux/dproc.c 2008-12-02 10:54:54.000000000 +0100
@@ -84,7 +84,8 @@ _PROTOTYPE(static void process_proc_map, @@ -89,7 +89,8 @@ _PROTOTYPE(static void process_proc_map,
_PROTOTYPE(static int process_id,(char *idp, int idpl, char *cmd, UID_ARG uid, _PROTOTYPE(static int process_id,(char *idp, int idpl, char *cmd, UID_ARG uid,
int pid, int ppid, int pgid)); int pid, int ppid, int pgid));
_PROTOTYPE(static int statEx,(char *p, struct stat *s, int *ss)); _PROTOTYPE(static int statEx,(char *p, struct stat *s, int *ss));
@ -11,7 +11,7 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
#if defined(HASSELINUX) #if defined(HASSELINUX)
_PROTOTYPE(static int cmp_cntx_eq,(char *pcntx, char *ucntx)); _PROTOTYPE(static int cmp_cntx_eq,(char *pcntx, char *ucntx));
@@ -154,6 +155,7 @@ gather_proc_info() @@ -159,6 +160,7 @@ gather_proc_info()
struct dirent *dp; struct dirent *dp;
struct stat sb; struct stat sb;
int lwp, n, nl, pgid, pid, ppid, rv, tx; int lwp, n, nl, pgid, pid, ppid, rv, tx;
@ -19,7 +19,7 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
static char *lwppath = (char *)NULL; static char *lwppath = (char *)NULL;
static int lwppathl = 0; static int lwppathl = 0;
static char *path = (char *)NULL; static char *path = (char *)NULL;
@@ -246,6 +248,13 @@ gather_proc_info() @@ -252,6 +254,13 @@ gather_proc_info()
while ((dp = readdir(ps))) { while ((dp = readdir(ps))) {
if (nm2id(dp->d_name, &pid, &n)) if (nm2id(dp->d_name, &pid, &n))
continue; continue;
@ -33,7 +33,7 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
/* /*
* Build path to PID's directory. * Build path to PID's directory.
*/ */
@@ -259,7 +268,14 @@ gather_proc_info() @@ -265,7 +274,14 @@ gather_proc_info()
Exit(1); Exit(1);
} }
} }
@ -49,12 +49,12 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
n += (pidx + 1); n += (pidx + 1);
/* /*
* Process the PID's stat info. * Process the PID's stat info.
@@ -1016,6 +1032,64 @@ process_id(idp, idpl, cmd, uid, pid, ppi @@ -1007,6 +1023,64 @@ process_id(idp, idpl, cmd, uid, pid, ppi
return(0); return(0);
} }
+/* fill tid if the initial thread is zombie, +/* fill tid if the initial thread is zombie,
+ * but other thread still alive + * but other thread still alive
+ * + *
+ * returns -1=error, 0=nothing, 1=ok + * returns -1=error, 0=nothing, 1=ok
+ */ + */
@ -80,7 +80,7 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
+ return -1; + return -1;
+ if (_pid != pid) + if (_pid != pid)
+ return -1; /* corrupted /proc? */ + return -1; /* corrupted /proc? */
+ if (pstate!='Z') + if (pstate!='Z')
+ return 0; /* ignore normal proceses */ + return 0; /* ignore normal proceses */
+ +
+ snpf(path, sizeof(path), "%s/%d/task", PROCFS, pid); + snpf(path, sizeof(path), "%s/%d/task", PROCFS, pid);
@ -88,12 +88,12 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
+ /* open /proc/<pid>/task */ + /* open /proc/<pid>/task */
+ if (!(tdp = opendir(path))) + if (!(tdp = opendir(path)))
+ return 0; /* kernel < 2.6.x */ + return 0; /* kernel < 2.6.x */
+ +
+ /* look for first alive thread */ + /* look for first alive thread */
+ while ((td = readdir(tdp))) { + while ((td = readdir(tdp))) {
+ if (strcmp(td->d_name, ".")==0 || strcmp(td->d_name, "..")==0) + if (strcmp(td->d_name, ".")==0 || strcmp(td->d_name, "..")==0)
+ continue; + continue;
+ +
+ /* /proc/<pid>/task/<tid>/stat */ + /* /proc/<pid>/task/<tid>/stat */
+ snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name); + snpf(path, sizeof(path), "%s/%d/task/%s/stat", PROCFS, pid, td->d_name);
+ if (!(f = fopen(path, "r"))) + if (!(f = fopen(path, "r")))
@ -114,7 +114,7 @@ diff -up lsof_4.80-rh/dialects/linux/dproc.c.th lsof_4.80-rh/dialects/linux/dpro
/* /*
* process_proc_map() - process the memory map of a process * process_proc_map() - process the memory map of a process
@@ -1259,12 +1333,6 @@ read_id_stat(ty, p, id, cmd, ppid, pgid) @@ -1250,12 +1324,6 @@ read_id_stat(ty, p, id, cmd, ppid, pgid)
return(1); return(1);
} }
/* /*

View File

@ -1 +1 @@
f5db1a8e2cb8337ed043ca68178955e6 lsof_4.80-rh.tar.bz2 b5ef18418760dd304b223a4acb3e14d7 lsof_4.81-rh.tar.bz2

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# #
# This script removes non-linux dialects from upstream source package before release. # This script removes non-linux dialects from upstream source package before
# There is a problem with copyrights for some UN*Xes ... also .. this script merges all # release. There is a problem with copyrights for some UN*Xes ... also .. this
# to the one normal tarball and rename all to lsof_X.XX-rh. # script merges all to the one normal tarball and rename all to lsof_X.XX-rh.
# #
# Usage: ./upstream2downstream <usptream-tarball> # Usage: ./upstream2downstream <usptream-tarball>
# #