diff --git a/headers/private/system/system_revision.h b/headers/private/system/system_revision.h index c1c612b26b..3b5a7541cd 100644 --- a/headers/private/system/system_revision.h +++ b/headers/private/system/system_revision.h @@ -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 */ diff --git a/src/system/libroot/os/Jamfile b/src/system/libroot/os/Jamfile index 43a0747914..6fbd278ac8 100644 --- a/src/system/libroot/os/Jamfile +++ b/src/system/libroot/os/Jamfile @@ -25,6 +25,7 @@ MergeObject os_main.o : scheduler.c sem.c system_info.c + system_revision.c team.c thread.c time.cpp diff --git a/src/system/libroot/os/system_revision.c b/src/system/libroot/os/system_revision.c new file mode 100644 index 0000000000..bf5f076d24 --- /dev/null +++ b/src/system/libroot/os/system_revision.c @@ -0,0 +1,20 @@ +/* + * Copyright 2011, Oliver Tappe . + * Distributed under the terms of the MIT License. + */ + + +#include + + +// 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; +} diff --git a/src/system/libroot/posix/sys/uname.c b/src/system/libroot/posix/sys/uname.c index cc81e61dd2..06279302e0 100644 --- a/src/system/libroot/posix/sys/uname.c +++ b/src/system/libroot/posix/sys/uname.c @@ -16,17 +16,12 @@ #include -// 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 @@ uname(struct utsname *info) 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));