lsof/lsof_4.78C-inode.patch

338 lines
9.7 KiB
Diff

diff -up lsof_4.78C-rh/dialects/linux/dnode.c.inode lsof_4.78C-rh/dialects/linux/dnode.c
--- lsof_4.78C-rh/dialects/linux/dnode.c.inode 2006-06-12 19:10:05.000000000 +0200
+++ lsof_4.78C-rh/dialects/linux/dnode.c 2007-10-03 14:01:54.000000000 +0200
@@ -191,7 +191,7 @@ get_locks(p)
char buf[MAXPATHLEN], *ec, **fp;
dev_t dev;
int ex, i, h, mode, pid;
- unsigned long inode;
+ INODETYPE inode;
struct llock *lp, *np;
FILE *ls;
long maj, min;
@@ -267,7 +267,7 @@ get_locks(p)
*/
ec = (char *)NULL;
if (!fp[7] || !*fp[7]
- || (inode = strtoul(fp[7], &ec, 0)) == ULONG_MAX
+ || (inode = strtoull(fp[7], &ec, 0)) == ULONG_MAX
|| !ec || *ec)
continue;
/*
@@ -297,7 +297,7 @@ get_locks(p)
for (lp = LckH[h]; lp; lp = lp->next) {
if (lp->pid == pid
&& lp->dev == dev
- && lp->inode == (INODETYPE)inode
+ && lp->inode == inode
&& lp->type == type)
break;
}
@@ -307,14 +307,15 @@ get_locks(p)
* Allocate a new llock structure and link it to the PID hash bucket.
*/
if (!(lp = (struct llock *)malloc(sizeof(struct llock)))) {
+ (void) snpf(buf, sizeof(buf), InodeFmt_d, inode);
(void) fprintf(stderr,
- "%s: can't allocate llock: PID %d; dev %x; inode %ld\n",
- Pn, pid, (int)dev, inode);
+ "%s: can't allocate llock: PID %d; dev %x; inode %s\n",
+ Pn, pid, (int)dev, buf);
Exit(1);
}
lp->pid = pid;
lp->dev = dev;
- lp->inode = (INODETYPE)inode;
+ lp->inode = inode;
lp->type = type;
lp->next = LckH[h];
LckH[h] = lp;
diff -up lsof_4.78C-rh/dialects/linux/dproc.c.inode lsof_4.78C-rh/dialects/linux/dproc.c
--- lsof_4.78C-rh/dialects/linux/dproc.c.inode 2007-10-03 14:01:54.000000000 +0200
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-03 14:01:54.000000000 +0200
@@ -41,6 +41,9 @@ static char *rcsid = "$Id: dproc.c,v 1.1
#include <selinux/selinux.h>
#endif /* defined(HASSELINUX) */
+#if !defined(ULLONG_MAX)
+#define ULLONG_MAX 18446744073709551615ULL
+#endif /* !defined(ULLONG_MAX) */
/*
* Local definitions
@@ -790,7 +793,10 @@ process_proc_map(p, s, ss)
dev = (dev_t)makedev((int)maj, (int)min);
if (!fp[5] || !*fp[5])
continue;
- inode = (INODETYPE)atoi(fp[5]);
+ ep = (char *)NULL;
+ if ((inode = strtoull(fp[5], &ep, 0)) == ULLONG_MAX
+ || !ep || *ep)
+ continue;
if (!dev && !inode)
continue;
/*
diff -up lsof_4.78C-rh/dialects/linux/dsock.c.inode lsof_4.78C-rh/dialects/linux/dsock.c
--- lsof_4.78C-rh/dialects/linux/dsock.c.inode 2006-06-12 19:10:05.000000000 +0200
+++ lsof_4.78C-rh/dialects/linux/dsock.c 2007-10-03 14:02:39.000000000 +0200
@@ -350,7 +350,8 @@ get_ax25(p)
FILE *as;
char buf[MAXPATHLEN], *da, *dev_ch, *ep, **fp, *sa;
int h, nf;
- unsigned long inode, rq, sq, state;
+ INODETYPE inode;
+ unsigned long rq, sq, state;
MALLOC_S len;
unsigned char rqs, sqs;
/*
@@ -410,12 +411,12 @@ get_ax25(p)
*/
ep = (char *)NULL;
if (!fp[23] || !*fp[23]
- || (inode = strtoul(fp[23], &ep, 0)) == ULONG_MAX
+ || (inode = strtoull(fp[23], &ep, 0)) == ULONG_MAX
|| !ep || *ep)
continue;
h = INOHASH((INODETYPE)inode);
for (ap = AX25sin[h]; ap; ap = ap->next) {
- if ((INODETYPE)inode == ap->inode)
+ if (inode == ap->inode)
break;
}
if (ap)
@@ -496,7 +497,7 @@ get_ax25(p)
}
ap->da = da;
ap->dev_ch = dev_ch;
- ap->inode = (INODETYPE)inode;
+ ap->inode = inode;
ap->rq = rq;
ap->rqs = rqs;
ap->sa = sa;
@@ -521,7 +522,8 @@ get_ipx(p)
char buf[MAXPATHLEN], *ep, **fp, *la, *ra;
int fl = 1;
int h;
- unsigned long inode, rxq, state, txq;
+ INODETYPE inode;
+ unsigned long rxq, state, txq;
struct ipxsin *ip, *np;
MALLOC_S len;
FILE *xs;
@@ -588,12 +590,12 @@ get_ipx(p)
*/
ep = (char *)NULL;
if (!fp[6] || !*fp[6]
- || (inode = strtoul(fp[6], &ep, 0)) == ULONG_MAX
+ || (inode = strtoull(fp[6], &ep, 0)) == ULONG_MAX
|| !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (ip = Ipxsin[h]; ip; ip = ip->next) {
- if ((INODETYPE)inode == ip->inode)
+ if (inode == ip->inode)
break;
}
if (ip)
@@ -653,7 +655,7 @@ get_ipx(p)
Pn, sizeof(struct ipxsin));
Exit(1);
}
- ip->inode = (INODETYPE)inode;
+ ip->inode = inode;
ip->la = la;
ip->ra = ra;
ip->txq = txq;
@@ -676,7 +678,7 @@ get_raw(p)
{
char buf[MAXPATHLEN], *ep, **fp, *la, *ra, *sp;
int h;
- unsigned long inode;
+ INODETYPE inode;
int nf = 12;
struct rawsin *np, *rp;
MALLOC_S lal, ral, spl;
@@ -741,12 +743,12 @@ get_raw(p)
*/
ep = (char *)NULL;
if (!fp[9] || !*fp[9]
- || (inode = strtoul(fp[9], &ep, 0)) == ULONG_MAX
+ || (inode = strtoull(fp[9], &ep, 0)) == ULONG_MAX
|| !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (rp = Rawsin[h]; rp; rp = rp->next) {
- if ((INODETYPE)inode == rp->inode)
+ if (inode == rp->inode)
break;
}
if (rp)
@@ -800,7 +802,7 @@ get_raw(p)
Pn, sizeof(struct rawsin));
Exit(1);
}
- rp->inode = (INODETYPE)inode;
+ rp->inode = inode;
rp->la = la;
rp->lal = lal;
rp->ra = ra;
@@ -825,9 +827,10 @@ get_tcpudp(p, pr, clr)
int clr; /* 1 == clear the table */
{
char buf[MAXPATHLEN], *ep, **fp;
- unsigned long faddr, fport, inode, laddr, lport, rxq, state, txq;
+ unsigned long faddr, fport, laddr, lport, rxq, state, txq;
int h, nf;
FILE *fs;
+ INODETYPE inode;
struct tcp_udp *np, *tp;
/*
* Delete previous table contents. Allocate a table for the first time.
@@ -902,7 +905,7 @@ get_tcpudp(p, pr, clr)
|| (fport = strtoul(fp[4], &ep, 16)) == ULONG_MAX || !ep || *ep)
continue;
/*
- * Get the state, queue sizes, and inode.
+ * Get the state and queue sizes.
*/
ep = (char *)NULL;
if (!fp[5] || !*fp[5]
@@ -921,11 +924,11 @@ get_tcpudp(p, pr, clr)
*/
ep = (char *)NULL;
if (!fp[13] || !*fp[13]
- || (inode = strtoul(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
+ || (inode = strtoull(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (tp = TcpUdp[h]; tp; tp = tp->next) {
- if (tp->inode == (INODETYPE)inode)
+ if (tp->inode == inode)
break;
}
if (tp)
@@ -939,7 +942,7 @@ get_tcpudp(p, pr, clr)
Pn, sizeof(struct tcp_udp));
Exit(1);
}
- tp->inode = (INODETYPE)inode;
+ tp->inode = inode;
tp->faddr = faddr;
tp->fport = (int)(fport & 0xffff);
tp->laddr = laddr;
@@ -966,7 +969,7 @@ get_raw6(p)
{
char buf[MAXPATHLEN], *ep, **fp, *la, *ra, *sp;
int h;
- unsigned long inode;
+ INODETYPE inode;
int nf = 12;
struct rawsin *np, *rp;
MALLOC_S lal, ral, spl;
@@ -1031,12 +1034,12 @@ get_raw6(p)
*/
ep = (char *)NULL;
if (!fp[9] || !*fp[9]
- || (inode = strtoul(fp[9], &ep, 0)) == ULONG_MAX
+ || (inode = strtoull(fp[9], &ep, 0)) == ULONG_MAX
|| !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (rp = Rawsin6[h]; rp; rp = rp->next) {
- if ((INODETYPE)inode == rp->inode)
+ if (inode == rp->inode)
break;
}
if (rp)
@@ -1090,7 +1093,7 @@ get_raw6(p)
Pn, sizeof(struct rawsin));
Exit(1);
}
- rp->inode = (INODETYPE)inode;
+ rp->inode = inode;
rp->la = la;
rp->lal = lal;
rp->ra = ra;
@@ -1116,9 +1119,10 @@ get_tcpudp6(p, pr, clr)
{
char buf[MAXPATHLEN], *ep, **fp;
struct in6_addr faddr, laddr;
- unsigned long fport, inode, lport, rxq, state, txq;
+ unsigned long fport, lport, rxq, state, txq;
int h, nf;
FILE *fs;
+ INODETYPE inode;
struct tcp_udp6 *np6, *tp6;
/*
* Delete previous table contents. Allocate a table for the first time.
@@ -1189,7 +1193,7 @@ get_tcpudp6(p, pr, clr)
|| (fport = strtoul(fp[4], &ep, 16)) == ULONG_MAX || !ep || *ep)
continue;
/*
- * Get the state, queue sizes, and inode.
+ * Get the state and queue sizes.
*/
ep = (char *)NULL;
if (!fp[5] || !*fp[5]
@@ -1208,11 +1212,11 @@ get_tcpudp6(p, pr, clr)
*/
ep = (char *)NULL;
if (!fp[13] || !*fp[13]
- || (inode = strtoul(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
+ || (inode = strtoull(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (tp6 = TcpUdp6[h]; tp6; tp6 = tp6->next) {
- if (tp6->inode == (INODETYPE)inode)
+ if (tp6->inode == inode)
break;
}
if (tp6)
@@ -1226,7 +1230,7 @@ get_tcpudp6(p, pr, clr)
Pn, sizeof(struct tcp_udp6));
Exit(1);
}
- tp6->inode = (INODETYPE)inode;
+ tp6->inode = inode;
tp6->faddr = faddr;
tp6->fport = (int)(fport & 0xffff);
tp6->laddr = laddr;
@@ -1254,7 +1258,7 @@ get_unix(p)
char buf[MAXPATHLEN], *ep, **fp, *path, *pcb;
int fl = 1;
int h, nf;
- unsigned long inode;
+ INODETYPE inode;
MALLOC_S len;
struct uxsin *np, *up;
FILE *us;
@@ -1319,11 +1323,11 @@ get_unix(p)
*/
ep = (char *)NULL;
if (!fp[6] || !*fp[6]
- || (inode = strtoul(fp[6], &ep, 0)) == ULONG_MAX || !ep || *ep)
+ || (inode = strtoull(fp[6], &ep, 0)) == ULONG_MAX || !ep || *ep)
continue;
- h = INOHASH((INODETYPE)inode);
+ h = INOHASH(inode);
for (up = Uxsin[h]; up; up = up->next) {
- if ((INODETYPE)inode == up->inode)
+ if (inode == up->inode)
break;
}
if (up)
@@ -1362,7 +1366,7 @@ get_unix(p)
Pn, sizeof(struct uxsin));
Exit(1);
}
- up->inode = (INODETYPE)inode;
+ up->inode = inode;
up->pcb = pcb;
up->sb_def = 0;
if ((up->path = path) && (*path == '/')) {