kern_synch.c (29041) | kern_synch.c (29680) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 |
39 * $Id: kern_synch.c,v 1.37 1997/08/21 20:33:39 bde Exp $ | 39 * $Id: kern_synch.c,v 1.38 1997/09/02 20:05:43 bde Exp $ |
40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/proc.h> 47#include <sys/kernel.h> --- 278 unchanged lines hidden (view full) --- 326int 327tsleep(ident, priority, wmesg, timo) 328 void *ident; 329 int priority, timo; 330 char *wmesg; 331{ 332 struct proc *p = curproc; 333 int s, sig, catch = priority & PCATCH; | 40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/proc.h> 47#include <sys/kernel.h> --- 278 unchanged lines hidden (view full) --- 326int 327tsleep(ident, priority, wmesg, timo) 328 void *ident; 329 int priority, timo; 330 char *wmesg; 331{ 332 struct proc *p = curproc; 333 int s, sig, catch = priority & PCATCH; |
334 struct callout_handle thandle; |
|
334 335#ifdef KTRACE 336 if (KTRPOINT(p, KTR_CSW)) 337 ktrcsw(p->p_tracep, 1, 0); 338#endif 339 s = splhigh(); 340 if (cold || panicstr) { 341 /* --- 16 unchanged lines hidden (view full) --- 358 panic("sleeping process already on another queue"); 359#endif 360 p->p_wchan = ident; 361 p->p_wmesg = wmesg; 362 p->p_slptime = 0; 363 p->p_priority = priority & PRIMASK; 364 TAILQ_INSERT_TAIL(&slpque[LOOKUP(ident)], p, p_procq); 365 if (timo) | 335 336#ifdef KTRACE 337 if (KTRPOINT(p, KTR_CSW)) 338 ktrcsw(p->p_tracep, 1, 0); 339#endif 340 s = splhigh(); 341 if (cold || panicstr) { 342 /* --- 16 unchanged lines hidden (view full) --- 359 panic("sleeping process already on another queue"); 360#endif 361 p->p_wchan = ident; 362 p->p_wmesg = wmesg; 363 p->p_slptime = 0; 364 p->p_priority = priority & PRIMASK; 365 TAILQ_INSERT_TAIL(&slpque[LOOKUP(ident)], p, p_procq); 366 if (timo) |
366 timeout(endtsleep, (void *)p, timo); | 367 thandle = timeout(endtsleep, (void *)p, timo); |
367 /* 368 * We put ourselves on the sleep queue and start our timeout 369 * before calling CURSIG, as we could stop there, and a wakeup 370 * or a SIGCONT (or both) could occur while we were stopped. 371 * A SIGCONT would cause us to be marked as SSLEEP 372 * without resuming us, thus we must be ready for sleep 373 * when CURSIG is called. If the wakeup happens while we're 374 * stopped, p->p_wchan will be 0 upon return from CURSIG. --- 24 unchanged lines hidden (view full) --- 399 if (sig == 0) { 400#ifdef KTRACE 401 if (KTRPOINT(p, KTR_CSW)) 402 ktrcsw(p->p_tracep, 0, 0); 403#endif 404 return (EWOULDBLOCK); 405 } 406 } else if (timo) | 368 /* 369 * We put ourselves on the sleep queue and start our timeout 370 * before calling CURSIG, as we could stop there, and a wakeup 371 * or a SIGCONT (or both) could occur while we were stopped. 372 * A SIGCONT would cause us to be marked as SSLEEP 373 * without resuming us, thus we must be ready for sleep 374 * when CURSIG is called. If the wakeup happens while we're 375 * stopped, p->p_wchan will be 0 upon return from CURSIG. --- 24 unchanged lines hidden (view full) --- 400 if (sig == 0) { 401#ifdef KTRACE 402 if (KTRPOINT(p, KTR_CSW)) 403 ktrcsw(p->p_tracep, 0, 0); 404#endif 405 return (EWOULDBLOCK); 406 } 407 } else if (timo) |
407 untimeout(endtsleep, (void *)p); | 408 untimeout(endtsleep, (void *)p, thandle); |
408 if (catch && (sig != 0 || (sig = CURSIG(p)))) { 409#ifdef KTRACE 410 if (KTRPOINT(p, KTR_CSW)) 411 ktrcsw(p->p_tracep, 0, 0); 412#endif 413 if (p->p_sigacts->ps_sigintr & sigmask(sig)) 414 return (EINTR); 415 return (ERESTART); --- 301 unchanged lines hidden --- | 409 if (catch && (sig != 0 || (sig = CURSIG(p)))) { 410#ifdef KTRACE 411 if (KTRPOINT(p, KTR_CSW)) 412 ktrcsw(p->p_tracep, 0, 0); 413#endif 414 if (p->p_sigacts->ps_sigintr & sigmask(sig)) 415 return (EINTR); 416 return (ERESTART); --- 301 unchanged lines hidden --- |