View | Details | Raw Unified | Return to bug 251266 | Differences between
and this patch

Collapse All | Expand All

(-)sysutils/lsof/files/patch-dialects_freebsd_dproc.c (-6 / +21 lines)
Lines 15-21 Link Here
15
 
15
 
16
 _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
16
 _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
17
 _PROTOTYPE(static void get_kernel_access,(void));
17
 _PROTOTYPE(static void get_kernel_access,(void));
18
@@ -132,6 +140,15 @@ gather_proc_info()
18
@@ -118,6 +126,9 @@ gather_proc_info()
19
 					 *	   streams with eXPORT data,
20
 					 *	   where supported */
21
 	struct filedesc fd;
22
+#if	defined(PWDDESC_KVM_LOAD_PWD)
23
+ 	struct pwddesc pd;
24
+#endif	/* defined(PWDDESC_KVM_LOAD_PWD) */
25
 	int i, nf;
26
 	MALLOC_S nb;
27
 
28
@@ -132,6 +143,15 @@ gather_proc_info()
19
 	KA_T fa;
29
 	KA_T fa;
20
 #endif	/* defined(HAS_FDESCENTTBL) */
30
 #endif	/* defined(HAS_FDESCENTTBL) */
21
 
31
 
Lines 31-37 Link Here
31
 	static ofb_t *ofb = NULL;
41
 	static ofb_t *ofb = NULL;
32
 	static int ofbb = 0;
42
 	static int ofbb = 0;
33
 	int pgid, pid;
43
 	int pgid, pid;
34
@@ -305,13 +322,29 @@ gather_proc_info()
44
@@ -305,13 +325,34 @@ gather_proc_info()
35
 	    if (!fd.fd_files
45
 	    if (!fd.fd_files
36
 	    ||  kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt)))
46
 	    ||  kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt)))
37
 		continue;
47
 		continue;
Lines 45-51 Link Here
45
 
55
 
46
+#if	defined(HAS_PWD)
56
+#if	defined(HAS_PWD)
47
+	    cdir = rdir = jdir = NULL;
57
+	    cdir = rdir = jdir = NULL;
58
+#if	defined(PWDDESC_KVM_LOAD_PWD)
59
+	    pwd_addr = (KA_T)PWDDESC_KVM_LOAD_PWD(&pd);
60
+#else	/* !defined(PWDDESC_KVM_LOAD_PWD) */
48
+	    pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
61
+	    pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
62
+#endif	/* defined(PWDDESC_KVM_LOAD_PWD) */
63
+
49
+	    if (pwd_addr != 0) {
64
+	    if (pwd_addr != 0) {
50
+		    if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
65
+		    if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
51
+			    cdir = pwd.pwd_cdir;
66
+			    cdir = pwd.pwd_cdir;
Lines 62-68 Link Here
62
 	/*
77
 	/*
63
 	 * Allocate a local process structure.
78
 	 * Allocate a local process structure.
64
 	 */
79
 	 */
65
@@ -347,20 +380,20 @@ gather_proc_info()
80
@@ -347,20 +388,20 @@ gather_proc_info()
66
 	/*
81
 	/*
67
 	 * Save current working directory information.
82
 	 * Save current working directory information.
68
 	 */
83
 	 */
Lines 87-93 Link Here
87
 		if (Lf->sf)
102
 		if (Lf->sf)
88
 		    link_lfile();
103
 		    link_lfile();
89
 	    }
104
 	    }
90
@@ -369,10 +402,10 @@ gather_proc_info()
105
@@ -369,10 +410,10 @@ gather_proc_info()
91
 	/*
106
 	/*
92
 	 * Save jail directory information.
107
 	 * Save jail directory information.
93
 	 */
108
 	 */
Lines 100-106 Link Here
100
 		if (Lf->sf)
115
 		if (Lf->sf)
101
 		    link_lfile();
116
 		    link_lfile();
102
 	    }
117
 	    }
103
@@ -655,7 +688,29 @@ kread(addr, buf, len)
118
@@ -655,7 +696,29 @@ kread(addr, buf, len)
104
 	return((br == len) ? 0 : 1);
119
 	return((br == len) ? 0 : 1);
105
 }
120
 }
106
 
121
 
Lines 130-136 Link Here
130
 /*
145
 /*
131
  * process_text() - process text information
146
  * process_text() - process text information
132
  */
147
  */
133
@@ -682,20 +737,15 @@ process_text(vm)
148
@@ -682,20 +745,15 @@ process_text(vm)
134
 /*
149
 /*
135
  * Read the vm_map structure.  Search its vm_map_entry structure list.
150
  * Read the vm_map structure.  Search its vm_map_entry structure list.
136
  */
151
  */

Return to bug 251266