summaryrefslogtreecommitdiff
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2002-02-17 01:09:56 +0000
committerJulian Elischer <julian@FreeBSD.org>2002-02-17 01:09:56 +0000
commit2eb927e2bb836a41f794d8a3887c4c6d438bcb90 (patch)
tree3dd328b38aee15fdbfd88129f31df6365b57a0d8 /sys/kern/kern_prot.c
parent39a2e724e1df056c27f90930ac98793b48edb9ef (diff)
Notes
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 4214cc1ddf40..f7056a0eca53 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1684,6 +1684,27 @@ crdup(cr)
}
/*
+ * small routine to swap a thread's current ucred for the correct one
+ * taken from the process.
+ */
+void
+cred_update_thread(struct thread *td)
+{
+ struct proc *p;
+
+ p = td->td_proc;
+ if (td->td_ucred != NULL) {
+ mtx_lock(&Giant);
+ crfree(td->td_ucred);
+ mtx_unlock(&Giant);
+ td->td_ucred = NULL;
+ }
+ PROC_LOCK(p);
+ td->td_ucred = crhold(p->p_ucred);
+ PROC_UNLOCK(p);
+}
+
+/*
* Get login name, if available.
*/
#ifndef _SYS_SYSPROTO_H_