mq on kqueue broken after upgrade to FreeBSD 11

Konstantin Belousov kostikbel at gmail.com
Fri Sep 30 09:45:51 UTC 2016


On Thu, Sep 29, 2016 at 06:11:16PM -0500, Lewis Donzis wrote:
> I had posted this on the userland forum, but it was suggested that I re-post it to this mailing list, so here goes???
> 
> We have applications that are using kevent() with, among other things, POSIX message queues, so they can wake up when data is ready.
> 
> As such, we were using __mq_oshandle() to get a handle from an mqd_t, suitable for passing to kevent().
> 
> However, this function appears to have been removed from publication in FreeBSD 11.0, although it still exists in the source. I saw some discussion about it being a mistake to have been available previously, but plenty of other __mq_*() functions are still public.
> 
> So the question is, how is one supposed to get a kevent() on a POSIX message queue, now that the fd is no longer available?
> 
> (I realize that one could argue that it was never supported, but it does (did) work, and why else would the kernel uipc_mqueue.c have code for supporting it? And that's not to mention that __mq_oshandle() is still declared in /usr/include/mqueue.h)
> 

Where was a discussion about the function presence being the mistake ?

In r291439, symbol versioning for librt was fixed, and apparently
__mq_oshandle() is not present in the global symbols list for librt.
I suspect that this is an erronous ommission, since the function'
declaration is present in the mqueue.h header and it is used by some
mqueue tests.

As such, I believe that exporting it is the intended option there.
The following patch should fix the problem for you.

I also exported __timer_oshandle, but there is no similar definition
in header.

diff --git a/lib/librt/Symbol.map b/lib/librt/Symbol.map
index 161bb76..5482488 100644
--- a/lib/librt/Symbol.map
+++ b/lib/librt/Symbol.map
@@ -18,11 +18,13 @@ FBSD_1.0 {
 	mq_unlink;
 	mq_send;
 	mq_receive;
+	__mq_oshandle;
 	timer_create;
 	timer_delete;
 	timer_gettime;
 	timer_settime;
 	timer_getoverrun;
+	__timer_oshandle;
 };
 
 FBSDprivate_1.0 {


More information about the freebsd-arch mailing list