Skip to contentSkip to conversation

Accessing data structure from kernel space

DISCUSSION linux lover 3 participants 3 messages Mar 23, 2005

lore
Share & tools
lore
#0 lore raw

Hello all,
I have one linked list data structure added to
a file in kernel source code which has some kernel info. I want to acess that linked list structure from user space. Is that possible??
Also how to add own system call usable at user
level from kernel module??
regards,
linux_lover.

__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs

#1 lore raw
Quoted 10 lines · linux lover

Hello all,
I have one linked list data structure added to
a file in kernel source code which has some kernel info. I want to acess that linked list structure from user space. Is that possible??
Also how to add own system call usable at user
level from kernel module??
regards,
linux_lover.

Many people will tell you to use the /proc file-system. I suggest you make a simple "character" driver and access your kernel structure using ioctl() or mmap().

You don't add your own system call __ever__, even if you are a long-time kernel developer. The current API already has lots of standard interface capabilities. Thinking, even for an instant, that you need more means that you don't understand Unix/Linux.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.

#2 lore raw
Quoted 5 lines
Quoted 5 lines

Hello all,
I have one linked list data structure added to
a file in kernel source code which has some kernel info. I want to acess that linked list structure from user space. Is that possible??

Yes!!

Quoted 2 lines
Quoted 2 lines

Also how to add own system call usable at user
level from kernel module??

!!

Quoted 1 line

Many people will tell you to use the /proc file-system.

*cough* sysfs *cough*
err...(due to new horizons):
*cough* relayfs *cough*

Jan Engelhardt