Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 18th, 2009, 02: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?
  #2 (permalink)  
Old March 19th, 2009, 04: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;
...
}
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12:36 PM
Over 21 calculator - project PetraMan Javascript How-To 1 March 29th, 2005 09:44 AM



All times are GMT -4. The time now is 10:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.