From owner-freebsd-hackers@FreeBSD.ORG Thu May 5 21:49:47 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 81CA116A4CE for ; Thu, 5 May 2005 21:49:47 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE30E43DB2 for ; Thu, 5 May 2005 21:49:44 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.21] (rat.samsco.home [192.168.254.21]) (authenticated bits=0) by pooker.samsco.org (8.13.3/8.13.3) with ESMTP id j45LtFNt002290; Thu, 5 May 2005 15:55:16 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <427A94C0.1020205@samsco.org> Date: Thu, 05 May 2005 15:48:48 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.7.5) Gecko/20050321 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Halil Demirezen References: <200505060010.26184.halil@enderunix.org> In-Reply-To: <200505060010.26184.halil@enderunix.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org cc: freebsd-hackers@freebsd.org 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: Thu, 05 May 2005 21:49:47 -0000 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 =-) Scitt