summaryrefslogtreecommitdiff
path: root/sysutils/lsof/patches/patch-ad
blob: 71c16f6a47891f9fbe893d7450e995d3522a8a8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$NetBSD: patch-ad,v 1.14 2007/11/21 11:01:55 apb Exp $

--- dialects/n+obsd/dnode.c.orig	2007-04-24 18:22:06.000000000 +0200
+++ dialects/n+obsd/dnode.c
@@ -38,6 +38,9 @@ static char *rcsid = "$Id: dnode.c,v 1.3
 
 #include "lsof.h"
 
+#if __NetBSD_Version__ > 399001800
+#define NOLOCKF
+#endif
 
 #if	defined(HAS_DINODE_U)
 #define	DINODE_U	dinode_u
@@ -194,12 +197,17 @@ process_node(va)
 	unsigned char ns;
 	unsigned char rdevs;
 	char *ep, *ty;
+#ifndef NOLOCKF
 	struct lockf lf, *lff, *lfp;
+#endif
 	struct inode i;
 	struct mfsnode m;
+#if	defined(HASTMPFS)
+	struct tmpfs_node tmp;
+#endif	/* defined(HASTMPFS) */
 	struct nfsnode n;
 	enum nodetype {NONODE, CDFSNODE, DOSNODE, EXT2NODE, FDESCNODE, INODE,
-		KERNFSNODE, MFSNODE, NFSNODE, PFSNODE, PTYFSNODE} nty;
+		KERNFSNODE, MFSNODE, NFSNODE, PFSNODE, PTYFSNODE, TMPFSNODE} nty;
 	enum vtype type;
 	struct vnode *v, vb;
 	struct l_vfs *vfs;
@@ -414,7 +422,7 @@ process_overlaid_node:
 	 */
 	    if (!v->v_data
 	    ||  kread((KA_T)v->v_data, (char *)&kn, sizeof(kn))) {
-		if (v->v_type != VDIR || !(v->v_flag && VROOT)) {
+		if (v->v_type != VDIR || !(v->VNODE_VFLAG && NCACHE_VROOT)) {
 		    (void) snpf(Namech, Namechl,
 			"can't read kernfs_node at: %s",
 			print_kptr((KA_T)v->v_data, (char *)NULL, 0));
@@ -449,7 +457,7 @@ process_overlaid_node:
 	 * size are fixed; otherwise, safely stat() the file to get the
 	 * inode number and size.
 	 */
-	    if (v->v_type == VDIR && (v->v_flag & VROOT)) {
+	    if (v->v_type == VDIR && (v->VNODE_VFLAG & NCACHE_VROOT)) {
 		(void) snpf(Namech, Namechl, "%s", _PATH_KERNFS);
 		ksb.st_ino = (ino_t)2;
 		ksb.st_size = DEV_BSIZE;
@@ -471,6 +479,19 @@ process_overlaid_node:
 	    nty = MFSNODE;
 	    break;
 
+#if	defined(HASTMPFS)
+	case VT_TMPFS:
+	    if (!v->v_data
+	    ||  kread((KA_T)v->v_data, (char *)&tmp, sizeof(tmp))) {
+		(void) snpf(Namech, Namechl, "can't read tmpfs_node at: %s",
+		    print_kptr((KA_T)v->v_data, (char *)NULL, 0));
+		enter_nm(Namech);
+		return;
+	    }
+	    nty = TMPFSNODE;
+	    break;
+#endif	/* defined(HASTMPFS) */
+
 #if	defined(HASMSDOSFS)
 	case VT_MSDOSFS:
 	    if (!v->v_data
@@ -619,6 +640,7 @@ process_overlaid_node:
 
 	    }
 
+#ifndef NOLOCKF
 	    if ((lff = i.i_lockf)) {
 
 	    /*
@@ -667,6 +689,7 @@ process_overlaid_node:
 		    break;
 		} while ((lfp = lf.lf_next) && lfp != lff);
 	    }
+#endif
 	    break;
 	default:
 	    if (v->v_type == VBAD || v->v_type == VNON)
@@ -900,6 +923,13 @@ process_overlaid_node:
 	    break;
 #endif	/* defined(HASPTYFS) */
 
+#if	defined(HASTMPFS)
+	case TMPFSNODE:
+	    Lf->inode = (INODETYPE)tmp.tn_id;
+	    Lf->inp_ty = 1;
+	    break;
+#endif	/* defined(HASTMPFS) */
+
 	}
 
 /*
@@ -1019,6 +1049,13 @@ process_overlaid_node:
 			Lf->sz_def = 1;
 			break;
 
+#if	defined(HASTMPFS)
+		    case TMPFSNODE:
+			Lf->sz = (SZOFFTYPE)tmp.tn_size;
+			Lf->sz_def = 1;
+			break;
+#endif	/* defined(HASTMPFS) */
+
 #if	defined(HASEXT2FS)
 		    case EXT2NODE:
 # if	defined(HASI_E2FS_PTR)
@@ -1221,6 +1258,9 @@ process_overlaid_node:
 	    Lf->dev_def = Lf->rdev_def = 0;
 	    (void) snpf(Namech, Namechl, "%#x", m.mfs_baseoff);
 	    enter_dev_ch("memory");
+	} else if (nty == TMPFSNODE) {
+	    Lf->dev_def = Lf->rdev_def = 0;
+	    enter_dev_ch("memory");
 	}
 
 #if	defined(HASPROCFS)