Author: zooey Date: 2011-05-13 22:38:14 +0200 (Fri, 13 May 2011) New Revision: 41479 Changeset: https://dev.haiku-os.org/changeset/41479 Added: haiku/trunk/src/system/libroot/os/system_revision.c Modified: haiku/trunk/headers/private/system/system_revision.h haiku/trunk/src/system/libroot/os/Jamfile haiku/trunk/src/system/libroot/posix/sys/uname.c Log: * move sHaikuRevision from uname.c into new system_revision.c * add private function get_system_revision() for accessing the revision string * adjust uname to use get_system_revision Modified: haiku/trunk/headers/private/system/system_revision.h =================================================================== --- haiku/trunk/headers/private/system/system_revision.h 2011-05-13 20:38:02 UTC (rev 41478) +++ haiku/trunk/headers/private/system/system_revision.h 2011-05-13 20:38:14 UTC (rev 41479) @@ -11,4 +11,18 @@ #define SYSTEM_REVISION_LENGTH 128 +#ifdef __cplusplus +extern "C" { +#endif + + +/** returns the system revision */ +const char* get_system_revision(); + + +#ifdef __cplusplus +} +#endif + + #endif /* _SYSTEM_SYSTEM_REVISION_H */ Modified: haiku/trunk/src/system/libroot/os/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/Jamfile 2011-05-13 20:38:02 UTC (rev 41478) +++ haiku/trunk/src/system/libroot/os/Jamfile 2011-05-13 20:38:14 UTC (rev 41479) @@ -25,6 +25,7 @@ scheduler.c sem.c system_info.c + system_revision.c team.c thread.c time.cpp Added: haiku/trunk/src/system/libroot/os/system_revision.c =================================================================== --- haiku/trunk/src/system/libroot/os/system_revision.c (rev 0) +++ haiku/trunk/src/system/libroot/os/system_revision.c 2011-05-13 20:38:14 UTC (rev 41479) @@ -0,0 +1,20 @@ +/* + * Copyright 2011, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>. + * Distributed under the terms of the MIT License. + */ + + +#include <system_revision.h> + + +// Haiku SVN revision. Will be set when copying libroot.so to the image. +// Lives in a separate section so that it can easily be found. +static char sHaikuRevision[SYSTEM_REVISION_LENGTH] + __attribute__((section("_haiku_revision"))); + + +const char* +get_system_revision() +{ + return sHaikuRevision; +} Modified: haiku/trunk/src/system/libroot/posix/sys/uname.c =================================================================== --- haiku/trunk/src/system/libroot/posix/sys/uname.c 2011-05-13 20:38:02 UTC (rev 41478) +++ haiku/trunk/src/system/libroot/posix/sys/uname.c 2011-05-13 20:38:14 UTC (rev 41479) @@ -16,17 +16,12 @@ #include <system_revision.h> -// Haiku SVN revision. Will be set when copying libroot.so to the image. -// Lives in a separate section so that it can easily be found. -static char sHaikuRevision[SYSTEM_REVISION_LENGTH] - __attribute__((section("_haiku_revision"))); - - int uname(struct utsname *info) { system_info systemInfo; const char *platform; + const char *haikuRevision; if (!info) { errno = B_BAD_VALUE; @@ -37,8 +32,9 @@ strlcpy(info->sysname, "Haiku", sizeof(info->sysname)); - if (sHaikuRevision[0] != '\0') - snprintf(info->version, sizeof(info->version), "r%s ", sHaikuRevision); + haikuRevision = get_system_revision(); + if (haikuRevision[0] != '\0') + snprintf(info->version, sizeof(info->version), "%s ", haikuRevision); else info->version[0] = '\0'; strlcat(info->version, systemInfo.kernel_build_date, sizeof(info->version));