Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH lttng-ust] Fix: Don't wait during registration if clock_gettime() fails
@ 2015-04-23 17:07 Jérémie Galarneau
  2015-04-23 17:15 ` Mathieu Desnoyers
  0 siblings, 1 reply; 2+ messages in thread
From: Jérémie Galarneau @ 2015-04-23 17:07 UTC (permalink / raw)


get_constructor_timeout() currently returns -1 which, according to
the lttng-ust(3) man page and lttng_ust_init() implementation,
"waits forever".

This changes the behavior to match what is expressed in the comments.

Comments in get_constructor_timeout() and get_timeout() are also
modified to match the following convention:

-1: wait forever
0: don't wait
1: wait for "constructor_delay_ms"

Signed-off-by: J?r?mie Galarneau <jeremie.galarneau at efficios.com>
---
 liblttng-ust/lttng-ust-comm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
index 14bbb96..52dc2da 100644
--- a/liblttng-ust/lttng-ust-comm.c
+++ b/liblttng-ust/lttng-ust-comm.c
@@ -402,7 +402,7 @@ int setup_local_apps(void)
 
 /*
  * Get notify_sock timeout, in ms.
- * -1: don't wait. 0: wait forever. >0: timeout, in ms.
+ * -1: wait forever. 0: don't wait. >0: timeout, in ms.
  */
 static
 long get_timeout(void)
@@ -427,7 +427,7 @@ long get_notify_sock_timeout(void)
 }
 
 /*
- * Return values: -1: don't wait. 0: wait forever. 1: timeout wait.
+ * Return values: -1: wait forever. 0: don't wait. 1: timeout wait.
  */
 static
 int get_constructor_timeout(struct timespec *constructor_timeout)
@@ -450,7 +450,8 @@ int get_constructor_timeout(struct timespec *constructor_timeout)
 	 */
 	ret = clock_gettime(CLOCK_REALTIME, constructor_timeout);
 	if (ret) {
-		return -1;
+		/* don't wait */
+		return 0;
 	}
 	constructor_timeout->tv_sec += constructor_delay_ms / 1000UL;
 	constructor_timeout->tv_nsec +=
@@ -459,6 +460,7 @@ int get_constructor_timeout(struct timespec *constructor_timeout)
 		constructor_timeout->tv_sec++;
 		constructor_timeout->tv_nsec -= 1000000000UL;
 	}
+	/* timeout wait (constructor_delay_ms) */
 	return 1;
 }
 
-- 
2.3.6




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [lttng-dev] [PATCH lttng-ust] Fix: Don't wait during registration if clock_gettime() fails
  2015-04-23 17:07 [lttng-dev] [PATCH lttng-ust] Fix: Don't wait during registration if clock_gettime() fails Jérémie Galarneau
@ 2015-04-23 17:15 ` Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2015-04-23 17:15 UTC (permalink / raw)


Merged into stable-2.5, 2.6, master, good catch !

I updated 2 comments to ensure they start with a capital
letter and end with a dot.

Thanks!

Mathieu

----- Original Message -----
> get_constructor_timeout() currently returns -1 which, according to
> the lttng-ust(3) man page and lttng_ust_init() implementation,
> "waits forever".
> 
> This changes the behavior to match what is expressed in the comments.
> 
> Comments in get_constructor_timeout() and get_timeout() are also
> modified to match the following convention:
> 
> -1: wait forever
> 0: don't wait
> 1: wait for "constructor_delay_ms"
> 
> Signed-off-by: J?r?mie Galarneau <jeremie.galarneau at efficios.com>
> ---
>  liblttng-ust/lttng-ust-comm.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
> index 14bbb96..52dc2da 100644
> --- a/liblttng-ust/lttng-ust-comm.c
> +++ b/liblttng-ust/lttng-ust-comm.c
> @@ -402,7 +402,7 @@ int setup_local_apps(void)
>  
>  /*
>   * Get notify_sock timeout, in ms.
> - * -1: don't wait. 0: wait forever. >0: timeout, in ms.
> + * -1: wait forever. 0: don't wait. >0: timeout, in ms.
>   */
>  static
>  long get_timeout(void)
> @@ -427,7 +427,7 @@ long get_notify_sock_timeout(void)
>  }
>  
>  /*
> - * Return values: -1: don't wait. 0: wait forever. 1: timeout wait.
> + * Return values: -1: wait forever. 0: don't wait. 1: timeout wait.
>   */
>  static
>  int get_constructor_timeout(struct timespec *constructor_timeout)
> @@ -450,7 +450,8 @@ int get_constructor_timeout(struct timespec
> *constructor_timeout)
>  	 */
>  	ret = clock_gettime(CLOCK_REALTIME, constructor_timeout);
>  	if (ret) {
> -		return -1;
> +		/* don't wait */
> +		return 0;
>  	}
>  	constructor_timeout->tv_sec += constructor_delay_ms / 1000UL;
>  	constructor_timeout->tv_nsec +=
> @@ -459,6 +460,7 @@ int get_constructor_timeout(struct timespec
> *constructor_timeout)
>  		constructor_timeout->tv_sec++;
>  		constructor_timeout->tv_nsec -= 1000000000UL;
>  	}
> +	/* timeout wait (constructor_delay_ms) */
>  	return 1;
>  }
>  
> --
> 2.3.6
> 
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-23 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23 17:07 [lttng-dev] [PATCH lttng-ust] Fix: Don't wait during registration if clock_gettime() fails Jérémie Galarneau
2015-04-23 17:15 ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox