Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to define global integer in fedora kernel 1

Status
Not open for further replies.

CsharpDeveloper

Programmer
Dec 30, 2004
1
TR
Hi ,
I try to add some new properties to linux kernel in fedora core 2 . I have to define a global integer variable in one of the header file , which I can reach it from all .c files in kernel .
i.e. it will be enough to reach and modify it from user.c and timer.c .
I tried something with extern but I got compile error when try to "make bzdisk" command .
Does anyone has solution to this problem . What should I write in header file (call it timer.h)
and what should I write in user.c and timer.c to access and modify this integer variable named int my_general_file_limit .
Please help me as soon as possible and send me e-mail if possible . I'm in a deadlock .
Thanx to everyone .
Mr.Tunca Usluer
 
I haven't tried to modify the kernel, so I don't know if things work differently, in a normal c program you define the variable in just one file then refer to it as extern in the shared header file for all other c programs to reference.

Remember that #including a header file is the same thing as just typing the contents directly into the top of the c file.

Thus (for instance) in timer.c have:
int my_general_file_limit;
and in timer.h have:
extern my_general_file_limit;

Then don't redefine it anywhere else, just use it.
 
There are forums for linux desktop and linux servers... you'll probably get alot more information there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top