mqueue.h(0P)

πŸ’Œ mqueue.h β€” message queues (REALTIME)

okay bestie, welcome to the POSIX Programmer's Manual ✨ this one is mqueue.h(0P) and it's literally the header that makes POSIX message queues happen. sit down, hydrate, let's go 🫢


🌸 PROLOG

so like, this manual page is part of the POSIX Programmer's Manual. quick heads up though, no cap:

the Linux implementation of this interface may differ β€” so bestie, consult 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 accordingly.

✨ NAME

mqueue.h β€” message queues (REALTIME) πŸŽ€


πŸ¦‹ SYNOPSIS

#include <mqueue.h>

that's it. that's the whole vibe. one include and you're in. πŸ’…


πŸ‘‘ DESCRIPTION

okay so the <mqueue.h> header shall define the mqd_t type, which is what we use for message queue descriptors. and listen β€” it is not an array type. just a type. periodt. πŸ™…β€β™€οΈ

it also shall define the pthread_attr_t, size_t, and ssize_t types, exactly as described in <sys/types.h>. slay, reuse the types. 🌈

and it shall define the struct timespec structure as described in <time.h>. ⭐

the tag sigevent shall be declared as naming an incomplete structure type β€” its contents live over in the <signal.h> header, so don't come for it here, she's mysterious on purpose. 🧚

now for the main character: the <mqueue.h> header shall define the mq_attr structure, which is used for getting and setting the attributes of a message queue. attributes are initially set when the message queue is created. and an mq_attr structure shall have at least these fields:

  • long mq_flags β€” message queue flags. 🚩
  • long mq_maxmsg β€” maximum number of messages.
  • long mq_msgsize β€” maximum message size.
  • long mq_curmsgs β€” number of messages currently queued.

the following shall be declared as functions, and may also be defined as macros β€” function prototypes shall be provided. (yes bestie, macros are allowed, it's giving flexible πŸ’…)

int      mq_close(mqd_t);
int      mq_getattr(mqd_t, struct mq_attr *);
int      mq_notify(mqd_t, const struct sigevent *);
mqd_t    mq_open(const char *, int, ...);
ssize_t  mq_receive(mqd_t, char *, size_t, unsigned *);
int      mq_send(mqd_t, const char *, size_t, unsigned);
int      mq_setattr(mqd_t, const struct mq_attr *restrict,
             struct mq_attr *restrict);
ssize_t  mq_timedreceive(mqd_t, char *restrict, size_t,
             unsigned *restrict, const struct timespec *restrict);
int      mq_timedsend(mqd_t, const char *, size_t, unsigned,
             const struct timespec *);
int      mq_unlink(const char *);

also β€” including the <mqueue.h> header may make visible symbols defined in these headers: <fcntl.h>, <signal.h>, and <time.h>. lowkey sneaky, highkey useful. πŸ™ˆ

and the following sections are informative. (i.e. not normative, just tea. β˜•)


πŸ’œ APPLICATION USAGE

None.

literally nothing. empty. the void. she said no thoughts, head empty. 😭


πŸ“ RATIONALE

None.

also empty. two empty sections in a row, iconic honestly. πŸ’€


πŸ”₯ FUTURE DIRECTIONS

None.

nothing's changing, bestie. she's stable. she's at peace. 🌸


🌈 SEE ALSO

  • <fcntl.h>
  • <signal.h>
  • <sys_types.h>
  • <time.h>

and from the System Interfaces volume of POSIX.1‐2017:

  • mq_close()
  • mq_getattr()
  • mq_notify()
  • mq_open()
  • mq_receive()
  • mq_send()
  • mq_setattr()
  • mq_unlink()

go read those, they're the whole friend group fr fr 🫢


okay legal bestie moment, stay with me:

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 .

not me getting emotional over a copyright notice 😭 but fr, respect the standard.

and that's the whole page, bestie!! πŸŽ€ this little queen is from IEEE/The Open Group, 2017, filed under mqueue.h(0P) β€” so if you ever need to cite her, you know exactly who she is and when she showed up. mwah πŸ’– now go queue some messages, you absolute icon. πŸ‘‘βœ¨

πŸ“¦ where this page comes from