mq_unlink(3)

okay so real quick, this is mq_unlink(3), a page from the Library Functions Manual, and it's all about yeeting a message queue name into the void 🫢


✨ NAME ✨

mq_unlink β€” remove a message queue

πŸ“š LIBRARY πŸ“š

Real-time library (that's librt, and you link it with -lrt) πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <mqueue.h>

int mq_unlink(const char *name);

🌸 DESCRIPTION 🌸

okay so mq_unlink() removes the specified message queue name. and bestie, it's immediate β€” the message queue name is gone the second this call goes through, no hesitation, no waiting around, main character energy fr fr πŸ’…

but here's the tea: the queue itself isn't destroyed right away. it gets destroyed once any other processes that have the queue open close their descriptors referring to the queue. so like... it's a "you can leave but the party keeps going until everyone leaves" kinda situation ✨

πŸ’– RETURN VALUE πŸ’–

  • on success, mq_unlink() returns 0 β€” slay, we love a clean win πŸ‘‘
  • on error, -1 is returned, and errno is set to indicate the error 😭

πŸ’€ ERRORS πŸ’€

  • EACCES β€” the caller does not have permission to unlink this message queue. like, the door is locked and you are not on the list bestie πŸ™ˆ
  • ENAMETOOLONG β€” name was too long. it's giving "essay when they asked for a text" πŸ’€
  • ENOENT β€” there is no message queue with the given name. nothing there. ghosted. literally nothing to unlink πŸ“

🧚 ATTRIBUTES 🧚

for an explanation of the terms used in this section, see attributes(7), okay?

  • Interface: mq_unlink()
  • Attribute: Thread safety
  • Value: MT-Safe

so yeah, it's thread safe, no cap β€” multiple threads can be in there at the same time and nobody's fighting 🫢

🌈 STANDARDS 🌈

POSIX.1-2008. periodt. πŸ’…

⭐ HISTORY ⭐

POSIX.1-2001. so it's been iconic since way back, not me being nostalgic πŸŽ€

πŸ”₯ SEE ALSO πŸ”₯

mq_close(3), mq_getattr(3), mq_notify(3), mq_open(3), mq_receive(3), mq_send(3), mq_overview(7)

go read those too, iykyk πŸ“–βœ¨


and that's the whole page, bestie!! this one's from Linux man-pages 6.20, dated 2026-02-08 β€” the mq_unlink(3) page, signed, sealed, delivered πŸ’œ

πŸ“¦ where this page comes from
  • 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 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms