Opened 17 years ago

Last modified 9 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:
Platform: All

Description

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(t.team, &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." (http://www.cppreference.com/stdstring/strrchr.html)

Perhaps the team_info struct could be improved in R2.

Change History (5)

comment:1 by axeld, 15 years ago

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

comment:2 by nathanhi, 13 years ago

Cc: nathanhirschauer@… added

comment:3 by diver, 13 years ago

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

comment:4 by jonas.kirilla, 10 years ago

Owner: changed from jonas.kirilla to nobody

comment:5 by pulkomandy, 9 years ago

Milestone: R1R2

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

Note: See TracTickets for help on using tickets.