title: Passing Address to user space from Kernel space
body: <p>I am working on linux-3.7.6/kernel/sched/core.c where in schedule() function I have to record the pid's and tgid's for processes and have to show the recorded values to user space. I took global array of structs in kernel space where I am storing tgid and pid's and I was thinking if I could just pass the address of the array to user space and then access the values of tgid and pid at user space.</p>
  
  <pre><code>typedef struct process{
  int pid;
  int tgid;
  }p;
  
  p proc[100];
  </code></pre>
  
  <p>Is there a way I can send all the data stored in array of structs to user space in one shot?
  I have used copy_to_user before but just stuck here as how to send these entire set of values as copy_to_user copies data in form of blocks? I would really appreciate if somebody could give me directions as how to go ahead. Thanks!</p>