From owner-p4-projects@FreeBSD.ORG Fri Jun 20 17:46:13 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 240A037B405; Fri, 20 Jun 2003 17:46:12 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3B4337B401 for ; Fri, 20 Jun 2003 17:46:06 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51B6043F3F for ; Fri, 20 Jun 2003 17:46:06 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h5L0k60U074423 for ; Fri, 20 Jun 2003 17:46:06 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h5L0k5S4074420 for perforce@freebsd.org; Fri, 20 Jun 2003 17:46:05 -0700 (PDT) Date: Fri, 20 Jun 2003 17:46:05 -0700 (PDT) Message-Id: <200306210046.h5L0k5S4074420@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 33461 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jun 2003 00:46:13 -0000 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 #include +#include +#include + 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 +#include + 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); - - -