Add cases for uname() for all known platforms

After what QEMU linux-user says about those.

Not sure what to do for ARM. I used the lowest emulated CPU in QEMU.
This commit is contained in:
François Revol 2014-07-28 14:41:00 +02:00
parent 2692aea576
commit 3501a97d9b

View File

@ -12,6 +12,7 @@
#include <unistd.h>
#include <OS.h>
#include <ByteOrder.h>
#include <errno_private.h>
#include <system_revision.h>
@ -58,7 +59,42 @@ uname(struct utsname *info)
case B_CPU_x86_64:
platform = "x86_64";
break;
default: //TODO:add others
case B_CPU_PPC:
platform = "ppc";
break;
case B_CPU_PPC_64:
platform = "ppc64";
break;
case B_CPU_M68K:
platform = "m68k";
break;
case B_CPU_ARM:
/* The minimal ARM version emulated by QEMU
* XXX: use armv6 (raspberry Pi)?
* XXX: should we really use B_HOST_IS_LENDIAN here?
* XXX: use real cpu version as on Linux?
* cf. http://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/uname.c
*/
#if B_HOST_IS_LENDIAN
platform = "armv5tel";
#else
platform = "armv5teb";
#endif
break;
case B_CPU_ARM_64:
platform = "aarch64";
break;
case B_CPU_ALPHA:
platform = "alpha";
break;
case B_CPU_MIPS:
platform = "mips";
break;
case B_CPU_SH:
platform = "sh4";
break;
case B_CPU_UNKNOWN:
default:
platform = "unknown";
break;
}