[PATCH 2/5] Replace program_invocation_short_name with prog_name from command line

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Apr 30 17:07:11 UTC 2025


Hi Jeevaka,
On 2025-04-29 at 20:39:57 +0000, Jeevaka Prabu Badrappan wrote:

write in subject which file you changed, so instead:

[PATCH 2/5] Replace program_invocation_short_name with prog_name from command line

write for example:

[PATCH 2/5] tools/gputop: find program name from command line

and implement it yourself in some sensible way,
for example search for last '/' and take nsmae from that.

Regards,
Kamil

> program_invocation_short_name is global variable provided by glibc.
> 
> Inorder to get the igt built for Android(without glibc), replaced the
> program_invocation_short_name with the prog_name.
> 
> Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
> ---
>  tools/gputop.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/gputop.c b/tools/gputop.c
> index 43b01f566..ef868f670 100644
> --- a/tools/gputop.c
> +++ b/tools/gputop.c
> @@ -335,7 +335,7 @@ struct gputop_args {
>  	unsigned long delay_usec;
>  };
>  
> -static void help(void)
> +static void help(char* prog_name)
>  {
>  	printf("Usage:\n"
>  	       "\t%s [options]\n\n"
> @@ -343,7 +343,7 @@ static void help(void)
>  	       "\t-h, --help                show this help\n"
>  	       "\t-d, --delay =SEC[.TENTHS] iterative delay as SECS [.TENTHS]\n"
>  	       "\t-n, --iterations =NUMBER  number of executions\n"
> -	       , program_invocation_short_name);
> +	       , prog_name);
>  }
>  
>  static int parse_args(int argc, char * const argv[], struct gputop_args *args)
> @@ -384,7 +384,7 @@ static int parse_args(int argc, char * const argv[], struct gputop_args *args)
>  			}
>  			break;
>  		case 'h':
> -			help();
> +			help(argv[0]);
>  			return 0;
>  		default:
>  			fprintf(stderr, "Unkonwn option '%c'.\n", c);
> -- 
> 2.49.0
> 


More information about the igt-dev mailing list