Switch haiku-revision from uint32 to string, as that's going to be required soon, no matter if we switch to Git or Mercurial
* increase _SYS_NAMELEN defined in sys/utsname.h to 128 to allow long(ish) revisions * sHaikuRevision is now a static character array (in both libroot and kernel) * adjust build tool set_haiku_revision to write the revision as string git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
#define _SYS_UTSNAME_H
|
#define _SYS_UTSNAME_H
|
||||||
|
|
||||||
|
|
||||||
#define _SYS_NAMELEN 32
|
#define _SYS_NAMELEN 128
|
||||||
|
|
||||||
struct utsname {
|
struct utsname {
|
||||||
char sysname[_SYS_NAMELEN]; /* Name of the OS */
|
char sysname[_SYS_NAMELEN]; /* Name of the OS */
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ extern "C" {
|
|||||||
|
|
||||||
status_t system_info_init(struct kernel_args *args);
|
status_t system_info_init(struct kernel_args *args);
|
||||||
status_t system_notifications_init();
|
status_t system_notifications_init();
|
||||||
uint32 get_haiku_revision(void);
|
const char* get_haiku_revision(void);
|
||||||
|
|
||||||
status_t _user_get_system_info(system_info *userInfo, size_t size);
|
status_t _user_get_system_info(system_info *userInfo, size_t size);
|
||||||
status_t _user_get_system_info_etc(int32 id, void *buffer,
|
status_t _user_get_system_info_etc(int32 id, void *buffer,
|
||||||
|
|||||||
@@ -1402,7 +1402,7 @@ syslog_init_post_vm(struct kernel_args* args)
|
|||||||
|
|
||||||
char revisionBuffer[64];
|
char revisionBuffer[64];
|
||||||
length = snprintf(revisionBuffer, sizeof(revisionBuffer),
|
length = snprintf(revisionBuffer, sizeof(revisionBuffer),
|
||||||
"Welcome to syslog debug output!\nHaiku revision: %lu\n",
|
"Welcome to syslog debug output!\nHaiku revision: %s\n",
|
||||||
get_haiku_revision());
|
get_haiku_revision());
|
||||||
syslog_write(revisionBuffer,
|
syslog_write(revisionBuffer,
|
||||||
std::min(length, (ssize_t)sizeof(revisionBuffer) - 1), false);
|
std::min(length, (ssize_t)sizeof(revisionBuffer) - 1), false);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ _start(kernel_args *bootKernelArgs, int currentCPU)
|
|||||||
debug_init(&sKernelArgs);
|
debug_init(&sKernelArgs);
|
||||||
set_dprintf_enabled(true);
|
set_dprintf_enabled(true);
|
||||||
dprintf("Welcome to kernel debugger output!\n");
|
dprintf("Welcome to kernel debugger output!\n");
|
||||||
dprintf("Haiku revision: %lu\n", get_haiku_revision());
|
dprintf("Haiku revision: %s\n", get_haiku_revision());
|
||||||
|
|
||||||
// init modules
|
// init modules
|
||||||
TRACE("init CPU\n");
|
TRACE("init CPU\n");
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
#include <sem.h>
|
#include <sem.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
#include <team.h>
|
#include <team.h>
|
||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
#include <util/AutoLock.h>
|
#include <util/AutoLock.h>
|
||||||
@@ -44,7 +45,8 @@ const static char *kKernelName = "kernel_" HAIKU_ARCH;
|
|||||||
|
|
||||||
// Haiku SVN revision. Will be set when copying the kernel to the image.
|
// 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.
|
// Lives in a separate section so that it can easily be found.
|
||||||
static uint32 sHaikuRevision __attribute__((section("_haiku_revision")));
|
static char sHaikuRevision[_SYS_NAMELEN]
|
||||||
|
__attribute__((section("_haiku_revision")));
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -52,7 +54,7 @@ dump_info(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
kprintf("kernel build: %s %s (gcc%d %s)\n", __DATE__, __TIME__, __GNUC__,
|
kprintf("kernel build: %s %s (gcc%d %s)\n", __DATE__, __TIME__, __GNUC__,
|
||||||
__VERSION__);
|
__VERSION__);
|
||||||
kprintf("SVN revision: %lu\n\n", sHaikuRevision);
|
kprintf("SVN revision: %s\n\n", sHaikuRevision);
|
||||||
|
|
||||||
kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus());
|
kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus());
|
||||||
|
|
||||||
@@ -466,7 +468,7 @@ system_notifications_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32
|
const char*
|
||||||
get_haiku_revision(void)
|
get_haiku_revision(void)
|
||||||
{
|
{
|
||||||
return sHaikuRevision;
|
return sHaikuRevision;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
// Haiku SVN revision. Will be set when copying libroot.so to the image.
|
// 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.
|
// Lives in a separate section so that it can easily be found.
|
||||||
static uint32 sHaikuRevision __attribute__((section("_haiku_revision")));
|
static char sHaikuRevision[_SYS_NAMELEN]
|
||||||
static uint32 sHaikuRevision = 0;
|
__attribute__((section("_haiku_revision")));
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -35,11 +35,10 @@ uname(struct utsname *info)
|
|||||||
|
|
||||||
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
|
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
|
||||||
|
|
||||||
info->version[0] = '\0';
|
if (sHaikuRevision[0] != '\0')
|
||||||
if (sHaikuRevision) {
|
snprintf(info->version, sizeof(info->version), "r%s ", sHaikuRevision);
|
||||||
snprintf(info->version, sizeof(info->version), "r%ld ",
|
else
|
||||||
sHaikuRevision);
|
info->version[0] = '\0';
|
||||||
}
|
|
||||||
strlcat(info->version, systemInfo.kernel_build_date, sizeof(info->version));
|
strlcat(info->version, systemInfo.kernel_build_date, sizeof(info->version));
|
||||||
strlcat(info->version, " ", sizeof(info->version));
|
strlcat(info->version, " ", sizeof(info->version));
|
||||||
strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version));
|
strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version));
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -570,7 +571,6 @@ main(int argc, const char* const* argv)
|
|||||||
// parameters
|
// parameters
|
||||||
const char* fileName = argv[1];
|
const char* fileName = argv[1];
|
||||||
const char* revisionString = argv[2];
|
const char* revisionString = argv[2];
|
||||||
uint32_t revision = atol(revisionString);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ELFObject elfObject;
|
ELFObject elfObject;
|
||||||
@@ -583,9 +583,9 @@ main(int argc, const char* const* argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert revision number to object endianess and write to section
|
// write revision string to section
|
||||||
uint32_t revisionBuffer = elfObject.GetUInt32(revision);
|
elfObject.Write(info.offset, revisionString,
|
||||||
elfObject.Write(info.offset, &revisionBuffer, sizeof(revisionBuffer),
|
std::min(sizeof(utsname::version), strlen(revisionString) + 1),
|
||||||
"Failed to write revision.");
|
"Failed to write revision.");
|
||||||
|
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user