diff options
author | David Marchand <david.marchand@redhat.com> | 2020-11-14 10:05:31 +0100 |
---|---|---|
committer | Thomas Monjalon <thomas@monjalon.net> | 2020-11-15 15:33:05 +0100 |
commit | 9c3586a6436d4df4bc12ad01d1c5130d24b09bd6 (patch) | |
tree | bcaf4e50cff6321e8630681648995609b9c596eb /examples | |
parent | e0216ac509558b2b95d34f5b4df604e0e4d0bf1e (diff) |
examples/vhost_blk: fix build with pkg-config
vhost_blk.c: In function ‘ctrlr_worker’:
vhost_blk.c:543:2: warning: implicit declaration of function ‘CPU_ZERO’
[-Wimplicit-function-declaration]
543 | CPU_ZERO(&cpuset);
| ^~~~~~~~
vhost_blk.c:544:2: warning: implicit declaration of function ‘CPU_SET’
[-Wimplicit-function-declaration]
544 | CPU_SET(0, &cpuset);
| ^~~~~~~
vhost_blk.c:545:2: warning: implicit declaration of function
‘pthread_setaffinity_np’ [-Wimplicit-function-declaration]
545 | pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cczpiMWH.o: in function `ctrlr_worker':
vhost_blk.c:(.text+0x1076): undefined reference to `CPU_ZERO'
/usr/bin/ld: vhost_blk.c:(.text+0x1082): undefined reference to
`CPU_SET'
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:34: build/vhost-blk-shared] Error 1
Explicitly pass _GNU_SOURCE and include missing headers (rather than
rely on automagic inclusion from other system headers).
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/vhost_blk/vhost_blk.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c index 8f5d61a589..bb293d492f 100644 --- a/examples/vhost_blk/vhost_blk.c +++ b/examples/vhost_blk/vhost_blk.c @@ -2,6 +2,12 @@ * Copyright(c) 2010-2019 Intel Corporation */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <pthread.h> +#include <sched.h> + #include <stdint.h> #include <unistd.h> #include <stdbool.h> |