]> xenbits.xensource.com Git - libvirt.git/commitdiff
examples: Define _GNU_SOURCE for more examples
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Feb 2024 12:28:15 +0000 (13:28 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Feb 2024 17:01:03 +0000 (18:01 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
examples/c/admin/logging.c
examples/c/domain/domtop.c

index 575d15a3a67c94e41da1128dacb7b3ad7312ec35..f7620b2ab5ee8637bd2385c93bd761863d2683a4 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
index 65663a1c392b95a8031da6196972828578cb8545..2345a5953c777bcee7fe67cd2fa569fb0327543a 100644 (file)
@@ -18,6 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#define _GNU_SOURCE
 #include <errno.h>
 #include <getopt.h>
 #include <libvirt/libvirt.h>