summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2000-06-18 17:59:57 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2000-06-18 17:59:57 +0000
commit3e1b0c93cbfea793e98b3b3bf7551399ede91f93 (patch)
treeb3afe1b2bd5097be03d5846b827f206f8539ac5f /sys/kern
parent69a21ea0afdd021cb62f457b1cf6f2a69856ee12 (diff)
Mark kernel threads as system processes. Make ps hide them by default,
show them with -k. Do not try to show RSS based values for them as they mess up column alignment. vmstat -f now shows kernel threads separately from rforks too.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c5
-rw-r--r--sys/kern/kern_kthread.c5
-rw-r--r--sys/kern/kern_sysctl.c10
3 files changed, 14 insertions, 6 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index b2a08f77625..30eb6228e73 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.31 2000/03/23 16:54:44 art Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.32 2000/06/18 17:59:55 niklas Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -384,6 +384,9 @@ again:
} else if (flags & FORK_RFORK) {
forkstat.cntrfork++;
forkstat.sizrfork += vm->vm_dsize + vm->vm_ssize;
+ } else {
+ forkstat.cntkthread++;
+ forkstat.sizkthread += vm->vm_dsize + vm->vm_ssize;
}
/*
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 4d4a90fec05..096ec9023ca 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_kthread.c,v 1.7 2000/01/31 19:57:19 deraadt Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.8 2000/06/18 17:59:55 niklas Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
@@ -83,8 +83,7 @@ kthread_create(func, arg, newpp, fmt, va_alist)
* descriptors and don't leave the exit status around for the
* parent to wait for.
*/
- error = fork1(&proc0, FORK_RFORK|FORK_SHAREVM|FORK_NOZOMBIE, NULL,
- 0, rv);
+ error = fork1(&proc0, FORK_SHAREVM|FORK_NOZOMBIE, NULL, 0, rv);
if (error)
return (error);
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index eca6d0e08da..4ecc9bdd2f0 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.35 2000/06/05 11:02:51 art Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.36 2000/06/18 17:59:55 niklas Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -715,7 +715,8 @@ sysctl_doproc(name, namelen, where, sizep)
struct eproc eproc;
int error = 0;
- if (namelen != 2 && !(namelen == 1 && name[0] == KERN_PROC_ALL))
+ if (namelen != 2 && !(namelen == 1 &&
+ (name[0] == KERN_PROC_ALL || name[0] == KERN_PROC_KTHREAD)))
return (EINVAL);
p = LIST_FIRST(&allproc);
doingzomb = 0;
@@ -760,6 +761,11 @@ again:
if (p->p_cred->p_ruid != (uid_t)name[1])
continue;
break;
+
+ case KERN_PROC_ALL:
+ if (p->p_flag & P_SYSTEM)
+ continue;
+ break;
}
if (buflen >= sizeof(struct kinfo_proc)) {
fill_eproc(p, &eproc);