Find the answer to your Linux question:
Results 1 to 3 of 3
hi, i wrote a module that add an entry and a file in /proc fs. i need to read this file from the kernel (tcp_output.c). how do i do that? ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2004
    Posts
    6

    read from /proc


    hi,

    i wrote a module that add an entry and a file in /proc fs.
    i need to read this file from the kernel (tcp_output.c).
    how do i do that?

    b.t.w. i'm working with version 2.6.7

    thanks,
    shimrit

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    To read info from the proc filesystem, you use cat.

    Code:
    cat /proc/cpuinfo
    Since these are technically files, I'd imagine that you can read them as per a normal file in your C program. Keep in mind, though, that they are constantly changing.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Just Joined!
    Join Date
    Jan 2005
    Location
    Toronto, ON, Canada
    Posts
    79
    I wrote a module that add an entry and a file in /proc fs.
    i need to read this file from the kernel (tcp_output.c).
    how do i do that?
    From your question you have your own kernel module which register /proc file and write to it. And you want to access that info from the kernel code tcp_output.c? Is that the question? If this is your question read this in how to implement it.

    http://www.faqs.org/docs/kernel/x762.html

  4. $spacer_open
    $spacer_close

Posting Permissions

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