Index: sys/kern/kern_thread.c =================================================================== --- sys/kern/kern_thread.c +++ sys/kern/kern_thread.c @@ -865,7 +865,7 @@ * * Such locations include userret(). * If the "return_instead" argument is non zero, the thread must be able to - * accept 0 (caller may continue), or 1 (caller must abort) as a result. + * accept 0 (caller may continue), or non-zero (caller must abort) as a result. * * The 'return_instead' argument tells the function if it may do a * thread_exit() or suspend, or whether the caller must abort and back @@ -877,11 +877,11 @@ * * P_SINGLE_EXIT | return_instead == 0| return_instead != 0 *---------------+--------------------+--------------------- - * 0 | returns 0 | returns 0 or 1 + * 0 | returns 0 | returns * | when ST ends | immediately *---------------+--------------------+--------------------- - * 1 | thread exits | returns 1 - * | | immediately + * 1 | thread exits | returns + * | | immediately * 0 = thread_exit() or suspension ok, * other = return error instead of stopping the thread. * @@ -915,14 +915,6 @@ if (p->p_singlethread == td) return (0); /* Exempt from stopping. */ } - if ((p->p_flag & P_SINGLE_EXIT) && return_instead) - return (EINTR); - - /* Should we goto user boundary if we didn't come from there? */ - if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE && - (p->p_flag & P_SINGLE_BOUNDARY) && return_instead) - return (ERESTART); - /* * Ignore suspend requests if they are deferred. */ @@ -935,6 +927,9 @@ return (TD_SBDRY_INTR(td) ? TD_SBDRY_ERRNO(td) : 0); } + if (return_instead) + return (ERESTART); + /* * If the process is waiting for us to exit, * this thread should just suicide.