diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-06-02 23:05:32 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-06-02 23:05:32 +0000 |
commit | e54f1563747789b89c0456389f777741fa14ff92 (patch) | |
tree | 7ebc5fbbb254baef4d51f8bca7ba5b80c206d441 /sys | |
parent | cfacbfe1b6ead3a553cd75194cccec0dd528e5fa (diff) |
Change the wait-channel type to 'const volatile void *', eliminating
the need for casts when calling tsleep(), msleep(), and wakeup().
"I guess so" oga@ "it's masturbation" art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_synch.c | 14 | ||||
-rw-r--r-- | sys/sys/proc.h | 15 |
2 files changed, 16 insertions, 13 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 5d15d0e23a2..612718375b6 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.89 2009/04/14 09:13:25 art Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.90 2009/06/02 23:05:31 guenther Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -102,7 +102,7 @@ int safepri; * call should be interrupted by the signal (return EINTR). */ int -tsleep(void *ident, int priority, const char *wmesg, int timo) +tsleep(const volatile void *ident, int priority, const char *wmesg, int timo) { struct sleep_state sls; int error, error1; @@ -141,7 +141,8 @@ tsleep(void *ident, int priority, const char *wmesg, int timo) * entered the sleep queue we drop the mutex. After sleeping we re-lock. */ int -msleep(void *ident, struct mutex *mtx, int priority, const char *wmesg, int timo) +msleep(const volatile void *ident, struct mutex *mtx, int priority, + const char *wmesg, int timo) { struct sleep_state sls; int error, error1, spl; @@ -176,7 +177,8 @@ msleep(void *ident, struct mutex *mtx, int priority, const char *wmesg, int tim } void -sleep_setup(struct sleep_state *sls, void *ident, int prio, const char *wmesg) +sleep_setup(struct sleep_state *sls, const volatile void *ident, int prio, + const char *wmesg) { struct proc *p = curproc; @@ -345,7 +347,7 @@ unsleep(struct proc *p) * Make a number of processes sleeping on the specified identifier runnable. */ void -wakeup_n(void *ident, int n) +wakeup_n(const volatile void *ident, int n) { struct slpque *qp; struct proc *p; @@ -385,7 +387,7 @@ wakeup_n(void *ident, int n) * Make all processes sleeping on the specified identifier runnable. */ void -wakeup(void *chan) +wakeup(const volatile void *chan) { wakeup_n(chan, -1); } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 9b004d7cf7e..be766faa946 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.117 2009/04/17 15:17:27 blambert Exp $ */ +/* $OpenBSD: proc.h,v 1.118 2009/06/02 23:05:31 guenther Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -194,7 +194,7 @@ struct proc { u_int p_estcpu; /* Time averaged value of p_cpticks. */ int p_cpticks; /* Ticks of cpu time. */ fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ - void *p_wchan; /* Sleep address. */ + const volatile void *p_wchan;/* Sleep address. */ struct timeout p_sleep_to;/* timeout for tsleep() */ const char *p_wmesg; /* Reason for sleep. */ u_int p_swtime; /* Time swapped in or out. */ @@ -426,8 +426,8 @@ void procinit(void); void resetpriority(struct proc *); void setrunnable(struct proc *); void unsleep(struct proc *); -void wakeup_n(void *chan, int); -void wakeup(void *chan); +void wakeup_n(const volatile void *, int); +void wakeup(const volatile void *); #define wakeup_one(c) wakeup_n((c), 1) void reaper(void); void exit1(struct proc *, int, int); @@ -449,7 +449,8 @@ struct sleep_state { int sls_sig; }; -void sleep_setup(struct sleep_state *, void *, int, const char *); +void sleep_setup(struct sleep_state *, const volatile void *, int, + const char *); void sleep_setup_timeout(struct sleep_state *, int); void sleep_setup_signal(struct sleep_state *, int); void sleep_finish(struct sleep_state *, int); @@ -457,8 +458,8 @@ int sleep_finish_timeout(struct sleep_state *); int sleep_finish_signal(struct sleep_state *); void sleep_queue_init(void); -int tsleep(void *, int, const char *, int); -int msleep(void *, struct mutex *, int, const char*, int); +int tsleep(const volatile void *, int, const char *, int); +int msleep(const volatile void *, struct mutex *, int, const char*, int); #if defined(MULTIPROCESSOR) void proc_trampoline_mp(void); /* XXX */ |