examples: Define _GNU_SOURCE for more examples

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>
This commit is contained in:
Michal Privoznik 2024-02-07 13:28:15 +01:00
parent ce41108ecc
commit 9ef6541cec
2 changed files with 2 additions and 0 deletions

View File

@ -1,3 +1,4 @@
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>

View File

@ -18,6 +18,7 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#define _GNU_SOURCE
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#include <libvirt/libvirt.h> #include <libvirt/libvirt.h>