From owner-freebsd-arch@FreeBSD.ORG Sun Jun 13 04:12:24 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 409A216A4D2 for ; Sun, 13 Jun 2004 04:12:21 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 512C543D1F for ; Sun, 13 Jun 2004 04:12:20 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from freebsd.org (junior-wifi.samsco.home [192.168.0.11]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id i5D4EXrF000393; Sat, 12 Jun 2004 22:14:34 -0600 (MDT) (envelope-from scottl@freebsd.org) Message-ID: <40CBD3F3.7040407@freebsd.org> Date: Sat, 12 Jun 2004 22:11:31 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040304 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Polstra References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: freebsd-arch@freebsd.org 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: Sun, 13 Jun 2004 04:12:24 -0000 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? > > John Being the ips maintainer, I have no objection to this change. Scott