From 744cbfd4f133283d3a025a79ee8cfaa0c737ca42 Mon Sep 17 00:00:00 2001 From: Sangamesh Mallayya Date: Mon, 24 Nov 2025 08:53:34 -0600 Subject: [PATCH] AIX: implement xsetprogname and xgetprogname AIX don't have xgetprogname & xsetprogname. Hence, we see an compilation error due to missing xgetprogname & xsetprogname. The proposed patch fixes the compilation error by implementing these missing function. We launch rpm program without any issue (other local changes). $ LIBPATH=/opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/10/pthread/ppc64 ./tools/rpm RPM version 6.0.90 Copyright (C) 1998-2002 - Red Hat, Inc. This program may be freely redistributed under the terms of the GNU GPL Usage: rpm [-afgpqlsiv?] [-a|--all] [-f|--file] [--path] [-g|--group] [-p|--package] [-q|--query] [--triggeredby] --- misc/system.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/misc/system.h b/misc/system.h index 36ea094cfa..edccb0ab15 100644 --- a/misc/system.h +++ b/misc/system.h @@ -85,6 +85,15 @@ extern int fdatasync(int fildes); # define xsetprogname(pn) extern const char *__progname; # define xgetprogname(pn) __progname +#elif defined(_AIX) +char *aix_progname = NULL; +#define xsetprogname(pn) \ + { if (aix_progname == NULL) { \ + if ((aix_progname = strrchr(pn, '/')) != NULL) aix_progname++; \ + else aix_progname = pn; \ + } \ + } +#define xgetprogname() aix_progname #else # error "Did not find any sutable implementation of xsetprogname/xgetprogname" #endif