From owner-freebsd-current@FreeBSD.ORG Wed Aug 4 14:36:38 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39B8E1065670 for ; Wed, 4 Aug 2010 14:36:38 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id EFE078FC14 for ; Wed, 4 Aug 2010 14:36:37 +0000 (UTC) Received: from [172.31.193.10] (rrcs-98-101-145-84.midsouth.biz.rr.com [98.101.145.84]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id o74EaTBS001079 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 4 Aug 2010 10:36:37 -0400 (EDT) X-DKIM: Sendmail DKIM Filter v2.8.3 duke.cs.duke.edu o74EaTBS001079 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail; t=1280932597; bh=4Y7E+CR86GSFENJ49fxb6Ls2YNjUVcPJYy3ZDS7+uuY=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding; b=nPaWtbZaxAkQ6KOyNb9C+FgDgfUYFQHnntwq36s1FpG+LBcbHiGiOXnzt0pRVmtri xkj3IJrwAsCm/KbZQvvaHHNT/cakt667+y1SrQ1WE0D2xYD6AS26awvGqmOjbcf77F RaTYnwtQyjmoFnHrG3jBt2EeAbThroIaW/pj/qUc= Message-ID: <4C597AE8.5090703@cs.duke.edu> Date: Wed, 04 Aug 2010 10:36:24 -0400 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Incorrect cv_wait_sig() return values? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2010 14:36:38 -0000 Hi, I recently noticed that cv_wait_sig() will return -1 rather than EINTR when a SIGINT is delivered. This is in contrast to CONDVAR(9) which states: <...> cv_wait_sig() and cv_timedwait_sig() return prematurely with a value of EINTR or ERESTART if a signal is caught <...> To demonstrate the problem outside my out-of-tree driver, I took the skeleton driver from http://www.captain.at/programming/freebsd/ and added the following function, invoked at module load: static struct mtx m; static struct cv c; static void cv_test(void) { int rc; mtx_init(&m, "skel_m", MTX_DEF, MTX_DEF); cv_init(&c, "skel_c"); mtx_lock(&m); rc = cv_wait_sig(&c, &m); mtx_unlock(&m); printf("cv_wait_sig returned %d\n", rc); cv_destroy(&c); mtx_destroy(&m); } I load the module, and I ^C kldload after a few seconds to break out of the cv_wait_sig(), which results in this output on console: Skeleton KLD loaded. cv_wait_sig returned -1 Am I doing something wrong, or are condvars broken? I've tried to track this down with dtrace, but failed.. Thanks, Drew