Page MenuHomeFreeBSD
Paste P456

Masterwork From Distant Lands
ActivePublic

Authored by cem on Thu, Nov 12, 11:08 PM.
diff --git a/dialects/freebsd/dproc.c b/dialects/freebsd/dproc.c
index 8533265..6b66937 100644
--- a/dialects/freebsd/dproc.c
+++ b/dialects/freebsd/dproc.c
@@ -44,6 +44,9 @@ static char copyright[] =
#if __FreeBSD_version >= 1300081
#define HAS_PWD
#endif
+#if __FreeBSD_version >= 1300130
+#define HAS_PWDDESC
+#endif
_PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
_PROTOTYPE(static void get_kernel_access,(void));
@@ -125,6 +128,9 @@ gather_proc_info()
* streams with eXPORT data,
* where supported */
struct filedesc fd;
+#if defined(HAS_PWDDESC)
+ struct pwddesc pd;
+#endif
int i, nf;
MALLOC_S nb;
@@ -317,6 +323,12 @@ gather_proc_info()
|| kread((KA_T)p->P_FD, (char *)&fd, sizeof(fd)))
continue;
+#if defined(HAS_PWDDESC)
+ if (!p->ki_pd
+ || kread((KA_T)p->ki_pd, (char *)&pd, sizeof(pd)))
+ continue;
+#endif
+
#if defined(HAS_FDESCENTTBL)
if (!fd.fd_files
|| kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt)))
@@ -330,7 +342,11 @@ gather_proc_info()
#if defined(HAS_PWD)
cdir = rdir = jdir = NULL;
+#if defined(HAS_PWDDESC)
+ pwd_addr = (KA_T)PWDDESC_KVM_LOAD_PWD(&pd);
+#else
pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
+#endif
if (pwd_addr != 0) {
if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
cdir = pwd.pwd_cdir;

Event Timeline

cem changed the title of this paste from untitled to Masterwork From Distant Lands.