summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-10-31 00:03:45 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-10-31 00:03:45 +0000
commit520aa7b79f7628ca288ed4502fde80fbeb040808 (patch)
tree6cae80e00f499882741435ba0a1b8c11f35895bc
parent1f0613d3b46d523d998071f1a8eee83f8c3760ed (diff)
The return of rfork(RFTHREAD) must be consistent with getthrid().
Fixes rthread breakage observed by Vladimir Kirillov.
-rw-r--r--sys/kern/kern_fork.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index b92ea4a2cdb..d3f98721754 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.122 2010/07/26 01:56:27 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.123 2010/10/31 00:03:44 guenther Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -480,7 +480,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
* marking us as parent via retval[1].
*/
if (retval != NULL) {
- retval[0] = p2->p_pid;
+ retval[0] = p2->p_pid +
+ (flags & FORK_THREAD ? THREAD_PID_OFFSET : 0);
retval[1] = 0;
}
return (0);