haiku/src/system/libroot/libroot_init.c
Ingo Weinhold 24df65921b Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
  handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
  support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
  of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
  [set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-12 00:00:23 +00:00

83 lines
1.9 KiB
C

/*
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include <pthread.h>
#include <string.h>
#include <image.h>
#include <user_runtime.h>
#include <runtime_loader.h>
#include <fork.h>
#include <libroot_private.h>
#include <pthread_private.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;
if (__gRuntimeLoader->program_args->umask != (mode_t)-1)
umask(__gRuntimeLoader->program_args->umask);
pthread_self()->id = find_thread(NULL);
__init_time();
__init_heap();
__init_env(__gRuntimeLoader->program_args);
__init_heap_post_env();
__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.
}