[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: passing array from kernel space to user space
On Wed, 2006-04-05 at 09:45 +0200, Jan Hudec wrote:
> On Tue, Apr 04, 2006 at 18:55:58 +0530, taha hafeez wrote:
> > On Mon, 2006-04-03 at 00:26 +0200, Vincenzo Mallozzi wrote:
> > > --- taha siddiqi <tawushafeez@xxxxxxxxx> wrote:
> > >
> > > > Hi
> > > >
> > > > Same answer, "please explain the situation !!"
> > > >
> > > > taha
> > > >
> > > > Thanks.
> > >
> > > The array I want to pass from kernel space to user
> > > space contains pid_t elements.
> > > First, I pass the length of the array from user space
> > > to kernel space.
> > > Then, I build the array with the given length filling
> > > it with the pid of processes I need to monitor.
> > > Finally, I've to pass this array of pids to the user
> > > space.
> > > I hope I've well explained the situation.
> > > Thanks all.
> > > Vincenzo Mallozzi.
> > >
> >
> > Well, I think I get you now....
> >
> > Correct me if I am wrong...
> >
> >
> > data buffer
> > USER_SPACE ------------> KERNEL SPACE [fill data with pid_t]
> > ^ |
> > | |
> > *------<----------------*
> > data buffer
> >
> > Why do we need to pass the data buffer to kernel ?
> > Does it contain any information that kernel needs ?
> > if not, then that step can be avoided ?
> >
> > Then you just need a read
...write() call not read() ....
> call implementation of
> > struct file_operations {}.
>
> read call implements passing data FROM KERNEL (because it implements the
> read syscall)
> write call implements passing data TO KERNEL (because it implements the
> write syscall)
>
> > taha
> >
oops!!... yeap it is write() call... sorry!!!
(I always try to be careful with my reply but still i make mistakes...)
taha
>
> >
> >
> >
> > --
> > Kernelnewbies: Help each other learn about the Linux kernel.
> > Archive: http://mail.nl.linux.org/kernelnewbies/
> > FAQ: http://kernelnewbies.org/faq/
> >
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/