Re: Where should I declare the global variable

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

 



Still stuck ..The problem is that system call is in kernel and tcp_ipv6.c is kernel module file. I have defined global variable in kernel i.e in system call and try to access it in kernel module IPv6. But still I am getting the same
WARNING: "global_fd" [net/ipv6/ipv6.ko] undefined!


The code for both the files is as follows

For System call
#include<linux/linkage.h>
#include<linux/kernel.h>

int global_fd = 0;
EXPORT_SYMBOL(global_fd);

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

For tcp_ipv6.c

<Include files ............>
extern int global_fd ;
...
...
..
static int tcp_v6_rcv(struct sk_buff **pskb)
{
printk("\n%d done\n",global_fd);
..
...


----- Original Message ----
From: Mike Frysinger <vapier.adi@xxxxxxxxx>
To: Irfan Ahmed <ahm_irf@xxxxxxxxx>
Cc: kernelnewbies@xxxxxxxxxxxx
Sent: Thursday, May 3, 2007 3:38:09 AM
Subject: Re: Where should I declare the global variable

On 5/3/07, Irfan Ahmed <ahm_irf@xxxxxxxxx> wrote:
> I have added a new system call that is used to initialize a global variable
> through userspace program. After initialization, I need to use that global
> variable  in ~/net/ipv6/tcp_ipv6.c file. let say printing the value of that
> global variable.

ignoring the fact that is just plain wrong ...

> So where should I declare that global variable.

just put an 'extern ...' in the tcp_ipv6.c file since i doubt you have
any sort of real linux API for other linux kernel things to utilize
-mike


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