mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-05-23 21:54:49 +02:00
Port getprogname() to AIX
Get the program name from the COMM field from the proc filesystem. We could use instead the information from the psinfo binary file under /proc, but that seems to have a shorter string limit.
This commit is contained in:
parent
92337b15a2
commit
9fa06763a1
@ -62,6 +62,14 @@ getprogname(void)
|
|||||||
/* getexecname(3) returns an absolute pathname, normalize it. */
|
/* getexecname(3) returns an absolute pathname, normalize it. */
|
||||||
if (__progname == NULL)
|
if (__progname == NULL)
|
||||||
setprogname(getexecname());
|
setprogname(getexecname());
|
||||||
|
#elif defined(_AIX)
|
||||||
|
if (__progname == NULL) {
|
||||||
|
struct procentry64 procs;
|
||||||
|
pid_t pid = getpid ();
|
||||||
|
|
||||||
|
if (getprocs64(&procs, sizeof procs, NULL, 0, &pid, 1) > 0)
|
||||||
|
__progname = strdup(procs.pi_comm);
|
||||||
|
}
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (__progname == NULL) {
|
if (__progname == NULL) {
|
||||||
WCHAR *wpath = NULL;
|
WCHAR *wpath = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user