Working with kernel_accept?

Pranay Kumar Srivastava Pranay.Shrivastava at hcl.com
Wed Feb 1 06:28:54 EST 2012


I was trying to create socket within kernel and I used kernel_* helper functions to get started. This worked fine for UDP however with TCP I ran into some issues when I did the following steps

1.) I was able to create a listening TCP socket using sock_create_kern, should I be using sock_create only?

2.) I had changed the sk_data_ready callback for the listening socket so that a waiting thread would be notified when a connection is ready to be accepted. When that happened the thread was woken up and that thread then called kernel_accept.

3.) Now started the issue, in kernel_accept it uses sock_create_lite and the machine just froze. After quite a lot of hours, i was able to figure out the problem which was apparently with sock_create_lite. This function was not initializing sock->sk, printed it and found it to be NULL, which I guess caused the machine to froze.

4.) As a resolve, I went back to sock_create_kern and called sock->ops->accept instead of kernel_accept and it worked.

Is there any other step required in order to work with kernel_accept?
I'm using SLES 11 SP1, kernel 2.6.32.12


::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------



More information about the Kernelnewbies mailing list