84 lines
2.6 KiB
Plaintext
84 lines
2.6 KiB
Plaintext
$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;
|