The mq_getfd_np function was added in ddce1c3ddbfb773c2ee1343721f4e5bbe07186d0 (SVN r306588) in 2016. However, it's never had a man page. It needs one. Especially since mq_open2(2) contains this paragraph, which doesn't make sense if the reader doesn't know about mq_getfd_np: FreeBSD implements message queue based on file descriptor. The descriptor is inherited by child after fork(2). The descriptor is closed in a new image after exec(3). The select(2) and kevent(2) system calls are supported for message queue descriptor.
This function allows retrieving and setting group, user and mode bits on a POSIX message queue without mounting mqueuefs (the module must be loaded but need not be mounted). One key question is what one must do with the descriptor when done with the associated mqd_t handle. Should the fd be closed explicitly or does mq_close take care of that?
Created attachment 248374 [details] manual page Early draft for man page. Writing some code to verify what is claimed is actually true.
(In reply to unitrunker from comment #2) Probably a good idea to create a phabricator review and set doc committers to review. They will be able to commit too.
Created attachment 248500 [details] POC tests to validate a few things state in the proposed doc Covers close before mq_close and mq_close before close. Also covers fork.
Created attachment 248501 [details] manual page Updated and clarified some points in the document.
(In reply to Cy Schubert from comment #3) https://reviews.freebsd.org/D43947 Adding reviewers now.