* [lttng-dev] [PATCH lttng-tools] Fix: set errno with value from SO_ERROR on error.
[not found] <1519182391-24817-1-git-send-email-jonathan.rajotte-julien@efficios.com>
@ 2018-02-27 16:17 ` Jérémie Galarneau
0 siblings, 0 replies; only message in thread
From: Jérémie Galarneau @ 2018-02-27 16:17 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]
Merged in master, stable-2.10, and stable-2.9.
Thanks,
Jérémie
On Tue, Feb 20, 2018 at 10:06:31PM -0500, Jonathan Rajotte wrote:
> Debugging output at the same time in case of asynchronous handling.
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/common/sessiond-comm/inet.c | 6 ++++++
> src/common/sessiond-comm/inet6.c | 7 +++++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/src/common/sessiond-comm/inet.c b/src/common/sessiond-comm/inet.c
> index 25dbd21..0e72bb7 100644
> --- a/src/common/sessiond-comm/inet.c
> +++ b/src/common/sessiond-comm/inet.c
> @@ -176,6 +176,8 @@ int connect_with_timeout(struct lttcomm_sock *sock)
> goto success;
> }
>
> + DBG("Asynchronous connect for sock %d, performing polling with"
> + " timeout: %lums", sock->fd, timeout);
> /*
> * Perform poll loop following EINPROGRESS recommendation from
> * connect(2) man page.
> @@ -202,12 +204,16 @@ int connect_with_timeout(struct lttcomm_sock *sock)
> ret = getsockopt(sock->fd, SOL_SOCKET,
> SO_ERROR, &optval, &optval_len);
> if (ret) {
> + PERROR("getsockopt");
> goto error;
> }
> if (!optval) {
> + /* errno is set to zero from getsockopt */
> connect_ret = 0;
> goto success;
> } else {
> + /* Get actual connect() errno from opt_val */
> + errno = optval;
> goto error;
> }
> }
> diff --git a/src/common/sessiond-comm/inet6.c b/src/common/sessiond-comm/inet6.c
> index 0b0383c..071fd52 100644
> --- a/src/common/sessiond-comm/inet6.c
> +++ b/src/common/sessiond-comm/inet6.c
> @@ -174,6 +174,9 @@ int connect_with_timeout(struct lttcomm_sock *sock)
> goto success;
> }
>
> + DBG("Asynchronous connect for sock %d, performing polling with"
> + " timeout: %lums", sock->fd, timeout);
> +
> /*
> * Perform poll loop following EINPROGRESS recommendation from
> * connect(2) man page.
> @@ -200,12 +203,16 @@ int connect_with_timeout(struct lttcomm_sock *sock)
> ret = getsockopt(sock->fd, SOL_SOCKET,
> SO_ERROR, &optval, &optval_len);
> if (ret) {
> + PERROR("getsockopt");
> goto error;
> }
> if (!optval) {
> + /* errno is set to zero from getsockopt */
> connect_ret = 0;
> goto success;
> } else {
> + /* Get actual connect() errno from opt_val */
> + errno = optval;
> goto error;
> }
> }
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] only message in thread