Some of our examples use GNU/Linux extensions functions/variables:
1) domtop.c uses usleep(3),
2) logging.c uses getopt(3).
Put _GNU_SOURCE definition at the top of corresponding files so
that users can just grab the code and compile it (in contrast
with the rest of the code where _GNU_SOURCE is declared in
meson-config.h).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
examples/c/admin/logging.c | 1 +
examples/c/domain/domtop.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/examples/c/admin/logging.c b/examples/c/admin/logging.c
index 575d15a3a6..f7620b2ab5 100644
--- a/examples/c/admin/logging.c
+++ b/examples/c/admin/logging.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
diff --git a/examples/c/domain/domtop.c b/examples/c/domain/domtop.c
index 65663a1c39..2345a5953c 100644
--- a/examples/c/domain/domtop.c
+++ b/examples/c/domain/domtop.c
@@ -18,6 +18,7 @@
* <
http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
#include <errno.h>
#include <getopt.h>
#include <libvirt/libvirt.h>
--
2.43.0