Loading ...
Sorry, an error occurred while loading the content.
 

Re: [blug-prog] Help regarding -kernel to user space

Expand Messages
  • Nikunj A. Dadhania
    Hi, ... There should be some standard interfaces from which u can get kernel IP information, most of them will be there in /proc/net/ directory. You can open
    Message 1 of 3 , May 9, 2003
      Hi,

      On Fri, 2003-05-09 at 06:34, Murali Subramanian wrote:
      > Hi,
      > I am the newbie of Linux Programming. I am seeking the help from
      > you. I had a problem with get the kernel data to my userspace.
      > /usr/src/linux/net/ipv4/netfilter/ipt_LOG.c is a kernel file which has
      > the ip network informations.
      There should be some standard interfaces from which u can get kernel IP
      information, most of them will be there in /proc/net/ directory. You can
      open these files in read-only mode and get the required data.

      If you need to write your own interfaces, you will have to refer to
      Linux kernel module programming guide(lkmpg) which are available at
      www.tldp.org


      > I want to get the data from my user program. I found two commands
      > which is 'copy_to_user() & copy_from_user()'. But i dont know,how to
      > use this functions for my user program.
      These functions are _only_ used in kernel space and CANNOT be used in
      user space programs

      >
      > Please guide me with example or else send me the sample code for using
      > these two functions which would be very useful to me...
      The lkmpg has examples to use these functions.

      You could also visit this link.
      http://www.oreilly.com/catalog/linuxdrive2/chapter/book/

      Thanks
      Nikunj
    • Nikunj A. Dadhania
      ... Forgot one more thing, all the ip network informations data structures which you are interested in could only be accessed by your module if and only if
      Message 2 of 3 , May 9, 2003
        On Fri, 2003-05-09 at 06:34, Murali Subramanian wrote:
        > Hi,
        > I am the newbie of Linux Programming. I am seeking the help from
        > you. I had a problem with get the kernel data to my userspace.
        > /usr/src/linux/net/ipv4/netfilter/ipt_LOG.c is a kernel file which has
        > the ip network informations.
        Forgot one more thing, all the ip network informations data structures
        which you are interested in could only be accessed by your module if and
        only if they are global.

        After writing this module(may be a character driver with ioctl), you
        will also need to write a user level utilities to get information from
        the kernel.

        hope this information helps you.

        thanks
        nikunj
      Your message has been successfully submitted and would be delivered to recipients shortly.