haiku/src/system/libroot/libroot_init.c
Axel Dörfler 74c0424a43 * Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
  it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
  was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
  message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
  unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
  uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
  and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
  compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 02:32:19 +00:00

68 lines
1.5 KiB
C

/*
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include <libroot_private.h>
#include <user_runtime.h>
#include <fork.h>
#include <image.h>
#include <string.h>
void initialize_before(image_id imageID);
struct rld_export *__gRuntimeLoader = NULL;
// This little bugger is set to something meaningful by the runtime loader
// Ugly, eh?
char *__progname = NULL;
int __libc_argc;
char **__libc_argv;
char _single_threaded = true;
// determines if I/O locking needed; needed for BeOS compatibility
thread_id __main_thread_id;
char **argv_save;
// needed for BeOS compatibility - they are set in the startup code
// (have a look at the glue/ directory)
int _data_offset_main_;
// this is obviously needed for R4.5 compatiblity
void
initialize_before(image_id imageID)
{
char *programPath = __gRuntimeLoader->program_args->args[0];
if (programPath) {
if ((__progname = strrchr(programPath, '/')) == NULL)
__progname = programPath;
else
__progname++;
}
__libc_argc = __gRuntimeLoader->program_args->arg_count;
__libc_argv = __gRuntimeLoader->program_args->args;
__init_time();
__init_fork();
__init_heap();
__init_env(__gRuntimeLoader->program_args);
}
void _init_c_library_(void);
void
_init_c_library_(void)
{
// This function is called from the BeOS start_dyn.o - so it's called once
// for every application that was compiled under BeOS.
// Our libroot functions are already initialized above, so we don't have to
// do anything here.
}