On Fri, May 27, 2011 at 01:08:05PM +0000, Emmanuel Dreyfus wrote: > The questions: > - did I miss a way to sleep on write when kernel is out of buffer memory? > - if this is impossible, what about adding a socket option for that? > - would it make sense to have such an option be the default for > SOCK_STREAM and SOCK_SEQPACKET?
You could use select(2), poll(2), or kqueue(2) to sleep until a socket is ready for writing, however, I don't know if any of those will put your program to sleep until a threshold number of bytes can be written. I.e., if you need to write 5 bytes, your program may wake when it can write just 1. I hope the FUSE filesystems cannot deadlock with the kernel in the following way: the kernel exhausts buffers queueing buffers for your filesystem to read; meanwhile, the filesystem waits to write until buffers are free. Dave -- David Young OJC Technologies dyo...@ojctech.com Urbana, IL * (217) 344-0444 x24