On Mon, Aug 01, 2011 at 08:11:04AM +0200, Vlad Galu wrote: > On Jul 31, 2011, at 9:59 PM, Bernard van Gastel wrote: > > 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!
> 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(). This is documented FreeBSD behaviour and common across BSDs, but is not portable. POSIX leaves it unspecified what the non-blocking state of the new socket is and in fact Linux always makes the new socket blocking (unless you request non-blocking using their new accept4() call). Because this portability issue can be very subtle, I suggest not blindly relying on it. -- Jilles Tjoelker _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"