From owner-freebsd-net Sat May 18 16:53:40 2002 Delivered-To: freebsd-net@freebsd.org Received: from mail.speakeasy.net (mail15.speakeasy.net [216.254.0.215]) by hub.freebsd.org (Postfix) with ESMTP id A065E37B416 for ; Sat, 18 May 2002 16:53:28 -0700 (PDT) Received: (qmail 27112 invoked from network); 18 May 2002 23:53:25 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail15.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 18 May 2002 23:53:25 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g4INqkF83718; Sat, 18 May 2002 19:52:46 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3CE6E6A2.4A42228B@mindspring.com> Date: Sat, 18 May 2002 19:52:36 -0400 (EDT) From: John Baldwin To: Terry Lambert Subject: Re: new zero copy sockets patches available Cc: net@FreeBSD.org, current@FreeBSD.org, "Kenneth D. Merry" , Alfred Perlstein Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On 18-May-2002 Terry Lambert wrote: > John Baldwin wrote: >> On 18-May-2002 Terry Lambert wrote: >> > John Baldwin wrote: >> >> > God, it's annoying that a statically declared mutex is not >> >> > defacto initialized. >> >> >> >> Is it in solaris? >> > >> > It isn't in FreeBSD because of the need to link mutex'es into >> > the "witness protection program". 8-). >> >> Actually, there is more to it than that. Or at least, there will be >> when turnstiles are added (turnstiles require some function callouts >> to work properly). > > It's the function callouts that are the problem. 8-(. Unfortunately there aren't easy solutions to this. Even solaris 7 uses callouts. We would use fewer of them at least. >> > MUTEX_DECLARE(mutex_name). >> >> Umm, yes, like MTX_SYSINIT(). :) > > No. An MTX_SYSINIT() that wrapped a declaration and a SYSINIT() > would als imply the definition of an static function to do the > initialization, that then got called by the SYSINIT() itself. This is a false implication. > This is actually what I was saying was bad: a static function > per mutex declaration. Umm, no, there is _one_ global function that we call. Why not check the actual code? > So, among other things, you want to use the same initializer function > instance for all statically declared mutexes. Um, we already do this. > So you have to use something other than a SYSINIT() for the declarations, > but you could use *one SYSINIT()* to do the pre-use initialization of > *all* declarations. Why don't you read the code? Here, I'll quote it for you: struct mtx_args { struct mtx *ma_mtx; const char *ma_desc; int ma_opts; }; #define MTX_SYSINIT(name, mtx, desc, opts) \ static struct mtx_args name##_args = { \ mtx, \ desc, \ opts \ }; \ SYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ mtx_sysinit, &name##_args) Note no static function, instead we use the global function mtx_sysinit() in kern_mutex.c: /* * General init routine used by the MTX_SYSINIT() macro. */ void mtx_sysinit(void *arg) { struct mtx_args *margs = arg; mtx_init(margs->ma_mtx, margs->ma_desc, NULL, margs->ma_opts); } -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message