haiku/src/kernel/libroot/libroot_init.c
Axel Dörfler 26dade365a Added the _single_threaded global variable as it is needed by the std I/O
implementation in BeOS.
(spawn_thread() will change the value later, but that will come with the whole
stdio implemenation (as it would now print out a warning))


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-02-11 19:51:49 +00:00

74 lines
1.7 KiB
C

/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include <user_runtime.h>
#include <string.h>
extern void __init__image(struct uspace_program_args const *args);
extern void __init__dlfcn(struct uspace_program_args const *args);
void initialize_before(image_id imageID, struct uspace_program_args const *args);
char *__progname = NULL;
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 original
// BeOS startup code, but they won't be initialized when the
// OpenBeOS startup code is used.
// ToDo: these functions are defined in libgcc - this one is included in
// libroot.so in BeOS, but we probably don't want to do that.
// Since we don't yet have libgcc at all, it's defined here for now
// so that BeOS executables will find them.
// Remove them later!
void __deregister_frame_info(void);
void
__deregister_frame_info(void)
{
}
void __register_frame_info(void);
void
__register_frame_info(void)
{
}
void
initialize_before(image_id imageID, struct uspace_program_args const *args)
{
char *programPath = args->argv[0];
if (programPath) {
if ((__progname = strrchr(programPath, '/')) == NULL)
__progname = programPath;
else
__progname++;
}
__init__image(args);
__init__dlfcn(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.
}