Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Dec 2019 16:19:33 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356057 - in head: share/man/man9 sys/ddb sys/kern sys/sys
Message-ID:  <201912241619.xBOGJXlg032499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Tue Dec 24 16:19:33 2019
New Revision: 356057
URL: https://svnweb.freebsd.org/changeset/base/356057

Log:
  sleep(9), sleepqueue(9): const'ify wchan pointers
  
  _sleep(9), wakeup(9), sleepqueue(9), et al do not dereference or modify the
  channel pointers provided in any way; they are merely used as intptrs into a
  dictionary structure to match waiters with wakers.  Correctly annotate this
  such that _sleep() and wakeup() may be used on const pointers without
  invoking ugly patterns like __DECONST().  Plumb const through all of the
  underlying sleepqueue bits.
  
  No functional change.
  
  Reviewed by:	rlibby
  Discussed with:	kib, markj
  Differential Revision:	https://reviews.freebsd.org/D22914

Modified:
  head/share/man/man9/sleep.9
  head/share/man/man9/sleepqueue.9
  head/sys/ddb/db_ps.c
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_lock.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_sx.c
  head/sys/kern/kern_synch.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/proc.h
  head/sys/sys/sleepqueue.h
  head/sys/sys/systm.h
  head/sys/sys/user.h

Modified: head/share/man/man9/sleep.9
==============================================================================
--- head/share/man/man9/sleep.9	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/share/man/man9/sleep.9	Tue Dec 24 16:19:33 2019	(r356057)
@@ -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 ,

Modified: head/share/man/man9/sleepqueue.9
==============================================================================
--- head/share/man/man9/sleepqueue.9	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/share/man/man9/sleepqueue.9	Tue Dec 24 16:19:33 2019	(r356057)
@@ -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.

Modified: head/sys/ddb/db_ps.c
==============================================================================
--- head/sys/ddb/db_ps.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/ddb/db_ps.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -265,7 +265,7 @@ dumpthread(volatile struct proc *p, volatile struct th
 {
 	char state[9], wprefix;
 	const char *wmesg;
-	void *wchan;
+	const void *wchan;
 	
 	if (all) {
 		db_printf("%6d                  ", td->td_tid);

Modified: head/sys/kern/kern_clock.c
==============================================================================
--- head/sys/kern/kern_clock.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/kern_clock.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -212,7 +212,7 @@ deadlres_td_on_lock(struct proc *p, struct thread *td,
 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);

Modified: head/sys/kern/kern_lock.c
==============================================================================
--- head/sys/kern/kern_lock.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/kern_lock.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -1733,7 +1733,7 @@ _lockmgr_assert(const struct lock *lk, int what, const
 int
 lockmgr_chain(struct thread *td, struct thread **ownerp)
 {
-	struct lock *lk;
+	const struct lock *lk;
 
 	lk = td->td_wchan;
 

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/kern_proc.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -1297,7 +1297,7 @@ pstats_free(struct pstats *ps)
  * it can be replaced by assignment of zero.
  */
 static inline uint32_t
-ptr32_trim(void *ptr)
+ptr32_trim(const void *ptr)
 {
 	uintptr_t uptr;
 

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/kern_sx.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -1526,7 +1526,7 @@ db_show_sx(const struct lock_object *lock)
 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.

Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/kern_synch.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -77,7 +77,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_F
     NULL);
 
 int	hogticks;
-static char pause_wchan[MAXCPU];
+static const char pause_wchan[MAXCPU];
 
 static struct callout loadav_callout;
 
@@ -131,7 +131,7 @@ SYSINIT(sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepini
  * 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 @@ _sleep(void *ident, struct lock_object *lock, int prio
 }
 
 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 @@ refcount_sleep(volatile u_int *count, const char *wmes
  * Make all threads sleeping on the specified identifier runnable.
  */
 void
-wakeup(void *ident)
+wakeup(const void *ident)
 {
 	int wakeup_swapper;
 
@@ -429,7 +429,7 @@ wakeup(void *ident)
  * swapped out.
  */
 void
-wakeup_one(void *ident)
+wakeup_one(const void *ident)
 {
 	int wakeup_swapper;
 
@@ -441,7 +441,7 @@ wakeup_one(void *ident)
 }
 
 void
-wakeup_any(void *ident)
+wakeup_any(const void *ident)
 {
 	int wakeup_swapper;
 

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/kern/subr_sleepqueue.c	Tue Dec 24 16:19:33 2019	(r356057)
@@ -130,7 +130,7 @@ struct sleepqueue {
 	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 @@ static uma_zone_t sleepq_zone;
 /*
  * 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_init(void *mem, int size, int flags)
 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 @@ sleepq_free(struct sleepqueue *sq)
  * 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 @@ sleepq_lock(void *wchan)
  * 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 @@ sleepq_lookup(void *wchan)
  * 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 @@ sleepq_release(void *wchan)
  * 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 @@ sleepq_add(void *wchan, struct lock_object *lock, cons
  * 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 @@ sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sb
  * 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 @@ sleepq_sleepcnt(void *wchan, int queue)
  * 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 @@ out:
  * 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 @@ sleepq_check_signals(void)
  * 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 @@ sleepq_wait(void *wchan, int pri)
  * 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 @@ sleepq_wait_sig(void *wchan, int pri)
  * 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 @@ sleepq_timedwait(void *wchan, int pri)
  * 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 @@ sleepq_timedwait_sig(void *wchan, int pri)
  * 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 @@ sleepq_init(void *mem, int size, int flags)
  * 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 @@ match_any(struct thread *td __unused)
  * 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 @@ sleepq_timeout(void *arg)
 	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 @@ sleepq_timeout(void *arg)
  * 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 @@ int
 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 @@ sleepq_chains_remove_matching(bool (*matches)(struct t
  */
 #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;

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/sys/proc.h	Tue Dec 24 16:19:33 2019	(r356057)
@@ -252,7 +252,7 @@ struct thread {
 	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. */

Modified: head/sys/sys/sleepqueue.h
==============================================================================
--- head/sys/sys/sleepqueue.h	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/sys/sleepqueue.h	Tue Dec 24 16:19:33 2019	(r356057)
@@ -88,33 +88,33 @@ struct thread;
 
 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
 

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/sys/systm.h	Tue Dec 24 16:19:33 2019	(r356057)
@@ -480,7 +480,7 @@ static __inline void		splx(intrmask_t ipl __unused)	{ 
  * 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 @@ int	_sleep(void * _Nonnull chan, struct lock_object *l
 #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 @@ int	pause_sbt(const char *wmesg, sbintime_t sbt, sbint
 	    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

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h	Tue Dec 24 16:13:15 2019	(r356056)
+++ head/sys/sys/user.h	Tue Dec 24 16:19:33 2019	(r356057)
@@ -128,7 +128,7 @@ struct kinfo_proc {
 	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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912241619.xBOGJXlg032499>