From: Matthew Dillon Date: Sat, 28 Jun 2003 02:36:44 +0000 (+0000) Subject: Give ps access to a process's thread structure. X-Git-Tag: v2.0.1~13341 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/b8acf5a9c20e92684f577e3b5ebe8344d78e228e Give ps access to a process's thread structure. --- diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index dc7faf0d51..111888f981 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -32,7 +32,7 @@ * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_proc.c,v 1.6 2003/06/26 20:27:51 dillon Exp $ + * $DragonFly: src/sys/kern/kern_proc.c,v 1.7 2003/06/28 02:36:43 dillon Exp $ */ #include @@ -430,6 +430,9 @@ sysctl_out_proc(struct proc *p, struct sysctl_req *req, int doingzomb) if (error) return (error); error = SYSCTL_OUT(req,(caddr_t)&eproc, sizeof(eproc)); + if (error) + return (error); + error = SYSCTL_OUT(req,(caddr_t)&p->p_thread, sizeof(struct thread)); if (error) return (error); if (!doingzomb && pid && (pfind(pid) != p)) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f4eaefc5f0..a313e1ab79 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -37,7 +37,7 @@ * * @(#)proc.h 8.15 (Berkeley) 5/19/95 * $FreeBSD: src/sys/sys/proc.h,v 1.99.2.9 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/proc.h,v 1.17 2003/06/27 03:30:43 dillon Exp $ + * $DragonFly: src/sys/sys/proc.h,v 1.18 2003/06/28 02:36:44 dillon Exp $ */ #ifndef _SYS_PROC_H_ @@ -232,10 +232,12 @@ struct proc { struct thread *p_thread; /* temporarily embed thread struct in proc */ }; +#if defined(_KERNEL) #define p_wchan p_thread->td_wchan #define p_wmesg p_thread->td_wmesg #define p_session p_pgrp->pg_session #define p_pgid p_pgrp->pg_id +#endif /* Status values. */ #define SIDL 1 /* Process being created by fork. */ diff --git a/sys/sys/user.h b/sys/sys/user.h index 868ac3ee30..f5c4076f3b 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -32,7 +32,7 @@ * * @(#)user.h 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/sys/user.h,v 1.24.2.1 2001/10/11 08:20:18 peter Exp $ - * $DragonFly: src/sys/sys/user.h,v 1.5 2003/06/23 23:52:51 dillon Exp $ + * $DragonFly: src/sys/sys/user.h,v 1.6 2003/06/28 02:36:44 dillon Exp $ */ #ifndef _SYS_USER_H_ @@ -93,6 +93,7 @@ struct kinfo_proc { char e_login[roundup(MAXLOGNAME, sizeof(long))]; /* setlogin() name */ long e_spare[2]; } kp_eproc; + struct thread kp_thread; /* thread structure */ }; void fill_eproc __P((struct proc *, struct eproc *));