eliminating a syscall on accept()+ioctl() combo

Vlad Galu dudu at dudu.ro
Mon Aug 1 06:34:40 UTC 2011


On Jul 31, 2011, at 9:59 PM, Bernard van Gastel wrote:

> Hi all,
> 
> I want to reduce the number of syscalls for my networking application. The app handles incoming connections with the 'accept()' system call. Is there a way to specify to accept() that the newly created file descriptors should be non-blocking (FIONBIO)? This will avoid an ioctl() after the accept(). Thanks!
> 
> With regards,
>  Bernard

Hi Bernard,

You can make your listening socket non-blocking. Newly created file descriptors will inherit that property. However, that will require you to select()/poll()/kqueue() for that descriptor as well, instead of simply blocking in accept().

HTH
Vlad


More information about the freebsd-hackers mailing list