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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
$NetBSD: patch-ab,v 1.3 2006/06/21 20:41:27 joerg Exp $
--- src/FreeBSD/os.c.orig 2006-06-21 20:12:56.000000000 +0000
+++ src/FreeBSD/os.c
@@ -125,16 +125,27 @@ GetStatus(ProcInfo *p)
if (!active.allprocs) {
#ifdef HAVE_REGEX
if (active.match_regexp) {
+#if defined(__DragonFly__)
+ int regmatch = regexec(&active.re_pat,
+ IDtouser(proc->kp_eproc.e_ucred.cr_ruid),
+ (size_t) NULL, (regmatch_t *) NULL,
+ REG_NOTBOL|REG_NOTEOL);
+#else
int regmatch = regexec(&active.re_pat,
IDtouser(proc->kp_eproc.e_pcred.p_ruid),
(size_t) NULL, (regmatch_t *) NULL,
REG_NOTBOL|REG_NOTEOL);
+#endif
if (regmatch == REG_NOMATCH) {
return False;
}
} else {
#endif
+#if defined(__DragonFly__)
+ if (active.uid_displayed != proc->kp_eproc.e_ucred.cr_ruid)
+#else
if (active.uid_displayed != proc->kp_eproc.e_pcred.p_ruid)
+#endif
return False;
#ifdef HAVE_REGEX
}
@@ -166,8 +177,10 @@ GetStatus(ProcInfo *p)
if (proc->kp_proc.p_pid == MyPid && !cmd_options.me_too)
pstat = SSLEEP;
+#if !defined(__DragonFly__)
else if ((proc->kp_proc.p_flag & P_INMEM) == 0)
pstat = SSWAP;
+#endif
else
pstat = proc->kp_proc.p_stat;
@@ -179,7 +192,11 @@ void
GetProcName(ProcInfo *p, TREENODE *node)
{
ProcInfo proc = *p;
+#if defined(__DragonFly__)
+ node->uid = proc->kp_eproc.e_ucred.cr_ruid;
+#else
node->uid = proc->kp_eproc.e_pcred.p_ruid;
+#endif
if (proc->kp_proc.p_stat == SZOMB)
strcpy(node->label, "*zombie*");
@@ -196,9 +213,15 @@ GetProcName(ProcInfo *p, TREENODE *node)
/* We've got a sleeping process. (Hopefully that's the majority of
the processes. Assign a color based on userid. */
+#if defined(__DragonFly__)
+ node->color = GetUID_Color(proc->kp_eproc.e_ucred.cr_ruid);
+
+ if ( (username=IDtouser(proc->kp_eproc.e_ucred.cr_ruid)) != NULL ) {
+#else
node->color = GetUID_Color(proc->kp_eproc.e_pcred.p_ruid);
if ( (username=IDtouser(proc->kp_eproc.e_pcred.p_ruid)) != NULL ) {
+#endif
strcpy(node->label1, username);
} else {
strcpy(node->label1, UNKNOWN_USER);
@@ -209,7 +232,11 @@ GetProcName(ProcInfo *p, TREENODE *node)
#ifdef XPS_RECOLOR_LOGIN_PROCESSES
for (i=0;i<NUMLABS ;i++ ) {
if (strcmp(node->label, label_array[i]) == 0) {
+#if defined(__DragonFly__)
+ strcpy(node->label, IDtouser(proc->kp_eproc.e_ucred.cr_ruid));
+#else
strcpy(node->label, IDtouser(proc->kp_eproc.e_pcred.p_ruid));
+#endif
strcpy(node->label1, label_array[i]);
node->color = base.xterm;
node->show_username = 1;
|