aboutsummaryrefslogtreecommitdiff
path: root/docs/man/nng_alloc.adoc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-05 20:55:08 -0800
committerGarrett D'Amore <garrett@damore.org>2018-03-05 20:55:08 -0800
commit43c137b7a9ca046f272bb8e6971d8ce385563358 (patch)
tree849532fba2e366fe9e8c609d8b8fb96b30edecfb /docs/man/nng_alloc.adoc
parent2e9efe0f6d904f8e3c0bdd60f51ba7434f34e944 (diff)
downloadnng-43c137b7a9ca046f272bb8e6971d8ce385563358.tar.gz
nng-43c137b7a9ca046f272bb8e6971d8ce385563358.tar.bz2
nng-43c137b7a9ca046f272bb8e6971d8ce385563358.zip
Add some man pages (alloc, free, version).
Diffstat (limited to 'docs/man/nng_alloc.adoc')
-rw-r--r--docs/man/nng_alloc.adoc52
1 files changed, 52 insertions, 0 deletions
diff --git a/docs/man/nng_alloc.adoc b/docs/man/nng_alloc.adoc
new file mode 100644
index 00000000..af81aff9
--- /dev/null
+++ b/docs/man/nng_alloc.adoc
@@ -0,0 +1,52 @@
+= nng_alloc(3)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_alloc - allocate memory
+
+== SYNOPSIS
+
+[source, c]
+-----------
+#include <nng/nng.h>
+
+void *nng_alloc(size_t size);
+-----------
+
+== DESCRIPTION
+
+The `nng_alloc()` function allocates a contiguous memory region of
+at least _size_ bytes. The memory will be 64-bit aligned.
+
+The returned memory can be used to hold message buffers, in which
+case it can be directly passed to <<nng_send#,nng_send(3)>> using
+the flag `NNG_FLAG_ALLOC`. Alternatively, it can be freed when no
+longer needed using <<nng_free#,nng_free(3)>>.
+
+WARNING: Do not use the system `free()` function to release this memory.
+On some platforms this may work, but it is not guaranteed and may lead
+to a crash or other undesirable and unpredictable behavior.
+
+== RETURN VALUES
+
+This function returns 0 on success, and non-zero otherwise.
+
+== ERRORS
+
+`NNG_ENOMEM`:: Insufficient free memory exists.
+
+== SEE ALSO
+
+<<nng_free#,nng_free(3)>>,
+<<nng_send#,nng_send(3)>>,
+<<nng_strerror#,nng_strerror(3)>>,
+<<nng#,nng(7)>>