f71274580b
- Reimplemented mutex to use the _kern_mutex*() syscalls. - The initializer functions cannot fail anymore -- changed their return type to void. - Changed the initializer function semantics to not copy the name by default anymore (as in the kernel). Also added *_etc() versions of them that take an additional flags. - Added static initializer macros. - Made the mutex (and thus recursive_lock) lock functions non-interruptable. - Got rid of the "lazy" version. They are no longer needed, since the initialization of the standard types can be done statically and cannot fail. * Adjusted libroot, runtime loader, and other code using the private libroot locking primitives to the new semantics. * pthreads mutexes and condition variables: - Reimplemented using the _kern_mutex*() syscalls. - Consistently use POSIX error codes. - Fixed some not quite POSIX compliant behavior. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96
72 lines
1.6 KiB
C
72 lines
1.6 KiB
C
/*
|
|
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <fork.h>
|
|
#include <image.h>
|
|
#include <libroot_private.h>
|
|
#include <runtime_loader.h>
|
|
#include <user_runtime.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;
|
|
|
|
__gRuntimeLoader->call_atexit_hooks_for_range
|
|
= _call_atexit_hooks_for_range;
|
|
|
|
__init_time();
|
|
__init_heap();
|
|
__init_env(__gRuntimeLoader->program_args);
|
|
__init_pwd_backend();
|
|
}
|
|
|
|
|
|
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.
|
|
}
|
|
|