diff options
author | Thomas Graf <tgraf@redhat.com> | 2012-11-08 12:41:54 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@redhat.com> | 2012-11-08 12:41:54 (GMT) |
commit | b28c25eb236c535017a0d17ceca02f277e20953f (patch) | |
tree | 88b165cca830b00152eda79da8e28557ca6b4fd1 /lib | |
parent | fd6f205f8a14e8bf7288e65be435641d5ee2956a (diff) | |
download | libnl-b28c25eb236c535017a0d17ceca02f277e20953f.zip libnl-b28c25eb236c535017a0d17ceca02f277e20953f.tar.gz libnl-b28c25eb236c535017a0d17ceca02f277e20953f.tar.bz2 |
nl: Improve API doc of nl_connect() and nl_close()
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/nl.c | 32 |
1 files changed, 23 insertions, 9 deletions
@@ -62,18 +62,25 @@ */ /** - * Create and connect netlink socket. - * @arg sk Netlink socket. - * @arg protocol Netlink protocol to use. + * Create file descriptor and bind socket. + * @arg sk Netlink socket (required) + * @arg protocol Netlink protocol to use (required) * - * Creates a netlink socket using the specified protocol, binds the socket - * and issues a connection attempt. + * Creates a new Netlink socket using `socket()` and binds the socket to the + * protocol and local port specified in the `sk` socket object. Fails if + * the socket is already connected. * - * This function fail if socket is already connected. + * @note If available, the `close-on-exec` (`SOCK_CLOEXEC`) feature is enabled + * automatically on the new file descriptor. This causes the socket to + * be closed automatically if any of the `exec` family functions succeed. + * This is essential for multi threaded programs. * - * @note SOCK_CLOEXEC is set on the socket if available. + * @see nl_socket_alloc() + * @see nl_close() * * @return 0 on success or a negative error code. + * + * @retval -NLE_BAD_SOCK Socket is already connected */ int nl_connect(struct nl_sock *sk, int protocol) { @@ -137,8 +144,15 @@ errout: } /** - * Close/Disconnect netlink socket. - * @arg sk Netlink socket. + * Close Netlink socket + * @arg sk Netlink socket (required) + * + * Closes the Netlink socket using `close()`. + * + * @note The socket is closed automatically if a `struct nl_sock` object is + * freed using `nl_socket_free()`. + * + * @see nl_connect() */ void nl_close(struct nl_sock *sk) { |