Re: Send data from kernel to userspace with KEXT control ?
Re: Send data from kernel to userspace with KEXT control ?
- Subject: Re: Send data from kernel to userspace with KEXT control ?
- From: Josh Graessley <email@hidden>
- Date: Wed, 6 Sep 2006 10:45:26 -0700
Hello,
ctl_enqueuedata and ctl_enqueuembuf will enqueue data in the receive
queue for you. When you call those functions, your user space process
that is presumably waiting for data, will be woken up, giving it a
chance to call recv to get to that data.
I believe the point the documentation is making is that there is a
disconnect on the kernel to userspace side. When userspace calls to
the kernel, it all happens on one thread. There is a context switch to
go from userspace to kernel. When the kernel wants to pass data to
user space, it enqueues the data and any thread in userspace gets
kicked so it will call receive.
-josh
On Sep 6, 2006, at 2:25 AM, NAHieu wrote:
Hi,
I have a kext that has some data to send out to userspace. After some
time of investigations (great thanks to developers on this ML), I
think it is a good idea to employ network stack for this job.
To do that, I register a kernel control (ctl_register() function) in
kernel, and have an application in userspace. The application will
periodically send request for data to kernel. Inside kernel, I have a
buffer, and it is necessary to send all the data from the buffer out
to the userspace application.
However, from the guide "Network kernel extensions programming
guide", we read :
" ..... the user process can communicate with the control using
getsockopt, setsockopt, recv, and send on the socket. With the
exception of recv (which is transparently handled with a queue), calls
in user space to these functions result in a kernel-space call to the
equivalent functions in the control, ctl_getopt_func, ctl_setopt_func,
and ctl_send, respectively.
........"
So it is not clear how we can handle receive function (recv) from
inside kernel?
I understand that to send data out (when client requests with recv()),
I must handle the buffer for recv(), but I dont know how to do that.
Too bad the documentation is quite ambiguity to me.
Would anybody help me?
Many thanks,
H
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden