summaryrefslogtreecommitdiff
path: root/sysutils/lsof/patches/patch-ae
blob: 66b92b5e55c06d9b3ec1763fdad584ba406760dc (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
$NetBSD: patch-ae,v 1.5 2004/11/28 22:39:07 atatat Exp $

Incorporate a patch from the author that widens the NETBSDV definition
to account for new current versioning system, properly handles the
sys/bufq.h mess, adds a bit more to procfs support, and adds ptyfs
support.

--- dialects/n+obsd/dnode.c.orig	2004-07-06 15:20:23.000000000 -0400
+++ dialects/n+obsd/dnode.c
@@ -188,7 +188,7 @@ process_node(va)
 	struct mfsnode m;
 	struct nfsnode n;
 	enum nodetype {NONODE, CDFSNODE, DOSNODE, EXT2NODE, FDESCNODE, INODE,
-		KERNFSNODE, MFSNODE, NFSNODE, PFSNODE} nty;
+		KERNFSNODE, MFSNODE, NFSNODE, PFSNODE, PTYFSNODE} nty;
 	enum vtype type;
 	struct vnode *v, vb;
 	struct l_vfs *vfs;
@@ -262,6 +262,11 @@ process_node(va)
 	size_t sz;
 #endif	/* defined(HASPROCFS) */
 
+#if	defined(HASPTYFS)
+	struct ptyfsnode pt;
+	struct specinfo si;
+#endif	/* defined(HASPTYFS) */
+
 #if	defined(HASNULLFS)
 
 process_overlaid_node:
@@ -523,6 +528,19 @@ process_overlaid_node:
 	    break;
 #endif	/* defined(HASPROCFS) */
 
+#if    defined(HASPTYFS)
+	case VT_PTYFS:
+	    if (!v->v_data
+	    ||  kread((KA_T)v->v_data, (char *)&pt, sizeof(pt))) {
+		(void) snpf(Namech, Namechl, "can't read ptyfsnode at: %s",
+		    print_kptr((KA_T)v->v_data, (char *)NULL, 0));
+		enter_nm(Namech);
+		return;
+	    }
+	    nty = PTYFSNODE;
+	    break;
+#endif	/* defined(HASPTYFS) */
+
 #if	defined(HASEXT2FS)
 	case VT_EXT2FS:
 #endif	/* defined(HASEXT2FS) */
@@ -769,6 +787,21 @@ process_overlaid_node:
 	case NFSNODE:
 	    dev = NVATTR.va_fsid;
 	    devs = 1;
+
+#if	defined(HASPTYFS)
+	case PTYFSNODE:
+	    if (v->v_un.vu_specinfo
+	    &&  !kread((KA_T)v->v_un.vu_specinfo, (char *)&si, sizeof(si))) {
+		rdev = si.si_rdev;
+		rdevs = 1;
+	    }
+	    if (vfs) {
+		dev = (dev_t)vfs->fsid.__fsid_val[0];
+		devs = 1;
+	    }
+	    break;
+#endif	/* defined(HASPTYFS) */
+
 	}
 /*
  * Obtain the inode number.
@@ -836,6 +869,13 @@ process_overlaid_node:
 	    break;
 #endif	/* defined(HASPROCFS) */
 
+#if	defined(HASPTYFS)
+	case PTYFSNODE:
+	    Lf->inode = (unsigned long)pt.ptyfs_fileno;
+	    Lf->inp_ty = 1;
+	    break;
+#endif	/* defined(HASPTYFS) */
+
 	}
 
 /*
@@ -1152,7 +1192,8 @@ process_overlaid_node:
  * 	ioctl(fd, TIOCNOTTY) files;
  *	/kern files
  *	memory node files;
- *	/proc files.
+ *	/proc files;
+ *	ptyfs files.
  */
 
 	if (type == VBAD)
@@ -1222,14 +1263,52 @@ process_overlaid_node:
 		(void) snpf(ep, sz, "/%d/notepg", p.pfs_pid);
 		ty = "PGID";
 		break;
+	    case Pfd:
+		ep = endnm(&sz);
+		(void) snpf(ep, sz, "/%d/fd", p.pfs_pid);
+		ty = "PFD";
+		break;
+	    case Pmap:
+		ep = endnm(&sz);
+		(void) snpf(ep, sz, "/%d/map", p.pfs_pid);
+		ty = "PMAP";
+		break;
+	    case Pmaps:
+		ep = endnm(&sz);
+		(void) snpf(ep, sz, "/%d/maps", p.pfs_pid);
+		ty = "PMPS";
+		break;
 	    }
 	    if (ty)
 		(void) snpf(Lf->type, sizeof(Lf->type), ty);
-	    if (Namech[0])
-		enter_nm(Namech);
 	}
 #endif	/* defined(HASPROCFS) */
 
+#if	defined(HASPTYFS)
+	else if (nty == PTYFSNODE) {
+	    (void) snpf(Namech, Namechl, "%s", Lf->fsdir);
+	    Lf->nlink = 1;
+	    Lf->nlink_def = 1;
+	    switch (pt.ptyfs_type) {
+	    case PTYFSpts:
+		ep = endnm(&sz);
+		(void) snpf(ep, sz, "/%lu", (unsigned long)pt.ptyfs_pty);
+		break;
+	    case PTYFSptc:
+		ep = endnm(&sz);
+		(void) snpf(ep, sz, "/%lu (master)",
+		    (unsigned long)pt.ptyfs_pty);
+		break;
+	    case PTYFSroot:
+		Lf->sz = 512;
+		Lf->sz_def = 1;
+		break;
+	    }
+	    if (ty)
+		(void) snpf(Lf->type, sizeof(Lf->type), ty);
+	}
+#endif	/* defined(HASPTYFS) */
+
 #if	defined(HASBLKDEV)
 /*
  * If this is a VBLK file and it's missing an inode number, try to
@@ -1283,7 +1362,9 @@ process_overlaid_node:
 	    if (Sfile && is_file_named((char *)NULL,
 				       ((type == VCHR) || (type == VBLK)) ? 1
 									  : 0))
+	    {
 		Lf->sf |= SELNM;
+	    }
 	    if (ns)
 		Namech[0] = '\0';
 	}