Tech Support > Operating Systems > Linux / Variants > /proc interface
/proc interface
Posted by Hagit on January 26th, 2004


Hi
I would like to write a module that its only mission is to interface
through the /proc some internal information. The user will be able to
'cat /proc/my_module' and the relevant information will be printed to
the screen. Should my module be written as a caracter device driver,
or could it be just a simple module. Can you send/link me to any
simple example? As I understand, the module should call
create_proc_entry() - Am I right?
What kind of operation should it implement?
Any help will be very helpful
Thanks
Hagit

Posted by Alan Connor on January 26th, 2004


On 26 Jan 2004 11:56:11 -0800, Hagit <hagit_guy@hotmail.com> wrote:
If I am following you correctly, a module isn't required here, just a script.

#!/bin/sh

clear

echo; echo;

echo "enter the name of the module:"
echo; echo
read name
echo; echo
grep "$name" /proc/modules
echo; echo


Or something along those lines.

After doing

$ type mi

(Module Info) to make sure that the name isn't taken for another function or
alias or script, etc. call the file mi and make it executable by doing

$ chmod +rx mi

then move to a directory on your PATH, like /usr/local/bin.

$ echo $PATH

(the echo's just create blank lines for formatting purposes)



AC



Posted by Jeroen Geilman on January 27th, 2004


Hagit wrote:

Why ? If the module's only use is to insert info into /proc, then what
info is this ?

A character device will be... a device, so it will go in /dev.

I still don't understand that; what do you mean by "simple"?

The simplest module possible is one that does nothing, i.e. has a
module_init and (possibly) a module_cleanup, no actual working code.

If you say so, then that is all that is required.

How should I know ?
You still haven't explained what you want it to *do*.

Heheh


--
Jeroen Geilman

Analog bits courtesy of adaptr.

Posted by Hagit on January 27th, 2004


Alan Connor <zzzzzz@xxx.yyy> wrote in message news:<_PfRb.27846$1e.18483@newsread2.news.pas.eart hlink.net>...
Thank you very much, but I am not sure I ubderstood. Please try to
help:
first, the information that I want to interface is Kernel internal
information. Can I do it from a script?
second, what should the user do in order to get the information. I
want the user to read the file. Is this what you ment?
I need some more explanation.
THANKS!!!

Posted by Alan Connor on January 27th, 2004


On 27 Jan 2004 00:14:28 -0800, Hagit <hagit_guy@hotmail.com> wrote:
So you want to write extensions to proc filesystem driver...??

Sure you can't get the info from /lib/modules?

AC


Posted by Hagit on January 27th, 2004


Jeroen Geilman <jeroen-nospammat-adaptr.nl> wrote in message news:<63bhe1-30a.ln1@core.adaptr.nl>...

I want to display some kernel internal parameters.....
So
Do you think I need a module that call create_proc_entry() with the
relevant read() write() functions?!?!?
(I didnt understand what's so funny, but im glad i made someone smile
today. It worth any LINUX help!!!)


Similar Posts