From owner-freebsd-hackers@FreeBSD.ORG Fri May 6 12:40:26 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D06816A4D0 for ; Fri, 6 May 2005 12:40:26 +0000 (GMT) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2697A43D92 for ; Fri, 6 May 2005 12:40:25 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) (8.13.4/8.13.3) with ESMTP id j46CeMSY052260 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 6 May 2005 14:40:22 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.4/8.13.3/Submit) id j46CeMHu052259 for freebsd-hackers@freebsd.org; Fri, 6 May 2005 14:40:22 +0200 (CEST) Date: Fri, 6 May 2005 14:40:22 +0200 From: Divacky Roman To: freebsd-hackers@freebsd.org Message-ID: <20050506124022.GA51077@stud.fit.vutbr.cz> References: <427A94C0.1020205@samsco.org> <427AE2F700000446@ims3a.cp.tin.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <427AE2F700000446@ims3a.cp.tin.it> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.49 on 147.229.10.14 Subject: Re: A bit confused with the sched_4bsd.c code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 12:40:26 -0000 On Fri, May 06, 2005 at 09:39:21AM +0200, gerarra@tin.it wrote: > > > >Halil Demirezen wrote: > >> Hello, > >> > >> First of all, I am not sure if this is the correct mail list with posting > >this > >> mail. I apologize for that.. Second, I may seem to have little > >> C knowledge, though I am using C for about 5 years and plus. > >> > >> Let's start with the question. I am digging the FreeBSD-5.3 kernel codes. > >> Watson's Cross Reference is really helpful. In the schedcpu(void) function > >> there is an assignment like "ke = td->td_kse;" on line 438 (see: > >> http://fxr.watson.org/fxr/source/kern/sched_4bsd.c?v=RELENG53#L438"). > >> When I look at the thread structure at sys/proc.h, I could not see such > >an > >> entry td_kse in the "thread" structure. How has this structure been extended > > > >> or this entry added to the thread structure? > >> > >> Although the kernel codes seem to be simply understandable, there still > >lies > >> some difficulties to understand for an average C programmer: magic stuff > >done > >> by professionals. :) > >> > >> Anyway, any help really will be appreciated... > >> > >> Thanks. > > > >Look near the top of the file for: > > > >#define td_kse td_sched > > > >That makes td->td_kse resolve to td->td_sched. Now, there is > >other magic associated with td_sched in each scheduler source > >file, but that's different matter =-) > > If you *really* want to dig inside sources remind that grep is your friend I'd go with cscsope (ports/devel/cscope) instead of grep... ;)