ZMQ_MSG_INIT_BUFFER(3)
π ZMQ_MSG_INIT_BUFFER(3) π
okay bestie, welcome to the 0MQ Manual β¨ this is the page for zmq_msg_init_buffer, and it's literally the glow-up your message needs. sit down, hydrate, let's go π«Ά
πΈ NAME πΈ
zmq_msg_init_buffer β initialise a 0MQ message with a copy of a buffer π
β¨ SYNOPSIS β¨
int zmq_msg_init_buffer (zmq_msg_t *msg, const void *buf, size_t size);
π DESCRIPTION π
so the way that zmq_msg_init_buffer() works is: it shall allocate every resource it needs to store a message that's size bytes long, and then it initialises the message object that msg points to so it represents a copy of the buffer that the buf and size arguments are pointing at. copy, not borrow. she's her own girl π
and the implementation gets to choose for itself whether it stores the message content on the stack (for small messages) or on the heap (for large messages). it's giving "trust the implementation, she knows her limits" β¨
β οΈ Caution β never ever accesszmq_msg_tmembers directly. like, not even once. always use thezmq_msgfamily of functions instead. no peeking under the hood, bestie π
β οΈ Caution β the functionszmq_msg_init(),zmq_msg_init_data(),zmq_msg_init_buffer()andzmq_msg_init_buffer()are mutually exclusive. never initialise the samezmq_msg_ttwice. fr fr. double-initialising is not the vibe, it's a whole situation π
π RETURN VALUE π
zmq_msg_init_buffer() shall return zero if everything's cute and successful. otherwise it shall return -1 and set errno to one of the values listed below. she will tell you what went wrong, you just gotta listen π
π¦ ERRORS π¦
ENOMEMβ insufficient storage space is available. like, there is simply no room, the closet is full, we cannot make it work π
π SEE ALSO π
zmq_msg_init_data(3) zmq_msg_init_size(3) zmq_msg_init(3) zmq_msg_close(3) zmq_msg_data(3) zmq_msg_size(3) zmq(7)
π AUTHORS π
this page was written by the 0MQ community π«Ά and if you wanna make a change, please read the 0MQ Contribution Policy at http://www.zeromq.org/docs:contributing. they'd love to have you, no cap π
0MQ 4.3.5 Β· 10/09/2023 Β· that's the whole page bestie, mwah πβ¨ππ¦πΈ
π¦ where this page comes from
- epel 10: zeromq 4.3.5-18.el10_0 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms