updated to 4.87
This commit is contained in:
Peter Schiffer 2013-01-03 13:47:33 +01:00
parent 37e86b1997
commit c70eb9d28f
5 changed files with 12 additions and 146 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/lsof_4.86-rh.tar.bz2
/lsof_4.87-rh.tar.xz

View File

@ -1,136 +0,0 @@
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

View File

@ -1,7 +1,7 @@
Summary: A utility which lists open files on a Linux/UNIX system
Name: lsof
Version: 4.86
Release: 4%{?dist}
Version: 4.87
Release: 1%{?dist}
# Sendmail .. lib/snpf.c
# LGPLv2+ .. lib/regex.c, regex.h
License: zlib and Sendmail and LGPLv2+
@ -15,9 +15,8 @@ Group: Development/Debuggers
%global lsofrh lsof_%{version}-rh
URL: http://people.freebsd.org/~abe/
Source: %{lsofrh}.tar.bz2
Patch: lsof-4.86-anoninodfs.patch
Source0: %{lsofrh}.tar.xz
Source1: upstream2downstream.sh
BuildRequires: libselinux-devel
@ -28,7 +27,6 @@ UNIX system.
%prep
%setup -q -n %{lsofrh}
%patch -p1 -b .anoninodfs
%build
./Configure -n linux
@ -46,6 +44,10 @@ install -p -m 0644 lsof.8 ${RPM_BUILD_ROOT}%{_mandir}/man8
%{_mandir}/man*/*
%changelog
* Thu Jan 3 2013 Peter Schiffer <pschiffe@redhat.com> - 4.87-1
- resolves: #891508
updated to 4.87
* Tue Aug 28 2012 Peter Schiffer <pschiffe@redhat.com> - 4.86-4
- .spec file cleanup

View File

@ -1 +1 @@
0c81abdf6d7049c1a63bb936c1c260eb lsof_4.86-rh.tar.bz2
60ee5b17ce374be2fe1f3c7f1e2da1ee lsof_4.87-rh.tar.xz

View File

@ -33,13 +33,13 @@ rm -rf "$NAME"-rh/dialects/{aix,darwin,du,freebsd,hpux,n+obsd,n+os,osr,sun,uw}
echo " done."
echo -n "Creating final downstream tarball..."
tar jcf $MYPWD/"$NAME"-rh.tar.bz2 "$NAME"-rh
tar Jcf $MYPWD/"$NAME"-rh.tar.xz "$NAME"-rh
echo " done."
rm -rf $TMP
cd $MYPWD
echo
echo "Linux-only tarball: $MYPWD/"$NAME"-rh.tar.bz2"
echo "Linux-only tarball: $MYPWD/"$NAME"-rh.tar.xz"
echo