Walton H. wrote:
On 1/15/2010 9:59 AM, Iñaki Baz C. wrote:
In my server RbConfig::CONFIG[‘host_os’] = “linux-gnu” so finally it ends
if 1.size == 8
submit a bug! GitHub - rdp/os: The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities
My main concern with that though:
Would RbConfig::CONFIG[‘host_cpu’] return “x86_64” if I’m running 32-bit
Linux on a 64-bit CPU?
Not on this machine
cat /proc/cpuinfo | grep lm
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
xtpr pdcm lahf_lm tpr_shadow
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
xtpr pdcm lahf_lm tpr_shadow
uname -a
Linux xxxxxxx 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:01:29 UTC
2009 i686 GNU/Linux
ruby -e “require ‘rbconfig’; p(Config::CONFIG[‘host_cpu’])”
“i486”
Mac
El Viernes, 15 de Enero de 2010, Walton H. escribió:
64
end
b) 64 bits host:
RbConfig::CONFIG[‘host_os’] => “linux-gnu”
RbConfig::CONFIG[‘host_cpu’] => “x86_64”
submit a bug! GitHub - rdp/os: The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities
My main concern with that though:
Would RbConfig::CONFIG[‘host_cpu’] return “x86_64” if I’m running 32-bit
Linux on a 64-bit CPU?
No, I’ve tested it in a 64 bits server running Linux 32 bits:
RbConfig::CONFIG[‘host_os’] => “linux-gnu”
RbConfig::CONFIG[‘host_cpu’] => “i486”
1.size => 4
On Fri, Jan 15, 2010 at 2:28 PM, Roger P. [email protected]
wrote:
At least within a 32-bit OS (in a VM) it appears to be i686-linux so I
think we’re safe there.
Also, thanks for the hint on 1.size I didn’t know that one–it’s
integrated now [v 0.6.1]. Â That wouldn’t work for jruby (which always
returns 8), but should work fine for MRI, and I think we handle jruby
ok.
If you really want to know if you’re running on a 32 or 64-bit JVM (at
least for Hotspot) you can use this property:
~/projects/jruby âž” jruby -v -e “p ENV_JAVA[‘sun.arch.data.model’]”
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-15 6586) (Java
HotSpot™ Client VM 1.5.0_19) [i386-java]
“32”
~/projects/jruby âž” (pickjdk 3 ; jruby -v -e “p
ENV_JAVA[‘sun.arch.data.model’]”)
New JDK: 1.6.0
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-15 6586) (Java
HotSpot™ 64-Bit Server VM 1.6.0_17) [x86_64-java]
“64”
~/projects/jruby âž” (pickjdk 3 ; jruby -v -J-d32 -e “p
ENV_JAVA[‘sun.arch.data.model’]”)
New JDK: 1.6.0
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-15 6586) (Java
HotSpot™ Client VM 1.6.0_17) [i386-java]
“32”
There’s probably something similar (or identical) for JRockit and J9.
Charles Nutter wrote:
ENV_JAVA[‘sun.arch.data.model’]
Thanks I’ve included that.
@Trans “why this isn’t in core”
I’m really not sure
-r
On Fri, Jan 15, 2010 at 4:31 PM, Iñaki Baz C. [email protected] wrote:
No, I’ve tested it in a 64 bits server running Linux 32 bits:
RbConfig::CONFIG[‘host_os’] => “linux-gnu”
RbConfig::CONFIG[‘host_cpu’] => “i486”
1.size => 4
I think that the value of 1.size depends not on what platform Ruby is
running on but how it was configured when Ruby was compiled.
You can have a version of Ruby compiled for 32-bits which runs on a
64-bit platform.
–
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: Rick DeNatale - Developer - IBM | LinkedIn
On Fri, Jan 15, 2010 at 9:52 PM, Roger P. [email protected]
wrote:
Charles Nutter wrote:
ENV_JAVA[‘sun.arch.data.model’]
Thanks I’ve included that.
@Trans “why this isn’t in core”
I’m really not sure
Seems like it could easily be an rbconfig value…