From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 11 16:40:07 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FCB11065679 for ; Wed, 11 Feb 2009 16:40:07 +0000 (UTC) (envelope-from abohra@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 272FA8FC23 for ; Wed, 11 Feb 2009 16:40:07 +0000 (UTC) (envelope-from abohra@gmail.com) Received: by an-out-0708.google.com with SMTP id b38so173593ana.13 for ; Wed, 11 Feb 2009 08:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=P2et229lLzMOZus2+r28x2WHodSmAFlyRmsCesNnwZ0=; b=uwtegfKEUNGinTM8F8yzWmB7POZ/ZJ1ZPaB0HCkLutrqUfjjw7BhbxDLwzVGmxYBkj 0yBBx2PGZS8bTpDq1tLB4w4bHUbB7jwK5654OmX8+5gcvzkG3OXofyWBvqJ8bpSklMDN Ujxu+STw+PlQ4KqzIqMnylt8plYih2GmZG3W4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=cJeZjR8fmJ6NQ4HXfk7+VBe0Vl5eEbfCGAEoB23/dVX2jDCOs8+AgDhZ51hBHst1IS wUxzpy1IXkWALgJFjHa3uIZQHbMMdXeQFsOqrAT3OxB81hmfC6tDcG0ObfHfxGn/9e9f NcWilMYdOAvjr4Ea44jwFXeI7bNOSZWWqxy0Q= MIME-Version: 1.0 Received: by 10.100.8.17 with SMTP id 17mr6171791anh.85.1234370406229; Wed, 11 Feb 2009 08:40:06 -0800 (PST) In-Reply-To: <4992D1B0.8020708@icyb.net.ua> References: <43a2dc1a0902101243w5ce35609x35dbe440c39d80a8@mail.gmail.com> <4992D1B0.8020708@icyb.net.ua> Date: Wed, 11 Feb 2009 11:40:06 -0500 Message-ID: <43a2dc1a0902110840t1e4c8856lb5b33cc153ea4acb@mail.gmail.com> From: Aniruddha Bohra To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 11 Feb 2009 16:45:09 +0000 Cc: hackers@freebsd.org Subject: Re: a little bit of c++ in kernel [module] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 16:40:07 -0000 On Wed, Feb 11, 2009 at 8:25 AM, Andriy Gapon wrote: > on 10/02/2009 22:43 Aniruddha Bohra said the following: >> You can see Click: http://read.cs.ucla.edu/click/ >> It does not run on FreeBSD >4. >> I have an old diff which builds on the work by Marko Zec and Bruce >> Simpson, that allows me to load the click module. >> http://www.cs.rutgers.edu/~bohra/click-1.5.0.diff > > 1. options -fpermissive -fno-exceptions -fno-rtti are passed to c++ compiler > 2. there are new/delete implementations that use kernel malloc > > I think that #1 means that there are no exceptions, (non-trivial) > dynamic_cast and typeid for kernel c++ code. Correct. > 1. do you use any global/static objects with constructors? did you have > to write any code to call on those constructors when the module is loaded? Not sure about this one. But AFAIK, there are no global static objects with constructors in Click code. There is one router object that is always initialized and it is updated by writing to the clickfs file system. The other objects are created with new. > 2. did you have to write any other run-time support code or platform > glue code (besides new/delete)? Apart from the new and delete, I think the other things were the pseudofs code to initialize the file system, the locks in include/click/sync.hh, the glue code in atomic.hh. > 3. I assume virtual inheritance can be used in kernel code? do you use it? Yes. For example, all objects inherit from "Element" and that defines virtual functions. (include/click/element.hh) Hope this helps. Aniruddha