Skip to contentSkip to conversation

tcp_recvmsg and tcp_data_wait with respect to select

DISCUSSION Melkor Ainur 1 participant 1 message Jan 22, 2002

lore
Share & tools
lore
#0 lore raw

Hello all,

I have been writing a TCP stack. In my implementation of tcp_recvmsg, I put the calling process to sleep around my device's waitqueue by doing a interruptible_sleep_on(&mywaitq);
and then wake the caller on an interrupt.

This functionality works fine for an application that calls recv() and expects to block. However, an application like netcat/nc calls select on an input filehandle (stdin i think) as well as the recv() handle. When this is done, and I put the caller to sleep, recv works fine but the application is no longer
woken out of select by standard input. This would suggest that the way I put the caller to sleep is different than the way linux's tcp_recvmsg does it. Looking at the code, I see tcp_data_wait which does approximately the same thing. I instrumented this area with some debug and noticed that when running netcat this is not what is called. I will continue to look for where tcp_recvmsg actually puts the caller to sleep. In the mean time, I am hoping for any hints/suggestions that could help me solve this issue.

Thanks, Melkor

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/