Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Aug 2011 08:11:04 +0200
From:      Vlad Galu <dudu@dudu.ro>
To:        Bernard van Gastel <bvgastel@bitpowder.com>
Cc:        hackers@freebsd.org
Subject:   Re: eliminating a syscall on accept()+ioctl() combo
Message-ID:  <7E99FCF5-66DF-422E-B2FE-28547AF916A7@dudu.ro>
In-Reply-To: <E27242EA-A2DD-4CB8-92B6-8B95B3BF3B8E@bitpowder.com>
References:  <E27242EA-A2DD-4CB8-92B6-8B95B3BF3B8E@bitpowder.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

> Hi all,
>=20
> 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!
>=20
> 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=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7E99FCF5-66DF-422E-B2FE-28547AF916A7>