diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2015-06-10 10:43:59 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2015-06-10 10:43:59 +0000 |
commit | 4ea6a9a28fd7ae3cc6e8697bc93f9ce5ea6b6262 (patch) | |
tree | 4be753ea914cbf9f2ee65a2a1cc53e6989224d5d /sys/kern/kern_fork.c | |
parent | 8bd0e175953787f1209a257c622415b6e93cf29c (diff) | |
download | src-4ea6a9a28fd7ae3cc6e8697bc93f9ce5ea6b6262.tar.gz src-4ea6a9a28fd7ae3cc6e8697bc93f9ce5ea6b6262.zip |
Generalised support for copy-on-write structures shared by threads.
Thread credentials are maintained as follows: each thread has a pointer to
creds and a reference on them. The pointer is compared with proc's creds on
userspace<->kernel boundary and updated if needed.
This patch introduces a counter which can be compared instead, so that more
structures can use this scheme without adding more comparisons on the boundary.
Notes
Notes:
svn path=/head/; revision=284214
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index a3fde184ed7b..835b497195c8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -496,7 +496,6 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2, p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); - td2->td_ucred = crhold(p2->p_ucred); if (flags & RFSIGSHARE) { p2->p_sigacts = sigacts_hold(p1->p_sigacts); @@ -526,6 +525,8 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2, */ lim_fork(p1, p2); + thread_cow_get_proc(td2, p2); + pstats_fork(p1->p_stats, p2->p_stats); PROC_UNLOCK(p1); |