A bit confused with the sched_4bsd.c code
Julian Elischer
julian at elischer.org
Thu May 5 16:27:27 PDT 2005
Scott Long 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 =-)
this is a "temporary" (for a coupe of years) :-) thing
as teh two structures were merged, but I didn't want to change all the
files references because that would
make all the diffs to larde and obscure teh real differences.
at some point in teh future I will commit a change that cleans this up
but doesn't change anything else.
>
> Scitt
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers
mailing list