MQ_UNLINK(3POSIX)
π PROLOG π
ok so this page is part of the POSIX Programmer's Manual β we're in MQ_UNLINK(3POSIX) territory, bestie, the POSIX programmer's corner of the man page universe πΈ
heads up tho: the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. vibe check your platform first, fr fr.
β¨ NAME β¨
mq_unlink β remove a message queue (REALTIME) π
π SYNOPSIS π
#include <mqueue.h>
int mq_unlink(const char *name);
like. that's it. one function. one argument. iconic behavior.
π¦ DESCRIPTION π¦
okay so mq_unlink() shall remove the message queue named by the string name. bye bestie π
but here's the twist: if one or more processes have that message queue open when mq_unlink() gets called, then the destruction of the message queue shall be postponed until all references to it have been closed. the queue is basically on read receipt π it's not gone until everyone lets go.
but also: the mq_unlink() call need not block until all references have been closed β it may return immediately. so it can just dip and let the queue ghost everyone.
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 means:
mq_open()will fail ifO_CREATis not set, or- it will create a new message queue if
O_CREATis set.
it's giving "fresh start, who dis" β¨
π₯ RETURN VALUE π₯
- Upon successful completion, 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
-1and seterrnoto indicate the error. not slay π
π ERRORS π
The mq_unlink() function shall fail if:
EACCESβ Permission is denied to unlink the named message queue. rude.EINTRβ The call tomq_unlink()blocked waiting for all references to the named message queue to be closed and a signal interrupted the call. interrupted mid-vibe, so valid honestly.ENOENTβ The named message queue does not exist. it's not there bestie, never was π
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 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.
important little footnote energy: 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 once, don't come for it now π
The following sections are informative.
π EXAMPLES π
None. (yes literally none, the standard said "no examples, figure it out" π«Ά)
πΈ APPLICATION USAGE πΈ
None. (again! nothing here! the vibes are minimal and we respect it)
β RATIONALE β
None. (they really said "no thoughts, head empty" on this one)
π§ 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. it could get a glow-up. watch this space π
π 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 .
and that's the whole page bestie!! π«Άβ¨ this one came to you courtesy of IEEE/The Open Group, dated 2017, page MQ_UNLINK(3POSIX) β go forth and unlink responsibly πππ¦
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms