summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authorluoqi <luoqi@FreeBSD.org>1999-12-06 04:53:08 +0000
committerluoqi <luoqi@FreeBSD.org>1999-12-06 04:53:08 +0000
commit5c9244cd12f812687a0e1da3fa8fd69c320bdb42 (patch)
tree3d2bdc635a51af92e9000f2fe294d685906d5387 /sys/vm/vm_glue.c
parent5851b69ff706eaa8e3a487bdfbbf3fe0177ed46a (diff)
downloadFreeBSD-src-5c9244cd12f812687a0e1da3fa8fd69c320bdb42.zip
FreeBSD-src-5c9244cd12f812687a0e1da3fa8fd69c320bdb42.tar.gz
User ldt sharing.
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 5ec101f..7aa092d 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -209,6 +209,21 @@ vm_fork(p1, p2, flags)
{
register struct user *up;
+ if ((flags & RFPROC) == 0) {
+ /*
+ * Divorce the memory, if it is shared, essentially
+ * this changes shared memory amongst threads, into
+ * COW locally.
+ */
+ if ((flags & RFMEM) == 0) {
+ if (p1->p_vmspace->vm_refcnt > 1) {
+ vmspace_unshare(p1);
+ }
+ }
+ cpu_fork(p1, p2, flags);
+ return;
+ }
+
if (flags & RFMEM) {
p2->p_vmspace = p1->p_vmspace;
p1->p_vmspace->vm_refcnt++;
@@ -259,7 +274,7 @@ vm_fork(p1, p2, flags)
* cpu_fork will copy and update the pcb, set up the kernel stack,
* and make the child ready to run.
*/
- cpu_fork(p1, p2);
+ cpu_fork(p1, p2, flags);
}
/*
OpenPOWER on IntegriCloud