Find the answer to your Linux question:
Results 1 to 2 of 2
hey guys, i am trying to implement a module that reads from proc/meminfo proc/cpuinfo and writes it in another file in proc i also need the current process list written ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2006
    Posts
    1

    History Kernel Module


    hey guys,

    i am trying to implement a module that reads from

    proc/meminfo
    proc/cpuinfo

    and writes it in another file in proc

    i also need the current process list written in the same file, yet i couldnt go that far for now.

    can i use straight good old fprintf() in classical manner? or is there a more systematic way to do it?

    if you think fprintf() would satisfy, what may be the parameters?

  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Location
    Holland
    Posts
    301
    Quote Originally Posted by Timwe
    i am trying to implement a module that reads from

    proc/meminfo
    proc/cpuinfo
    Bad idea. The linux kernel doesn't read files. That's a user space task. In fact that are not common files but pseudo-files. Please, read these articles:

    http://www.linuxforums.org/misc/unde...ing_/proc.html
    http://www.linuxforums.org/misc/unde...c:_part_2.html
    http://www.linuxforums.org/misc/proc...he_inside.html

    Quote Originally Posted by Timwe
    and writes it in another file in proc

    i also need the current process list written in the same file, yet i couldnt go that far for now.

    can i use straight good old fprintf() in classical manner? or is there a more systematic way to do it?

    if you think fprintf() would satisfy, what may be the parameters?
    You can not use libc libraries from inside the kernel at all . Read some books about kernel programming. You can start for these articles:

    http://www.linuxforums.org/programmi...ng_part_i.html
    http://www.linuxforums.org/programmi...g_part_ii.html

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •