Opened 11 years ago

Last modified 4 years ago

#1373 assigned enhancement

Better parsing of team name in /bin/top

Reported by: jonas.kirilla Owned by: nobody
Priority: normal Milestone: R2
Component: Applications/Command Line Tools Version:
Keywords: Cc: nathanhirschauer@…
Blocked By: Blocking:
Has a Patch: no Platform: All


When running for example 'cat /dev/urandom' /bin/top shows 'urandom' as the team name. ProcessController shows '/bin/cat /dev/urandom'.

I think team_info.args usually starts with "/" as far as I can tell, but it can also start with "./". The path of the executable may contain spaces and there may be arguments following it. Tricky to parse I suppose. What's done in src/bin/top.c looks a bit naive though:

if (get_team_info(, &tm) < B_NO_ERROR) {
    strcpy(tm.args, "(unknown)");
} else {
    if (p = strrchr(tm.args, '/')) {
        strcpy(tm.args, p + 1);

"The function strrchr() returns a pointer to the last occurrence of ch in str, or NULL if no match is found." (

Perhaps the team_info struct could be improved in R2.

Change History (5)

comment:1 Changed 9 years ago by axeld

Owner: changed from axeld to nobody
Version: R1/pre-alpha1

comment:2 Changed 7 years ago by nathanhi

Cc: nathanhirschauer@… added

comment:3 Changed 7 years ago by diver

Owner: changed from nobody to jonas.kirilla
Status: newassigned

comment:4 Changed 5 years ago by jonas.kirilla

Owner: changed from jonas.kirilla to nobody

comment:5 Changed 4 years ago by pulkomandy

Milestone: R1R2

Moving to R2 as it needs an API change (of struct team_info).

Note: See TracTickets for help on using tickets.