MQ_UNLINK(3P)
๐ PROLOG ๐
Okay so real talk first, bestie. This manual page is part of the POSIX Programmer's Manual. But here's the tea: the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux at all. Vibe check your system first, fr fr. ๐ซถ
โจ NAME โจ
mq_unlink โ remove a message queue (REALTIME)
๐ SYNOPSIS ๐
#include <mqueue.h>
int mq_unlink(const char *name);
๐ฆ DESCRIPTION ๐ฆ
So the mq_unlink() function shall remove the message queue named by the string name. That's the whole job. Iconic. ๐
But wait, plot twist ๐ โ if one or more processes have the message queue open when mq_unlink() gets called, then destruction of the message queue gets postponed until all references to the message queue have been closed. It's giving "I'm leaving but I'm not leaving until everyone stops texting me" energy. And here's the thing: the mq_unlink() call need not block until all references have been closed โ it may return immediately. So it's not sitting there waiting for the group chat to go quiet, it can just dip. ๐โโ๏ธ๐จ
Then, after a successful call to mq_unlink(), reuse of the name shall subsequently cause mq_open() to behave as if no message queue of this name exists โ that is, mq_open() will fail if O_CREAT is not set, or will create a new message queue if O_CREAT is set. Fresh start, new name, who dis. โจ
๐ RETURN VALUE ๐
When it goes right, the function shall return a value of zero. Slay.
Otherwise? The named message queue shall be unchanged by this function call, and the function shall return a value of -1 and set errno to indicate the error. So nothing happened, and it told you why. Honest queen. ๐ญ
๐ฅ ERRORS ๐ฅ
The mq_unlink() function shall fail if:
EACCESโ Permission is denied to unlink the named message queue. Not your queue, not your call, bestie. ๐EINTRโ The call tomq_unlink()blocked waiting for all references to the named message queue to be closed, and a signal interrupted the call. Rude interruption, honestly. ๐ENOENTโ The named message queue does not exist. It's not there. Never was. Ghosted. ๐ป
The mq_unlink() function may fail if:
ENAMETOOLONGโ The length of thenameargument exceeds{_POSIX_PATH_MAX}on systems that do not support the XSI option, or exceeds{_XOPEN_PATH_MAX}on XSI systems, or the name has a pathname component that is longer than{_POSIX_NAME_MAX}on systems that do not support the XSI option, or longer than{_XOPEN_NAME_MAX}on XSI systems. BUT โ important little detail, no cap โ a call tomq_unlink()with anameargument that contains the same message queue name as was previously used in a successfulmq_open()call shall not give an[ENAMETOOLONG]error. So if it worked before, it's not gonna suddenly be "too long" on you. She remembers. ๐ง
Also just so you know: the following sections are informative. Not rules, just vibes.
๐ธ EXAMPLES ๐ธ
None. ๐ญ I know. Devastating. No examples to serve you today.
๐ APPLICATION USAGE ๐
None. Again. We're running on pure theory here. ๐ซ
โญ RATIONALE โญ
None. No reasoning given. It just is. Main character energy. ๐
๐ FUTURE DIRECTIONS ๐
A future version might require the mq_open() and mq_unlink() functions to have semantics similar to normal file system operations. So like... watch this space, bestie. Things might change. ๐ฎ
๐ SEE ALSO ๐
mq_close()mq_open()msgctl()msgget()msgrcv()msgsnd()
The Base Definitions volume of POSIX.1โ2017, <mqueue.h>
๐ 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 .
Okay that's the whole page, babe โ brought to you by IEEE/The Open Group, 2017, MQ_UNLINK(3P) era. Go forth and unlink responsibly. 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