EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: sequencer on 64bit linux
From: Andrew Johnson <[email protected]>
To: Benjamin Franksen <[email protected]>
Cc: [email protected]
Date: Mon, 4 Apr 2011 10:24:14 -0500
Hi Ben,

On Sunday 03 April 2011 11:34:39 Benjamin Franksen wrote:
> since CA does not support 64bit integer types, I wonder what to do about
> SNL programs with declarations like
>
> long x;
> assign x to "whatever";
>
> on a system where sizeof(long)==8 (like linux-x86_64). Note that in SNL
> code, the type of a variable determines the request type for CA requests.
> In this case DBR_LONG is certainly wrong, as it is defined to be 32bit.

Here's a naive question for FAQ purposes: Why can't you do what the database 
does and make the SNL 'long' type map to an epicsInt32 on all architectures?  
I personally understand the major disadvantage to doing that when interfacing 
to external APIs, but I think it's worth explaining exactly why you can't do 
that as part of this discussion.

I think making this an error is probably the right solution; the message 
should explain that the variable needs to be an int to assign it on any 64-bit 
systems, and the documentation should explain that the SNL code will need to 
marshal data values between two variables if the program really does need to 
use a 64-bit long variable.

> BTW, I doubt that the current stable version 2.0.12 works properly on such
> systems but I haven't tried it yet.

On little-endian (e.g. Intel/AMD) architecture systems the LSB is always at 
the pointed-to byte, thus long variables appear to work fine on most current 
64-bit systems as long as the values are all within the positive 32-bit range.  
This will fail as soon as either side tries to use a negative value, but many 
sites may already be using this version without realizing the problem because 
of that.  It would be good to see a 2.0.13 release with this fixed though, and 
the issue documented.

Good catch, thanks!

- Andrew
-- 
An error is only a mistake if you don't learn from it.
When you learn something from it, it becomes a lesson.


Replies:
Re: sequencer on 64bit linux Benjamin Franksen
Re: sequencer on 64bit linux Benjamin Franksen
References:
sequencer on 64bit linux Benjamin Franksen

Navigate by Date:
Prev: EDM start window position Scott Baily
Next: Re: sequencer on 64bit linux Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: sequencer on 64bit linux Benjamin Franksen
Next: Re: sequencer on 64bit linux Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·