From owner-freebsd-arch@FreeBSD.ORG Mon May 14 15:25:41 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A84F716A404 for ; Mon, 14 May 2007 15:25:41 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 66F1613C480 for ; Mon, 14 May 2007 15:25:41 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 9673020A8; Mon, 14 May 2007 17:25:37 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on tim.des.no Received: from dwp.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 1CEC120A6; Mon, 14 May 2007 17:25:37 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 1001) id F2F6950D8; Mon, 14 May 2007 17:25:36 +0200 (CEST) From: des@des.no (Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?=) To: MQ References: Date: Mon, 14 May 2007 17:25:36 +0200 In-Reply-To: (antinvidia@gmail.com's message of "Mon\, 14 May 2007 22\:29\:15 +0800") Message-ID: <86odknqvf3.fsf@dwp.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-arch@freebsd.org Subject: Re: A problem with the select(2) interface X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2007 15:25:41 -0000 MQ writes: > I'm writing a network application these days, for compatibility, I choose > the select(2) interface to do event polling. When using it, I'm curious > about the fact that the type of the final parameter is `struct timeval *'= . I > skimmed through the codes in /sys/kern/sys_generic.c, there is nothing > written to this address. So, I think if we can use `const struct timeval = *' > instead? This type can inform the users explicitly that we do NOT modify = the > timeval struct. But I'm not sure if this modification will conflict with = the > POSIX standard. Will you please tell me your considerations? Any suggesti= ons > will be appreciated. According to POSIX, the struct timeval may be updated to reflect the amount of time left if select() returns early (so you can call select() again with the same struct timeval and hit your original deadline). In reality, there is so much old code around that depends on it *not* being updated that this has never been implemented. This is often mentioned as an example of why blindly implementing a standard is not a good idea. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no