MQ_SETATTR(2)
π MQ_SETATTR(2) β set message queue attributes (REALTIME)
okay bestie, welcome to the System Calls Manual section, this is the mq_setattr(2) page and it's lowkey iconic. let's get into it β¨
π LIBRARY
POSIX Real-time Library β you gotta link it like -lrt or it's giving undefined reference energy π
β¨ SYNOPSIS β¨
#include <mqueue.h>
int
mq_setattr(mqd_t mqdes, const struct mq_attr *restrict mqstat,
struct mq_attr *restrict omqstat);
πΈ DESCRIPTION πΈ
okay so mq_setattr() sets the attributes on the open message queue description that mqdes points at β that's the message queue descriptor bestie, keep up π«Ά
when it goes through successfully, the message queue attributes matching these members of the mq_attr structure get set to whatever values you passed in:
mq_flagsβ this one's value is either zero orO_NONBLOCK. that's it. that's the whole vibe check π
and here's the part i need you to actually remember: the mq_maxmsg, mq_msgsize, and mq_curmsgs members of the mq_attr structure are ignored by mq_setattr(). like, literally ignored. they said not today π
π₯ RETURN VALUES π₯
on success it returns a value of zero, and the attributes of the message queue will have been changed exactly as you specified. slay β¨
otherwise? the message queue attributes stay unchanged, the function returns -1, and it sets the global variable errno to tell you what went wrong. rough, but at least it's honest π
π ERRORS π
the mq_setattr() system call will fail if:
[EBADF]β themqdesargument is not a valid message queue descriptor. bestie that's not a real queue, who is she π«
π SEE ALSO π
mq_open(2), mq_send(2), mq_timedsend(2)
go read those next, they're in the same friend group fr fr π
β STANDARDS β
the mq_setattr() system call conforms to IEEE Std 1003.1-2004 (βPOSIX.1β). certified. periodt π
π¦ HISTORY π¦
support for POSIX message queues first appeared in FreeBSD 7.0. throwback era π°οΈ
π COPYRIGHT π
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 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. no cap, the original wins π
the original Standard can be obtained online at http://www.opengroup.org/unix/online.html
and that's the whole page bestie!! π this one's from Debian, dated May 17, 2011 β vintage but still serving, mwah πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
- Copyright (C) 2001-2004 by the Institute of
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms