diff --git a/headers/private/system/system_revision.h b/headers/private/system/system_revision.h new file mode 100644 index 0000000000..c1c612b26b --- /dev/null +++ b/headers/private/system/system_revision.h @@ -0,0 +1,14 @@ +/* + * Copyright 2011, Oliver Tappe . + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_SYSTEM_REVISION_H +#define _SYSTEM_SYSTEM_REVISION_H + + +/** The length of the system revision character array symbol living in libroot + and the kernel */ +#define SYSTEM_REVISION_LENGTH 128 + + +#endif /* _SYSTEM_SYSTEM_REVISION_H */ diff --git a/src/system/kernel/system_info.cpp b/src/system/kernel/system_info.cpp index e35ba006e7..3823355ffc 100644 --- a/src/system/kernel/system_info.cpp +++ b/src/system/kernel/system_info.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -45,7 +45,7 @@ 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 char sHaikuRevision[_SYS_NAMELEN] +static char sHaikuRevision[SYSTEM_REVISION_LENGTH] __attribute__((section("_haiku_revision"))); diff --git a/src/system/libroot/posix/sys/uname.c b/src/system/libroot/posix/sys/uname.c index c4e1d08f93..cc81e61dd2 100644 --- a/src/system/libroot/posix/sys/uname.c +++ b/src/system/libroot/posix/sys/uname.c @@ -13,10 +13,12 @@ #include +#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[_SYS_NAMELEN] +static char sHaikuRevision[SYSTEM_REVISION_LENGTH] __attribute__((section("_haiku_revision"))); diff --git a/src/tools/Jamfile b/src/tools/Jamfile index 376563e117..afbff6d33d 100644 --- a/src/tools/Jamfile +++ b/src/tools/Jamfile @@ -96,6 +96,7 @@ MODE on rm_attrs = 755 ; BuildPlatformMain rmattr : rmattr.cpp : $(HOST_LIBBE) ; +UsePrivateObjectHeaders set_haiku_revision : system : : true ; BuildPlatformMain set_haiku_revision : set_haiku_revision.cpp : $(HOST_LIBSTDC++) $(HOST_LIBSUPC++) ; diff --git a/src/tools/set_haiku_revision.cpp b/src/tools/set_haiku_revision.cpp index 44f9f7f964..5022398448 100644 --- a/src/tools/set_haiku_revision.cpp +++ b/src/tools/set_haiku_revision.cpp @@ -10,12 +10,13 @@ #include #include #include -#include #include #include #include +#include + // We use htonl(), which is defined in on BeOS R5. #ifdef HAIKU_HOST_PLATFORM_BEOS #include @@ -585,7 +586,7 @@ main(int argc, const char* const* argv) // write revision string to section elfObject.Write(info.offset, revisionString, - std::min(sizeof(utsname::version), strlen(revisionString) + 1), + min((size_t)SYSTEM_REVISION_LENGTH, strlen(revisionString) + 1), "Failed to write revision."); } catch (Exception exception) {