summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-05-25 04:39:42 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-05-25 04:39:42 +0000
commit0de601c280f7774e627bbabcfdf5bcdd1787959c (patch)
treeabad380356fa48ee14f8bad1d2922201530fd134 /sys/kern
parent8093f5e607f42cbabe8359e77f8982ec908b2bac (diff)
Change the KERN_FILE_BYPID and KERN_FILE_BYUID modes of the KERN_FILE2
sysctl() to be per-process instead of per-thread. This means the filedesc table has to really be per-process instead of per-thread, so make it an error for the linux clone() emulation to try to do otherwise. This removes pointless duplication in fstat's output. requested by jsing@ and deraadt@, ok matthew@ deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index ba6e06515ce..e15d254edbc 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.223 2012/05/02 20:42:25 guenther Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.224 2012/05/25 04:39:41 guenther Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1288,8 +1288,11 @@ sysctl_file2(int *name, u_int namelen, char *where, size_t *sizep,
break;
}
LIST_FOREACH(pp, &allproc, p_list) {
- /* skip system, exiting, embryonic and undead processes */
- if ((pp->p_flag & P_SYSTEM) || (pp->p_flag & P_WEXIT)
+ /*
+ * skip system, exiting, embryonic and undead
+ * processes, as well as threads
+ */
+ if ((pp->p_flag & (P_SYSTEM | P_WEXIT | P_THREAD))
|| (pp->p_p->ps_flags & PS_EXITING)
|| pp->p_stat == SIDL || pp->p_stat == SZOMB)
continue;
@@ -1317,8 +1320,11 @@ sysctl_file2(int *name, u_int namelen, char *where, size_t *sizep,
break;
case KERN_FILE_BYUID:
LIST_FOREACH(pp, &allproc, p_list) {
- /* skip system, exiting, embryonic and undead processes */
- if ((pp->p_flag & P_SYSTEM) || (pp->p_flag & P_WEXIT)
+ /*
+ * skip system, exiting, embryonic and undead
+ * processes, as well as threads
+ */
+ if ((pp->p_flag & (P_SYSTEM | P_WEXIT | P_THREAD))
|| (pp->p_p->ps_flags & PS_EXITING)
|| pp->p_stat == SIDL || pp->p_stat == SZOMB)
continue;