On Thu, 2003-06-26 at 21:21, tirumal b wrote:
> hello,
> 
>   can u tell me how can i change this to kernel code,
> will i need to modify the kernel code and recompile it
> .please let me know.
> 
> Thank you

I'm afraid that's really a non-trivial task.  The basic steps would
require you to include the appropriate kernel header files and add the
appropriate flags and defines on the compile command line.

The easiest way to do it, especially with regard to testing, would be to
build your code as a kernel module so you can easily add and remove it
from the running kernel.  This way, you wouldn't need to rebuild the
kernel and reboot each time you wanted to test a change to your code
(unless, of course, your module hosed the system while it was running).

My suggestion to you if you're not a kernel hacker would be to either:

a) if you're saavy enough, look at some example drivers in the source
tree and glean what you need from them or possibly adapt a very basic
one to suit your needs, or

b) buy Rubini's Linux Device Driver book (I *think* it's still in
print).  It's somewhat out of date, but is still an excellent reference
manual for the basics of linux driver development.

I hope this helps.

David

> On Thu, 2003-06-26 at 20:45, [EMAIL PROTECTED] wrote:
> > tirumal b <[EMAIL PROTECTED]> said:
> > 
> > > hello,
> > > 
> > > i have tried to create files in /proc but i am not
> > > able to do so. This is the code i have written and
> it
> > > generates some errors.
> > > 
> > 
> > /proc isn't a 'real' file system.  It's a virtual
> representation of 
> your
> > machine/os environment and kernel, and gives you
> some access to 
> ongoing
> > operations.  Under most conditions you cannot write
> to that 
> directory.
> > 
> > best
> >     rickf
> 
> Upon initial inspection, the code seems valid.  I'm
> guessing the 
> problem
> is that creating entries in /proc can only be done by
> kernel code.  
> This
> is not kernel code, it's application code.
> 
> > > #include<stdio.h>
> > > #include<sys/types.h>
> > > #include<linux/proc_fs.h>
> > > main()
> > > {
> > > const char* name="CPU";
> > > mode_t mode=444;
> > > struct proc_dir_entry *l;
> > > l=create_proc_entry(name,mode,NULL);
> > > }
> > > 

-- 
David Hollister
Furthurnet - Free, legal P2P - share the tunes:  http://furthurnet.org


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to