Deleted Added
full compact
subr_sleepqueue.c (300109) subr_sleepqueue.c (302328)
1/*-
2 * Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * must consistently use the same lock to synchronize with a wait channel,
53 * though this check is currently only a warning for sleep/wakeup due to
54 * pre-existing abuse of that API. The same lock must also be held when
55 * awakening threads, though that is currently only enforced for condition
56 * variables.
57 */
58
59#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * must consistently use the same lock to synchronize with a wait channel,
53 * though this check is currently only a warning for sleep/wakeup due to
54 * pre-existing abuse of that API. The same lock must also be held when
55 * awakening threads, though that is currently only enforced for condition
56 * variables.
57 */
58
59#include <sys/cdefs.h>
60__FBSDID("$FreeBSD: head/sys/kern/subr_sleepqueue.c 300109 2016-05-18 03:50:21Z markj $");
60__FBSDID("$FreeBSD: head/sys/kern/subr_sleepqueue.c 302328 2016-07-03 18:19:48Z kib $");
61
62#include "opt_sleepqueue_profiling.h"
63#include "opt_ddb.h"
64#include "opt_sched.h"
65#include "opt_stack.h"
66
67#include <sys/param.h>
68#include <sys/systm.h>

--- 379 unchanged lines hidden (view full) ---

448 thread_unlock(td);
449 mtx_unlock_spin(&sc->sc_lock);
450 CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
451 (void *)td, (long)p->p_pid, td->td_name);
452 PROC_LOCK(p);
453 ps = p->p_sigacts;
454 mtx_lock(&ps->ps_mtx);
455 sig = cursig(td);
61
62#include "opt_sleepqueue_profiling.h"
63#include "opt_ddb.h"
64#include "opt_sched.h"
65#include "opt_stack.h"
66
67#include <sys/param.h>
68#include <sys/systm.h>

--- 379 unchanged lines hidden (view full) ---

448 thread_unlock(td);
449 mtx_unlock_spin(&sc->sc_lock);
450 CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
451 (void *)td, (long)p->p_pid, td->td_name);
452 PROC_LOCK(p);
453 ps = p->p_sigacts;
454 mtx_lock(&ps->ps_mtx);
455 sig = cursig(td);
456 if (sig == 0) {
456 if (sig == -1) {
457 mtx_unlock(&ps->ps_mtx);
457 mtx_unlock(&ps->ps_mtx);
458 KASSERT((td->td_flags & TDF_SBDRY) != 0, ("lost TDF_SBDRY"));
459 KASSERT(TD_SBDRY_INTR(td),
460 ("lost TDF_SERESTART of TDF_SEINTR"));
461 KASSERT((td->td_flags & (TDF_SEINTR | TDF_SERESTART)) !=
462 (TDF_SEINTR | TDF_SERESTART),
463 ("both TDF_SEINTR and TDF_SERESTART"));
464 ret = TD_SBDRY_ERRNO(td);
465 } else if (sig == 0) {
466 mtx_unlock(&ps->ps_mtx);
458 ret = thread_suspend_check(1);
459 MPASS(ret == 0 || ret == EINTR || ret == ERESTART);
460 } else {
461 if (SIGISMEMBER(ps->ps_sigintr, sig))
462 ret = EINTR;
463 else
464 ret = ERESTART;
465 mtx_unlock(&ps->ps_mtx);

--- 903 unchanged lines hidden ---
467 ret = thread_suspend_check(1);
468 MPASS(ret == 0 || ret == EINTR || ret == ERESTART);
469 } else {
470 if (SIGISMEMBER(ps->ps_sigintr, sig))
471 ret = EINTR;
472 else
473 ret = ERESTART;
474 mtx_unlock(&ps->ps_mtx);

--- 903 unchanged lines hidden ---