summaryrefslogtreecommitdiff
path: root/sysutils/libgtop/patches/patch-df
blob: 4e5528013ea78452f836996215a8a597eb9b54bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$NetBSD: patch-df,v 1.1 2009/07/11 13:14:13 hasso Exp $

--- sysdeps/freebsd/procstate.c.orig	2008-05-24 01:13:23 +0300
+++ sysdeps/freebsd/procstate.c	2009-07-11 15:26:10 +0300
@@ -64,6 +64,37 @@ glibtop_get_proc_state_p (glibtop *serve
 		return;
 	}
 
+#ifdef __DragonFly__
+	buf->uid = pinfo[0].kp_ruid;
+	buf->gid = pinfo[0].kp_rgid;
+
+	g_strlcpy (buf->cmd, pinfo[0].kp_comm, sizeof (buf->cmd));
+
+	switch (pinfo[0].kp_stat) {
+		case SACTIVE:
+			switch (pinfo[0].kp_lwp.kl_stat) {
+				case LSRUN:
+					buf->state = GLIBTOP_PROCESS_RUNNING;
+					break;
+				case LSSLEEP:
+					buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
+					break;
+				case LSSTOP:
+					buf->state = GLIBTOP_PROCESS_STOPPED;
+					break;
+				default:
+					buf->state = 0;
+					break;
+			}
+		case SZOMB:
+			buf->state = GLIBTOP_PROCESS_ZOMBIE;
+			break;
+		case SIDL:
+		default:
+			buf->state = 0;
+			break;
+	}
+#else
 	buf->uid = pinfo[0].ki_ruid;
 	buf->gid = pinfo[0].ki_rgid;
 
@@ -91,6 +122,7 @@ glibtop_get_proc_state_p (glibtop *serve
 			buf->state = 0;
 			break;
 	}
+#endif
 
 	buf->flags = _glibtop_sysdeps_proc_state;
 }