* 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 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -25,6 +25,7 @@ MergeObject os_main.o :
|
||||
scheduler.c
|
||||
sem.c
|
||||
system_info.c
|
||||
system_revision.c
|
||||
team.c
|
||||
thread.c
|
||||
time.cpp
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>.
|
||||
* 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;
|
||||
}
|
||||
@@ -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 @@ 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));
|
||||
|
||||
Reference in New Issue
Block a user