From fe8b72bc69e027abd0975ea252706a8d2b92caee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 15 Mar 2008 16:59:30 +0000 Subject: [PATCH] Applied patch by Vasilis: * Fixed various warnings with GCC4 due to the double sHaikuRevision line. * Turned system_info.c to a C++ file. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24404 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/Jamfile | 2 +- .../kernel/{system_info.c => system_info.cpp} | 24 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) rename src/system/kernel/{system_info.c => system_info.cpp} (93%) diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index 7af0be79fe..77d423391d 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -36,7 +36,7 @@ KernelMergeObject kernel_core.o : sem.cpp shutdown.c signal.cpp - system_info.c + system_info.cpp smp.c syscalls.cpp team.cpp diff --git a/src/system/kernel/system_info.c b/src/system/kernel/system_info.cpp similarity index 93% rename from src/system/kernel/system_info.c rename to src/system/kernel/system_info.cpp index fda4ebb87c..5362e0f7ef 100644 --- a/src/system/kernel/system_info.c +++ b/src/system/kernel/system_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007, Haiku, Inc. + * Copyright (c) 2004-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -9,6 +9,9 @@ #include +#include + +#include #include #include @@ -25,10 +28,6 @@ #include #include -#include - -#include - const static int64 kKernelVersion = 0x1; const static char *kKernelName = "kernel_" HAIKU_ARCH; @@ -37,18 +36,15 @@ const static char *kKernelName = "kernel_" HAIKU_ARCH; // Haiku SVN revision. Will be set when copying the kernel to the image. // Lives in a separate section so that it can easily be found. static uint32 sHaikuRevision __attribute__((section("_haiku_revision"))); -static uint32 sHaikuRevision = 0; static int dump_info(int argc, char **argv) { - int32 i; - kprintf("kernel build: %s %s\n\n", __DATE__, __TIME__); kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus()); - for (i = 0; i < smp_get_num_cpus(); i++) + for (int32 i = 0; i < smp_get_num_cpus(); i++) kprintf(" [%ld] %Ld\n", i + 1, cpu_get_active_time(i)); // ToDo: Add page_faults @@ -70,8 +66,6 @@ dump_info(int argc, char **argv) status_t _get_system_info(system_info *info, size_t size) { - int32 i; - if (size != sizeof(system_info)) return B_BAD_VALUE; @@ -80,7 +74,7 @@ _get_system_info(system_info *info, size_t size) info->boot_time = rtc_boot_time(); info->cpu_count = smp_get_num_cpus(); - for (i = 0; i < info->cpu_count; i++) + for (int32 i = 0; i < info->cpu_count; i++) info->cpu_infos[i].active_time = cpu_get_active_time(i); // ToDo: Add page_faults @@ -128,15 +122,13 @@ get_haiku_revision(void) status_t _user_get_system_info(system_info *userInfo, size_t size) { - system_info info; - status_t status; - // The BeBook says get_system_info() always returns B_OK, // but that ain't true with invalid addresses if (userInfo == NULL || !IS_USER_ADDRESS(userInfo)) return B_BAD_ADDRESS; - status = _get_system_info(&info, size); + system_info info; + status_t status = _get_system_info(&info, size); if (status == B_OK) { if (user_memcpy(userInfo, &info, sizeof(system_info)) < B_OK) return B_BAD_ADDRESS;