summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-01-02 02:48:03 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-01-02 02:48:03 +0000
commit5b1618d74b95433796387f58c2f50a1ad4967cb9 (patch)
treee51918d02fbd4fa61632a77f4ba80158fb6eb975 /sys/kern
parentd09fe4b5dc86bf5c41075659e42f9f279b6f6249 (diff)
downloadFreeBSD-src-5b1618d74b95433796387f58c2f50a1ad4967cb9.zip
FreeBSD-src-5b1618d74b95433796387f58c2f50a1ad4967cb9.tar.gz
Adjust code for Julian's last commit. use td_mailbox to detect if
a syscall is from UTS kernel.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_kse.c18
-rw-r--r--sys/kern/kern_thread.c18
2 files changed, 16 insertions, 20 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index 8434c68..166e688 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -317,11 +317,8 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
struct ksegrp *kg;
p = td->td_proc;
- /* KSE-enabled processes only, please. */
- if (!(p->p_flag & P_KSES))
- return (EINVAL);
- /* must be a bound thread */
- if (td->td_flags & TDF_UNBOUND)
+ /* Only UTS can do the syscall */
+ if (!(p->p_flag & P_KSES) || (td->td_mailbox != NULL))
return (EINVAL);
kg = td->td_ksegrp;
/* serialize killing kse */
@@ -358,11 +355,11 @@ kse_release(struct thread * td, struct kse_release_args * uap)
p = td->td_proc;
kg = td->td_ksegrp;
/*
- * Must be a bound thread. And kse must have a mailbox ready,
- * if not, the kse can not generate an upcall.
+ * kse must have a mailbox ready for upcall, and only UTS can
+ * do the syscall.
*/
if (!(p->p_flag & P_KSES) ||
- (td->td_flags & TDF_UNBOUND) ||
+ (td->td_mailbox != NULL) ||
(td->td_kse->ke_mailbox == NULL))
return (EINVAL);
@@ -1310,9 +1307,10 @@ thread_user_enter(struct proc *p, struct thread *td)
* has already done an upcall.
*/
if (p->p_numthreads > max_threads_per_proc) {
- if (td->td_standin != NULL)
+ if (td->td_standin != NULL) {
thread_stash(td->td_standin);
- td->td_standin = NULL;
+ td->td_standin = NULL;
+ }
} else {
if (td->td_standin == NULL)
td->td_standin = thread_alloc();
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 8434c68..166e688 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -317,11 +317,8 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
struct ksegrp *kg;
p = td->td_proc;
- /* KSE-enabled processes only, please. */
- if (!(p->p_flag & P_KSES))
- return (EINVAL);
- /* must be a bound thread */
- if (td->td_flags & TDF_UNBOUND)
+ /* Only UTS can do the syscall */
+ if (!(p->p_flag & P_KSES) || (td->td_mailbox != NULL))
return (EINVAL);
kg = td->td_ksegrp;
/* serialize killing kse */
@@ -358,11 +355,11 @@ kse_release(struct thread * td, struct kse_release_args * uap)
p = td->td_proc;
kg = td->td_ksegrp;
/*
- * Must be a bound thread. And kse must have a mailbox ready,
- * if not, the kse can not generate an upcall.
+ * kse must have a mailbox ready for upcall, and only UTS can
+ * do the syscall.
*/
if (!(p->p_flag & P_KSES) ||
- (td->td_flags & TDF_UNBOUND) ||
+ (td->td_mailbox != NULL) ||
(td->td_kse->ke_mailbox == NULL))
return (EINVAL);
@@ -1310,9 +1307,10 @@ thread_user_enter(struct proc *p, struct thread *td)
* has already done an upcall.
*/
if (p->p_numthreads > max_threads_per_proc) {
- if (td->td_standin != NULL)
+ if (td->td_standin != NULL) {
thread_stash(td->td_standin);
- td->td_standin = NULL;
+ td->td_standin = NULL;
+ }
} else {
if (td->td_standin == NULL)
td->td_standin = thread_alloc();
OpenPOWER on IntegriCloud