eal: use program_invocation_short_name
Checks
Commit Message
Glibc already has a documented variable with the program
name so use it instead of computing the value.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/linux/eal.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Comments
07/03/2023 17:53, Stephen Hemminger:
> Glibc already has a documented variable with the program
> name so use it instead of computing the value.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied, thanks.
@@ -968,8 +968,6 @@ rte_eal_init(int argc, char **argv)
int i, fctret, ret;
static uint32_t run_once;
uint32_t has_run = 0;
- const char *p;
- static char logid[PATH_MAX];
char cpuset[RTE_CPU_AFFINITY_STR_LEN];
char thread_name[RTE_MAX_THREAD_NAME_LEN];
bool phys_addrs;
@@ -991,9 +989,6 @@ rte_eal_init(int argc, char **argv)
return -1;
}
- p = strrchr(argv[0], '/');
- strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
-
eal_reset_internal_config(internal_conf);
/* set log level as early as possible */
@@ -1172,7 +1167,8 @@ rte_eal_init(int argc, char **argv)
#endif
}
- if (eal_log_init(logid, internal_conf->syslog_facility) < 0) {
+ if (eal_log_init(program_invocation_short_name,
+ internal_conf->syslog_facility) < 0) {
rte_eal_init_alert("Cannot init logging.");
rte_errno = ENOMEM;
__atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);