[v2,07/11] examples/performance-thread: fix build with pkg-config

Message ID 20201113122430.25354-8-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Examples compilation fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Nov. 13, 2020, 12:24 p.m. UTC
  main.c: In function ‘lthread_tx’:
main.c:2091:25: error: implicit declaration of function ‘sched_getcpu’;
 did you mean ‘sched_getparam’? [-Werror=implicit-function-declaration]
 2091 |  tx_conf->conf.cpu_id = sched_getcpu();
      |                         ^~~~~~~~~~~~
      |                         sched_getparam
cc1: all warnings being treated as errors

Explicitly pass _GNU_SOURCE and include missing header (rather than
rely on automagic inclusion from other system headers).

Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/performance-thread/l3fwd-thread/main.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 7bf61db6be..4d82fb82ef 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -2,6 +2,10 @@ 
  * Copyright(c) 2010-2016 Intel Corporation
  */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -12,6 +16,7 @@ 
 #include <stdarg.h>
 #include <errno.h>
 #include <getopt.h>
+#include <sched.h>
 
 #include <rte_common.h>
 #include <rte_vect.h>