util: Get program name based on path when possible
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tue, 23 Oct 2018 15:38:48 +0000 (11:38 -0400)
committerMichel Dänzer <michel.daenzer@amd.com>
Fri, 28 Dec 2018 14:41:01 +0000 (15:41 +0100)
commit759b94038987bb983398cd4b1d2cb1c8f79817a9
treea42c4029d185618f3bb956c9b6f11ba85209bfd1
parentbf1dfcc3e8120400c9a78d03dd914a786728b5f7
util: Get program name based on path when possible

Some programs start with the path and command line arguments in
argv[0] (program_invocation_name). Chromium is an example of
an application using mesa that does this.

This tries to query the real path for the symbolic link /proc/self/exe
to find the program name instead. It only uses the realpath if it
was a prefix of the invocation to avoid breaking wine programs.

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/util/u_process.c