hey,

I think we need to split the P_* flags and the S* stati between procs and lwps. This is how i see the P_* flags could be split.

How should we do with the S* status? Introduce PS* or LPS*? Processes can't sleep anymore, but they could be stopped. Do we want a flag for that or do we check p_nstopped == p_nthreads?

cheers
  simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Index: sys/proc.h
===================================================================
RCS file: /cvs/src/sys/sys/proc.h,v
retrieving revision 1.70
diff -u -r1.70 proc.h
--- sys/proc.h  11 Oct 2005 09:59:56 -0000      1.70
+++ sys/proc.h  11 Oct 2005 20:50:11 -0000
@@ -317,8 +317,8 @@
 #define        P_INMEM         0x00004 /* Loaded into memory. */
 #define        P_PPWAIT        0x00010 /* Parent is waiting for child to 
exec/exit. */
 #define        P_PROFIL        0x00020 /* Has started profiling. */
-#define P_SELECT       0x00040 /* Selecting; wakeup/waiting danger. */
-#define        P_SINTR         0x00080 /* Sleep is interruptible. */
+#define LWP_SELECT     0x00040 /* Selecting; wakeup/waiting danger. */
+#define        LWP_SINTR       0x00080 /* Sleep is interruptible. */
 #define        P_SUGID         0x00100 /* Had set id privileges since last 
exec. */
 #define        P_SYSTEM        0x00200 /* System proc: no sigs, stats or 
swapping. */
 #define        P_UNUSED00400   0x00400
@@ -331,23 +331,23 @@
 /* was P_NOSWAP        0x08000 was: Do not swap upages; p->p_hold */
 /* was P_PHYSIO        0x10000 was: Doing physical I/O; use p->p_hold */
 
-#define        P_UPCALLPEND    0x20000 /* an upcall is pending */
+#define        LWP_UPCALLPEND  0x20000 /* an upcall is pending */
 
 #define        P_SWAPPING      0x40000 /* Process is being swapped. */
 #define        P_SWAPINREQ     0x80000 /* Swapin request due to wakeup */
 
 /* Marked a kernel thread */
-#define        P_ONRUNQ        0x100000 /* on a user scheduling run queue */
-#define        P_KTHREADP      0x200000 /* Process is really a kernel thread */
+#define        LWP_ONRUNQ      0x100000 /* on a user scheduling run queue */
+#define        P_KTHREADP      0x200000 /* Process is really a kernel thread 
XXX not used? */
 #define P_UNUSED400000 0x400000
-#define        P_DEADLKTREAT   0x800000 /* lock aquisition - deadlock 
treatment */
+#define        LWP_DEADLKTREAT   0x800000 /* lock aquisition - deadlock 
treatment XXX not used? */
 
 #define        P_JAILED        0x1000000 /* Process is in jail */
-#define        P_OLDMASK       0x2000000 /* need to restore mask before pause 
*/
-#define        P_ALTSTACK      0x4000000 /* have alternate signal stack */
+#define        LWP_OLDMASK     0x2000000 /* need to restore mask before pause 
*/
+#define        LWP_ALTSTACK    0x4000000 /* have alternate signal stack */
 #define        P_INEXEC        0x8000000 /* Process is in execve(). */
-#define P_PASSIVE_ACQ  0x10000000 /* Passive acquire cpu (see kern_switch) */
-#define        P_UPCALLWAIT    0x20000000 /* Wait for upcall or signal */
+#define LWP_PASSIVE_ACQ        0x10000000 /* Passive acquire cpu (see 
kern_switch) */
+#define        LWP_UPCALLWAIT  0x20000000 /* Wait for upcall or signal */
 
 #ifdef _KERNEL
 
@@ -371,6 +371,7 @@
  * Handy macro for LISTs.
  */
 #define FOREACH_PROC_IN_SYSTEM(p)      LIST_FOREACH((p), &allproc, p_list)
+#define FOREACH_LWP_IN_PROC(p, lp)     LIST_FOREACH((lp), (p)->p_lwps, 
lwp_list)
 
 /*
  * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t,

Reply via email to