Date: Fri, 20 Jun 2003 17:46:05 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 33461 for review Message-ID: <200306210046.h5L0k5S4074420@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=33461 Change 33461 by rwatson@rwatson_powerbook on 2003/06/20 17:45:05 Various cleanups to condvar code: (1) Do build kern_condvar.c (also: correct spelling of subr_sbuf.c) (2) Include Mach headers to support wait_queue_t and mutex_t in kern_condvar.c, condvar.h. (3) Do install condvar.h when building (4) Cleanup types for condvar function variables (bits left over from FreeBSD prototypes) (5) Forward declare uthread and use it instead of thread Note: we currently statically allocate storage for the wait_queue_t in struct cv, in the style of FreeBSD. This is discouraged in Mach due to the potential for the storage to change size. Affected files ... .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/conf/files#4 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_condvar.c#2 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/Makefile#3 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/condvar.h#2 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/conf/files#4 (text+ko) ==== @@ -442,6 +442,7 @@ bsd/kern/kdebug.c standard bsd/kern/kern_acct.c standard bsd/kern/kern_clock.c standard +bsd/kern/kern_condvar.c standard bsd/kern/kern_core.c standard bsd/kern/kern_symfile.c standard bsd/kern/kern_descrip.c standard @@ -476,7 +477,7 @@ bsd/kern/subr_log.c standard bsd/kern/subr_prf.c standard bsd/kern/subr_prof.c standard -bsd/kern/subr_sbur.c standard +bsd/kern/subr_sbuf.c standard bsd/kern/subr_xxx.c standard bsd/kern/sys_generic.c standard bsd/kern/sys_socket.c standard ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_condvar.c#2 (text+ko) ==== @@ -37,6 +37,9 @@ #include <sys/types.h> #include <sys/condvar.h> +#include <kern/lock.h> +#include <kern/wait_queue.h> + void cv_init(struct cv *cvp, const char *desc) { @@ -91,7 +94,7 @@ * Not supported in Darwin right now. */ int -cv_timedwait(struct cv *cvp, mutex*t *mp, int timo) +cv_timedwait(struct cv *cvp, mutex_t *mp, int timo) { panic("cv_timedwait: not currently supported"); @@ -101,7 +104,7 @@ * Not supported in Darwin right now. */ int -cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo) +cv_timedwait_sig(struct cv *cvp, mutex_t *mp, int timo) { panic("cv_timedwait: not currently supported"); @@ -125,7 +128,7 @@ * Not supported in Darwin right now. */ void -cv_waitq_remove(struct thread *td) +cv_waitq_remove(struct uthread *td) { panic("cv_waitq_remove: not currently supported"); ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/Makefile#3 (text+ko) ==== @@ -22,6 +22,7 @@ DATAFILES = \ appleapiopts.h \ acct.h attr.h buf.h callout.h cdefs.h clist.h conf.h \ + condvar.h \ dir.h dirent.h disk.h disklabel.h disktab.h dkstat.h dmap.h domain.h \ errno.h ev.h exec.h fcntl.h file.h filedesc.h filio.h gmon.h ioccom.h ioctl.h \ ioctl_compat.h ipc.h kernel.h kern_event.h ktrace.h loadable_fs.h lock.h lockf.h mach_swapon.h malloc.h \ ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/condvar.h#2 (text+ko) ==== @@ -34,23 +34,24 @@ * Implement BSD-layer condition variables using Mach-layer wait queues. */ +#include <kern/lock.h> +#include <kern/wait_queue.h> + struct cv { wait_queue_t cv_wait_queue; mutex_t *cv_mutex; /* Debugging only. */ const char *cv_description; }; +struct uthread; void cv_init(struct cv *cvp, const char *desc); void cv_destroy(struct cv *cvp); void cv_wait(struct cv *cvp, mutex_t *mp); int cv_wait_sig(struct cv *cvp, mutex_t *mp); -int cv_timedwait(struct cv *cvp, mutex*t *mp, int timo); -int cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo); +int cv_timedwait(struct cv *cvp, mutex_t *mp, int timo); +int cv_timedwait_sig(struct cv *cvp, mutex_t *mp, int timo); void cv_signal(struct cv *cvp); void cv_broadcast(struct cv *cvp); -void cv_waitq_remove(struct thread *td); +void cv_waitq_remove(struct uthread *td); int cv_waitq_empty(struct cv *cvp); const char *cv_wmesg(struct cv *cvp); - - -
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306210046.h5L0k5S4074420>