Index: head/share/man/man9/sleep.9 =================================================================== --- head/share/man/man9/sleep.9 +++ head/share/man/man9/sleep.9 @@ -47,14 +47,14 @@ .In sys/systm.h .In sys/proc.h .Ft int -.Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo" +.Fn msleep "const void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo" .Ft int -.Fn msleep_sbt "void *chan" "struct mtx *mtx" "int priority" \ +.Fn msleep_sbt "const void *chan" "struct mtx *mtx" "int priority" \ "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft int -.Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo" +.Fn msleep_spin "const void *chan" "struct mtx *mtx" "const char *wmesg" "int timo" .Ft int -.Fn msleep_spin_sbt "void *chan" "struct mtx *mtx" "const char *wmesg" \ +.Fn msleep_spin_sbt "const void *chan" "struct mtx *mtx" "const char *wmesg" \ "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft int .Fn pause "const char *wmesg" "int timo" @@ -64,16 +64,16 @@ .Fn pause_sbt "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" \ "int flags" .Ft int -.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo" +.Fn tsleep "const void *chan" "int priority" "const char *wmesg" "int timo" .Ft int -.Fn tsleep_sbt "void *chan" "int priority" "const char *wmesg" \ +.Fn tsleep_sbt "const void *chan" "int priority" "const char *wmesg" \ "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft void -.Fn wakeup "void *chan" +.Fn wakeup "const void *chan" .Ft void -.Fn wakeup_one "void *chan" +.Fn wakeup_one "const void *chan" .Ft void -.Fn wakeup_any "void *chan" +.Fn wakeup_any "const void *chan" .Sh DESCRIPTION The functions .Fn tsleep , Index: head/share/man/man9/sleepqueue.9 =================================================================== --- head/share/man/man9/sleepqueue.9 +++ head/share/man/man9/sleepqueue.9 @@ -54,40 +54,40 @@ .Ft int .Fn sleepq_abort "struct thread *td" .Ft void -.Fn sleepq_add "void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue" +.Fn sleepq_add "const void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue" .Ft struct sleepqueue * .Fn sleepq_alloc "void" .Ft int -.Fn sleepq_broadcast "void *wchan" "int flags" "int pri" "int queue" +.Fn sleepq_broadcast "const void *wchan" "int flags" "int pri" "int queue" .Ft void .Fn sleepq_free "struct sleepqueue *sq" .Ft struct sleepqueue * -.Fn sleepq_lookup "void *wchan" +.Fn sleepq_lookup "const void *wchan" .Ft void -.Fn sleepq_lock "void *wchan" +.Fn sleepq_lock "const void *wchan" .Ft void -.Fn sleepq_release "void *wchan" +.Fn sleepq_release "const void *wchan" .Ft void -.Fn sleepq_remove "struct thread *td" "void *wchan" +.Fn sleepq_remove "struct thread *td" "const void *wchan" .Ft int -.Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue" +.Fn sleepq_signal "const void *wchan" "int flags" "int pri" "int queue" .Ft void -.Fn sleepq_set_timeout "void *wchan" "int timo" +.Fn sleepq_set_timeout "const void *wchan" "int timo" .Ft void -.Fn sleepq_set_timeout_sbt "void *wchan" "sbintime_t sbt" \ +.Fn sleepq_set_timeout_sbt "const void *wchan" "sbintime_t sbt" \ "sbintime_t pr" "int flags" .Ft u_int -.Fn sleepq_sleepcnt "void *wchan" "int queue" +.Fn sleepq_sleepcnt "const void *wchan" "int queue" .Ft int -.Fn sleepq_timedwait "void *wchan" "int pri" +.Fn sleepq_timedwait "const void *wchan" "int pri" .Ft int -.Fn sleepq_timedwait_sig "void *wchan" "int pri" +.Fn sleepq_timedwait_sig "const void *wchan" "int pri" .Ft int -.Fn sleepq_type "void *wchan" +.Fn sleepq_type "const void *wchan" .Ft void -.Fn sleepq_wait "void *wchan" "int pri" +.Fn sleepq_wait "const void *wchan" "int pri" .Ft int -.Fn sleepq_wait_sig "void *wchan" "int pri" +.Fn sleepq_wait_sig "const void *wchan" "int pri" .Sh DESCRIPTION Sleep queues provide a mechanism for suspending execution of a thread until some condition is met. Index: head/sys/ddb/db_ps.c =================================================================== --- head/sys/ddb/db_ps.c +++ head/sys/ddb/db_ps.c @@ -265,7 +265,7 @@ { char state[9], wprefix; const char *wmesg; - void *wchan; + const void *wchan; if (all) { db_printf("%6d ", td->td_tid); Index: head/sys/kern/kern_clock.c =================================================================== --- head/sys/kern/kern_clock.c +++ head/sys/kern/kern_clock.c @@ -212,7 +212,7 @@ static void deadlres_td_sleep_q(struct proc *p, struct thread *td, int slpticks) { - void *wchan; + const void *wchan; int i, slptype, tticks; sx_assert(&allproc_lock, SX_LOCKED); Index: head/sys/kern/kern_lock.c =================================================================== --- head/sys/kern/kern_lock.c +++ head/sys/kern/kern_lock.c @@ -1733,7 +1733,7 @@ int lockmgr_chain(struct thread *td, struct thread **ownerp) { - struct lock *lk; + const struct lock *lk; lk = td->td_wchan; Index: head/sys/kern/kern_proc.c =================================================================== --- head/sys/kern/kern_proc.c +++ head/sys/kern/kern_proc.c @@ -1297,7 +1297,7 @@ * it can be replaced by assignment of zero. */ static inline uint32_t -ptr32_trim(void *ptr) +ptr32_trim(const void *ptr) { uintptr_t uptr; Index: head/sys/kern/kern_sx.c =================================================================== --- head/sys/kern/kern_sx.c +++ head/sys/kern/kern_sx.c @@ -1526,7 +1526,7 @@ int sx_chain(struct thread *td, struct thread **ownerp) { - struct sx *sx; + const struct sx *sx; /* * Check to see if this thread is blocked on an sx lock. Index: head/sys/kern/kern_synch.c =================================================================== --- head/sys/kern/kern_synch.c +++ head/sys/kern/kern_synch.c @@ -77,7 +77,7 @@ NULL); int hogticks; -static char pause_wchan[MAXCPU]; +static const char pause_wchan[MAXCPU]; static struct callout loadav_callout; @@ -131,7 +131,7 @@ * flag the lock is not re-locked before returning. */ int -_sleep(void *ident, struct lock_object *lock, int priority, +_sleep(const void *ident, struct lock_object *lock, int priority, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; @@ -233,7 +233,7 @@ } int -msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg, +msleep_spin_sbt(const void *ident, struct mtx *mtx, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; @@ -409,7 +409,7 @@ * Make all threads sleeping on the specified identifier runnable. */ void -wakeup(void *ident) +wakeup(const void *ident) { int wakeup_swapper; @@ -429,7 +429,7 @@ * swapped out. */ void -wakeup_one(void *ident) +wakeup_one(const void *ident) { int wakeup_swapper; @@ -441,7 +441,7 @@ } void -wakeup_any(void *ident) +wakeup_any(const void *ident) { int wakeup_swapper; Index: head/sys/kern/subr_sleepqueue.c =================================================================== --- head/sys/kern/subr_sleepqueue.c +++ head/sys/kern/subr_sleepqueue.c @@ -130,7 +130,7 @@ u_int sq_blockedcnt[NR_SLEEPQS]; /* (c) N. of blocked threads. */ LIST_ENTRY(sleepqueue) sq_hash; /* (c) Chain and free list. */ LIST_HEAD(, sleepqueue) sq_free; /* (c) Free queues. */ - void *sq_wchan; /* (c) Wait channel. */ + const void *sq_wchan; /* (c) Wait channel. */ int sq_type; /* (c) Queue type. */ #ifdef INVARIANTS struct lock_object *sq_lock; /* (c) Associated lock. */ @@ -163,7 +163,7 @@ /* * Prototypes for non-exported routines. */ -static int sleepq_catch_signals(void *wchan, int pri); +static int sleepq_catch_signals(const void *wchan, int pri); static inline int sleepq_check_signals(void); static inline int sleepq_check_timeout(void); #ifdef INVARIANTS @@ -173,7 +173,7 @@ static int sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri, int srqflags); static void sleepq_remove_thread(struct sleepqueue *sq, struct thread *td); -static void sleepq_switch(void *wchan, int pri); +static void sleepq_switch(const void *wchan, int pri); static void sleepq_timeout(void *arg); SDT_PROBE_DECLARE(sched, , , sleep); @@ -257,7 +257,7 @@ * Lock the sleep queue chain associated with the specified wait channel. */ void -sleepq_lock(void *wchan) +sleepq_lock(const void *wchan) { struct sleepqueue_chain *sc; @@ -271,7 +271,7 @@ * the table, NULL is returned. */ struct sleepqueue * -sleepq_lookup(void *wchan) +sleepq_lookup(const void *wchan) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -289,7 +289,7 @@ * Unlock the sleep queue chain associated with a given wait channel. */ void -sleepq_release(void *wchan) +sleepq_release(const void *wchan) { struct sleepqueue_chain *sc; @@ -304,8 +304,8 @@ * woken up. */ void -sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags, - int queue) +sleepq_add(const void *wchan, struct lock_object *lock, const char *wmesg, + int flags, int queue) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -390,7 +390,7 @@ * sleep queue after timo ticks if the thread has not already been awakened. */ void -sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr, +sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, int flags) { struct sleepqueue_chain *sc __unused; @@ -419,7 +419,7 @@ * Return the number of actual sleepers for the specified queue. */ u_int -sleepq_sleepcnt(void *wchan, int queue) +sleepq_sleepcnt(const void *wchan, int queue) { struct sleepqueue *sq; @@ -438,7 +438,7 @@ * may have transitioned from the sleepq lock to a run lock. */ static int -sleepq_catch_signals(void *wchan, int pri) +sleepq_catch_signals(const void *wchan, int pri) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -558,7 +558,7 @@ * Returns with thread lock. */ static void -sleepq_switch(void *wchan, int pri) +sleepq_switch(const void *wchan, int pri) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -664,7 +664,7 @@ * Block the current thread until it is awakened from its sleep queue. */ void -sleepq_wait(void *wchan, int pri) +sleepq_wait(const void *wchan, int pri) { struct thread *td; @@ -679,7 +679,7 @@ * or it is interrupted by a signal. */ int -sleepq_wait_sig(void *wchan, int pri) +sleepq_wait_sig(const void *wchan, int pri) { int rcatch; @@ -694,7 +694,7 @@ * or it times out while waiting. */ int -sleepq_timedwait(void *wchan, int pri) +sleepq_timedwait(const void *wchan, int pri) { struct thread *td; @@ -712,7 +712,7 @@ * it is interrupted by a signal, or it times out waiting to be awakened. */ int -sleepq_timedwait_sig(void *wchan, int pri) +sleepq_timedwait_sig(const void *wchan, int pri) { int rcatch, rvalt, rvals; @@ -731,7 +731,7 @@ * Returns the type of sleepqueue given a waitchannel. */ int -sleepq_type(void *wchan) +sleepq_type(const void *wchan) { struct sleepqueue *sq; int type; @@ -910,7 +910,7 @@ * Find thread sleeping on a wait channel and resume it. */ int -sleepq_signal(void *wchan, int flags, int pri, int queue) +sleepq_signal(const void *wchan, int flags, int pri, int queue) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -971,7 +971,7 @@ * Resume all threads sleeping on a specified wait channel. */ int -sleepq_broadcast(void *wchan, int flags, int pri, int queue) +sleepq_broadcast(const void *wchan, int flags, int pri, int queue) { struct sleepqueue *sq; @@ -1023,7 +1023,7 @@ struct sleepqueue_chain *sc __unused; struct sleepqueue *sq; struct thread *td; - void *wchan; + const void *wchan; int wakeup_swapper; td = arg; @@ -1067,7 +1067,7 @@ * wait channel if it is on that queue. */ void -sleepq_remove(struct thread *td, void *wchan) +sleepq_remove(struct thread *td, const void *wchan) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -1111,7 +1111,7 @@ sleepq_abort(struct thread *td, int intrval) { struct sleepqueue *sq; - void *wchan; + const void *wchan; THREAD_LOCK_ASSERT(td, MA_OWNED); MPASS(TD_ON_SLEEPQ(td)); @@ -1183,7 +1183,7 @@ */ #ifdef STACK int -sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, +sleepq_sbuf_print_stacks(struct sbuf *sb, const void *wchan, int queue, int *count_stacks_printed) { struct thread *td, *td_next; Index: head/sys/sys/proc.h =================================================================== --- head/sys/sys/proc.h +++ head/sys/sys/proc.h @@ -252,7 +252,7 @@ int td_pflags; /* (k) Private thread (TDP_*) flags. */ int td_dupfd; /* (k) Ret value from fdopen. XXX */ int td_sqqueue; /* (t) Sleepqueue queue blocked on. */ - void *td_wchan; /* (t) Sleep address. */ + const void *td_wchan; /* (t) Sleep address. */ const char *td_wmesg; /* (t) Reason for sleep. */ volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */ u_char td_tsqueue; /* (t) Turnstile queue blocked on. */ Index: head/sys/sys/sleepqueue.h =================================================================== --- head/sys/sys/sleepqueue.h +++ head/sys/sys/sleepqueue.h @@ -88,33 +88,33 @@ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); -void sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, - int flags, int queue); +void sleepq_add(const void *wchan, struct lock_object *lock, + const char *wmesg, int flags, int queue); struct sleepqueue *sleepq_alloc(void); -int sleepq_broadcast(void *wchan, int flags, int pri, int queue); +int sleepq_broadcast(const void *wchan, int flags, int pri, int queue); void sleepq_chains_remove_matching(bool (*matches)(struct thread *)); void sleepq_free(struct sleepqueue *sq); -void sleepq_lock(void *wchan); -struct sleepqueue *sleepq_lookup(void *wchan); -void sleepq_release(void *wchan); -void sleepq_remove(struct thread *td, void *wchan); +void sleepq_lock(const void *wchan); +struct sleepqueue *sleepq_lookup(const void *wchan); +void sleepq_release(const void *wchan); +void sleepq_remove(struct thread *td, const void *wchan); int sleepq_remove_matching(struct sleepqueue *sq, int queue, bool (*matches)(struct thread *), int pri); -int sleepq_signal(void *wchan, int flags, int pri, int queue); -void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, +int sleepq_signal(const void *wchan, int flags, int pri, int queue); +void sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, int flags); #define sleepq_set_timeout(wchan, timo) \ sleepq_set_timeout_sbt((wchan), tick_sbt * (timo), 0, C_HARDCLOCK) -u_int sleepq_sleepcnt(void *wchan, int queue); -int sleepq_timedwait(void *wchan, int pri); -int sleepq_timedwait_sig(void *wchan, int pri); -int sleepq_type(void *wchan); -void sleepq_wait(void *wchan, int pri); -int sleepq_wait_sig(void *wchan, int pri); +u_int sleepq_sleepcnt(const void *wchan, int queue); +int sleepq_timedwait(const void *wchan, int pri); +int sleepq_timedwait_sig(const void *wchan, int pri); +int sleepq_type(const void *wchan); +void sleepq_wait(const void *wchan, int pri); +int sleepq_wait_sig(const void *wchan, int pri); #ifdef STACK struct sbuf; -int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, +int sleepq_sbuf_print_stacks(struct sbuf *sb, const void *wchan, int queue, int *count_stacks_printed); #endif Index: head/sys/sys/systm.h =================================================================== --- head/sys/sys/systm.h +++ head/sys/sys/systm.h @@ -480,7 +480,7 @@ * Common `proc' functions are declared here so that proc.h can be included * less often. */ -int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri, +int _sleep(const void * _Nonnull chan, struct lock_object *lock, int pri, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ @@ -488,7 +488,7 @@ #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ (flags)) -int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx, +int msleep_spin_sbt(const void * _Nonnull chan, struct mtx *mtx, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep_spin(chan, mtx, wmesg, timo) \ msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ @@ -504,9 +504,9 @@ 0, C_HARDCLOCK) #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) -void wakeup(void * chan); -void wakeup_one(void * chan); -void wakeup_any(void * chan); +void wakeup(const void *chan); +void wakeup_one(const void *chan); +void wakeup_any(const void *chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning Index: head/sys/sys/user.h =================================================================== --- head/sys/sys/user.h +++ head/sys/sys/user.h @@ -128,7 +128,7 @@ struct vnode *ki_textvp; /* pointer to executable file */ struct filedesc *ki_fd; /* pointer to open file info */ struct vmspace *ki_vmspace; /* pointer to kernel vmspace struct */ - void *ki_wchan; /* sleep address */ + const void *ki_wchan; /* sleep address */ pid_t ki_pid; /* Process identifier */ pid_t ki_ppid; /* parent process id */ pid_t ki_pgid; /* process group id */