Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2002 12:36:22 -0700 (PDT)
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 12090 for review
Message-ID:  <200205291936.g4TJaMK79460@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12090

Change 12090 by julian@julian_ref on 2002/05/29 12:35:49

	Patch (with duct tape) a bit of the worst libkvm broken-ness.

Affected files ...

... //depot/projects/kse/lib/libkvm/kvm_proc.c#12 edit
... //depot/projects/kse/sys/sys/proc.h#102 edit

Differences ...

==== //depot/projects/kse/lib/libkvm/kvm_proc.c#12 (text+ko) ====

@@ -325,10 +325,24 @@
 		kp->ki_estcpu = proc.p_ksegrp.kg_estcpu;	/* XXXKSE */
 		kp->ki_slptime = proc.p_kse.ke_slptime;		/* XXXKSE */
 		kp->ki_swtime = proc.p_swtime;
-		kp->ki_flag = proc.p_flag;
+		kp->ki_flag = proc.p_flag;	/* WILDLY INNACURATE XXXKSE */
 		kp->ki_sflag = proc.p_sflag;
 		kp->ki_wchan = mainthread.td_wchan;		/* XXXKSE */
 		kp->ki_traceflag = proc.p_traceflag;
+		if (proc.p_state == PRS_NORMAL) { /*  XXXKSE very aproximate */
+			if ((mainthread.td_state == TDS_RUN) ||
+			    (mainthread.td_state == TDS_RUNNING) {
+				kp->ki_stat = SRUN;
+			} else if (mainthread.td_state == TDS_SLEEP) {
+				kp->ki_stat = SSLEEP;
+			} else if (P_SHOULDSTOP(&proc)) {
+				kp->ki_stat = SSTOP;
+			}
+		} else (proc.p_state == PRS_ZOMBIE) {
+			kp->ki_stat = SZOMB;
+		} else {
+			kp->ki_stat = SIDL;
+		}
 		kp->ki_stat = proc.p_state;
 		kp->ki_pri.pri_class = proc.p_ksegrp.kg_pri_class; /* XXXKSE */
 		kp->ki_pri.pri_user = proc.p_ksegrp.kg_user_pri; /* XXXKSE */

==== //depot/projects/kse/sys/sys/proc.h#102 (text+ko) ====

@@ -523,9 +523,6 @@
 #define	P_KTHREAD	0x00004	/* Kernel thread. (*)*/
 #define	P_NOLOAD	0x00008	/* Ignore during load avg calculations. */
 #define	P_PPWAIT	0x00010	/* Parent is waiting for child to exec/exit. */
-/*#define P_SPARE	0x00020 *//* SPARE */
-/*#define P_SPARE	0x00040 *//* SPARE */
-/*#define P_SPARE	0x00080 *//* SPARE */
 #define	P_SUGID		0x00100	/* Had set id privileges since last exec. */
 #define	P_SYSTEM	0x00200	/* System proc: no sigs, stats or swapping. */
 #define	P_WAITED	0x01000	/* Someone is waiting for us */
@@ -560,6 +557,14 @@
 #define	PS_SWAPPING	0x00200	/* Process is being swapped. */
 #define	PS_NEEDSIGCHK	0x02000	/* Process may need signal delivery. */
 
+#ifndef _KERNEL /* Only usable by libkvm for legacy apps */
+#define SIDL	1		/* Process being created by fork. */
+#define SRUN	2		/* Currently runnable. */
+#define SSLEEP	3		/* Sleeping on an address. */
+#define SSTOP	4		/* Process debugging or suspension. */
+#define SZOMB	5		/* Awaiting collection by parent. */
+#endif
+
 #define	P_MAGIC		0xbeefface
 
 #ifdef _KERNEL

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205291936.g4TJaMK79460>