[PATCH v4 1/2] testpmd: go back to using cmdline_interact
Stephen Hemminger
stephen at networkplumber.org
Fri Mar 17 17:38:34 CET 2023
On Fri, 17 Mar 2023 17:20:48 +0100
Olivier Matz <olivier.matz at 6wind.com> wrote:
> >
> > +#ifdef RTE_EXEC_ENV_WINDOWS
> > signal(SIGINT, signal_handler);
> > signal(SIGTERM, signal_handler);
> > +#else
> > + /* Want read() not to be restarted on signal */
> > + struct sigaction action = {
> > + .sa_handler = signal_handler,
> > + };
> > +
> > + sigaction(SIGINT, &action, NULL);
> > + sigaction(SIGTERM, &action, NULL);
> > +#endif
>
> If we have to change this in testpmd, we'll have to do the same in other
> applications.
The only a couple other program combining signal() and cmdline_interact().
These programs all exit from signal handler and never return from it.
In examples/ntb, the program is using the signal suicide (lets kill myself)
model, which will work. Not sure why it bothers just to print a message.
In examples/vdpa, the program is trapping signal and calling close on ports.
This is not signal safe, but that is up to the vdpa maintainers to address.
Also, examples/vm_power_management is calling channel_XXX_exit() routines
which is not signal safe. Ditto, need the maintainers to address that.
> > +__rte_experimental
> > +void cmdline_cancel(struct cmdline *cl);
> > +
>
> The help says this function causes the read() in cmdline_interact to
> exit, but the unix implementation is empty.
>
> Maybe we should instead explain in what condition this function must
> called. Also, shouldn't this function call cmdline_quit() too to avoid
> the user to do it?
Prefer to have function not to do implicit quit.
PS: cmdline functions need better documentation.
More information about the dev
mailing list