Give the runtime loader a chance to reinit its semaphore after fork().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21886 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-08-11 00:14:26 +00:00
parent 6981ec9f0a
commit 1873b4b37e
5 changed files with 21 additions and 2 deletions

View File

@ -39,6 +39,8 @@ struct rld_export {
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
const char **_name);
status_t (*reinit_after_fork)();
const struct user_space_program_args *program_args;
};

View File

@ -4,13 +4,15 @@
*/
#include <syscalls.h>
#include <fork.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <syscalls.h>
#include <user_runtime.h>
typedef struct fork_hook {
struct fork_hook *next;
@ -153,6 +155,7 @@ fork(void)
// ToDo: initialize child
__main_thread_id = find_thread(NULL);
__init_fork();
__gRuntimeLoader->reinit_after_fork();
call_fork_hooks(sChildHooks);
} else {

View File

@ -1670,3 +1670,14 @@ rldelf_init(void)
sErrorMessage.SetTo(buffer, 1024, 'Rler');
}
}
status_t
elf_reinit_after_fork()
{
rld_sem = create_sem(1, "rld_lock");
if (rld_sem < 0)
return rld_sem;
return B_OK;
}

View File

@ -34,7 +34,9 @@ struct rld_export gRuntimeLoader = {
get_symbol,
get_nth_symbol,
test_executable,
get_next_image_dependency
get_next_image_dependency,
elf_reinit_after_fork
};

View File

@ -44,6 +44,7 @@ int resolve_symbol(image_t *rootImage, image_t *image, struct Elf32_Sym *sym,
status_t elf_verify_header(void *header, int32 length);
void rldelf_init(void);
void rldexport_init(void);
status_t elf_reinit_after_fork();
status_t heap_init(void);