From owner-freebsd-arch@freebsd.org Thu Oct 6 00:11:12 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97A99AF42F9 for ; Thu, 6 Oct 2016 00:11:12 +0000 (UTC) (envelope-from lew@perftech.com) Received: from smtp-gw.pt.net (smtp-gw.pt.net [206.210.194.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp-gw.pt.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 660B66E6 for ; Thu, 6 Oct 2016 00:11:11 +0000 (UTC) (envelope-from lew@perftech.com) X-ASG-Debug-ID: 1475712544-09411a12c012a7ef0001-RYubVt Received: from mail.pt.net (mail.pt.net [206.210.194.11]) by smtp-gw.pt.net with ESMTP id sFv9fcYJRUFR7BEJ (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 05 Oct 2016 19:09:04 -0500 (CDT) X-Barracuda-Envelope-From: lew@perftech.com X-Barracuda-Effective-Source-IP: mail.pt.net[206.210.194.11] X-Barracuda-Apparent-Source-IP: 206.210.194.11 Received: from localhost (localhost [IPv6:::1]) by mail.pt.net (Postfix) with ESMTP id DD089842630; Wed, 5 Oct 2016 19:09:04 -0500 (CDT) Received: from mail.pt.net ([IPv6:::1]) by localhost (mail.pt.net [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id lwSi51cxktPZ; Wed, 5 Oct 2016 19:09:04 -0500 (CDT) Received: from localhost (localhost [IPv6:::1]) by mail.pt.net (Postfix) with ESMTP id A67BB842634; Wed, 5 Oct 2016 19:09:04 -0500 (CDT) X-Virus-Scanned: amavisd-new at pt.net Received: from mail.pt.net ([IPv6:::1]) by localhost (mail.pt.net [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id FkQ_uIrwcDHM; Wed, 5 Oct 2016 19:09:04 -0500 (CDT) Received: from [192.168.0.16] (cpe-173-173-96-61.satx.res.rr.com [173.173.96.61]) (Authenticated sender: lew@pt.net) by mail.pt.net (Postfix) with ESMTPSA id 5AAFD842630; Wed, 5 Oct 2016 19:09:04 -0500 (CDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: mq on kqueue broken after upgrade to FreeBSD 11 From: Lewis Donzis X-ASG-Orig-Subj: Re: mq on kqueue broken after upgrade to FreeBSD 11 In-Reply-To: <20161005131412.GF38409@kib.kiev.ua> Date: Wed, 5 Oct 2016 19:09:03 -0500 Cc: Jilles Tjoelker , deischen@freebsd.org, freebsd-arch@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20160930184418.1047afc2@kan> <20161001092515.GW38409@kib.kiev.ua> <20161001201655.GA91457@stack.nl> <20161001210722.GC38409@kib.kiev.ua> <20161001231524.GB91457@stack.nl> <20161002114613.GE38409@kib.kiev.ua> <20161002132242.GA2628@stack.nl> <7A72D37B-6C57-41FE-893F-592235A19D9D@perftech.com> <20161002163708.GG38409@kib.kiev.ua> <95CA96C0-A0F2-46B6-8BEA-E1A923FEC91D@perftech.com> <20161005131412.GF38409@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3124) X-Barracuda-Connect: mail.pt.net[206.210.194.11] X-Barracuda-Start-Time: 1475712544 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://smtp-gw.pt.net:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1893 X-Virus-Scanned: by bsmtpd at pt.net X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC0_MISMATCH_TO X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.33509 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2016 00:11:12 -0000 > On Oct 5, 2016, at 8:14 AM, Konstantin Belousov = wrote: >=20 > On Mon, Oct 03, 2016 at 07:27:54AM -0500, Lewis Donzis wrote: >> That's a very good point, I hadn't considered those other functions, >> and it???s clear that an fd is allocated and stored in the mqd_t. >> But using close() instead of mq_close() wouldn't delete the sigevent >> or free the memory that was allocated by mq_open(). In other words, >> I don't understand why you'd ever want/need to use close() on the >> underlying fd. >=20 > I really have troubles giving any useful interpretation to your = question. > OS provides the kernel service which backs the posix message queue > implementation in userspace, as a file descriptor. To release = resources > designated by the file descriptor, it must be closed, as in, close(2) > must be called. Librt does this in mq_close(3). >=20 > Why should I need to show a case of using close(2) on kernel mq > descriptor (perhaps besides librt) ? And how this changes or augments > the fact that kmq is file descriptor ? Sorry, perhaps I wasn=E2=80=99t clear. As I read it, you suggested that = you "can and should call close()" on the fd in an mqd_t, and my point = was simply that such practice would obviously be bad because it would = fail to release resources allocated by mq_open(). So yes, the correct = way to close an mqueue is via mq_close(), i.e., we=E2=80=99re not meant = to circumvent the librt functions. The problem is that it=E2=80=99s not exactly clean that we have mq_*() = functions for some operations, whereas for others, we=E2=80=99re = required to convert the mqd_t to an fd. Of course, this is no fault of = FreeBSD, and perhaps the POSIX folks should have come up with a better = way to address this. For example, they could have specified a portable = way to get the underlying fd from an mqd_t and specified what can and = cannot be done with the fd. lew=