From owner-freebsd-arch@freebsd.org Thu Oct 6 19:17:49 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 0457EBECB26 for ; Thu, 6 Oct 2016 19:17:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76837A5A; Thu, 6 Oct 2016 19:17:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u96JHhTO055519 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 6 Oct 2016 22:17:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u96JHhTO055519 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u96JHgkO055518; Thu, 6 Oct 2016 22:17:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 6 Oct 2016 22:17:42 +0300 From: Konstantin Belousov To: Lewis Donzis Cc: Jilles Tjoelker , deischen@freebsd.org, freebsd-arch@freebsd.org Subject: Re: mq on kqueue broken after upgrade to FreeBSD 11 Message-ID: <20161006191742.GV38409@kib.kiev.ua> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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 19:17:49 -0000 On Wed, Oct 05, 2016 at 07:09:03PM -0500, Lewis Donzis wrote: > Sorry, perhaps I wasn???t 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???re not meant to > circumvent the librt functions. > > The problem is that it???s not exactly clean that we have mq_*() > functions for some operations, whereas for others, we???re 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. POSIX does not and can not mandate the implementation. Existence of the backing fd is pure implementation detail. Access to the fd through mq_getfd_np() is some good will service from the implementation which is supposed to make additional things possible besides the guarantees of the POSIX spec. kqueue(2) is not part of the POSIX, same as the use of mq for the multiplexed wait (select/poll/kqueue). POSIX intent is that app code get notifications by events.