kernel/team: Set team arguments during load_image/exec_team.
This way, by the time we send a notification, the arguments are already set even if the main thread has not yet started. Fixes #12703. Change-Id: Ib93b4b16bffa8cb943cf6389f0f72dce89f9749b Reviewed-on: https://review.haiku-os.org/c/haiku/+/7702 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
9631ca7349
commit
365b32bb6e
@@ -1636,18 +1636,17 @@ team_create_thread_start_internal(void* args)
|
|||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("team_create_thread_start: loading elf binary '%s'\n", path));
|
|
||||||
|
|
||||||
// set team args and update state
|
|
||||||
team->Lock();
|
|
||||||
team->SetArgs(path, teamArgs->flat_args + 1, argCount - 1);
|
|
||||||
team->state = TEAM_STATE_NORMAL;
|
|
||||||
team->Unlock();
|
|
||||||
|
|
||||||
free_team_arg(teamArgs);
|
free_team_arg(teamArgs);
|
||||||
// the arguments are already on the user stack, we no longer need
|
// the arguments are already on the user stack, we no longer need
|
||||||
// them in this form
|
// them in this form
|
||||||
|
|
||||||
|
TRACE(("team_create_thread_start: loading elf binary '%s'\n", path));
|
||||||
|
|
||||||
|
// update state
|
||||||
|
team->Lock();
|
||||||
|
team->state = TEAM_STATE_NORMAL;
|
||||||
|
team->Unlock();
|
||||||
|
|
||||||
// Clone commpage area
|
// Clone commpage area
|
||||||
area_id commPageArea = clone_commpage_area(team->id,
|
area_id commPageArea = clone_commpage_area(team->id,
|
||||||
&team->commpage_address);
|
&team->commpage_address);
|
||||||
@@ -1808,6 +1807,8 @@ load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount,
|
|||||||
_flatArgs = NULL;
|
_flatArgs = NULL;
|
||||||
// args are owned by the team_arg structure now
|
// args are owned by the team_arg structure now
|
||||||
|
|
||||||
|
team->SetArgs(path, teamArgs->flat_args + 1, argCount - 1);
|
||||||
|
|
||||||
// create a new io_context for this team
|
// create a new io_context for this team
|
||||||
team->io_context = vfs_new_io_context(parentIOContext, true);
|
team->io_context = vfs_new_io_context(parentIOContext, true);
|
||||||
if (!team->io_context) {
|
if (!team->io_context) {
|
||||||
@@ -2014,6 +2015,8 @@ exec_team(const char* path, char**& _flatArgs, size_t flatArgsSize,
|
|||||||
_flatArgs = NULL;
|
_flatArgs = NULL;
|
||||||
// args are owned by the team_arg structure now
|
// args are owned by the team_arg structure now
|
||||||
|
|
||||||
|
team->SetArgs(path, teamArgs->flat_args + 1, argCount - 1);
|
||||||
|
|
||||||
// TODO: remove team resources if there are any left
|
// TODO: remove team resources if there are any left
|
||||||
// thread_atkernel_exit() might not be called at all
|
// thread_atkernel_exit() might not be called at all
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user