@@ -643,7 +643,7 @@ static void *display_thread_tui(void *arg)
643
643
*/
644
644
evlist__for_each_entry (top -> evlist , pos ) {
645
645
struct hists * hists = evsel__hists (pos );
646
- hists -> uid_filter_str = top -> record_opts . target . uid_str ;
646
+ hists -> uid_filter_str = top -> uid_str ;
647
647
}
648
648
649
649
ret = evlist__tui_browse_hists (top -> evlist , help , & hbt , top -> min_percent ,
@@ -1571,7 +1571,7 @@ int cmd_top(int argc, const char **argv)
1571
1571
"Add prefix to source file path names in programs (with --prefix-strip)" ),
1572
1572
OPT_STRING (0 , "prefix-strip" , & annotate_opts .prefix_strip , "N" ,
1573
1573
"Strip first N entries of source file path name in programs (with --prefix)" ),
1574
- OPT_STRING ('u' , "uid" , & target -> uid_str , "user" , "user to profile" ),
1574
+ OPT_STRING ('u' , "uid" , & top . uid_str , "user" , "user to profile" ),
1575
1575
OPT_CALLBACK (0 , "percent-limit" , & top , "percent" ,
1576
1576
"Don't show entries under that percent" , parse_percent_limit ),
1577
1577
OPT_CALLBACK (0 , "percentage" , NULL , "relative|absolute" ,
@@ -1762,15 +1762,17 @@ int cmd_top(int argc, const char **argv)
1762
1762
ui__warning ("%s\n" , errbuf );
1763
1763
}
1764
1764
1765
- status = target__parse_uid (target );
1766
- if (status ) {
1767
- int saved_errno = errno ;
1768
-
1769
- target__strerror (target , status , errbuf , BUFSIZ );
1770
- ui__error ("%s\n" , errbuf );
1765
+ if (top .uid_str ) {
1766
+ uid_t uid = parse_uid (top .uid_str );
1771
1767
1772
- status = - saved_errno ;
1773
- goto out_delete_evlist ;
1768
+ if (uid == UINT_MAX ) {
1769
+ ui__error ("Invalid User: %s" , top .uid_str );
1770
+ status = - EINVAL ;
1771
+ goto out_delete_evlist ;
1772
+ }
1773
+ status = parse_uid_filter (top .evlist , uid );
1774
+ if (status )
1775
+ goto out_delete_evlist ;
1774
1776
}
1775
1777
1776
1778
if (target__none (target ))
0 commit comments