MQ_GETATTR(3POSIX)
π MQ_GETATTR π β from the POSIX Programmer's Manual, bestie
okay so first thing, real talk: this page lives in the POSIX Programmer's Manual. The Linux version of this interface might act different (so go check the Linux man page for the deets on Linux behavior), or honestly it might not even be implemented on Linux at all. π
β¨ NAME β¨
mq_getattr β get message queue attributes (REALTIME) π
πΈ SYNOPSIS πΈ
#include <mqueue.h>
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
π¦ DESCRIPTION π¦
So the mq_getattr() function obtains status information and attributes of the message queue and the open message queue description that's associated with the message queue descriptor. Like, it's giving you the receipts on your queue. π§Ύβ¨
The mqdes argument specifies a message queue descriptor. That's your lil handle to the queue. π«Ά
The results get returned in the mq_attr structure referenced by the mqstat argument.
Once it comes back, these members are gonna have the values tied to the open message queue description β set when the message queue was opened, and then modified by any subsequent mq_setattr() calls:
mq_flags
And these attributes of the message queue come back as they were set at message queue creation:
mq_maxmsgmq_msgsize
Then, upon return, this member inside the mq_attr structure referenced by mqstat gets set to the current state of the message queue:
mq_curmsgs
The number of messages currently on the queue. That's it, that's the whole thing. π
β RETURN VALUE β
If everything goes off without a hitch, mq_getattr() shall return zero. π
Otherwise? It returns -1 and sets errno to tell you what went wrong. not the vibe. π
π ERRORS π
The mq_getattr() function may fail if:
EBADFβ themqdesargument is not a valid message queue descriptor. bestie that's not a real queue, that's a fake ID. π«
Heads up: the following sections are informative β they're the bonus content, not the requirements. π
π EXAMPLES π
See mq_notify(). (yes really, that's the whole example, go look π)
π APPLICATION USAGE π
None. (iconic of them tbh, nothing to add π )
π§ RATIONALE π§
None.
π FUTURE DIRECTIONS π
None.
π SEE ALSO π
mq_notify()mq_open()mq_send()mq_setattr()msgctl()msgget()msgrcv()msgsnd()
Also 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!! πβ¨ written up by IEEE/The Open Group, dated 2017, and it's the MQ_GETATTR(3POSIX) page in the POSIX Programmer's Manual. slay, go read your queue attributes, periodt. ππ¦π
π¦ 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