numam-dpdk/lib/librte_eal
Bruce Richardson 5364de644a eal: support strlcpy function
The strncpy function is error prone for doing "safe" string copies, so
we generally try to use "snprintf" instead in the code. The function
"strlcpy" is a better alternative, since it better conveys the
intention of the programmer, and doesn't suffer from the non-null
terminating behaviour of it's n'ed brethern.

The downside of this function is that it is not available by default
on linux, though standard in the BSD's. It is available on most
distros by installing "libbsd" package.

This patch therefore provides the following in rte_string_fns.h to ensure
that strlcpy is available there:
* for BSD, include string.h as normal
* if RTE_USE_LIBBSD is set, include <bsd/string.h>
* if not set, fallback to snprintf for strlcpy

Using make build system, the RTE_USE_LIBBSD is a hard-coded value to "n",
but when using meson, it's automatically set based on what is available
on the platform.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-04 17:33:08 +02:00
..
bsdapp move kernel modules directories 2018-03-21 23:04:21 +01:00
common eal: support strlcpy function 2018-04-04 17:33:08 +02:00
linuxapp mem: use z specifier to format size_t 2018-04-04 13:43:33 +02:00
Makefile lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
meson.build move kernel modules directories 2018-03-21 23:04:21 +01:00
rte_eal_version.map eal: register log type and pick level from args 2018-03-30 14:08:44 +02:00