Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to pass info from kernel to user space

15 views
Skip to first unread message

anhvuitinh

unread,
Aug 3, 2009, 9:40:24 PM8/3/09
to
Hi everyone,

I have the IP address info which is only available at run-time when
the board boots up. What is the easiest way to pass this info from
kernel space to an user app running in user space?

Thanks,
Peter

Steve Watt

unread,
Aug 5, 2009, 6:55:35 PM8/5/09
to
In article <a923f0cc-5bf8-43ff...@u38g2000pro.googlegroups.com>,

Same way you'd do it on any other operating system. Open a socket,
call ioctl(fd, SIOCGIFCONF...).

Mind, that particular interface is horribly ugly, and it's possible
that the getifaddrs() API is available.
--
Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.5" / 37N 20' 15.3"
Internet: steve @ Watt.COM Whois: SW32-ARIN
Free time? There's no such thing. It just comes in varying prices...

anhvuitinh

unread,
Aug 10, 2009, 3:45:17 PM8/10/09
to
Thanks, Steve but that's not what I am looking for.
My kernel image was built with a default IP address and needs to be
changed at run-time to a correct one.
I know I have to modify the ethernet driver to do it but since I am
new with LynxOS, I try to use a work-around way which is executing the
'ifconfig' command from a user app to change the IP address. The
problem is I don't know how to pass the IP info to my user app.
I am thinking saving the IP info to a file is one way to do it but I
don't know when the file system is available during boot time and how
to save it. I tried to use 'open' and 'write' API but looks like these
APIs are for user space only.

Any idea? Thanks.

Steve Watt

unread,
Aug 10, 2009, 8:19:05 PM8/10/09
to
In article <faceb32b-112b-4f4e...@a37g2000prf.googlegroups.com>,

This doesn't make sense.

IP addresses are not configured into kernels. Period. You don't need
to modify an Ethernet driver to change the IP address unless the person
who coded the Ethernet driver Just Didn't Get It(TM).

They are sometimes configured into KDIs, which is a kernel and a
filesystem joined at the hip for ease of handling in an embedded
system.

So, where's the IP address in question coming from? If it's in the KDI,
then you need to change the KDI. If it's something that gets set via,
say, dhcp, you need to fetch it from there.

If it's provided via some web form or similar configuration mechanism,
you make sure that the rc script in the KDI knows what bit of non-volatile
memory to look at to find the non-default IP address to use.

0 new messages