Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/wait.h
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#define SKIP_SLEEP() (SCHEDULER_STOPPED() || kdb_active) | #define SKIP_SLEEP() (SCHEDULER_STOPPED() || kdb_active) | ||||
#define might_sleep() \ | #define might_sleep() \ | ||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()") | WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()") | ||||
#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) | |||||
#if __LinuxKPI_version >= 40013 | |||||
#define __add_wait_queue_entry_tail(wqh,wq) __add_wait_queue_tail((wqh),(wq)) | |||||
#define wait_queue_entry wait_queue | |||||
#define wait_queue_entry_t wait_queue_t | |||||
#endif | |||||
struct wait_queue; | struct wait_queue; | ||||
struct wait_queue_head; | struct wait_queue_head; | ||||
typedef struct wait_queue wait_queue_t; | typedef struct wait_queue wait_queue_t; | ||||
typedef struct wait_queue_head wait_queue_head_t; | typedef struct wait_queue_head wait_queue_head_t; | ||||
typedef int wait_queue_func_t(wait_queue_t *, unsigned int, int, void *); | typedef int wait_queue_func_t(wait_queue_t *, unsigned int, int, void *); | ||||
/* | /* | ||||
* Many API consumers directly reference these fields and those of | * Many API consumers directly reference these fields and those of | ||||
* wait_queue_head. | * wait_queue_head. | ||||
*/ | */ | ||||
struct wait_queue { | struct wait_queue { | ||||
unsigned int flags; /* always 0 */ | unsigned int flags; /* always 0 */ | ||||
void *private; | void *private; | ||||
wait_queue_func_t *func; | wait_queue_func_t *func; | ||||
struct list_head task_list; | union { | ||||
/* | |||||
* Changes in Linux v4.13. | |||||
* Remove deprecated code when we | |||||
* don't depend on < 4.13 any more. | |||||
*/ | |||||
struct list_head task_list; /* < v.4.13 */ | |||||
struct list_head entry; /* >= v4.13 */ | |||||
}; | }; | ||||
}; | |||||
struct wait_queue_head { | struct wait_queue_head { | ||||
spinlock_t lock; | spinlock_t lock; | ||||
struct list_head task_list; | union { | ||||
struct list_head task_list; /* < v.4.13 */ | |||||
struct list_head head; /* >= v4.13 */ | |||||
}; | }; | ||||
}; | |||||
/* | /* | ||||
* This function is referenced by at least one DRM driver, so it may not be | * This function is referenced by at least one DRM driver, so it may not be | ||||
* renamed and furthermore must be the default wait queue callback. | * renamed and furthermore must be the default wait queue callback. | ||||
*/ | */ | ||||
extern wait_queue_func_t autoremove_wake_function; | extern wait_queue_func_t autoremove_wake_function; | ||||
extern wait_queue_func_t default_wake_function; | extern wait_queue_func_t default_wake_function; | ||||
Show All 20 Lines | #define DECLARE_WAIT_QUEUE_HEAD(name) \ | ||||
MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF) | MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF) | ||||
#define init_waitqueue_head(wqh) do { \ | #define init_waitqueue_head(wqh) do { \ | ||||
mtx_init(&(wqh)->lock.m, spin_lock_name("wqhead"), \ | mtx_init(&(wqh)->lock.m, spin_lock_name("wqhead"), \ | ||||
NULL, MTX_DEF | MTX_NEW | MTX_NOWITNESS); \ | NULL, MTX_DEF | MTX_NEW | MTX_NOWITNESS); \ | ||||
INIT_LIST_HEAD(&(wqh)->task_list); \ | INIT_LIST_HEAD(&(wqh)->task_list); \ | ||||
} while (0) | } while (0) | ||||
void linux_init_wait_entry(wait_queue_t *wait, int flags); | |||||
void linux_wake_up(wait_queue_head_t *, unsigned int, int, bool); | void linux_wake_up(wait_queue_head_t *, unsigned int, int, bool); | ||||
#define init_wait_entry(w, f) \ | |||||
linux_init_wait_entry(w, f) | |||||
#define wake_up(wqh) \ | #define wake_up(wqh) \ | ||||
linux_wake_up(wqh, TASK_NORMAL, 1, false) | linux_wake_up(wqh, TASK_NORMAL, 1, false) | ||||
#define wake_up_all(wqh) \ | #define wake_up_all(wqh) \ | ||||
linux_wake_up(wqh, TASK_NORMAL, 0, false) | linux_wake_up(wqh, TASK_NORMAL, 0, false) | ||||
#define wake_up_locked(wqh) \ | #define wake_up_locked(wqh) \ | ||||
linux_wake_up(wqh, TASK_NORMAL, 1, true) | linux_wake_up(wqh, TASK_NORMAL, 1, true) | ||||
#define wake_up_all_locked(wqh) \ | #define wake_up_all_locked(wqh) \ | ||||
linux_wake_up(wqh, TASK_NORMAL, 0, true) | linux_wake_up(wqh, TASK_NORMAL, 0, true) | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#define wait_event(wqh, cond) do { \ | #define wait_event(wqh, cond) do { \ | ||||
(void) __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ | (void) __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ | ||||
TASK_UNINTERRUPTIBLE, NULL); \ | TASK_UNINTERRUPTIBLE, NULL); \ | ||||
} while (0) | } while (0) | ||||
#define wait_event_timeout(wqh, cond, timeout) ({ \ | #define wait_event_timeout(wqh, cond, timeout) ({ \ | ||||
__wait_event_common(wqh, cond, timeout, TASK_UNINTERRUPTIBLE, \ | __wait_event_common(wqh, cond, timeout, TASK_UNINTERRUPTIBLE, \ | ||||
NULL); \ | NULL); \ | ||||
}) | |||||
#define wait_event_killable(wqh, cond) ({ \ | |||||
__wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ | |||||
TASK_KILLABLE, NULL); \ | |||||
}) | }) | ||||
#define wait_event_interruptible(wqh, cond) ({ \ | #define wait_event_interruptible(wqh, cond) ({ \ | ||||
__wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ | __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ | ||||
TASK_INTERRUPTIBLE, NULL); \ | TASK_INTERRUPTIBLE, NULL); \ | ||||
}) | }) | ||||
#define wait_event_interruptible_timeout(wqh, cond, timeout) ({ \ | #define wait_event_interruptible_timeout(wqh, cond, timeout) ({ \ | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |