aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/man/nng_aio_finish.3.adoc1
-rw-r--r--docs/man/nng_aio_get_input.3.adoc1
-rw-r--r--docs/man/nng_aio_reset.3.adoc1
-rw-r--r--docs/man/nng_aio_set_output.3.adoc1
-rw-r--r--docs/man/nng_aio_start.3.adoc1
-rw-r--r--docs/ref/api/aio.md2
-rw-r--r--include/nng/nng.h2
-rw-r--r--src/core/aio.c14
-rw-r--r--src/core/aio.h12
-rw-r--r--src/nng.c4
10 files changed, 17 insertions, 22 deletions
diff --git a/docs/man/nng_aio_finish.3.adoc b/docs/man/nng_aio_finish.3.adoc
index bb0791b8..a4855ec8 100644
--- a/docs/man/nng_aio_finish.3.adoc
+++ b/docs/man/nng_aio_finish.3.adoc
@@ -51,7 +51,6 @@ None.
== SEE ALSO
[.text-left]
-xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
xref:nng_aio_reset.3.adoc[nng_aio_reset(3)],
xref:nng_aio_cancel.3.adoc[nng_aio_cancel(3)],
xref:nng_aio_start.3.adoc[nng_aio_start(3)],
diff --git a/docs/man/nng_aio_get_input.3.adoc b/docs/man/nng_aio_get_input.3.adoc
index 204ec435..ef331312 100644
--- a/docs/man/nng_aio_get_input.3.adoc
+++ b/docs/man/nng_aio_get_input.3.adoc
@@ -45,7 +45,6 @@ None.
== SEE ALSO
[.text-left]
-xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
xref:nng_aio_get_output.3.adoc[nng_aio_get_output(3)],
xref:nng_aio_set_input.3.adoc[nng_aio_set_input(3)],
xref:nng_aio_result.3.adoc[nng_aio_result(3)],
diff --git a/docs/man/nng_aio_reset.3.adoc b/docs/man/nng_aio_reset.3.adoc
index cb0feec0..8f4ba514 100644
--- a/docs/man/nng_aio_reset.3.adoc
+++ b/docs/man/nng_aio_reset.3.adoc
@@ -33,7 +33,6 @@ users of the _aio_ should not call this function.
== SEE ALSO
[.text-left]
-xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
xref:nng_aio_cancel.3.adoc[nng_aio_cancel(3)],
xref:nng_aio_start.3.adoc[nng_aio_start(3)],
xref:nng_aio_finish.3.adoc[nng_aio_finish(3)],
diff --git a/docs/man/nng_aio_set_output.3.adoc b/docs/man/nng_aio_set_output.3.adoc
index 67f8ac66..883598ce 100644
--- a/docs/man/nng_aio_set_output.3.adoc
+++ b/docs/man/nng_aio_set_output.3.adoc
@@ -52,7 +52,6 @@ None.
== SEE ALSO
[.text-left]
-xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
xref:nng_aio_finish.3.adoc[nng_aio_finish(3)],
xref:nng_aio_get_output.3.adoc[nng_aio_get_output(3)],
xref:nng_aio_result.3.adoc[nng_aio_result(3)],
diff --git a/docs/man/nng_aio_start.3.adoc b/docs/man/nng_aio_start.3.adoc
index 82dbde23..4c5d090a 100644
--- a/docs/man/nng_aio_start.3.adoc
+++ b/docs/man/nng_aio_start.3.adoc
@@ -62,7 +62,6 @@ although it is harmless if it does.
== SEE ALSO
[.text-left]
-xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
xref:nng_aio_cancel.3.adoc[nng_aio_cancel(3)],
xref:nng_aio_finish.3.adoc[nng_aio_finish(3)],
xref:nng_aio_result.3.adoc[nng_aio_result(3)],
diff --git a/docs/ref/api/aio.md b/docs/ref/api/aio.md
index dcf9aa85..2f7b9a73 100644
--- a/docs/ref/api/aio.md
+++ b/docs/ref/api/aio.md
@@ -43,7 +43,7 @@ complete, creating a synchronous flow from an asynchronous one.
## Create Handle
```c
-int nng_aio_alloc(nng_aio **aiop, void (*callb)(void *), void *arg);
+nng_err nng_aio_alloc(nng_aio **aiop, void (*callb)(void *), void *arg);
```
The {{i:`nng_aio_alloc`}} function creates an [`nng_aio`] object, with the
diff --git a/include/nng/nng.h b/include/nng/nng.h
index 908fbb23..7ad814c4 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -563,7 +563,7 @@ NNG_DECL void nng_strfree(char *);
// when a submitted operation completes (or is canceled or fails) the
// callback will be executed, generally in a different thread, with no
// locks held.
-NNG_DECL int nng_aio_alloc(nng_aio **, void (*)(void *), void *);
+NNG_DECL nng_err nng_aio_alloc(nng_aio **, void (*)(void *), void *);
// nng_aio_free frees the AIO and any associated resources.
// It *must not* be in use at the time it is freed.
diff --git a/src/core/aio.c b/src/core/aio.c
index 81020bbb..128178c8 100644
--- a/src/core/aio.c
+++ b/src/core/aio.c
@@ -124,7 +124,7 @@ nni_aio_fini(nni_aio *aio)
}
}
-int
+nng_err
nni_aio_alloc(nni_aio **aio_p, nni_cb cb, void *arg)
{
nni_aio *aio;
@@ -134,7 +134,7 @@ nni_aio_alloc(nni_aio **aio_p, nni_cb cb, void *arg)
}
nni_aio_init(aio, cb, arg);
*aio_p = aio;
- return (0);
+ return (NNG_OK);
}
void
@@ -154,7 +154,7 @@ nni_aio_reap(nni_aio *aio)
}
}
-int
+nng_err
nni_aio_set_iov(nni_aio *aio, unsigned nio, const nni_iov *iov)
{
@@ -170,7 +170,7 @@ nni_aio_set_iov(nni_aio *aio, unsigned nio, const nni_iov *iov)
}
}
aio->a_nio = nio;
- return (0);
+ return (NNG_OK);
}
// nni_aio_stop cancels any outstanding operation, and waits for the
@@ -602,7 +602,7 @@ nni_aio_expire_loop(void *arg)
for (;;) {
nni_aio *aio;
- int rv;
+ nng_err rv;
nni_time next;
next = q->eq_next;
@@ -884,7 +884,7 @@ nni_aio_sys_fini(void)
nni_aio_expire_q_list = NULL;
}
-int
+nng_err
nni_aio_sys_init(nng_init_params *params)
{
int16_t num_thr;
@@ -912,5 +912,5 @@ nni_aio_sys_init(nng_init_params *params)
nni_aio_expire_q_list[i] = eq;
}
- return (0);
+ return (NNG_OK);
}
diff --git a/src/core/aio.h b/src/core/aio.h
index 25475323..e0b5a388 100644
--- a/src/core/aio.h
+++ b/src/core/aio.h
@@ -1,5 +1,5 @@
//
-// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -37,7 +37,7 @@ extern void nni_aio_reap(nni_aio *);
// is called with the supplied argument when the operation is complete.
// If NULL is supplied for the callback, then nni_aio_wake is used in its
// place, and the aio is used for the argument.
-extern int nni_aio_alloc(nni_aio **, nni_cb, void *arg);
+extern nng_err nni_aio_alloc(nni_aio **, nni_cb, void *arg);
// nni_aio_free frees the aio, releasing resources (locks)
// associated with it. This is safe to call on zeroed memory.
@@ -138,7 +138,7 @@ extern size_t nni_aio_iov_advance(nni_aio *, size_t);
// nni_aio_iov_count returns the number of bytes referenced by the aio iov.
extern size_t nni_aio_iov_count(nni_aio *);
-extern int nni_aio_set_iov(nni_aio *, unsigned, const nni_iov *);
+extern nng_err nni_aio_set_iov(nni_aio *, unsigned, const nni_iov *);
extern void nni_aio_set_timeout(nni_aio *, nng_duration);
extern void nni_aio_set_expire(nni_aio *, nni_time);
@@ -188,9 +188,9 @@ extern void nni_aio_completions_run(nni_aio_completions *);
extern void nni_aio_completions_add(
nni_aio_completions *, nni_aio *, nng_err, size_t);
-extern int nni_aio_sys_init(nng_init_params *);
-extern bool nni_aio_sys_drain(void);
-extern void nni_aio_sys_fini(void);
+extern nng_err nni_aio_sys_init(nng_init_params *);
+extern bool nni_aio_sys_drain(void);
+extern void nni_aio_sys_fini(void);
typedef struct nni_aio_expire_q nni_aio_expire_q;
diff --git a/src/nng.c b/src/nng.c
index 26f45f76..ad9ae0f6 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -1828,11 +1828,11 @@ nng_msg_set_pipe(nng_msg *msg, nng_pipe p)
nni_msg_set_pipe(msg, p.id);
}
-int
+nng_err
nng_aio_alloc(nng_aio **app, void (*cb)(void *), void *arg)
{
nng_aio *aio;
- int rv;
+ nng_err rv;
if ((rv = nni_aio_alloc(&aio, (nni_cb) cb, arg)) == 0) {
nng_aio_set_timeout(aio, NNG_DURATION_DEFAULT);