Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Paste
P456
Masterwork From Distant Lands
Active
Public
Actions
Authored by
cem
on Nov 12 2020, 11:08 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
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
edited the content of this paste.
(Show Details)
Nov 12 2020, 11:08 PM
2020-11-12 23:08:14 (UTC+0)
cem
changed the title of this paste from untitled to
Masterwork From Distant Lands
.
cem
mentioned this in
D27037: Split out cwd/root/jail, cmask state from filedesc table
.
Nov 12 2020, 11:08 PM
2020-11-12 23:08:34 (UTC+0)
cem
edited the content of this paste.
(Show Details)
Nov 17 2020, 9:02 PM
2020-11-17 21:02:32 (UTC+0)
Log In to Comment