2002-10-05 21:04:37 +04:00
|
|
|
/*
|
2004-07-05 22:47:54 +04:00
|
|
|
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
|
|
|
** Distributed under the terms of the Haiku License.
|
2002-10-05 21:04:37 +04:00
|
|
|
*/
|
|
|
|
|
2003-01-13 13:50:14 +03:00
|
|
|
|
2002-10-05 21:04:37 +04:00
|
|
|
#include <user_runtime.h>
|
2003-01-13 13:50:14 +03:00
|
|
|
#include <string.h>
|
2002-10-05 21:04:37 +04:00
|
|
|
|
|
|
|
|
2003-01-12 20:13:32 +03:00
|
|
|
extern void __init__image(struct uspace_program_args const *args);
|
2003-01-13 13:50:14 +03:00
|
|
|
extern void __init__dlfcn(struct uspace_program_args const *args);
|
2002-10-05 21:04:37 +04:00
|
|
|
|
2003-01-12 20:13:32 +03:00
|
|
|
void initialize_before(image_id imageID, struct uspace_program_args const *args);
|
|
|
|
|
2003-01-13 13:50:14 +03:00
|
|
|
char *__progname = NULL;
|
|
|
|
|
2003-02-11 22:51:49 +03:00
|
|
|
char _single_threaded = true;
|
|
|
|
// determines if I/O locking needed; needed for BeOS compatibility
|
2004-07-05 22:47:54 +04:00
|
|
|
|
|
|
|
int __libc_argc;
|
|
|
|
char **__libc_argv;
|
2003-01-13 13:50:14 +03:00
|
|
|
thread_id __main_thread_id;
|
|
|
|
char **argv_save;
|
2004-07-05 22:47:54 +04:00
|
|
|
// needed for BeOS compatibility - they are set in the startup code
|
|
|
|
// (have a look at the glue/ directory)
|
2003-01-13 13:50:14 +03:00
|
|
|
|
|
|
|
|
2002-10-05 21:04:37 +04:00
|
|
|
void
|
2003-01-12 20:13:32 +03:00
|
|
|
initialize_before(image_id imageID, struct uspace_program_args const *args)
|
2002-10-05 21:04:37 +04:00
|
|
|
{
|
2003-01-13 13:50:14 +03:00
|
|
|
char *programPath = args->argv[0];
|
|
|
|
if (programPath) {
|
|
|
|
if ((__progname = strrchr(programPath, '/')) == NULL)
|
|
|
|
__progname = programPath;
|
|
|
|
else
|
|
|
|
__progname++;
|
|
|
|
}
|
|
|
|
|
2003-01-12 20:13:32 +03:00
|
|
|
__init__image(args);
|
2003-01-13 13:50:14 +03:00
|
|
|
__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.
|
2002-10-05 21:04:37 +04:00
|
|
|
}
|
|
|
|
|