I have made the following changes intended for : CE:UX:MTF / lsof Please review and accept ASAP - BOSS has already processed this request and suggests ??? See the "Messages from BOSS" section below
https://build.pub.meego.com/request/show/2740 Thank You, bossbot ([email protected]) [This message was auto-generated] --- Request # 2740: Messages from BOSS: None State: new 2011-10-25T07:34:37 bossbot Reviews: from bossbot :BOSS suggests accepting this review. See email for more details. BOSS accepted this review because: Target repo CE_UX_MTF_armv7hl found. accepted on No date Changes: submit: Project:MTF / lsof -> CE:UX:MTF / lsof Index: lsof.changes =================================================================== --- lsof.changes (revision 0) +++ lsof.changes (revision 2) @@ -0,0 +1,12 @@ +* Wed Jun 08 2011 Anas Nashif <[email protected]> - 4.82 +- Repackage docs + +* Mon Jan 11 2010 Passion Zhao <[email protected]> - 4.82 +- Update to 4.82 + +* Sat Feb 07 2009 Anas Nashif <[email protected]> - 4.81 +- Update to 4.81 + +* Tue Sep 09 2008 Anas Nashif <[email protected]> - 4.78 +- initial checkin into moblin +- remove selinux support Index: lsof_4.81-threads.patch =================================================================== --- lsof_4.81-threads.patch (revision 0) +++ lsof_4.81-threads.patch (revision 2) @@ -0,0 +1,129 @@ +diff -up lsof_4.81-rh/dialects/linux/dproc.c.kzak lsof_4.81-rh/dialects/linux/dproc.c +--- lsof_4.81-rh/dialects/linux/dproc.c.kzak 2008-10-21 18:17:25.000000000 +0200 ++++ lsof_4.81-rh/dialects/linux/dproc.c 2008-12-02 10:54:54.000000000 +0100 +@@ -89,7 +89,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)); +@@ -159,6 +160,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; +@@ -252,6 +254,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. + */ +@@ -265,7 +274,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. +@@ -1007,6 +1023,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 +@@ -1250,12 +1324,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: lsof.spec =================================================================== --- lsof.spec (revision 0) +++ lsof.spec (revision 2) @@ -0,0 +1,53 @@ +# +# Please submit bugfixes or comments via http://bugs.meego.com/ +# + +Name: lsof +Version: 4.82 +Release: 1 +License: zlib +Summary: A utility which lists open files on a Linux/UNIX system +Group: Development/Debuggers + +Url: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof +# lsof contains licensed code that we cannot ship. Therefore we use +# upstream2downstream.sh script to remove the code before shipping it. +# +# The script you can found in CVS or download from: +# http://cvs.fedoraproject.org/viewcvs/rpms/lsof/devel/upstream2downstream.sh +# +%define lsofrh lsof_4.82-rh +Source0: %{lsofrh}.tar.bz2 + +# 184338 - allow lsof access nptl threads +Patch1: lsof_4.81-threads.patch + +%description +Lsof stands for LiSt Open Files, and it does just that: it lists +information about files that are open by the processes running on a +UNIX system. + +%prep +%setup -q -n %{lsofrh} +%patch1 -p1 + +%build +LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux + +make DEBUG="%{optflags}" %{?_smp_mflags} + +%install +mkdir -p %{buildroot}%{_sbindir} +install -p -m 0755 lsof %{buildroot}%{_prefix}/sbin +mkdir -p %{buildroot}%{_mandir}/man8 +install -p lsof.8 %{buildroot}%{_mandir}/man8/ + +%clean +rm -rf %{buildroot} + +%docs_package + +%files +%defattr(644,root,root,755) +%attr(0755,root,root) %{_sbindir}/lsof + Index: lsof_4.82-rh.tar.bz2 =================================================================== Binary file lsof_4.82-rh.tar.bz2 added
