From 1b825b063da65fe3d88c1ca97afded0d6f6ccc14 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 5 Apr 2024 08:40:25 -0700 Subject: Compat pages converted. --- docs/ref/compat/nn_allocmsg.adoc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/ref/compat/nn_allocmsg.adoc (limited to 'docs/ref/compat/nn_allocmsg.adoc') diff --git a/docs/ref/compat/nn_allocmsg.adoc b/docs/ref/compat/nn_allocmsg.adoc new file mode 100644 index 00000000..273f17e6 --- /dev/null +++ b/docs/ref/compat/nn_allocmsg.adoc @@ -0,0 +1,40 @@ +## nn_allocmsg + +Allocate message (compatible API). + +### Synopsis + +```c +#include + +void *nn_allocmsg(size_t size, int type); +``` + +### Description + +The `nn_allocmsg` allocates a message structure of size _size_, and is primarily used to support zero-copy send operations, making use of the `NNG_MSG` special size indicator. +The value returned is a pointer to the start of the message payload buffer. + +The value of _size_ must be positive, and small enough to hold reasonable message data plus book-keeping information. + +The value of _type_ *must* be zero. + +The returned message must be disposed of by either xref:nn_freemsg.adoc[`nn_freemsg`] or xref:nn_send.adoc[`nn_send`] when the caller is finished with it. + +### Return Values + +This function returns a pointer to message buffer space, or `NULL` on failure. + +### Errors + +[horizontal] +`ENOMEM`:: Insufficient memory is available. +`EINVAL`:: An invalid _size_ or _type_ was specified. +`ETERM`:: The library is shutting down. + +### See Also + +xref:nn_errno.adoc[nn_errno], +xref:nn_freemsg.adoc[nn_freemsg], +xref:nn_reallocmsg.adoc[nn_reallocmsg], +xref:nn_send.adoc[nn_send] -- cgit v1.2.3-70-g09d2