site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cD8OTEaSxLsB/nAlHSspI8HKhysUBuePBuMiKORHzzMslWjg8LFT+mQVkq824+39GVmqrjuKSYxL94Ve+/eL1eRZKBeSRMItb+jTaHKK0byuuR8d1GQjYOcrHrLjhVdAdM8dSCHP2I5m/TLldA/SrD3HWWyFwtYaQ+C2uyRwEQM= Ah, never mind. I have found tcplognke, and look like that is what I need. Thank you, H Hi Josh, On 9/7/06, Josh Graessley <jgraessley@apple.com> wrote:
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.
Excellent!!! It is less ambiguity now for me. Could you point me to any documentation about ctl_enqueudata/clt_enqueuembuf? Is there any sample code about using kernel control to exchange data between kernelspace and userspace? Too bad that the NKE documentation fails to mention these functions? Many thanks. H
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,
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On 9/9/06, NAHieu <nahieu@gmail.com> wrote: This email sent to site_archiver@lists.apple.com