Where should I declare the global variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





----- Forwarded Message ----
From: Irfan Ahmed <ahm_irf@xxxxxxxxx>
To: kanishk rastogi <kanishk_rastogi85@xxxxxxxxx>
Sent: Friday, May 4, 2007 1:40:28 AM
Subject: Re: Where should I declare the global variable

I got the following warining when I run # make modules_install

WARNING: /lib/modules/2.6.18.2/kernel/net/ipv6/ipv6.ko needs unknown symbol global_fd

though I have defined 

___________ in tcp_ipv6.c file_____
extern int global_fd ;


I have also declared this variable in  my system call code which is as follows
---------System call code _______________________________
#include<linux/linkage.h>
#include<linux/kernel.h>

int global_fd;

asmlinkage int sys_mycall(int fd)
{
global_fd = fd;
return fd;
}

_________________________


Yes the code is getting compiled with the following warnings mentioned in the previous email

----- Original Message ----
From: kanishk rastogi <kanishk_rastogi85@xxxxxxxxx>
To: Irfan Ahmed <ahm_irf@xxxxxxxxx>
Sent: Friday, May 4, 2007 12:51:37 AM
Subject: Re: Where should I declare the global variable



----- Original Message ----
From: Irfan Ahmed <ahm_irf@xxxxxxxxx>
To: kernelnewbies@xxxxxxxxxxxx
Sent: Friday, May 4, 2007 9:13:02 AM
Subject: Where should I declare the global variable

Hi,

I am need to use one global variable in two files.
One is ~/net/ipv6/tcp_ipv6.c where I have defined the global variable as extern int global_fd;
Second is my custom system call code. Its code is as follows
__________
#include<linux/linkage.h>
#include<linux/kernel.h>

int global_fd;

asmlinkage int sys_mycall(int fd)
{
global_fd = fd;
return fd;
}
___________

where is this code
is it getting compiled


Now I am still getting the follwing error
___________________________
CHK include/linux/version.h
CHK include/linux/utsrelease.h
Building modules, stage 2.
MODPOST
WARNING: drivers/atm/he.o - Section mismatch: reference to .init.text: from .text between 'he_start' (at offset 0x2074) and 'he_service_tbrq'
WARNING: "global_fd" [net/ipv6/ipv6.ko] undefined!
WARNING: "sys_write" [net/ipv6/ipv6.ko] undefined!
[root@localhost linux-2.6.18.2]#
________________

Anther thing that I want to ask about sys_write . Can I use it in kernel code other than kernel module. and how can I solve the undefined problem of sys_write even I have also added the syscalls.h header file.

Regards,

Irfan

Send instant messages to your online friends http://uk.messenger.yahoo.com


Send instant messages to your online friends http://uk.messenger.yahoo.com



Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.


Send instant messages to your online friends http://uk.messenger.yahoo.com


Send instant messages to your online friends http://uk.messenger.yahoo.com

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux