Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs updates #2087

Merged
merged 7 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs/man/libnng.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ Listeners accept incoming connection requests, and dialers make them.
|xref:nng_listener_id.3.adoc[nng_listener_id()]|get numeric listener identifier
|xref:nng_listener_set.3.adoc[nng_listener_set()]|set listener option
|xref:nng_listener_start.3.adoc[nng_listener_start()]|start listener
|xref:nng_pipe_close.3.adoc[nng_pipe_close()]|close pipe
|xref:nng_pipe_dialer.3.adoc[nng_pipe_dialer()]|return dialer that created pipe
|xref:nng_pipe_get.3.adoc[nng_pipe_get()]|get pipe option
|xref:nng_pipe_id.3.adoc[nng_pipe_id()]|get numeric pipe identifier
|xref:nng_pipe_listener.3.adoc[nng_pipe_listener()]|return listener that created pipe
|xref:nng_pipe_notify.3.adoc[nng_pipe_notify()]|register pipe notification callback
|xref:nng_pipe_socket.3.adoc[nng_pipe_socket()]|return owning socket for pipe
|===

=== Asynchronous Operations
Expand Down
13 changes: 0 additions & 13 deletions docs/man/man3http.desc

This file was deleted.

1 change: 0 additions & 1 deletion docs/man/man3http.sect

This file was deleted.

1 change: 0 additions & 1 deletion docs/man/nng.7.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ other languages please check the http://nanomsg.org/[website].
=== Transports

[horizontal]
xref:nng_inproc.7.adoc[nng_inproc(7)]:: Intra-process transport
xref:nng_ipc.7.adoc[nng_ipc(7)]:: Inter-process transport
xref:nng_socket.7.adoc[nng_socket(7)]:: BSD socket transport
xref:nng_tls.7.adoc[nng_tls(7)]:: TLSv1.2 over TCP transport
Expand Down
1 change: 0 additions & 1 deletion docs/man/nng_aio_finish.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
1 change: 0 additions & 1 deletion docs/man/nng_aio_get_input.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
1 change: 0 additions & 1 deletion docs/man/nng_aio_reset.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
1 change: 0 additions & 1 deletion docs/man/nng_aio_set_output.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
1 change: 0 additions & 1 deletion docs/man/nng_aio_start.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/api/aio.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/api/ctx.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Threads waiting for operations on the context when this
call is executed may also return with an `NNG_ECLOSED` result.

> [!NOTE]
> Closing the socket associated with _ctx_ using `nng_socket_close`] also closes this context.
> Closing the socket associated with _ctx_ using [`nng_socket_close`] also closes this context.

## Sending Messages

Expand Down
2 changes: 1 addition & 1 deletion docs/ref/api/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct {
int16_t num_resolver_threads;
} nng_init_params;

extern int nng_init(nng_init_parms *params);
extern nng_err nng_init(nng_init_parms *params);
```

Before using other interfaces in this library, it is necessary to initialize
Expand Down
4 changes: 2 additions & 2 deletions docs/ref/api/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ number facilities when available.
## Create Socket Pair

```c
int nng_socket_pair(int fds[2]);
nng_err nng_socket_pair(int fds[2]);
```

The `nng_socket_pair` function creates a pair of connected file descriptors.
The {{i:`nng_socket_pair`}} function creates a pair of connected file descriptors.
These file descriptors, which are returned in the _fds_ array, are suitable for
use with the [Socket transport][socktran].

Expand Down
8 changes: 4 additions & 4 deletions include/nng/nng.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ typedef void (*nng_pipe_cb)(nng_pipe, nng_pipe_ev, void *);
// nng_pipe_notify registers a callback to be executed when the
// given event is triggered. To watch for different events, register
// multiple times. Each event can have at most one callback registered.
NNG_DECL int nng_pipe_notify(nng_socket, nng_pipe_ev, nng_pipe_cb, void *);
NNG_DECL nng_err nng_pipe_notify(nng_socket, nng_pipe_ev, nng_pipe_cb, void *);

// nng_listen creates a listening endpoint with no special options,
// and starts it listening. It is functionally equivalent to the legacy
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1292,7 +1292,7 @@ typedef struct {
// only the first call can contain a non-NULL params. If already
// initialized with non-NULL params, will return NNG_EALREADY.
// Applications should *not* call a matching nng_fini() in that case.
NNG_DECL int nng_init(nng_init_params *parms);
NNG_DECL nng_err nng_init(nng_init_params *parms);

// nng_fini is used to terminate the library, freeing certain global resources.
// Each call to nng_fini is paired to a call to nng_init. The last such
Expand Down Expand Up @@ -1407,7 +1407,7 @@ NNG_DECL uint32_t nng_random(void);
// by reliable, bidirectional, byte streams. This will return NNG_ENOTSUP
// if the platform lacks support for this. The argument is a pointer
// to an array of file descriptors (or HANDLES or similar).
NNG_DECL int nng_socket_pair(int[2]);
NNG_DECL nng_err nng_socket_pair(int[2]);

// Multithreading and synchronization functions.

Expand Down
14 changes: 7 additions & 7 deletions src/core/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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)
{

Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -912,5 +912,5 @@ nni_aio_sys_init(nng_init_params *params)
nni_aio_expire_q_list[i] = eq;
}

return (0);
return (NNG_OK);
}
12 changes: 6 additions & 6 deletions src/core/aio.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023 Staysail Systems, Inc. <[email protected]>
// Copyright 2025 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// This software is supplied under the terms of the MIT License, a
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/core/init.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2025 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// This software is supplied under the terms of the MIT License, a
Expand Down Expand Up @@ -49,11 +49,11 @@ static nng_init_params init_params;
unsigned int init_count;
nni_atomic_flag init_busy;

int
nng_err
nng_init(nng_init_params *params)
{
nng_init_params zero = { 0 };
int rv;
nng_err rv;

// cheap spin lock
while (nni_atomic_flag_test_and_set(&init_busy)) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ extern int nni_plat_udp_sockname(nni_plat_udp *, nni_sockaddr *);
// in APIs to transport file descriptors, or across a fork/exec boundary (so
// that child processes may use these with socket to inherit a socket that is
// connected to the parent.)
extern int nni_socket_pair(int[2]);
extern nng_err nni_socket_pair(int[2]);

//
// File/Store Support
Expand Down
12 changes: 6 additions & 6 deletions src/nng.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,10 @@ nng_socket_raw(nng_socket id, bool *rawp)
return (0);
}

int
nng_err
nng_pipe_notify(nng_socket s, nng_pipe_ev ev, nng_pipe_cb cb, void *arg)
{
int rv;
nng_err rv;
nni_sock *sock;

if ((rv = nni_sock_find(&sock, s.id)) != 0) {
Expand All @@ -1186,7 +1186,7 @@ nng_pipe_notify(nng_socket s, nng_pipe_ev ev, nng_pipe_cb cb, void *arg)

nni_sock_set_pipe_cb(sock, ev, cb, arg);
nni_sock_rele(sock);
return (0);
return (NNG_OK);
}

void
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -2135,7 +2135,7 @@ nng_random(void)
return (nni_random());
}

int
nng_err
nng_socket_pair(int fds[2])
{
return (nni_socket_pair(fds));
Expand Down
12 changes: 7 additions & 5 deletions src/platform/posix/posix_socketpair.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023 Staysail Systems, Inc. <[email protected]>
// Copyright 2025 Staysail Systems, Inc. <[email protected]>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
Expand All @@ -17,7 +17,7 @@
#include <errno.h>
#include <sys/socket.h>

int
nng_err
nni_socket_pair(int fds[2])
{
int rv;
Expand All @@ -28,14 +28,16 @@ nni_socket_pair(int fds[2])

#ifdef SO_NOSIGPIPE
int set = 1;
setsockopt(fds[0], SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
setsockopt(
fds[0], SOL_SOCKET, SO_NOSIGPIPE, (void *) &set, sizeof(int));
setsockopt(
fds[1], SOL_SOCKET, SO_NOSIGPIPE, (void *) &set, sizeof(int));
#endif

return (0);
}
#else
int
nng_err
nni_socket_pair(int fds[2])
{
return (NNG_ENOTSUP);
Expand Down
Loading
Loading