From 7c61d84fcd53518c0a155315f72a71e21d5c3574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 15 May 2008 12:10:12 +0000 Subject: [PATCH] Patch by Vasilis Kaoutsis: * Renamed main.c to main.cpp * Use find_directory() to construct the Bootscript path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25509 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/Jamfile | 2 +- src/system/kernel/{main.c => main.cpp} | 29 +++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) rename src/system/kernel/{main.c => main.cpp} (91%) diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index 353d59766f..cc8a13cfc7 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -29,7 +29,7 @@ KernelMergeObject kernel_core.o : kernel_daemon.cpp linkhack.c lock.cpp - main.c + main.cpp module.cpp Notifications.cpp port.cpp diff --git a/src/system/kernel/main.c b/src/system/kernel/main.cpp similarity index 91% rename from src/system/kernel/main.c rename to src/system/kernel/main.cpp index 8a573d0778..935cf631bd 100644 --- a/src/system/kernel/main.c +++ b/src/system/kernel/main.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -21,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -61,8 +64,17 @@ static uint32 sCpuRendezvous; static uint32 sCpuRendezvous2; static int32 main2(void *); -int _start(kernel_args *bootKernelArgs, int cpu); /* keep compiler happy */ +#ifdef __cplusplus +extern "C" { +#endif + +extern int _start(kernel_args *bootKernelArgs, int cpu); + /* keep compiler happy */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif int _start(kernel_args *bootKernelArgs, int currentCPU) @@ -292,8 +304,19 @@ main2(void *unused) // start the init process { - const char *args[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", - NULL}; + KPath bootScriptPath; + status_t status = find_directory(B_BEOS_SYSTEM_DIRECTORY, gBootDevice, + false, bootScriptPath.LockBuffer(), bootScriptPath.BufferSize()); + if (status != B_OK) + dprintf("main2: find_directory() failed: %s\n", strerror(status)); + bootScriptPath.UnlockBuffer(); + status = bootScriptPath.Append("boot/Bootscript"); + if (status != B_OK) { + dprintf("main2: constructing path to Bootscript failed: " + "%s\n", strerror(status)); + } + + const char *args[] = { "/bin/sh", bootScriptPath.Path(), NULL }; int32 argc = 2; thread_id thread;