Skip to content

Commit

Permalink
kernel: +image_iterate_through_team_images()
Browse files Browse the repository at this point in the history
Like image_iterate_through_images(), but iterates though the images of
the given team only.
  • Loading branch information
weinhold committed Apr 24, 2016
1 parent 99f0055 commit ac1f1a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions headers/private/kernel/kimage.h
Expand Up @@ -49,6 +49,8 @@ extern status_t remove_images(Team *team);
typedef bool (*image_iterator_callback)(struct image* image, void* cookie);
struct image* image_iterate_through_images(image_iterator_callback callback,
void* cookie);
struct image* image_iterate_through_team_images(team_id teamID,
image_iterator_callback callback, void* cookie);

extern status_t image_debug_lookup_user_symbol_address(Team *team,
addr_t address, addr_t *_baseAddress, const char **_symbolName,
Expand Down
25 changes: 25 additions & 0 deletions src/system/kernel/image.cpp
Expand Up @@ -298,6 +298,31 @@ image_iterate_through_images(image_iterator_callback callback, void* cookie)
}


struct image*
image_iterate_through_team_images(team_id teamID,
image_iterator_callback callback, void* cookie)
{
// get the team
Team* team = Team::Get(teamID);
if (team == NULL)
return NULL;
BReference<Team> teamReference(team, true);

// iterate through the team's images
MutexLocker imageLocker(sImageMutex);

struct image* image = NULL;

while ((image = (struct image*)list_get_next_item(&team->image_list,
image)) != NULL) {
if (callback(image, cookie))
break;
}

return image;
}


status_t
image_debug_lookup_user_symbol_address(Team *team, addr_t address,
addr_t *_baseAddress, const char **_symbolName, const char **_imageName,
Expand Down

0 comments on commit ac1f1a9

Please sign in to comment.