MQ_CLOSE(3P)
πΈ MQ_CLOSE(3P) β the POSIX Programmer's Manual one π
okay bestie, first things first: this page lives in the POSIX Programmer's Manual, and the manual name is MQ_CLOSE(3P) β that's section 3P, the POSIX-flavored section. Say it with me. π
β¨ PROLOG β¨ (the lil disclaimer, do not skip)
This manual page is part of the POSIX Programmer's Manual, periodt.
Heads up fr fr: the Linux implementation of this interface may differ β so consult the corresponding Linux manual page for details on Linux behavior. And plot twist: the interface may not even be implemented on Linux. π Not me finding that out the hard way.
π NAME π
mq_close β close a message queue (REALTIME). That's it, that's the whole name section, she's brief and she's iconic. π
π¦ SYNOPSIS π¦
#include <mqueue.h>
int mq_close(mqd_t mqdes);
That's the whole vibe. Include the header, call the function, hand her a mqdes. Easy. β¨
π DESCRIPTION π
So mq_close() shall remove the association between the message queue descriptor, mqdes, and its message queue. Like, you two are no longer linked. It's giving conscious uncoupling. π«Ά
β οΈ REAL TALK, WRITE THIS DOWN: the results of using this message queue descriptor after a successful return from thismq_close(), and until that descriptor comes back from a subsequentmq_open(), are undefined. Undefined!! That means nobody promised you anything, bestie. Do not touch it. Do not look at it. Let her go. π
And here's the other thing: if the process has successfully attached a notification request to the message queue via this mqdes, then that attachment shall be removed, and the message queue is then available for another process to attach for notification. So you're not just closing β you're clearing the runway for the next person. Generous. Main character energy. π
π₯ RETURN VALUE π₯
- On success? She returns a value of zero. Clean. Gorgeous. Slay. π
- Otherwise? She returns a value of
-1and setserrnoto indicate the error. Not slay. But informative. π
π ERRORS π
The mq_close() function shall fail if:
EBADFβ themqdesargument is not a valid message queue descriptor. That descriptor is fake, expired, or just not a descriptor, and the function is NOT having it.
The following sections are informative. (Read: cute bonus content, not the actual rules. π)
πΈ EXAMPLES πΈ
None.
(Not a single one. She said no example era. Respect it.) β¨
π§ APPLICATION USAGE π§
None.
(Nothing to add, bestie. Nothing at all.) π
β RATIONALE β
None.
(She didn't feel the need to justify herself. Queen behavior.) π
π FUTURE DIRECTIONS π
None.
(No plans. No notes. No future arc announced.) π¦
π«Ά SEE ALSO π«Ά
Go read these next, they're all in the group chat:
mq_open()mq_unlink()msgctl()msgget()msgrcv()msgsnd()
And also: The Base Definitions volume of POSIX.1β2017, <mqueue.h> β the header itself, iykyk. π
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie π go forth and close your message queues responsibly β¨
signed, sealed, and delivered by IEEE/The Open Group, dated 2017 β mwah π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms