From c8882988b7f4e5de279d3d659f8a5b394a23360c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 30 May 2006 00:21:22 +0000 Subject: [PATCH] The kernel's struct team now has a field to remember where the arguments of a running team to be able to fill in the team_info::args field. Currently, only the path is stored, there, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17646 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/thread_types.h | 1 + src/system/kernel/team.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/headers/private/kernel/thread_types.h b/headers/private/kernel/thread_types.h index 9c57c2b15c..a82f0cba86 100644 --- a/headers/private/kernel/thread_types.h +++ b/headers/private/kernel/thread_types.h @@ -95,6 +95,7 @@ struct team { pid_t session_id; struct process_group *group; char name[B_OS_NAME_LENGTH]; + char args[64]; // contents for the team_info::args field int num_threads; /* number of threads in this team */ int state; /* current team state, see above */ int pending_signals; diff --git a/src/system/kernel/team.c b/src/system/kernel/team.c index e87510e661..64b136b490 100644 --- a/src/system/kernel/team.c +++ b/src/system/kernel/team.c @@ -194,6 +194,7 @@ team_init(kernel_args *args) kernel_team = create_team_struct("kernel_team", true); if (kernel_team == NULL) panic("could not create kernel team!\n"); + strcpy(kernel_team->args, kernel_team->name); kernel_team->state = TEAM_STATE_NORMAL; insert_team_into_group(group, kernel_team); @@ -1063,6 +1064,9 @@ team_create_thread_start(void *args) TRACE(("team_create_thread_start: loading elf binary '%s'\n", path)); + // TODO: add args + strlcpy(team->args, path, sizeof(team->args)); + free_team_arg(teamArgs); // the arguments are already on the user stack, we no longer need them in this form @@ -1904,13 +1908,10 @@ fill_team_info(struct team *team, team_info *info, size_t size) //info->area_count = info->debugger_nub_thread = team->debug_info.nub_thread; info->debugger_nub_port = team->debug_info.nub_port; - //info->argc = - //info->args[64] = //info->uid = //info->gid = - // ToDo: make this to return real argc/argv - strlcpy(info->args, team->name, sizeof(info->args)); + strlcpy(info->args, team->args, sizeof(info->args)); info->argc = 1; return B_OK; @@ -1954,8 +1955,12 @@ _get_next_team_info(int32 *cookie, team_info *info, size_t size) struct team *team = NULL; int32 slot = *cookie; team_id lastTeamID; + cpu_status state; - cpu_status state = disable_interrupts(); + if (slot < 1) + slot = 1; + + state = disable_interrupts(); GRAB_TEAM_LOCK(); lastTeamID = peek_next_thread_id();