Wrox Programmer Forums
|
BOOK: Professional Linux Kernel Architecture ISBN: 978-0-470-34343-2 Discuss the book Professional Linux Kernel Architecture, Wolfgang Mauerer, ISBN: 978-0-470-34343-2
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Linux Kernel Architecture ISBN: 978-0-470-34343-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2009, 01:11 AM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default list_entry(), page 21

The explanation of list_entry() macro is not clear. What does it return?
 
Old March 19th, 2009, 03:56 AM
wlm wlm is offline
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

list_entry returns a pointer to the container data structure. In the
example on p. 21/22, this would be a pointer to struct task_struct.
Unfortunately, the pointer declaration is missing. Correctly, the example
statement should read

Code:
struct task_struct *tsk = list_entry(ptr, struct task_struct, run_list);
Here we assume that ptr points to a list_head instance embedded in
task_struct (this was indeed the case for the O(1) scheduler):

Code:
struct task_struct {
...
    struct list_head run_list;
...
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
After initial code; Page 1082; Ch 21 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 August 3rd, 2006 11:36 AM
Over 21 calculator - project PetraMan Javascript How-To 1 March 29th, 2005 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.