[dpdk-dev] [PATCH v2 1/7] eal: add wrappers for POSIX string functions

Nick Connolly nick.connolly at mayadata.io
Mon Feb 22 19:21:20 CET 2021


> For any functions, such as strdup, which are not in a public header I would
> suggest the following as a possible start point, based off what was done
> for strlcpy.
>
> * In DPDK (probably EAL), define an rte_strdup function for use as a
>    fallback.
> * Inside the meson build scripts, use "cc.has_function()" to check if the
>    regular strdup function is available. If not, then add "-DRTE_NO_STRDUP"
>    to the c_args for DPDK building
> * Inside our DPDK header (rte_string_fns.h in the strdup case), we can add
>    a conditional define such as:
>     #ifdef RTE_NO_STRDUP
>     #define strdup(s) rte_strdup(s)
>     #endif
>
> Thoughts on this?
Looks like an elegant approach to me.
Nick


More information about the dev mailing list