mq_unlink(3)

okay so bestie, this one's from the Library Functions Manual, and it's called mq_unlink โ€” literally just "remove a message queue" ๐Ÿ’…


๐ŸŽ€ LIBRARY ๐ŸŽ€

it lives in the real-time library: librt, and you link it with -lrt. no cap.


โœจ SYNOPSIS โœจ

#include <mqueue.h>

int mq_unlink(const char *name);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so here's the vibe: mq_unlink() removes the specified message queue name.

and the way that the name gets removed immediately โ€” right away, no waiting, periodt. but the queue itself? the queue doesn't get destroyed until any other processes that have the queue open close their descriptors referring to the queue. so like... it's giving "you can leave but the party isn't over until everybody leaves" ๐Ÿซถ

no cap, that's the whole thing.


๐ŸŒธ RETURN VALUE ๐ŸŒธ

  • on success, mq_unlink() returns 0 โœจ
  • on error, -1 comes back, and errno gets set to tell you which error it was ๐Ÿ™ˆ

๐Ÿ’€ ERRORS ๐Ÿ’€

  • EACCES โ€” the caller does not have permission to unlink this message queue. like, not your queue, not your business, bestie ๐Ÿ˜ญ
  • ENAMETOOLONG โ€” name was too long. it's giving... excessive ๐Ÿ’…
  • ENOENT โ€” there is no message queue with the given name. ghosted fr fr ๐Ÿ‘ป

โญ ATTRIBUTES โญ

if you wanna know what these terms even mean, go peek at attributes(7). (that's the whole explanation, i'm not gatekeeping.)

and for mq_unlink() specifically:

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

so yeah โ€” thread safe, slay, iconic, no notes ๐Ÿ”ฅ


๐Ÿ‘‘ STANDARDS ๐Ÿ‘‘

POSIX.1-2008.


๐ŸŒˆ HISTORY ๐ŸŒˆ

POSIX.1-2001. it's been around, it's got lore, it's a main character ๐Ÿ’œ


๐Ÿงš SEE ALSO ๐Ÿงš


and that's the whole page bestie, go unlink responsibly ๐Ÿ“

this has been mq_unlink(3) from the Linux man-pages 6.20, dated 2026-02-08 โ€” k bye, love you, drink water ๐Ÿ’–โœจ๐Ÿฆ‹

๐Ÿ“ฆ 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