[Spice-devel] Bug fix for server on 32 bit systems

Submitted by Jeremy White on April 26, 2012, 5:12 p.m.

Details

Message ID 4F9981E9.60404@codeweavers.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Jeremy White April 26, 2012, 5:12 p.m.
My display channels were instantly timing out; turns out that the implementation of red_now() doesn't work on my 32 bit system.

This patch should fix that.

Cheers,

Jeremy

Patch hide | download patch | download mbox

From 77b366c0d33befceb530c095be276c1e0e2146b7 Mon Sep 17 00:00:00 2001
From: Jeremy White <jwhite@codeweavers.com>
Date: Thu, 26 Apr 2012 12:09:50 -0500
Subject: [PATCH] Force 64 bit multiplication on 32 bit systems; fixes a bug
 where the server times out the display channel freakily
 fast.

---
 server/red_worker.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 297b168..e341c00 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4636,7 +4636,7 @@  static inline uint64_t red_now(void)
 
     clock_gettime(CLOCK_MONOTONIC, &time);
 
-    return time.tv_sec * 1000000000 + time.tv_nsec;
+    return ((uint64_t) time.tv_sec) * 1000000000 + time.tv_nsec;
 }
 
 static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty)
-- 
1.7.9.5


Comments

On Thu, Apr 26, 2012 at 12:12:09PM -0500, Jeremy White wrote:
> My display channels were instantly timing out; turns out that the implementation of red_now() doesn't work on my 32 bit system.
> 
> This patch should fix that.
> 

Thanks! ACK, I'll commit. Could you please send the patches inline next
time though? thanks again,

Alon

> Cheers,
> 
> Jeremy

> From 77b366c0d33befceb530c095be276c1e0e2146b7 Mon Sep 17 00:00:00 2001
> From: Jeremy White <jwhite@codeweavers.com>
> Date: Thu, 26 Apr 2012 12:09:50 -0500
> Subject: [PATCH] Force 64 bit multiplication on 32 bit systems; fixes a bug
>  where the server times out the display channel freakily
>  fast.
> 
> ---
>  server/red_worker.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 297b168..e341c00 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -4636,7 +4636,7 @@ static inline uint64_t red_now(void)
>  
>      clock_gettime(CLOCK_MONOTONIC, &time);
>  
> -    return time.tv_sec * 1000000000 + time.tv_nsec;
> +    return ((uint64_t) time.tv_sec) * 1000000000 + time.tv_nsec;
>  }
>  
>  static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty)
> -- 
> 1.7.9.5
> 

> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
On Thu, Apr 26, 2012 at 12:12:09PM -0500, Jeremy White wrote:
> My display channels were instantly timing out; turns out that the implementation of red_now() doesn't work on my 32 bit system.
> 
> This patch should fix that.
> 
> Cheers,
> 
> Jeremy

> From 77b366c0d33befceb530c095be276c1e0e2146b7 Mon Sep 17 00:00:00 2001
> From: Jeremy White <jwhite@codeweavers.com>
> Date: Thu, 26 Apr 2012 12:09:50 -0500
> Subject: [PATCH] Force 64 bit multiplication on 32 bit systems; fixes a bug
>  where the server times out the display channel freakily
>  fast.
> 
> ---
>  server/red_worker.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 297b168..e341c00 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -4636,7 +4636,7 @@ static inline uint64_t red_now(void)
>  
>      clock_gettime(CLOCK_MONOTONIC, &time);
>  
> -    return time.tv_sec * 1000000000 + time.tv_nsec;
> +    return ((uint64_t) time.tv_sec) * 1000000000 + time.tv_nsec;

I wonder if 1000000000LL would have done the same thing.

>  }
>  
>  static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty)
> -- 
> 1.7.9.5
> 

> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel