Résultat sur albert (iMac Intel Core 2 Duo à 2 GHz, Mac OS X 10.5 Intel):
Quel kernel avons-nous ?
[pbn@albert] /Users/pbn>uname -a
Darwin albert 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
En particulier, quelle est l'architecture ?
[pbn@albert] /Users/pbn>uname -m
i386
Le CPU est-il 64-bit ?
[pbn@albert] /Users/pbn>sysctl hw.cpu64bit_capable
hw.cpu64bit_capable: 1
Oui, le CPU est 64-bit
Voyons les fichiers
[pbn@albert] /Users/pbn/Documents/other/print-sizeof-pointer>ls
print-sizeof-pointer-linux-32bit.bin print-sizeof-pointer-macosx.bin
print-sizeof-pointer-linux-64bit.bin print-sizeof-pointer.c
[pbn@albert] /Users/pbn/Documents/other/print-sizeof-pointer>ls -l
total 160
-rw-r--r-- 1 pbn staff 6587 1 jui 20:00 print-sizeof-pointer-linux-32bit.bin
-rw-r--r-- 1 pbn staff 9415 1 jui 20:00 print-sizeof-pointer-linux-64bit.bin
-rwxr-xr-x 1 pbn staff 53640 1 jui 20:00 print-sizeof-pointer-macosx.bin
-rw-r--r-- 1 pbn staff 561 1 jui 20:00 print-sizeof-pointer.c
Voyons de quel type d'exécutable il s'agit: c'est un "universal binary" qui contient quatre exécutables pour quatre architectures différentes
[pbn@albert] /Users/pbn/Documents/other/print-sizeof-pointer>file print-sizeof-pointermacosx.bin
print-sizeof-pointer-macosx.bin: Mach-O universal binary with 4 architectures
print-sizeof-pointer-macosx.bin (for architecture i386): Mach-O executable i386
print-sizeof-pointer-macosx.bin (for architecture x86_64): Mach-O 64-bit executable x86_64
print-sizeof-pointer-macosx.bin (for architecture ppc7400): Mach-O executable ppc
print-sizeof-pointer-macosx.bin (for architecture ppc64): Mach-O 64-bit executable ppc64
J'exécute mon programme:
[pbn@albert] /Users/pbn/Documents/other/print-sizeof-pointer>./print-sizeof-pointer-macosx.bin
print-sizeof-pointer.c
If the result is 8, this machine is a 64-bit system.
If the result is 4, this machine is a 32-bit system.
Result: 8
[pbn@albert] /Users/pbn/Documents/other/print-sizeof-pointer>
En bref le cas de Mac OS X 10.5 "Léopard" est un peu particulier: sur une machine 64-bit sous Mac OS X 10.5 "Léopard":
- l'operating system est 64-bit
- l'API (Cocoa) est 64-bit et/ou 32-bit
- le kernel est 32-bit
- les fichiers "Universal Binaries" peuvent contenir les exécutables pour plusieurs architectures.
Aucun commentaire:
Enregistrer un commentaire