[PATCH] eal: remove unnecessary argv[0] handling
Stephen Hemminger
stephen at networkplumber.org
Wed Feb 9 16:36:04 CET 2022
On Wed, 09 Feb 2022 15:58:26 +0100
Thomas Monjalon <thomas at monjalon.net> wrote:
> 02/02/2022 20:47, Stephen Hemminger:
> > The rte_eal_init function looks at argv[0] to determine
> > the program name to pass to the log init function.
> > This is both unnecessary and in a corner case a problem.
> >
> > Parsing argv[0] is unnecessary because the function openlog()
> > already determines the log identifier from program name if
> > NULL is passed, see openlog man page:
> > The string pointed to by ident is prepended to every message, and is
> > typically set to the program name. If ident is NULL, the program name
> > is used. (POSIX.1-2008 does not specify the behavior when ident is
> > NULL.)
>
> What about POSIX warning?
There are many cases where it is practical and useful to do non-POSIX
things (see _GNU_SOURCE). Look at pthread_setaffinity_np() etc.
> Did you test it? Which libc? What about musl?
No, I don't have or use alternative libc versions.
>
> [...]
> > - if (eal_log_init(logid, internal_conf->syslog_facility) < 0) {
> > + if (eal_log_init(NULL, internal_conf->syslog_facility) < 0) {
>
> We could completely remove the logid parameter.
Yes, it could go away.
More information about the dev
mailing list