From owner-freebsd-arch@FreeBSD.ORG Sat Jun 12 19:16:43 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 EC0D816A4CE for ; Sat, 12 Jun 2004 19:16:43 +0000 (GMT) Received: from blake.polstra.com (blake.polstra.com [64.81.189.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86D5B43D31 for ; Sat, 12 Jun 2004 19:16:43 +0000 (GMT) (envelope-from jdp@polstra.com) Received: from strings.polstra.com (dsl081-189-067.sea1.dsl.speakeasy.net [64.81.189.67]) by blake.polstra.com (8.12.11/8.12.11) with ESMTP id i5CJFLN0012224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 12 Jun 2004 12:15:21 -0700 (PDT) (envelope-from jdp@strings.polstra.com) Received: (from jdp@localhost) by strings.polstra.com (8.12.11/8.12.11/Submit) id i5CJFLoG045384 for freebsd-arch@freebsd.org; Sat, 12 Jun 2004 12:15:21 -0700 (PDT) (envelope-from jdp) Message-ID: X-Mailer: XFMail 1.5.5 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Sat, 12 Jun 2004 12:15:21 -0700 (PDT) From: John Polstra To: freebsd-arch@freebsd.org X-Bogosity: No, tests=bogofilter, spamicity=0.091382, version=0.14.5 Subject: 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: Sat, 12 Jun 2004 19:16:44 -0000 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