LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-27-2010, 11:18 PM   #1
jamesbon
Member
 
Registered: Jun 2010
Posts: 147

Rep: Reputation: 9
what is static inline void tvec_base


Hi,
I was going through a file known as
linux-2.6.34/kernel/timer.c and found following code.


static inline void
timer_set_base(struct timer_list *timer, struct tvec_base *new_base)
{
timer->base = (struct tvec_base *)((unsigned long)(new_base) |
tbase_get_deferrable(timer->base));
}

I want to understand what is it doing.
What is the meaning of static inline in above?
I searched and came across

http://www.velocityreviews.com/forum...functions.html
https://www.securecoding.cert.org/co...on-like+macros

http://tldp.org/HOWTO/KernelAnalysis-HOWTO-14.html

Also a book by http://en.wikipedia.org/wiki/The_C_P...age_%28book%29

which page is that exactly given?
I am having a pdf reader
known as Document Viewer 2.26.0 there is no way I can search the complete document in it.

Also I am not clear with use of word static in a function definition.

[edit crabboy] link to copyrighted material removed [/edit]

Last edited by crabboy; 08-27-2010 at 11:44 PM.
 
Old 08-27-2010, 11:28 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
In C, static means that the function is only visible within the same source file.

inline is a suggestion to the compiler to replace the function call with the code within the function. This is done to reduce the overhead of a function call. Pushing the parameters on the stack then a jump. This works well for smaller methods where speed is key.
 
Old 08-27-2010, 11:42 PM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by crabboy View Post
In C, static means that the function is only visible within the same source file.

inline is a suggestion to the compiler to replace the function call with the code within the function. This is done to reduce the overhead of a function call. Pushing the parameters on the stack then a jump. This works well for smaller methods where speed is key.
And 'void' means the function does not return a value.
 
Old 08-27-2010, 11:44 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
To the OP - you likely need to first learn "C", and then look into kernel.
 
Old 08-28-2010, 12:04 AM   #5
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
And for the documentation necessary to learn the C programming language (similar to C++):

http://en.wikibooks.org/wiki/C_Programming
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
In pci.h in 2.6 .27.24; static inline int pci_enable_device returns error -EIO ddeeks Linux - Newbie 0 06-12-2009 04:30 PM
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 10:51 AM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM
void main(void) linuxanswer Programming 4 10-26-2003 12:37 AM
void foo(void) and void foo() lackluster Programming 9 02-15-2003 10:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration