Where should I declare the global variable

3 views
Skip to first unread message

Irfan Ahmed

unread,
May 3, 2007, 3:03:45 AM5/3/07
to kernel...@nl.linux.org
Hi,

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.
So where should I declare that global variable.

Right now I have declare it in system call but  the following error occured
_______________________________________________________
 CC [M]  net/ipv6/tcp_ipv6.o
net/ipv6/tcp_ipv6.c: In function ‘tcp_v6_rcv’:
net/ipv6/tcp_ipv6.c:1313: error: ‘global_fd’ undeclared (first use in this function)
net/ipv6/tcp_ipv6.c:1313: error: (Each undeclared identifier is reported only once
net/ipv6/tcp_ipv6.c:1313: error: for each function it appears in.)
make[2]: *** [net/ipv6/tcp_ipv6.o] Error 1
make[1]: *** [net/ipv6] Error 2
make: *** [net] Error 2

__________________________________

Regards,

Irfan

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

Mike Frysinger

unread,
May 3, 2007, 3:38:09 AM5/3/07
to Irfan Ahmed, kernel...@nl.linux.org
On 5/3/07, Irfan Ahmed <ahm...@yahoo.com> 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

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to eca...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply all
Reply to author
Forward
0 new messages