From owner-freebsd-arch@FreeBSD.ORG Mon Jun 14 17:23:50 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 31AC216A4CE for ; Mon, 14 Jun 2004 17:23:50 +0000 (GMT) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id D267E43D6B for ; Mon, 14 Jun 2004 17:23:49 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 18948 invoked from network); 14 Jun 2004 17:20:50 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 14 Jun 2004 17:20:50 -0000 Received: from 10.50.41.233 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i5EHKkhG057506; Mon, 14 Jun 2004 13:20:47 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-arch@FreeBSD.org Date: Mon, 14 Jun 2004 13:21:42 -0400 User-Agent: KMail/1.6 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406141321.42275.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: John Polstra Subject: Re: RFC: API change for sema_timedwait X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 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 Jun 2004 17:23:50 -0000 On Saturday 12 June 2004 03:15 pm, John Polstra wrote: > Before 5.x becomes -stable, I'd like to change the API of > sema_timedwait(9). This function is used in only 3 places in the > kernel, all in "dev/ips/ips_commands.c". > > Currently, sema_timedwait returns 0 if the operation fails due to a > timeout. On success, it returns a non-zero value. This is precisely > the opposite of the standard convention in the kernel, where 0 means > success and a non-zero value (taken from ) means failure. > The convention exists because most functions can succeed in only one > way but can fail in several different ways. > > The reason I care about this is because I'd like to add new functions > sema_wait_sig() and sema_timedwait_sig() which can be interrupted > by a signal. Then sema_timedwait_sig could fail in two different > ways: as a result of a timeout or as a result of a signal. If these > functions returned proper errno values on failure, it would be easy to > distinguish between the two failure cases. > > This change would also make the return values of sema_timedwait, > sema_wait_sig, and sema_timedwait_sig consistent with the analogous > condition variable operations cv_timedwait, cv_wait_sig, and > cv_timedwait_sig and with tsleep and msleep. > > Does this change sound OK to you folks? Sounds ok to me. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org