Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, I'm trying to copy a structure instance into a userspace buffer using copy_to_user. I understood that the buffer is being copied from kernel space to user space, but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    16

    reading a buffer in a userspace program


    Hi all,
    I'm trying to copy a structure instance into a userspace buffer using copy_to_user. I understood that the buffer is being copied from kernel space to user space, but how do I use that buffer from my userspace c program?

  2. #2
    Just Joined!
    Join Date
    Feb 2008
    Posts
    9

    simpler than what you thought

    You would use it exactly as if you have called a function that takes in the structure pointer (i.e. structure by reference) and that function has filled up the structure for you. Of course, you need to allocate the memory for the structure in the user space before making the system call, just like you would before expecting a C library function that fills up the structure for you.

  3. #3
    Just Joined!
    Join Date
    Nov 2009
    Posts
    16
    hey,
    thanks a lot, but i had figured it out!

Posting Permissions

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