Re: [libgpiod,v2 1/2] tools: use getprogname() when available to remove dependency on glibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/25/23 4:12 AM, andy.shevchenko@xxxxxxxxx wrote:
>>  	printf("%s (libgpiod) v%s\n",
>> -	       program_invocation_short_name, gpiod_api_version());
>> +	       getprogname(), gpiod_api_version());
> 
> Now this can be a single line.
> 
>   	printf("%s (libgpiod) v%s\n", getprogname(), gpiod_api_version());
> 

Thanks, will collapse.

On 2/25/23 10:36 AM, Bartosz Golaszewski wrote:
> This is only relevant for gpio-tools so maybe instead of relying on
> either a GNU or BSD extension, let's just ditch both (and the checking
> infrastructure) and introduce our own local helpers:
> 
> void set_prog_name(const char *name);
> const char *get_prog_name(void);
> const char *get_prog_shortname(void);
> 
> And call set_prog_name(argv[0]) at the start of each program?
> Alternatively we can just use prctl() like libgpiosim does for tests
> but then we'd lose the potential info about the executable path.
> 
> I'm thinking this is better than relying on extensions as I've already
> had to stop using twalk_r() due to it being a GNU extension not
> provided by musl (not by bionic as I can see).
> 
> Bart

Sure, that sounds like a better solution. Will make the change.

Ben



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux