[haiku-commits] haiku: hrev47584 - src/system/libroot/posix/sys

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 28 Jul 2014 14:48:42 +0200 (CEST)

hrev47584 adds 2 changesets to branch 'master'
old head: 8b95dd25f979aea76f5cb1b72b8649fc9b903189
new head: 3501a97d9b90267aed0b9800ba1188b7b4a2692a
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=3501a97+%5E8b95dd2

----------------------------------------------------------------------------

2692aea: Fix "unhandled case in switch" warning

3501a97: 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.

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

1 file changed, 39 insertions(+)
src/system/libroot/posix/sys/uname.c | 39 ++++++++++++++++++++++++++++++++

############################################################################

Commit:      2692aea5768ffd2f8dfc484d4137a49183d376aa
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2692aea
Author:      François Revol <revol@xxxxxxx>
Date:        Sat Jul 26 23:25:39 2014 UTC

Fix "unhandled case in switch" warning

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/sys/uname.c 
b/src/system/libroot/posix/sys/uname.c
index 18ea62a..5eac164 100644
--- a/src/system/libroot/posix/sys/uname.c
+++ b/src/system/libroot/posix/sys/uname.c
@@ -58,6 +58,9 @@ uname(struct utsname *info)
                        case B_CPU_x86_64:
                                platform = "x86_64";
                                break;
+                       default: //TODO:add others
+                               platform = "unknown";
+                               break;
                }
        }
 

############################################################################

Revision:    hrev47584
Commit:      3501a97d9b90267aed0b9800ba1188b7b4a2692a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3501a97
Author:      François Revol <revol@xxxxxxx>
Date:        Mon Jul 28 12:41:00 2014 UTC

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.

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/sys/uname.c 
b/src/system/libroot/posix/sys/uname.c
index 5eac164..bb018a3 100644
--- a/src/system/libroot/posix/sys/uname.c
+++ b/src/system/libroot/posix/sys/uname.c
@@ -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;
                }


Other related posts: