diff --git a/lsof-4.86-anoninodfs.patch b/lsof-4.86-anoninodfs.patch new file mode 100644 index 0000000..528b7a9 --- /dev/null +++ b/lsof-4.86-anoninodfs.patch @@ -0,0 +1,136 @@ +diff -X excludes -ruN lsof_4.86_src/dialects/linux/dnode.c _lsof_4.86_src/dialects/linux/dnode.c +--- lsof_4.86_src/dialects/linux/dnode.c 2012-04-11 01:40:00.000000000 +0900 ++++ _lsof_4.86_src/dialects/linux/dnode.c 2012-06-04 13:19:05.290490391 +0900 +@@ -401,6 +401,10 @@ + /* Lf->ntype = Ntype = N_REGLR; by alloc_lfile() */ + process_proc_sock(p, s, ss, l, ls); + return; ++ case 0: ++ if (!strcmp(p, "anon_inode")) ++ Lf->ntype = Ntype = N_ANON_INODE; ++ break; + } + } + if (Selinet) +@@ -503,9 +507,13 @@ + tn = "VTXT"; + break; + default: +- (void) snpf(Lf->type, sizeof(Lf->type), "%04o", +- ((type >> 12) & 0xf)); +- tn = (char *)NULL; ++ if (Ntype == N_ANON_INODE) { ++ tn = "a_inode"; ++ } else { ++ (void) snpf(Lf->type, sizeof(Lf->type), "%04o", ++ ((type >> 12) & 0xf)); ++ tn = (char *)NULL; ++ } + } + } else + tn = "unknown"; +diff -X excludes -ruN lsof_4.86_src/dialects/linux/dproc.c _lsof_4.86_src/dialects/linux/dproc.c +--- lsof_4.86_src/dialects/linux/dproc.c 2012-04-11 01:40:01.000000000 +0900 ++++ _lsof_4.86_src/dialects/linux/dproc.c 2012-06-04 13:29:44.684989913 +0900 +@@ -81,7 +81,7 @@ + */ + + _PROTOTYPE(static int get_fdinfo,(char *p, struct l_fdinfo *fi)); +-_PROTOTYPE(static int getlinksrc,(char *ln, char *src, int srcl)); ++_PROTOTYPE(static int getlinksrc,(char *ln, char *src, int srcl, char** rest)); + _PROTOTYPE(static int isefsys,(char *path, char *type, int l, + efsys_list_t **rep, struct lfile **lfr)); + _PROTOTYPE(static int nm2id,(char *nm, int *id, int *idl)); +@@ -440,14 +440,18 @@ + + + static int +-getlinksrc(ln, src, srcl) ++getlinksrc(ln, src, srcl, rest) + char *ln; /* link path */ + char *src; /* link source path return address */ + int srcl; /* length of src[] */ ++ char **rest; /* string after `:' of link source path */ + { + char *cp; + int ll; + ++ if (rest) ++ *rest = NULL; ++ + if ((ll = readlink(ln, src, srcl - 1)) < 1 + || ll >= srcl) + return(-1); +@@ -457,6 +461,8 @@ + if ((cp = strchr(src, ':'))) { + *cp = '\0'; + ll = strlen(src); ++ if (rest) ++ *rest = cp + 1; + } + return(ll); + } +@@ -795,6 +801,7 @@ + static char *pathi = (char *)NULL; + static int pathil = 0; + int txts = 0; ++ char* rest; + + #if defined(HASSELINUX) + cntxlist_t *cntxp; +@@ -825,7 +832,7 @@ + (void) make_proc_path(idp, idpl, &path, &pathl, "cwd"); + alloc_lfile(CWD, -1); + efs = 0; +- if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { ++ if (getlinksrc(path, pbuf, sizeof(pbuf), NULL) < 1) { + if (!Fwarn) { + (void) memset((void *)&sb, 0, sizeof(sb)); + lnk = ss = 0; +@@ -873,7 +880,7 @@ + if (!Ckscko) { + (void) make_proc_path(idp, idpl, &path, &pathl, "root"); + alloc_lfile(RTD, -1); +- if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { ++ if (getlinksrc(path, pbuf, sizeof(pbuf), NULL) < 1) { + if (!Fwarn) { + (void) memset((void *)&sb, 0, sizeof(sb)); + lnk = ss = 0; +@@ -921,7 +928,7 @@ + txts = 0; + (void) make_proc_path(idp, idpl, &path, &pathl, "exe"); + alloc_lfile("txt", -1); +- if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { ++ if (getlinksrc(path, pbuf, sizeof(pbuf), NULL) < 1) { + (void) memset((void *)&sb, 0, sizeof(sb)); + lnk = ss = 0; + if (!Fwarn) { +@@ -1044,7 +1051,7 @@ + continue; + (void) make_proc_path(dpath, i, &path, &pathl, fp->d_name); + (void) alloc_lfile((char *)NULL, fd); +- if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { ++ if (getlinksrc(path, pbuf, sizeof(pbuf), &rest) < 1) { + (void) memset((void *)&sb, 0, sizeof(sb)); + lnk = ss = 0; + if (!Fwarn) { +@@ -1137,6 +1144,8 @@ + } + if (pn) { + process_proc_node(lnk ? pbuf : path, &sb, ss, &lsb, ls); ++ if (Lf->ntype == N_ANON_INODE) ++ enter_nm(rest); + if (Lf->sf) + link_lfile(); + } +diff -X excludes -ruN lsof_4.86_src/lsof.h _lsof_4.86_src/lsof.h +--- lsof_4.86_src/lsof.h 2011-09-08 04:14:10.000000000 +0900 ++++ _lsof_4.86_src/lsof.h 2012-06-04 13:27:40.190724414 +0900 +@@ -349,6 +349,7 @@ + #define N_VXFS 51 /* Veritas file system node */ + #define N_XFS 52 /* XFS node */ + #define N_ZFS 53 /* ZFS node */ ++#define N_ANON_INODE 54 /* inode on linux anon_inodefs */ + + # if !defined(OFFDECDIG) + #define OFFDECDIG 8 /* maximum number of digits in the diff --git a/lsof.spec b/lsof.spec index 517b258..871a661 100644 --- a/lsof.spec +++ b/lsof.spec @@ -1,7 +1,7 @@ Summary: A utility which lists open files on a Linux/UNIX system Name: lsof Version: 4.86 -Release: 1%{?dist} +Release: 2%{?dist} License: zlib Group: Development/Debuggers @@ -15,6 +15,8 @@ Group: Development/Debuggers Source0: %{lsofrh}.tar.bz2 URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof +Patch0: lsof-4.86-anoninodfs.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libselinux-devel @@ -26,7 +28,7 @@ UNIX system. %prep %setup -q -n %{lsofrh} -#%patch0 -p1 +%patch0 -p1 %build LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux @@ -50,6 +52,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man*/* %changelog +* Mon Jun 04 2012 Peter Schiffer - 4.86-2 +- added support for files on anon_inodefs + * Fri Apr 20 2012 Peter Schiffer - 4.86-1 - resolves: #811520 update to 4.86