From da758f9fce0dc7beadcf5008188e06a0e09aee22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 18 Dec 2006 12:56:27 +0000 Subject: [PATCH] * team::args is now correctly filled in. * the member will now also be shown when dumping a team. * minor cleanup: moved fill_team_info() into the private functions part of the file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19551 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.c | 82 ++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/src/system/kernel/team.c b/src/system/kernel/team.c index c6f3bb96b0..9fa455ba59 100644 --- a/src/system/kernel/team.c +++ b/src/system/kernel/team.c @@ -84,6 +84,7 @@ _dump_team_info(struct team *team) kprintf("TEAM: %p\n", team); kprintf("id: 0x%lx\n", team->id); kprintf("name: '%s'\n", team->name); + kprintf("args: '%s'\n", team->args); kprintf("next: %p\n", team->next); kprintf("parent: %p", team->parent); if (team->parent != NULL) { @@ -781,8 +782,25 @@ 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)); + // add args to info member + sizeLeft = strlcpy(team->args, path, sizeof(team->args)); + udest = team->args + sizeLeft; + sizeLeft = sizeof(team->args) - sizeLeft; + + for (i = 1; i < argCount && sizeLeft > 2; i++) { + size_t length; + + udest[0] = ' '; + udest++; + sizeLeft--; + + length = strlcpy(udest, teamArgs->args[i], sizeLeft); + if (length >= sizeLeft) + break; + + sizeLeft -= length; + udest += length; + } free_team_arg(teamArgs); // the arguments are already on the user stack, we no longer need them in this form @@ -1456,6 +1474,36 @@ err: } +/** Fills the team_info structure with information from the specified + * team. + * The team lock must be held when called. + */ + +static status_t +fill_team_info(struct team *team, team_info *info, size_t size) +{ + if (size != sizeof(team_info)) + return B_BAD_VALUE; + + // ToDo: Set more informations for team_info + memset(info, 0, size); + + info->team = team->id; + info->thread_count = team->num_threads; + info->image_count = count_images(team); + //info->area_count = + info->debugger_nub_thread = team->debug_info.nub_thread; + info->debugger_nub_port = team->debug_info.nub_port; + //info->uid = + //info->gid = + + strlcpy(info->args, team->args, sizeof(info->args)); + info->argc = 1; + + return B_OK; +} + + // #pragma mark - Private kernel API @@ -1959,36 +2007,6 @@ kill_team(team_id id) } -/** Fills the team_info structure with information from the specified - * team. - * The team lock must be held when called. - */ - -static status_t -fill_team_info(struct team *team, team_info *info, size_t size) -{ - if (size != sizeof(team_info)) - return B_BAD_VALUE; - - // ToDo: Set more informations for team_info - memset(info, 0, size); - - info->team = team->id; - info->thread_count = team->num_threads; - info->image_count = count_images(team); - //info->area_count = - info->debugger_nub_thread = team->debug_info.nub_thread; - info->debugger_nub_port = team->debug_info.nub_port; - //info->uid = - //info->gid = - - strlcpy(info->args, team->args, sizeof(info->args)); - info->argc = 1; - - return B_OK; -} - - status_t _get_team_info(team_id id, team_info *info, size_t size) {