The header files argp.h and error.h do not exist in musl libc.
Fix build with musl libc by using err(3) instead of
the GNU-specific error(3).
We could have used the identical errx("...: %s", strerror(ret))` but
strerror(3) is not thread-safe and the strerror_r variant has two
incompatible versions, one GNU specific and one XSI-compliant.
Avoid the mess by letting "err" use the thread-local errno.
This also fixes error message for kzmalloc failures which previously
would always have given "Unknown error -1", since that is what
strerror(-1) returns. Let "err" use the proper error message from errno
which is set by kzalloc.
Fixes:
9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Fixes:
f09ede6c8fd1 ("bus/dpaa: add BMAN driver core")
Fixes:
5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Fixes:
39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ err(0, "%s(): open(SOCK_RAW)", __func__);
return NULL;
}
#include <process.h>
#include "bman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
/*
* Global variables of the max portal/pool number this bman version supported
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ errno = ret;
+ err(0, "pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
cfg = bman_destroy_affine_portal();
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ err(0, "process_portal_unmap()");
+ }
return ret;
}
#include <process.h>
#include "qman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
+
#include <rte_branch_prediction.h>
/* Global variable containing revision id (even on non-control plane systems
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
cfg = qman_destroy_affine_portal(NULL);
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ err(0, "process_portal_unmap()");
+ }
return ret;
}
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ /* kzalloc sets errno */
+ err(0, "q_pcfg kzalloc failed");
return NULL;
}
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
kfree(q_pcfg);
return NULL;
}
#define __NETCFG_H
#include <fman.h>
-#include <argp.h>
/* Configuration information related to a specific ethernet port */
struct fm_eth_port_cfg {
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>