From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 1 06:34:40 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13215106564A for ; Mon, 1 Aug 2011 06:34:40 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9C54A8FC13 for ; Mon, 1 Aug 2011 06:34:39 +0000 (UTC) Received: by fxe4 with SMTP id 4so5849964fxe.13 for ; Sun, 31 Jul 2011 23:34:38 -0700 (PDT) Received: by 10.223.159.8 with SMTP id h8mr5928686fax.3.1312179069162; Sun, 31 Jul 2011 23:11:09 -0700 (PDT) Received: from [192.168.10.3] ([82.76.253.74]) by mx.google.com with ESMTPS id x13sm2670948fah.29.2011.07.31.23.11.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 31 Jul 2011 23:11:07 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Vlad Galu In-Reply-To: Date: Mon, 1 Aug 2011 08:11:04 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <7E99FCF5-66DF-422E-B2FE-28547AF916A7@dudu.ro> References: To: Bernard van Gastel X-Mailer: Apple Mail (2.1244.3) Cc: hackers@freebsd.org Subject: Re: eliminating a syscall on accept()+ioctl() combo X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 06:34:40 -0000 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=