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:
@@ -39,6 +39,8 @@ struct rld_export {
|
|||||||
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
|
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
|
||||||
const char **_name);
|
const char **_name);
|
||||||
|
|
||||||
|
status_t (*reinit_after_fork)();
|
||||||
|
|
||||||
const struct user_space_program_args *program_args;
|
const struct user_space_program_args *program_args;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <syscalls.h>
|
|
||||||
#include <fork.h>
|
#include <fork.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <syscalls.h>
|
||||||
|
#include <user_runtime.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct fork_hook {
|
typedef struct fork_hook {
|
||||||
struct fork_hook *next;
|
struct fork_hook *next;
|
||||||
@@ -153,6 +155,7 @@ fork(void)
|
|||||||
// ToDo: initialize child
|
// ToDo: initialize child
|
||||||
__main_thread_id = find_thread(NULL);
|
__main_thread_id = find_thread(NULL);
|
||||||
__init_fork();
|
__init_fork();
|
||||||
|
__gRuntimeLoader->reinit_after_fork();
|
||||||
|
|
||||||
call_fork_hooks(sChildHooks);
|
call_fork_hooks(sChildHooks);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1670,3 +1670,14 @@ rldelf_init(void)
|
|||||||
sErrorMessage.SetTo(buffer, 1024, 'Rler');
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ struct rld_export gRuntimeLoader = {
|
|||||||
get_symbol,
|
get_symbol,
|
||||||
get_nth_symbol,
|
get_nth_symbol,
|
||||||
test_executable,
|
test_executable,
|
||||||
get_next_image_dependency
|
get_next_image_dependency,
|
||||||
|
|
||||||
|
elf_reinit_after_fork
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
status_t elf_verify_header(void *header, int32 length);
|
||||||
void rldelf_init(void);
|
void rldelf_init(void);
|
||||||
void rldexport_init(void);
|
void rldexport_init(void);
|
||||||
|
status_t elf_reinit_after_fork();
|
||||||
|
|
||||||
status_t heap_init(void);
|
status_t heap_init(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user