zdtm: rely on -D_GNU_SOURCE passed from Makefiles

Submitted by Dmitry Safonov on April 4, 2017, 12:29 p.m.

Details

Message ID 20170404122955.2638-1-dsafonov@virtuozzo.com
State New
Series "zdtm: rely on -D_GNU_SOURCE passed from Makefiles"
Headers show

Commit Message

Dmitry Safonov April 4, 2017, 12:29 p.m.
After the commit
  02c763939c10 ("test/zdtm: unify common code")

CFLAGS with -D_GNU_SOURCE defined in the top Makefile
are being passed to tests Makefiles.
As _GNU_SOURCE is also defined by tests, that resulted in
zdtm tests build failures:

  make[2]: Entering directory `/home/criu/test/zdtm/lib'
   CC        test.o
  test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
   #define _GNU_SOURCE
   ^
  <command-line>:0:0: note: this is the location of the previous definition
  cc1: all warnings being treated as errors
  make[2]: *** [test.o] Error 1

However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't
do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`.
By calling middle makefile this way, it doesn't have _GNU_SOURCE in
CFLAGS from top-Makefile.

I think the right thing to do here - is following CRIU's way:
rely on definition of _GNU_SOURCE by Makefiles.

This patch is almost fully generated with
  find test/zdtm/ -name '*.c' -type f					\
     -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \;		\
     -exec sed -i '/define _GNU_SOURCE/d' '{}' \;

With an exception for adding -D_GNU_SOURCE in tests Makefiles for
keeping the same behaviour for zdtm.py.
Also changed utsname.c to use utsname::domainname, rather private
utsname::__domainname, as now it's uncovered (from sys/utsname.h):
> struct utsname
>  {
...
> # ifdef __USE_GNU
>     char domainname[_UTSNAME_DOMAIN_LENGTH];
> # else
>     char __domainname[_UTSNAME_DOMAIN_LENGTH];
> # endif

Reported-by: Adrian Reber <areber@redhat.com>
Cc: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 test/zdtm/lib/Makefile                     | 2 +-
 test/zdtm/lib/fs.c                         | 2 --
 test/zdtm/lib/lock.c                       | 2 --
 test/zdtm/lib/ns.c                         | 1 -
 test/zdtm/lib/test.c                       | 1 -
 test/zdtm/static/Makefile                  | 1 +
 test/zdtm/static/autofs.c                  | 2 --
 test/zdtm/static/caps00.c                  | 1 -
 test/zdtm/static/cgroup_stray.c            | 1 -
 test/zdtm/static/cgroupns.c                | 1 -
 test/zdtm/static/clone_fs.c                | 1 -
 test/zdtm/static/console.c                 | 2 --
 test/zdtm/static/del_standalone_un.c       | 1 -
 test/zdtm/static/deleted_unix_sock.c       | 1 -
 test/zdtm/static/different_creds.c         | 1 -
 test/zdtm/static/eventfs00.c               | 1 -
 test/zdtm/static/fanotify00.c              | 1 -
 test/zdtm/static/fdt_shared.c              | 1 -
 test/zdtm/static/fifo-rowo-pair.c          | 1 -
 test/zdtm/static/file_fown.c               | 1 -
 test/zdtm/static/file_locks00.c            | 2 --
 test/zdtm/static/file_locks01.c            | 2 --
 test/zdtm/static/file_locks02.c            | 2 --
 test/zdtm/static/file_locks03.c            | 2 --
 test/zdtm/static/file_locks04.c            | 2 --
 test/zdtm/static/file_locks05.c            | 2 --
 test/zdtm/static/file_locks06.c            | 2 --
 test/zdtm/static/file_locks07.c            | 2 --
 test/zdtm/static/file_locks08.c            | 2 --
 test/zdtm/static/groups.c                  | 1 -
 test/zdtm/static/helper_zombie_child.c     | 1 -
 test/zdtm/static/inotify00.c               | 1 -
 test/zdtm/static/inotify02.c               | 2 --
 test/zdtm/static/inotify_irmap.c           | 1 -
 test/zdtm/static/maps01.c                  | 1 -
 test/zdtm/static/mnt_ext_auto.c            | 1 -
 test/zdtm/static/mnt_ext_master.c          | 1 -
 test/zdtm/static/mnt_tracefs.c             | 1 -
 test/zdtm/static/mntns_deleted.c           | 2 --
 test/zdtm/static/mntns_ghost.c             | 1 -
 test/zdtm/static/mntns_link_remap.c        | 1 -
 test/zdtm/static/mntns_open.c              | 1 -
 test/zdtm/static/mntns_overmount.c         | 1 -
 test/zdtm/static/mntns_remap.c             | 1 -
 test/zdtm/static/mntns_ro_root.c           | 1 -
 test/zdtm/static/mntns_root_bind.c         | 1 -
 test/zdtm/static/mntns_shared_bind.c       | 1 -
 test/zdtm/static/mntns_shared_bind03.c     | 1 -
 test/zdtm/static/mntns_shared_vs_private.c | 1 -
 test/zdtm/static/mountpoints.c             | 1 -
 test/zdtm/static/msgque.c                  | 1 -
 test/zdtm/static/netns_sub.c               | 1 -
 test/zdtm/static/netns_sub_veth.c          | 1 -
 test/zdtm/static/pid00.c                   | 1 -
 test/zdtm/static/proc-self.c               | 1 -
 test/zdtm/static/remap_dead_pid.c          | 1 -
 test/zdtm/static/sem.c                     | 1 -
 test/zdtm/static/session00.c               | 1 -
 test/zdtm/static/session01.c               | 1 -
 test/zdtm/static/session02.c               | 1 -
 test/zdtm/static/session03.c               | 1 -
 test/zdtm/static/shm-mp.c                  | 1 -
 test/zdtm/static/shm.c                     | 1 -
 test/zdtm/static/sigaltstack.c             | 2 --
 test/zdtm/static/signalfd00.c              | 1 -
 test/zdtm/static/sigpending.c              | 1 -
 test/zdtm/static/sk-unix-rel.c             | 2 --
 test/zdtm/static/sock_peercred.c           | 1 -
 test/zdtm/static/socket-ext.c              | 2 --
 test/zdtm/static/socket-tcp.c              | 3 ---
 test/zdtm/static/socket_dgram_data.c       | 1 -
 test/zdtm/static/socket_queues.c           | 2 --
 test/zdtm/static/socket_snd_addr.c         | 1 -
 test/zdtm/static/sockets00.c               | 2 --
 test/zdtm/static/sockets01.c               | 2 --
 test/zdtm/static/sockets02.c               | 2 --
 test/zdtm/static/sockets03.c               | 2 --
 test/zdtm/static/sockets_dgram.c           | 2 --
 test/zdtm/static/sockets_spair.c           | 2 --
 test/zdtm/static/tempfs_subns.c            | 1 -
 test/zdtm/static/uffd-events.c             | 1 -
 test/zdtm/static/userns00.c                | 1 -
 test/zdtm/static/userns01.c                | 1 -
 test/zdtm/static/utsname.c                 | 2 +-
 test/zdtm/static/vt.c                      | 2 --
 test/zdtm/static/xids00.c                  | 1 -
 test/zdtm/transition/Makefile              | 1 +
 test/zdtm/transition/ipc.c                 | 1 -
 test/zdtm/transition/maps008.c             | 1 -
 test/zdtm/transition/shmem.c               | 1 -
 90 files changed, 4 insertions(+), 116 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
index d2d9f1cc31dc..20b54cdec58a 100644
--- a/test/zdtm/lib/Makefile
+++ b/test/zdtm/lib/Makefile
@@ -1,6 +1,6 @@ 
 LIBDIR	:= .
 
-CFLAGS	+= $(USERCFLAGS)
+CFLAGS	+= $(USERCFLAGS) -D_GNU_SOURCE
 
 LIB	:= libzdtmtst.a
 
diff --git a/test/zdtm/lib/fs.c b/test/zdtm/lib/fs.c
index 04788e9c4539..37f5e4191e78 100644
--- a/test/zdtm/lib/fs.c
+++ b/test/zdtm/lib/fs.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
diff --git a/test/zdtm/lib/lock.c b/test/zdtm/lib/lock.c
index 9d2a646a6f29..3c3691d98b73 100644
--- a/test/zdtm/lib/lock.c
+++ b/test/zdtm/lib/lock.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index 19a2b2ae4d25..7a0949f22015 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index 75b7d93bd9de..a01eac377a8f 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 861437258010..d699e5adf052 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -2,6 +2,7 @@  LIBDIR	:= ../lib
 LIB	:= $(LIBDIR)/libzdtmtst.a
 LDLIBS	+= $(LIB)
 CPPFLAGS += -I$(LIBDIR)
+CFLAGS	+= -D_GNU_SOURCE
 
 TST_NOFILE	:=				\
 		busyloop00			\
diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c
index 1644a6e10c94..68a62940d929 100644
--- a/test/zdtm/static/autofs.c
+++ b/test/zdtm/static/autofs.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/caps00.c b/test/zdtm/static/caps00.c
index 5911fa19b474..62484c4f4c4c 100644
--- a/test/zdtm/static/caps00.c
+++ b/test/zdtm/static/caps00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <unistd.h>
 #include <sys/types.h>
diff --git a/test/zdtm/static/cgroup_stray.c b/test/zdtm/static/cgroup_stray.c
index 9736845c07ab..235434ed2316 100644
--- a/test/zdtm/static/cgroup_stray.c
+++ b/test/zdtm/static/cgroup_stray.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdbool.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/cgroupns.c b/test/zdtm/static/cgroupns.c
index 955ab7227cce..cee7043533c1 100644
--- a/test/zdtm/static/cgroupns.c
+++ b/test/zdtm/static/cgroupns.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdbool.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/clone_fs.c b/test/zdtm/static/clone_fs.c
index 5cebea586e0a..e368aff996cd 100644
--- a/test/zdtm/static/clone_fs.c
+++ b/test/zdtm/static/clone_fs.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdlib.h>
 #include <syscall.h>
 #include <pthread.h>
diff --git a/test/zdtm/static/console.c b/test/zdtm/static/console.c
index 41246aea0298..026eacb2ee8b 100644
--- a/test/zdtm/static/console.c
+++ b/test/zdtm/static/console.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c
index 0fd3795bf2f6..b512ff710fd3 100644
--- a/test/zdtm/static/del_standalone_un.c
+++ b/test/zdtm/static/del_standalone_un.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/zdtm/static/deleted_unix_sock.c b/test/zdtm/static/deleted_unix_sock.c
index 793c96884a3e..bcc33f3deccb 100644
--- a/test/zdtm/static/deleted_unix_sock.c
+++ b/test/zdtm/static/deleted_unix_sock.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/different_creds.c b/test/zdtm/static/different_creds.c
index af7aa3c6f95a..59fd1fa7f95c 100644
--- a/test/zdtm/static/different_creds.c
+++ b/test/zdtm/static/different_creds.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <alloca.h>
 #include <unistd.h>
 #include <stdbool.h>
diff --git a/test/zdtm/static/eventfs00.c b/test/zdtm/static/eventfs00.c
index e05f514c4abc..72fd38a9cfa2 100644
--- a/test/zdtm/static/eventfs00.c
+++ b/test/zdtm/static/eventfs00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/test/zdtm/static/fanotify00.c b/test/zdtm/static/fanotify00.c
index 3084e185038b..9fc3d7a3b1d4 100644
--- a/test/zdtm/static/fanotify00.c
+++ b/test/zdtm/static/fanotify00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 #include <limits.h>
 
diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c
index e66f9f56de3e..b1c74d0ae972 100644
--- a/test/zdtm/static/fdt_shared.c
+++ b/test/zdtm/static/fdt_shared.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE             /* See feature_test_macros(7) */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/fifo-rowo-pair.c b/test/zdtm/static/fifo-rowo-pair.c
index b967147724c5..85aad027d2ce 100644
--- a/test/zdtm/static/fifo-rowo-pair.c
+++ b/test/zdtm/static/fifo-rowo-pair.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c
index c0732e72ac17..f29ba45af536 100644
--- a/test/zdtm/static/file_fown.c
+++ b/test/zdtm/static/file_fown.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c
index 82888709e46a..8a1ecc26fee9 100644
--- a/test/zdtm/static/file_locks00.c
+++ b/test/zdtm/static/file_locks00.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c
index 24f54acc78dd..aadc5e422222 100644
--- a/test/zdtm/static/file_locks01.c
+++ b/test/zdtm/static/file_locks01.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks02.c b/test/zdtm/static/file_locks02.c
index 2db3bd0a0575..4e2e31b60ef5 100644
--- a/test/zdtm/static/file_locks02.c
+++ b/test/zdtm/static/file_locks02.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks03.c b/test/zdtm/static/file_locks03.c
index 167fd2e19324..9d5f198ef39d 100644
--- a/test/zdtm/static/file_locks03.c
+++ b/test/zdtm/static/file_locks03.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks04.c b/test/zdtm/static/file_locks04.c
index 28ed497b8a81..96170d51e840 100644
--- a/test/zdtm/static/file_locks04.c
+++ b/test/zdtm/static/file_locks04.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks05.c b/test/zdtm/static/file_locks05.c
index f7d34b19e884..33877f842c6b 100644
--- a/test/zdtm/static/file_locks05.c
+++ b/test/zdtm/static/file_locks05.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks06.c b/test/zdtm/static/file_locks06.c
index 8eafa7c580e7..53f088f0dcbb 100644
--- a/test/zdtm/static/file_locks06.c
+++ b/test/zdtm/static/file_locks06.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <sys/file.h>
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks07.c b/test/zdtm/static/file_locks07.c
index 25051b92581e..8bd517491293 100644
--- a/test/zdtm/static/file_locks07.c
+++ b/test/zdtm/static/file_locks07.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <sys/file.h>
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/file_locks08.c b/test/zdtm/static/file_locks08.c
index 7963704da836..a654c205bea4 100644
--- a/test/zdtm/static/file_locks08.c
+++ b/test/zdtm/static/file_locks08.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <sys/wait.h>
 #include <sys/file.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/groups.c b/test/zdtm/static/groups.c
index f7548eacf38c..01ec3a12bab7 100644
--- a/test/zdtm/static/groups.c
+++ b/test/zdtm/static/groups.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/helper_zombie_child.c b/test/zdtm/static/helper_zombie_child.c
index 1e6b4bda7117..657d56f27e11 100644
--- a/test/zdtm/static/helper_zombie_child.c
+++ b/test/zdtm/static/helper_zombie_child.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdbool.h>
diff --git a/test/zdtm/static/inotify00.c b/test/zdtm/static/inotify00.c
index 00190dc58ca2..3c7cab0a7d34 100644
--- a/test/zdtm/static/inotify00.c
+++ b/test/zdtm/static/inotify00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 #include <limits.h>
 
diff --git a/test/zdtm/static/inotify02.c b/test/zdtm/static/inotify02.c
index eca36dde81f7..9b343a873f94 100644
--- a/test/zdtm/static/inotify02.c
+++ b/test/zdtm/static/inotify02.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <unistd.h>
 #include <limits.h>
 
diff --git a/test/zdtm/static/inotify_irmap.c b/test/zdtm/static/inotify_irmap.c
index 872201018d53..cf35886e2a5e 100644
--- a/test/zdtm/static/inotify_irmap.c
+++ b/test/zdtm/static/inotify_irmap.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 #include <limits.h>
 
diff --git a/test/zdtm/static/maps01.c b/test/zdtm/static/maps01.c
index 024dff1fc36e..8940119ef894 100644
--- a/test/zdtm/static/maps01.c
+++ b/test/zdtm/static/maps01.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/mnt_ext_auto.c b/test/zdtm/static/mnt_ext_auto.c
index 69d8149393ab..947ea00cb9d8 100644
--- a/test/zdtm/static/mnt_ext_auto.c
+++ b/test/zdtm/static/mnt_ext_auto.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <sys/mount.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/mnt_ext_master.c b/test/zdtm/static/mnt_ext_master.c
index c0ef7ad5fee4..f2c8e38d4e90 100644
--- a/test/zdtm/static/mnt_ext_master.c
+++ b/test/zdtm/static/mnt_ext_master.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include <sys/mount.h>
diff --git a/test/zdtm/static/mnt_tracefs.c b/test/zdtm/static/mnt_tracefs.c
index 968658b5b259..99d60870afc8 100644
--- a/test/zdtm/static/mnt_tracefs.c
+++ b/test/zdtm/static/mnt_tracefs.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <sys/mount.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/mntns_deleted.c b/test/zdtm/static/mntns_deleted.c
index b38d8340bee7..39f9d0b47cea 100644
--- a/test/zdtm/static/mntns_deleted.c
+++ b/test/zdtm/static/mntns_deleted.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_ghost.c b/test/zdtm/static/mntns_ghost.c
index dca0c34507d0..e0d31572a4e8 100644
--- a/test/zdtm/static/mntns_ghost.c
+++ b/test/zdtm/static/mntns_ghost.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_link_remap.c b/test/zdtm/static/mntns_link_remap.c
index a148a9e0cca5..642641b1617b 100644
--- a/test/zdtm/static/mntns_link_remap.c
+++ b/test/zdtm/static/mntns_link_remap.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_open.c b/test/zdtm/static/mntns_open.c
index 629d762750ae..e19c4ea72dee 100644
--- a/test/zdtm/static/mntns_open.c
+++ b/test/zdtm/static/mntns_open.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_overmount.c b/test/zdtm/static/mntns_overmount.c
index 541355c54f3c..aa297a055f7c 100644
--- a/test/zdtm/static/mntns_overmount.c
+++ b/test/zdtm/static/mntns_overmount.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_remap.c b/test/zdtm/static/mntns_remap.c
index f7cdba443bf3..fd62cbf4081c 100644
--- a/test/zdtm/static/mntns_remap.c
+++ b/test/zdtm/static/mntns_remap.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <stdbool.h>
 #include <string.h>
diff --git a/test/zdtm/static/mntns_ro_root.c b/test/zdtm/static/mntns_ro_root.c
index 365be50e02e5..8415eec30a57 100644
--- a/test/zdtm/static/mntns_ro_root.c
+++ b/test/zdtm/static/mntns_ro_root.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_root_bind.c b/test/zdtm/static/mntns_root_bind.c
index 3bd0bece0695..3f15a2726da6 100644
--- a/test/zdtm/static/mntns_root_bind.c
+++ b/test/zdtm/static/mntns_root_bind.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_shared_bind.c b/test/zdtm/static/mntns_shared_bind.c
index f11b2df98d7a..ef48bd8a2235 100644
--- a/test/zdtm/static/mntns_shared_bind.c
+++ b/test/zdtm/static/mntns_shared_bind.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_shared_bind03.c b/test/zdtm/static/mntns_shared_bind03.c
index 32d08691ff4e..e75fe629778a 100644
--- a/test/zdtm/static/mntns_shared_bind03.c
+++ b/test/zdtm/static/mntns_shared_bind03.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mntns_shared_vs_private.c b/test/zdtm/static/mntns_shared_vs_private.c
index 771480b833be..5849bbbdb222 100644
--- a/test/zdtm/static/mntns_shared_vs_private.c
+++ b/test/zdtm/static/mntns_shared_vs_private.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/mountpoints.c b/test/zdtm/static/mountpoints.c
index ba88cd99c9d3..17fa9311c99e 100644
--- a/test/zdtm/static/mountpoints.c
+++ b/test/zdtm/static/mountpoints.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/msgque.c b/test/zdtm/static/msgque.c
index a855bec3603e..6bbb103bdf61 100644
--- a/test/zdtm/static/msgque.c
+++ b/test/zdtm/static/msgque.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include <stdio.h>
diff --git a/test/zdtm/static/netns_sub.c b/test/zdtm/static/netns_sub.c
index d36fdeeba9c3..8428bca74d89 100644
--- a/test/zdtm/static/netns_sub.c
+++ b/test/zdtm/static/netns_sub.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/netns_sub_veth.c b/test/zdtm/static/netns_sub_veth.c
index 6262456040eb..733072f26bfe 100644
--- a/test/zdtm/static/netns_sub_veth.c
+++ b/test/zdtm/static/netns_sub_veth.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/test/zdtm/static/pid00.c b/test/zdtm/static/pid00.c
index 0b03ef596389..e40bf73ae0ca 100644
--- a/test/zdtm/static/pid00.c
+++ b/test/zdtm/static/pid00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <unistd.h>
 #include <sys/types.h>
diff --git a/test/zdtm/static/proc-self.c b/test/zdtm/static/proc-self.c
index 54cc5f1f3db6..8292c08cca5b 100644
--- a/test/zdtm/static/proc-self.c
+++ b/test/zdtm/static/proc-self.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/test/zdtm/static/remap_dead_pid.c b/test/zdtm/static/remap_dead_pid.c
index b46fd2b0b741..1ee61a9d06f6 100644
--- a/test/zdtm/static/remap_dead_pid.c
+++ b/test/zdtm/static/remap_dead_pid.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/sem.c b/test/zdtm/static/sem.c
index c3603cb3c8be..6e459a8837f5 100644
--- a/test/zdtm/static/sem.c
+++ b/test/zdtm/static/sem.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include <stdio.h>
diff --git a/test/zdtm/static/session00.c b/test/zdtm/static/session00.c
index 2c79f0391599..5889a92b96d9 100644
--- a/test/zdtm/static/session00.c
+++ b/test/zdtm/static/session00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/wait.h>
diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c
index 9bea83d92852..155e9a4603d8 100644
--- a/test/zdtm/static/session01.c
+++ b/test/zdtm/static/session01.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/zdtm/static/session02.c b/test/zdtm/static/session02.c
index 02458520240e..37f245d2e85e 100644
--- a/test/zdtm/static/session02.c
+++ b/test/zdtm/static/session02.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <sched.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/session03.c b/test/zdtm/static/session03.c
index 2504d0179e0f..04fb8346138b 100644
--- a/test/zdtm/static/session03.c
+++ b/test/zdtm/static/session03.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <sched.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c
index e29904f3adac..084796ae21d9 100644
--- a/test/zdtm/static/shm-mp.c
+++ b/test/zdtm/static/shm-mp.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/types.h>
diff --git a/test/zdtm/static/shm.c b/test/zdtm/static/shm.c
index fc90a99558f9..d033321356eb 100644
--- a/test/zdtm/static/shm.c
+++ b/test/zdtm/static/shm.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include <stdio.h>
diff --git a/test/zdtm/static/sigaltstack.c b/test/zdtm/static/sigaltstack.c
index 71b316ab2c92..3ccd18277b8d 100644
--- a/test/zdtm/static/sigaltstack.c
+++ b/test/zdtm/static/sigaltstack.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
diff --git a/test/zdtm/static/signalfd00.c b/test/zdtm/static/signalfd00.c
index 5a152738271b..61b1f0398184 100644
--- a/test/zdtm/static/signalfd00.c
+++ b/test/zdtm/static/signalfd00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c
index 70c2580a1115..4adcfa6269d5 100644
--- a/test/zdtm/static/sigpending.c
+++ b/test/zdtm/static/sigpending.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c
index d341ce9afee9..f69a81697757 100644
--- a/test/zdtm/static/sk-unix-rel.c
+++ b/test/zdtm/static/sk-unix-rel.c
@@ -1,6 +1,4 @@ 
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sock_peercred.c b/test/zdtm/static/sock_peercred.c
index 1a9cfe20b90a..e681ecec9376 100644
--- a/test/zdtm/static/sock_peercred.c
+++ b/test/zdtm/static/sock_peercred.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <sys/socket.h>
 #include <sys/types.h>
diff --git a/test/zdtm/static/socket-ext.c b/test/zdtm/static/socket-ext.c
index 46bf6c9ffb18..4e550534bc2e 100644
--- a/test/zdtm/static/socket-ext.c
+++ b/test/zdtm/static/socket-ext.c
@@ -1,6 +1,4 @@ 
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/socket-tcp.c b/test/zdtm/static/socket-tcp.c
index 02f4c559b550..19dc53b855d1 100644
--- a/test/zdtm/static/socket-tcp.c
+++ b/test/zdtm/static/socket-tcp.c
@@ -1,6 +1,3 @@ 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include "zdtmtst.h"
 
 #ifdef ZDTM_IPV6
diff --git a/test/zdtm/static/socket_dgram_data.c b/test/zdtm/static/socket_dgram_data.c
index 7464a46ac718..9437d44a305b 100644
--- a/test/zdtm/static/socket_dgram_data.c
+++ b/test/zdtm/static/socket_dgram_data.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c
index 486d12a58436..375b449e048c 100644
--- a/test/zdtm/static/socket_queues.c
+++ b/test/zdtm/static/socket_queues.c
@@ -1,6 +1,4 @@ 
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/socket_snd_addr.c b/test/zdtm/static/socket_snd_addr.c
index 1d72d4e4aba3..fa587a03e018 100644
--- a/test/zdtm/static/socket_snd_addr.c
+++ b/test/zdtm/static/socket_snd_addr.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c
index 9d0095740a9a..a9558d7ad2b3 100644
--- a/test/zdtm/static/sockets00.c
+++ b/test/zdtm/static/sockets00.c
@@ -1,6 +1,4 @@ 
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c
index a111e9d40672..12650536fc22 100644
--- a/test/zdtm/static/sockets01.c
+++ b/test/zdtm/static/sockets01.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c
index a7bec03f7404..ed4afbbe0ace 100644
--- a/test/zdtm/static/sockets02.c
+++ b/test/zdtm/static/sockets02.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
index 9247d16a736e..309e7a0804f2 100644
--- a/test/zdtm/static/sockets03.c
+++ b/test/zdtm/static/sockets03.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sockets_dgram.c b/test/zdtm/static/sockets_dgram.c
index a34bb144c461..952453d0155f 100644
--- a/test/zdtm/static/sockets_dgram.c
+++ b/test/zdtm/static/sockets_dgram.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c
index f2c916f34093..ed9ffa94fe72 100644
--- a/test/zdtm/static/sockets_spair.c
+++ b/test/zdtm/static/sockets_spair.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/test/zdtm/static/tempfs_subns.c b/test/zdtm/static/tempfs_subns.c
index 413d0a1e26e1..42195b57cfd0 100644
--- a/test/zdtm/static/tempfs_subns.c
+++ b/test/zdtm/static/tempfs_subns.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE         /* See feature_test_macros(7) */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c
index 9939c86b8b30..5a46d7e6d232 100644
--- a/test/zdtm/static/uffd-events.c
+++ b/test/zdtm/static/uffd-events.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/userns00.c b/test/zdtm/static/userns00.c
index ac68eef2fbc4..1b6f5c13b73c 100644
--- a/test/zdtm/static/userns00.c
+++ b/test/zdtm/static/userns00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/userns01.c b/test/zdtm/static/userns01.c
index 4d2a9d937dbf..8e4401ecac38 100644
--- a/test/zdtm/static/userns01.c
+++ b/test/zdtm/static/userns01.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/utsname.c b/test/zdtm/static/utsname.c
index 5e1e0cb88e78..964548a8f145 100644
--- a/test/zdtm/static/utsname.c
+++ b/test/zdtm/static/utsname.c
@@ -36,7 +36,7 @@  int main(int argc, char **argv)
 		fail("Nodename doesn't match");
 		return 1;
 	}
-	if (strcmp(ZDTM_DOMAIN, after.__domainname)) {
+	if (strcmp(ZDTM_DOMAIN, after.domainname)) {
 		fail("Domainname doesn't match");
 		return 1;
 	}
diff --git a/test/zdtm/static/vt.c b/test/zdtm/static/vt.c
index ab688402e8ff..0db0f2cd861c 100644
--- a/test/zdtm/static/vt.c
+++ b/test/zdtm/static/vt.c
@@ -1,5 +1,3 @@ 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/test/zdtm/static/xids00.c b/test/zdtm/static/xids00.c
index c3ddfb4835d7..0e8f324f6e7c 100644
--- a/test/zdtm/static/xids00.c
+++ b/test/zdtm/static/xids00.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
index cd9892159fed..681df6cf50c0 100644
--- a/test/zdtm/transition/Makefile
+++ b/test/zdtm/transition/Makefile
@@ -2,6 +2,7 @@  LIBDIR	:= ../lib
 LIB	:= $(LIBDIR)/libzdtmtst.a
 LDLIBS	+= $(LIB)
 CPPFLAGS += -I$(LIBDIR)
+CFLAGS	+= -D_GNU_SOURCE
 
 TST_NOFILE	=	\
 		ipc		\
diff --git a/test/zdtm/transition/ipc.c b/test/zdtm/transition/ipc.c
index 4affe04b21ce..be52d7396866 100644
--- a/test/zdtm/transition/ipc.c
+++ b/test/zdtm/transition/ipc.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include <stdio.h>
diff --git a/test/zdtm/transition/maps008.c b/test/zdtm/transition/maps008.c
index ce4b4f411db9..a89309d2fb65 100644
--- a/test/zdtm/transition/maps008.c
+++ b/test/zdtm/transition/maps008.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
diff --git a/test/zdtm/transition/shmem.c b/test/zdtm/transition/shmem.c
index 5cca2744ad8b..56b0f678b1ce 100644
--- a/test/zdtm/transition/shmem.c
+++ b/test/zdtm/transition/shmem.c
@@ -1,4 +1,3 @@ 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>

Comments

Adrian Reber April 4, 2017, 12:53 p.m.
Thanks! This fixes the error for me.

		Adrian

On Tue, Apr 04, 2017 at 03:29:55PM +0300, Dmitry Safonov wrote:
> After the commit
>   02c763939c10 ("test/zdtm: unify common code")
> 
> CFLAGS with -D_GNU_SOURCE defined in the top Makefile
> are being passed to tests Makefiles.
> As _GNU_SOURCE is also defined by tests, that resulted in
> zdtm tests build failures:
> 
>   make[2]: Entering directory `/home/criu/test/zdtm/lib'
>    CC        test.o
>   test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
>    #define _GNU_SOURCE
>    ^
>   <command-line>:0:0: note: this is the location of the previous definition
>   cc1: all warnings being treated as errors
>   make[2]: *** [test.o] Error 1
> 
> However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't
> do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`.
> By calling middle makefile this way, it doesn't have _GNU_SOURCE in
> CFLAGS from top-Makefile.
> 
> I think the right thing to do here - is following CRIU's way:
> rely on definition of _GNU_SOURCE by Makefiles.
> 
> This patch is almost fully generated with
>   find test/zdtm/ -name '*.c' -type f					\
>      -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \;		\
>      -exec sed -i '/define _GNU_SOURCE/d' '{}' \;
> 
> With an exception for adding -D_GNU_SOURCE in tests Makefiles for
> keeping the same behaviour for zdtm.py.
> Also changed utsname.c to use utsname::domainname, rather private
> utsname::__domainname, as now it's uncovered (from sys/utsname.h):
> > struct utsname
> >  {
> ...
> > # ifdef __USE_GNU
> >     char domainname[_UTSNAME_DOMAIN_LENGTH];
> > # else
> >     char __domainname[_UTSNAME_DOMAIN_LENGTH];
> > # endif
> 
> Reported-by: Adrian Reber <areber@redhat.com>
> Cc: Kir Kolyshkin <kir@openvz.org>
> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> ---
>  test/zdtm/lib/Makefile                     | 2 +-
>  test/zdtm/lib/fs.c                         | 2 --
>  test/zdtm/lib/lock.c                       | 2 --
>  test/zdtm/lib/ns.c                         | 1 -
>  test/zdtm/lib/test.c                       | 1 -
>  test/zdtm/static/Makefile                  | 1 +
>  test/zdtm/static/autofs.c                  | 2 --
>  test/zdtm/static/caps00.c                  | 1 -
>  test/zdtm/static/cgroup_stray.c            | 1 -
>  test/zdtm/static/cgroupns.c                | 1 -
>  test/zdtm/static/clone_fs.c                | 1 -
>  test/zdtm/static/console.c                 | 2 --
>  test/zdtm/static/del_standalone_un.c       | 1 -
>  test/zdtm/static/deleted_unix_sock.c       | 1 -
>  test/zdtm/static/different_creds.c         | 1 -
>  test/zdtm/static/eventfs00.c               | 1 -
>  test/zdtm/static/fanotify00.c              | 1 -
>  test/zdtm/static/fdt_shared.c              | 1 -
>  test/zdtm/static/fifo-rowo-pair.c          | 1 -
>  test/zdtm/static/file_fown.c               | 1 -
>  test/zdtm/static/file_locks00.c            | 2 --
>  test/zdtm/static/file_locks01.c            | 2 --
>  test/zdtm/static/file_locks02.c            | 2 --
>  test/zdtm/static/file_locks03.c            | 2 --
>  test/zdtm/static/file_locks04.c            | 2 --
>  test/zdtm/static/file_locks05.c            | 2 --
>  test/zdtm/static/file_locks06.c            | 2 --
>  test/zdtm/static/file_locks07.c            | 2 --
>  test/zdtm/static/file_locks08.c            | 2 --
>  test/zdtm/static/groups.c                  | 1 -
>  test/zdtm/static/helper_zombie_child.c     | 1 -
>  test/zdtm/static/inotify00.c               | 1 -
>  test/zdtm/static/inotify02.c               | 2 --
>  test/zdtm/static/inotify_irmap.c           | 1 -
>  test/zdtm/static/maps01.c                  | 1 -
>  test/zdtm/static/mnt_ext_auto.c            | 1 -
>  test/zdtm/static/mnt_ext_master.c          | 1 -
>  test/zdtm/static/mnt_tracefs.c             | 1 -
>  test/zdtm/static/mntns_deleted.c           | 2 --
>  test/zdtm/static/mntns_ghost.c             | 1 -
>  test/zdtm/static/mntns_link_remap.c        | 1 -
>  test/zdtm/static/mntns_open.c              | 1 -
>  test/zdtm/static/mntns_overmount.c         | 1 -
>  test/zdtm/static/mntns_remap.c             | 1 -
>  test/zdtm/static/mntns_ro_root.c           | 1 -
>  test/zdtm/static/mntns_root_bind.c         | 1 -
>  test/zdtm/static/mntns_shared_bind.c       | 1 -
>  test/zdtm/static/mntns_shared_bind03.c     | 1 -
>  test/zdtm/static/mntns_shared_vs_private.c | 1 -
>  test/zdtm/static/mountpoints.c             | 1 -
>  test/zdtm/static/msgque.c                  | 1 -
>  test/zdtm/static/netns_sub.c               | 1 -
>  test/zdtm/static/netns_sub_veth.c          | 1 -
>  test/zdtm/static/pid00.c                   | 1 -
>  test/zdtm/static/proc-self.c               | 1 -
>  test/zdtm/static/remap_dead_pid.c          | 1 -
>  test/zdtm/static/sem.c                     | 1 -
>  test/zdtm/static/session00.c               | 1 -
>  test/zdtm/static/session01.c               | 1 -
>  test/zdtm/static/session02.c               | 1 -
>  test/zdtm/static/session03.c               | 1 -
>  test/zdtm/static/shm-mp.c                  | 1 -
>  test/zdtm/static/shm.c                     | 1 -
>  test/zdtm/static/sigaltstack.c             | 2 --
>  test/zdtm/static/signalfd00.c              | 1 -
>  test/zdtm/static/sigpending.c              | 1 -
>  test/zdtm/static/sk-unix-rel.c             | 2 --
>  test/zdtm/static/sock_peercred.c           | 1 -
>  test/zdtm/static/socket-ext.c              | 2 --
>  test/zdtm/static/socket-tcp.c              | 3 ---
>  test/zdtm/static/socket_dgram_data.c       | 1 -
>  test/zdtm/static/socket_queues.c           | 2 --
>  test/zdtm/static/socket_snd_addr.c         | 1 -
>  test/zdtm/static/sockets00.c               | 2 --
>  test/zdtm/static/sockets01.c               | 2 --
>  test/zdtm/static/sockets02.c               | 2 --
>  test/zdtm/static/sockets03.c               | 2 --
>  test/zdtm/static/sockets_dgram.c           | 2 --
>  test/zdtm/static/sockets_spair.c           | 2 --
>  test/zdtm/static/tempfs_subns.c            | 1 -
>  test/zdtm/static/uffd-events.c             | 1 -
>  test/zdtm/static/userns00.c                | 1 -
>  test/zdtm/static/userns01.c                | 1 -
>  test/zdtm/static/utsname.c                 | 2 +-
>  test/zdtm/static/vt.c                      | 2 --
>  test/zdtm/static/xids00.c                  | 1 -
>  test/zdtm/transition/Makefile              | 1 +
>  test/zdtm/transition/ipc.c                 | 1 -
>  test/zdtm/transition/maps008.c             | 1 -
>  test/zdtm/transition/shmem.c               | 1 -
>  90 files changed, 4 insertions(+), 116 deletions(-)
> 
> diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
> index d2d9f1cc31dc..20b54cdec58a 100644
> --- a/test/zdtm/lib/Makefile
> +++ b/test/zdtm/lib/Makefile
> @@ -1,6 +1,6 @@
>  LIBDIR	:= .
>  
> -CFLAGS	+= $(USERCFLAGS)
> +CFLAGS	+= $(USERCFLAGS) -D_GNU_SOURCE
>  
>  LIB	:= libzdtmtst.a
>  
> diff --git a/test/zdtm/lib/fs.c b/test/zdtm/lib/fs.c
> index 04788e9c4539..37f5e4191e78 100644
> --- a/test/zdtm/lib/fs.c
> +++ b/test/zdtm/lib/fs.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <stdarg.h>
> diff --git a/test/zdtm/lib/lock.c b/test/zdtm/lib/lock.c
> index 9d2a646a6f29..3c3691d98b73 100644
> --- a/test/zdtm/lib/lock.c
> +++ b/test/zdtm/lib/lock.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <stdarg.h>
> diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
> index 19a2b2ae4d25..7a0949f22015 100644
> --- a/test/zdtm/lib/ns.c
> +++ b/test/zdtm/lib/ns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
> index 75b7d93bd9de..a01eac377a8f 100644
> --- a/test/zdtm/lib/test.c
> +++ b/test/zdtm/lib/test.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdio.h>
>  #include <errno.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
> index 861437258010..d699e5adf052 100644
> --- a/test/zdtm/static/Makefile
> +++ b/test/zdtm/static/Makefile
> @@ -2,6 +2,7 @@ LIBDIR	:= ../lib
>  LIB	:= $(LIBDIR)/libzdtmtst.a
>  LDLIBS	+= $(LIB)
>  CPPFLAGS += -I$(LIBDIR)
> +CFLAGS	+= -D_GNU_SOURCE
>  
>  TST_NOFILE	:=				\
>  		busyloop00			\
> diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c
> index 1644a6e10c94..68a62940d929 100644
> --- a/test/zdtm/static/autofs.c
> +++ b/test/zdtm/static/autofs.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <unistd.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/caps00.c b/test/zdtm/static/caps00.c
> index 5911fa19b474..62484c4f4c4c 100644
> --- a/test/zdtm/static/caps00.c
> +++ b/test/zdtm/static/caps00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <unistd.h>
>  #include <sys/types.h>
> diff --git a/test/zdtm/static/cgroup_stray.c b/test/zdtm/static/cgroup_stray.c
> index 9736845c07ab..235434ed2316 100644
> --- a/test/zdtm/static/cgroup_stray.c
> +++ b/test/zdtm/static/cgroup_stray.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/cgroupns.c b/test/zdtm/static/cgroupns.c
> index 955ab7227cce..cee7043533c1 100644
> --- a/test/zdtm/static/cgroupns.c
> +++ b/test/zdtm/static/cgroupns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/clone_fs.c b/test/zdtm/static/clone_fs.c
> index 5cebea586e0a..e368aff996cd 100644
> --- a/test/zdtm/static/clone_fs.c
> +++ b/test/zdtm/static/clone_fs.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdlib.h>
>  #include <syscall.h>
>  #include <pthread.h>
> diff --git a/test/zdtm/static/console.c b/test/zdtm/static/console.c
> index 41246aea0298..026eacb2ee8b 100644
> --- a/test/zdtm/static/console.c
> +++ b/test/zdtm/static/console.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c
> index 0fd3795bf2f6..b512ff710fd3 100644
> --- a/test/zdtm/static/del_standalone_un.c
> +++ b/test/zdtm/static/del_standalone_un.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/test/zdtm/static/deleted_unix_sock.c b/test/zdtm/static/deleted_unix_sock.c
> index 793c96884a3e..bcc33f3deccb 100644
> --- a/test/zdtm/static/deleted_unix_sock.c
> +++ b/test/zdtm/static/deleted_unix_sock.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <unistd.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/different_creds.c b/test/zdtm/static/different_creds.c
> index af7aa3c6f95a..59fd1fa7f95c 100644
> --- a/test/zdtm/static/different_creds.c
> +++ b/test/zdtm/static/different_creds.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <alloca.h>
>  #include <unistd.h>
>  #include <stdbool.h>
> diff --git a/test/zdtm/static/eventfs00.c b/test/zdtm/static/eventfs00.c
> index e05f514c4abc..72fd38a9cfa2 100644
> --- a/test/zdtm/static/eventfs00.c
> +++ b/test/zdtm/static/eventfs00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  
>  #include <errno.h>
> diff --git a/test/zdtm/static/fanotify00.c b/test/zdtm/static/fanotify00.c
> index 3084e185038b..9fc3d7a3b1d4 100644
> --- a/test/zdtm/static/fanotify00.c
> +++ b/test/zdtm/static/fanotify00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  #include <limits.h>
>  
> diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c
> index e66f9f56de3e..b1c74d0ae972 100644
> --- a/test/zdtm/static/fdt_shared.c
> +++ b/test/zdtm/static/fdt_shared.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE             /* See feature_test_macros(7) */
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/fifo-rowo-pair.c b/test/zdtm/static/fifo-rowo-pair.c
> index b967147724c5..85aad027d2ce 100644
> --- a/test/zdtm/static/fifo-rowo-pair.c
> +++ b/test/zdtm/static/fifo-rowo-pair.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  
>  #include <errno.h>
> diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c
> index c0732e72ac17..f29ba45af536 100644
> --- a/test/zdtm/static/file_fown.c
> +++ b/test/zdtm/static/file_fown.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  
>  #include <errno.h>
> diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c
> index 82888709e46a..8a1ecc26fee9 100644
> --- a/test/zdtm/static/file_locks00.c
> +++ b/test/zdtm/static/file_locks00.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c
> index 24f54acc78dd..aadc5e422222 100644
> --- a/test/zdtm/static/file_locks01.c
> +++ b/test/zdtm/static/file_locks01.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks02.c b/test/zdtm/static/file_locks02.c
> index 2db3bd0a0575..4e2e31b60ef5 100644
> --- a/test/zdtm/static/file_locks02.c
> +++ b/test/zdtm/static/file_locks02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks03.c b/test/zdtm/static/file_locks03.c
> index 167fd2e19324..9d5f198ef39d 100644
> --- a/test/zdtm/static/file_locks03.c
> +++ b/test/zdtm/static/file_locks03.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks04.c b/test/zdtm/static/file_locks04.c
> index 28ed497b8a81..96170d51e840 100644
> --- a/test/zdtm/static/file_locks04.c
> +++ b/test/zdtm/static/file_locks04.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks05.c b/test/zdtm/static/file_locks05.c
> index f7d34b19e884..33877f842c6b 100644
> --- a/test/zdtm/static/file_locks05.c
> +++ b/test/zdtm/static/file_locks05.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks06.c b/test/zdtm/static/file_locks06.c
> index 8eafa7c580e7..53f088f0dcbb 100644
> --- a/test/zdtm/static/file_locks06.c
> +++ b/test/zdtm/static/file_locks06.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <sys/file.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks07.c b/test/zdtm/static/file_locks07.c
> index 25051b92581e..8bd517491293 100644
> --- a/test/zdtm/static/file_locks07.c
> +++ b/test/zdtm/static/file_locks07.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <sys/file.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks08.c b/test/zdtm/static/file_locks08.c
> index 7963704da836..a654c205bea4 100644
> --- a/test/zdtm/static/file_locks08.c
> +++ b/test/zdtm/static/file_locks08.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <sys/wait.h>
>  #include <sys/file.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/groups.c b/test/zdtm/static/groups.c
> index f7548eacf38c..01ec3a12bab7 100644
> --- a/test/zdtm/static/groups.c
> +++ b/test/zdtm/static/groups.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <errno.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/helper_zombie_child.c b/test/zdtm/static/helper_zombie_child.c
> index 1e6b4bda7117..657d56f27e11 100644
> --- a/test/zdtm/static/helper_zombie_child.c
> +++ b/test/zdtm/static/helper_zombie_child.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <stdbool.h>
> diff --git a/test/zdtm/static/inotify00.c b/test/zdtm/static/inotify00.c
> index 00190dc58ca2..3c7cab0a7d34 100644
> --- a/test/zdtm/static/inotify00.c
> +++ b/test/zdtm/static/inotify00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  #include <limits.h>
>  
> diff --git a/test/zdtm/static/inotify02.c b/test/zdtm/static/inotify02.c
> index eca36dde81f7..9b343a873f94 100644
> --- a/test/zdtm/static/inotify02.c
> +++ b/test/zdtm/static/inotify02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <unistd.h>
>  #include <limits.h>
>  
> diff --git a/test/zdtm/static/inotify_irmap.c b/test/zdtm/static/inotify_irmap.c
> index 872201018d53..cf35886e2a5e 100644
> --- a/test/zdtm/static/inotify_irmap.c
> +++ b/test/zdtm/static/inotify_irmap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  #include <limits.h>
>  
> diff --git a/test/zdtm/static/maps01.c b/test/zdtm/static/maps01.c
> index 024dff1fc36e..8940119ef894 100644
> --- a/test/zdtm/static/maps01.c
> +++ b/test/zdtm/static/maps01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/mnt_ext_auto.c b/test/zdtm/static/mnt_ext_auto.c
> index 69d8149393ab..947ea00cb9d8 100644
> --- a/test/zdtm/static/mnt_ext_auto.c
> +++ b/test/zdtm/static/mnt_ext_auto.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <sys/mount.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/mnt_ext_master.c b/test/zdtm/static/mnt_ext_master.c
> index c0ef7ad5fee4..f2c8e38d4e90 100644
> --- a/test/zdtm/static/mnt_ext_master.c
> +++ b/test/zdtm/static/mnt_ext_master.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  
>  #include <sys/mount.h>
> diff --git a/test/zdtm/static/mnt_tracefs.c b/test/zdtm/static/mnt_tracefs.c
> index 968658b5b259..99d60870afc8 100644
> --- a/test/zdtm/static/mnt_tracefs.c
> +++ b/test/zdtm/static/mnt_tracefs.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <sys/mount.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/mntns_deleted.c b/test/zdtm/static/mntns_deleted.c
> index b38d8340bee7..39f9d0b47cea 100644
> --- a/test/zdtm/static/mntns_deleted.c
> +++ b/test/zdtm/static/mntns_deleted.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_ghost.c b/test/zdtm/static/mntns_ghost.c
> index dca0c34507d0..e0d31572a4e8 100644
> --- a/test/zdtm/static/mntns_ghost.c
> +++ b/test/zdtm/static/mntns_ghost.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_link_remap.c b/test/zdtm/static/mntns_link_remap.c
> index a148a9e0cca5..642641b1617b 100644
> --- a/test/zdtm/static/mntns_link_remap.c
> +++ b/test/zdtm/static/mntns_link_remap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_open.c b/test/zdtm/static/mntns_open.c
> index 629d762750ae..e19c4ea72dee 100644
> --- a/test/zdtm/static/mntns_open.c
> +++ b/test/zdtm/static/mntns_open.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_overmount.c b/test/zdtm/static/mntns_overmount.c
> index 541355c54f3c..aa297a055f7c 100644
> --- a/test/zdtm/static/mntns_overmount.c
> +++ b/test/zdtm/static/mntns_overmount.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_remap.c b/test/zdtm/static/mntns_remap.c
> index f7cdba443bf3..fd62cbf4081c 100644
> --- a/test/zdtm/static/mntns_remap.c
> +++ b/test/zdtm/static/mntns_remap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <stdbool.h>
>  #include <string.h>
> diff --git a/test/zdtm/static/mntns_ro_root.c b/test/zdtm/static/mntns_ro_root.c
> index 365be50e02e5..8415eec30a57 100644
> --- a/test/zdtm/static/mntns_ro_root.c
> +++ b/test/zdtm/static/mntns_ro_root.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_root_bind.c b/test/zdtm/static/mntns_root_bind.c
> index 3bd0bece0695..3f15a2726da6 100644
> --- a/test/zdtm/static/mntns_root_bind.c
> +++ b/test/zdtm/static/mntns_root_bind.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_bind.c b/test/zdtm/static/mntns_shared_bind.c
> index f11b2df98d7a..ef48bd8a2235 100644
> --- a/test/zdtm/static/mntns_shared_bind.c
> +++ b/test/zdtm/static/mntns_shared_bind.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_bind03.c b/test/zdtm/static/mntns_shared_bind03.c
> index 32d08691ff4e..e75fe629778a 100644
> --- a/test/zdtm/static/mntns_shared_bind03.c
> +++ b/test/zdtm/static/mntns_shared_bind03.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_vs_private.c b/test/zdtm/static/mntns_shared_vs_private.c
> index 771480b833be..5849bbbdb222 100644
> --- a/test/zdtm/static/mntns_shared_vs_private.c
> +++ b/test/zdtm/static/mntns_shared_vs_private.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/mountpoints.c b/test/zdtm/static/mountpoints.c
> index ba88cd99c9d3..17fa9311c99e 100644
> --- a/test/zdtm/static/mountpoints.c
> +++ b/test/zdtm/static/mountpoints.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/msgque.c b/test/zdtm/static/msgque.c
> index a855bec3603e..6bbb103bdf61 100644
> --- a/test/zdtm/static/msgque.c
> +++ b/test/zdtm/static/msgque.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  
>  #include <stdio.h>
> diff --git a/test/zdtm/static/netns_sub.c b/test/zdtm/static/netns_sub.c
> index d36fdeeba9c3..8428bca74d89 100644
> --- a/test/zdtm/static/netns_sub.c
> +++ b/test/zdtm/static/netns_sub.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <errno.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/netns_sub_veth.c b/test/zdtm/static/netns_sub_veth.c
> index 6262456040eb..733072f26bfe 100644
> --- a/test/zdtm/static/netns_sub_veth.c
> +++ b/test/zdtm/static/netns_sub_veth.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <errno.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/static/pid00.c b/test/zdtm/static/pid00.c
> index 0b03ef596389..e40bf73ae0ca 100644
> --- a/test/zdtm/static/pid00.c
> +++ b/test/zdtm/static/pid00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <unistd.h>
>  #include <sys/types.h>
> diff --git a/test/zdtm/static/proc-self.c b/test/zdtm/static/proc-self.c
> index 54cc5f1f3db6..8292c08cca5b 100644
> --- a/test/zdtm/static/proc-self.c
> +++ b/test/zdtm/static/proc-self.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  
>  #include <errno.h>
> diff --git a/test/zdtm/static/remap_dead_pid.c b/test/zdtm/static/remap_dead_pid.c
> index b46fd2b0b741..1ee61a9d06f6 100644
> --- a/test/zdtm/static/remap_dead_pid.c
> +++ b/test/zdtm/static/remap_dead_pid.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <string.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/sem.c b/test/zdtm/static/sem.c
> index c3603cb3c8be..6e459a8837f5 100644
> --- a/test/zdtm/static/sem.c
> +++ b/test/zdtm/static/sem.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  
>  #include <stdio.h>
> diff --git a/test/zdtm/static/session00.c b/test/zdtm/static/session00.c
> index 2c79f0391599..5889a92b96d9 100644
> --- a/test/zdtm/static/session00.c
> +++ b/test/zdtm/static/session00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <sys/wait.h>
> diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c
> index 9bea83d92852..155e9a4603d8 100644
> --- a/test/zdtm/static/session01.c
> +++ b/test/zdtm/static/session01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/test/zdtm/static/session02.c b/test/zdtm/static/session02.c
> index 02458520240e..37f245d2e85e 100644
> --- a/test/zdtm/static/session02.c
> +++ b/test/zdtm/static/session02.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sys/mman.h>
>  #include <sched.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/session03.c b/test/zdtm/static/session03.c
> index 2504d0179e0f..04fb8346138b 100644
> --- a/test/zdtm/static/session03.c
> +++ b/test/zdtm/static/session03.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sys/mman.h>
>  #include <sched.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c
> index e29904f3adac..084796ae21d9 100644
> --- a/test/zdtm/static/shm-mp.c
> +++ b/test/zdtm/static/shm-mp.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <sys/mman.h>
>  #include <sys/types.h>
> diff --git a/test/zdtm/static/shm.c b/test/zdtm/static/shm.c
> index fc90a99558f9..d033321356eb 100644
> --- a/test/zdtm/static/shm.c
> +++ b/test/zdtm/static/shm.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  
>  #include <stdio.h>
> diff --git a/test/zdtm/static/sigaltstack.c b/test/zdtm/static/sigaltstack.c
> index 71b316ab2c92..3ccd18277b8d 100644
> --- a/test/zdtm/static/sigaltstack.c
> +++ b/test/zdtm/static/sigaltstack.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <signal.h>
> diff --git a/test/zdtm/static/signalfd00.c b/test/zdtm/static/signalfd00.c
> index 5a152738271b..61b1f0398184 100644
> --- a/test/zdtm/static/signalfd00.c
> +++ b/test/zdtm/static/signalfd00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <unistd.h>
>  
>  #include <errno.h>
> diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c
> index 70c2580a1115..4adcfa6269d5 100644
> --- a/test/zdtm/static/sigpending.c
> +++ b/test/zdtm/static/sigpending.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <signal.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c
> index d341ce9afee9..f69a81697757 100644
> --- a/test/zdtm/static/sk-unix-rel.c
> +++ b/test/zdtm/static/sk-unix-rel.c
> @@ -1,6 +1,4 @@
>  
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sock_peercred.c b/test/zdtm/static/sock_peercred.c
> index 1a9cfe20b90a..e681ecec9376 100644
> --- a/test/zdtm/static/sock_peercred.c
> +++ b/test/zdtm/static/sock_peercred.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  #include <sys/socket.h>
>  #include <sys/types.h>
> diff --git a/test/zdtm/static/socket-ext.c b/test/zdtm/static/socket-ext.c
> index 46bf6c9ffb18..4e550534bc2e 100644
> --- a/test/zdtm/static/socket-ext.c
> +++ b/test/zdtm/static/socket-ext.c
> @@ -1,6 +1,4 @@
>  
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/socket-tcp.c b/test/zdtm/static/socket-tcp.c
> index 02f4c559b550..19dc53b855d1 100644
> --- a/test/zdtm/static/socket-tcp.c
> +++ b/test/zdtm/static/socket-tcp.c
> @@ -1,6 +1,3 @@
> -#ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> -#endif
>  #include "zdtmtst.h"
>  
>  #ifdef ZDTM_IPV6
> diff --git a/test/zdtm/static/socket_dgram_data.c b/test/zdtm/static/socket_dgram_data.c
> index 7464a46ac718..9437d44a305b 100644
> --- a/test/zdtm/static/socket_dgram_data.c
> +++ b/test/zdtm/static/socket_dgram_data.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c
> index 486d12a58436..375b449e048c 100644
> --- a/test/zdtm/static/socket_queues.c
> +++ b/test/zdtm/static/socket_queues.c
> @@ -1,6 +1,4 @@
>  
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/socket_snd_addr.c b/test/zdtm/static/socket_snd_addr.c
> index 1d72d4e4aba3..fa587a03e018 100644
> --- a/test/zdtm/static/socket_snd_addr.c
> +++ b/test/zdtm/static/socket_snd_addr.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c
> index 9d0095740a9a..a9558d7ad2b3 100644
> --- a/test/zdtm/static/sockets00.c
> +++ b/test/zdtm/static/sockets00.c
> @@ -1,6 +1,4 @@
>  
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c
> index a111e9d40672..12650536fc22 100644
> --- a/test/zdtm/static/sockets01.c
> +++ b/test/zdtm/static/sockets01.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c
> index a7bec03f7404..ed4afbbe0ace 100644
> --- a/test/zdtm/static/sockets02.c
> +++ b/test/zdtm/static/sockets02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
> index 9247d16a736e..309e7a0804f2 100644
> --- a/test/zdtm/static/sockets03.c
> +++ b/test/zdtm/static/sockets03.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sockets_dgram.c b/test/zdtm/static/sockets_dgram.c
> index a34bb144c461..952453d0155f 100644
> --- a/test/zdtm/static/sockets_dgram.c
> +++ b/test/zdtm/static/sockets_dgram.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c
> index f2c916f34093..ed9ffa94fe72 100644
> --- a/test/zdtm/static/sockets_spair.c
> +++ b/test/zdtm/static/sockets_spair.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> diff --git a/test/zdtm/static/tempfs_subns.c b/test/zdtm/static/tempfs_subns.c
> index 413d0a1e26e1..42195b57cfd0 100644
> --- a/test/zdtm/static/tempfs_subns.c
> +++ b/test/zdtm/static/tempfs_subns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <sys/wait.h>
> diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c
> index 9939c86b8b30..5a46d7e6d232 100644
> --- a/test/zdtm/static/uffd-events.c
> +++ b/test/zdtm/static/uffd-events.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/userns00.c b/test/zdtm/static/userns00.c
> index ac68eef2fbc4..1b6f5c13b73c 100644
> --- a/test/zdtm/static/userns00.c
> +++ b/test/zdtm/static/userns00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/userns01.c b/test/zdtm/static/userns01.c
> index 4d2a9d937dbf..8e4401ecac38 100644
> --- a/test/zdtm/static/userns01.c
> +++ b/test/zdtm/static/userns01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdbool.h>
>  #include <string.h>
>  #include <fcntl.h>
> diff --git a/test/zdtm/static/utsname.c b/test/zdtm/static/utsname.c
> index 5e1e0cb88e78..964548a8f145 100644
> --- a/test/zdtm/static/utsname.c
> +++ b/test/zdtm/static/utsname.c
> @@ -36,7 +36,7 @@ int main(int argc, char **argv)
>  		fail("Nodename doesn't match");
>  		return 1;
>  	}
> -	if (strcmp(ZDTM_DOMAIN, after.__domainname)) {
> +	if (strcmp(ZDTM_DOMAIN, after.domainname)) {
>  		fail("Domainname doesn't match");
>  		return 1;
>  	}
> diff --git a/test/zdtm/static/vt.c b/test/zdtm/static/vt.c
> index ab688402e8ff..0db0f2cd861c 100644
> --- a/test/zdtm/static/vt.c
> +++ b/test/zdtm/static/vt.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> diff --git a/test/zdtm/static/xids00.c b/test/zdtm/static/xids00.c
> index c3ddfb4835d7..0e8f324f6e7c 100644
> --- a/test/zdtm/static/xids00.c
> +++ b/test/zdtm/static/xids00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <unistd.h>
>  #include <errno.h>
>  #include <stdlib.h>
> diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
> index cd9892159fed..681df6cf50c0 100644
> --- a/test/zdtm/transition/Makefile
> +++ b/test/zdtm/transition/Makefile
> @@ -2,6 +2,7 @@ LIBDIR	:= ../lib
>  LIB	:= $(LIBDIR)/libzdtmtst.a
>  LDLIBS	+= $(LIB)
>  CPPFLAGS += -I$(LIBDIR)
> +CFLAGS	+= -D_GNU_SOURCE
>  
>  TST_NOFILE	=	\
>  		ipc		\
> diff --git a/test/zdtm/transition/ipc.c b/test/zdtm/transition/ipc.c
> index 4affe04b21ce..be52d7396866 100644
> --- a/test/zdtm/transition/ipc.c
> +++ b/test/zdtm/transition/ipc.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <sched.h>
>  
>  #include <stdio.h>
> diff --git a/test/zdtm/transition/maps008.c b/test/zdtm/transition/maps008.c
> index ce4b4f411db9..a89309d2fb65 100644
> --- a/test/zdtm/transition/maps008.c
> +++ b/test/zdtm/transition/maps008.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <stdlib.h>
>  #include <stdbool.h>
>  #include <string.h>
> diff --git a/test/zdtm/transition/shmem.c b/test/zdtm/transition/shmem.c
> index 5cca2744ad8b..56b0f678b1ce 100644
> --- a/test/zdtm/transition/shmem.c
> +++ b/test/zdtm/transition/shmem.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>  #include <errno.h>
>  #include <stdlib.h>
>  #include <string.h>
> -- 
> 2.12.0
>
Kir Kolyshkin April 4, 2017, 5:19 p.m.
On 04/04/2017 05:29 AM, Dmitry Safonov wrote:
> After the commit
>    02c763939c10 ("test/zdtm: unify common code")
>
> CFLAGS with -D_GNU_SOURCE defined in the top Makefile
> are being passed to tests Makefiles.
> As _GNU_SOURCE is also defined by tests, that resulted in
> zdtm tests build failures:
>
>    make[2]: Entering directory `/home/criu/test/zdtm/lib'
>     CC        test.o
>    test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
>     #define _GNU_SOURCE
>     ^
>    <command-line>:0:0: note: this is the location of the previous definition
>    cc1: all warnings being treated as errors
>    make[2]: *** [test.o] Error 1
>
> However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't
> do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`.
> By calling middle makefile this way, it doesn't have _GNU_SOURCE in
> CFLAGS from top-Makefile.
>
> I think the right thing to do here - is following CRIU's way:
> rely on definition of _GNU_SOURCE by Makefiles.
>
> This patch is almost fully generated with
>    find test/zdtm/ -name '*.c' -type f					\
>       -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \;		\
>       -exec sed -i '/define _GNU_SOURCE/d' '{}' \;
>
> With an exception for adding -D_GNU_SOURCE in tests Makefiles for
> keeping the same behaviour for zdtm.py.
> Also changed utsname.c to use utsname::domainname, rather private
> utsname::__domainname, as now it's uncovered (from sys/utsname.h):
>> struct utsname
>>   {
> ...
>> # ifdef __USE_GNU
>>      char domainname[_UTSNAME_DOMAIN_LENGTH];
>> # else
>>      char __domainname[_UTSNAME_DOMAIN_LENGTH];
>> # endif
> Reported-by: Adrian Reber <areber@redhat.com>
> Cc: Kir Kolyshkin <kir@openvz.org>
> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> ---
>   test/zdtm/lib/Makefile                     | 2 +-
>   test/zdtm/lib/fs.c                         | 2 --
>   test/zdtm/lib/lock.c                       | 2 --
>   test/zdtm/lib/ns.c                         | 1 -
>   test/zdtm/lib/test.c                       | 1 -
>   test/zdtm/static/Makefile                  | 1 +
>   test/zdtm/static/autofs.c                  | 2 --
>   test/zdtm/static/caps00.c                  | 1 -
>   test/zdtm/static/cgroup_stray.c            | 1 -
>   test/zdtm/static/cgroupns.c                | 1 -
>   test/zdtm/static/clone_fs.c                | 1 -
>   test/zdtm/static/console.c                 | 2 --
>   test/zdtm/static/del_standalone_un.c       | 1 -
>   test/zdtm/static/deleted_unix_sock.c       | 1 -
>   test/zdtm/static/different_creds.c         | 1 -
>   test/zdtm/static/eventfs00.c               | 1 -
>   test/zdtm/static/fanotify00.c              | 1 -
>   test/zdtm/static/fdt_shared.c              | 1 -
>   test/zdtm/static/fifo-rowo-pair.c          | 1 -
>   test/zdtm/static/file_fown.c               | 1 -
>   test/zdtm/static/file_locks00.c            | 2 --
>   test/zdtm/static/file_locks01.c            | 2 --
>   test/zdtm/static/file_locks02.c            | 2 --
>   test/zdtm/static/file_locks03.c            | 2 --
>   test/zdtm/static/file_locks04.c            | 2 --
>   test/zdtm/static/file_locks05.c            | 2 --
>   test/zdtm/static/file_locks06.c            | 2 --
>   test/zdtm/static/file_locks07.c            | 2 --
>   test/zdtm/static/file_locks08.c            | 2 --
>   test/zdtm/static/groups.c                  | 1 -
>   test/zdtm/static/helper_zombie_child.c     | 1 -
>   test/zdtm/static/inotify00.c               | 1 -
>   test/zdtm/static/inotify02.c               | 2 --
>   test/zdtm/static/inotify_irmap.c           | 1 -
>   test/zdtm/static/maps01.c                  | 1 -
>   test/zdtm/static/mnt_ext_auto.c            | 1 -
>   test/zdtm/static/mnt_ext_master.c          | 1 -
>   test/zdtm/static/mnt_tracefs.c             | 1 -
>   test/zdtm/static/mntns_deleted.c           | 2 --
>   test/zdtm/static/mntns_ghost.c             | 1 -
>   test/zdtm/static/mntns_link_remap.c        | 1 -
>   test/zdtm/static/mntns_open.c              | 1 -
>   test/zdtm/static/mntns_overmount.c         | 1 -
>   test/zdtm/static/mntns_remap.c             | 1 -
>   test/zdtm/static/mntns_ro_root.c           | 1 -
>   test/zdtm/static/mntns_root_bind.c         | 1 -
>   test/zdtm/static/mntns_shared_bind.c       | 1 -
>   test/zdtm/static/mntns_shared_bind03.c     | 1 -
>   test/zdtm/static/mntns_shared_vs_private.c | 1 -
>   test/zdtm/static/mountpoints.c             | 1 -
>   test/zdtm/static/msgque.c                  | 1 -
>   test/zdtm/static/netns_sub.c               | 1 -
>   test/zdtm/static/netns_sub_veth.c          | 1 -
>   test/zdtm/static/pid00.c                   | 1 -
>   test/zdtm/static/proc-self.c               | 1 -
>   test/zdtm/static/remap_dead_pid.c          | 1 -
>   test/zdtm/static/sem.c                     | 1 -
>   test/zdtm/static/session00.c               | 1 -
>   test/zdtm/static/session01.c               | 1 -
>   test/zdtm/static/session02.c               | 1 -
>   test/zdtm/static/session03.c               | 1 -
>   test/zdtm/static/shm-mp.c                  | 1 -
>   test/zdtm/static/shm.c                     | 1 -
>   test/zdtm/static/sigaltstack.c             | 2 --
>   test/zdtm/static/signalfd00.c              | 1 -
>   test/zdtm/static/sigpending.c              | 1 -
>   test/zdtm/static/sk-unix-rel.c             | 2 --
>   test/zdtm/static/sock_peercred.c           | 1 -
>   test/zdtm/static/socket-ext.c              | 2 --
>   test/zdtm/static/socket-tcp.c              | 3 ---
>   test/zdtm/static/socket_dgram_data.c       | 1 -
>   test/zdtm/static/socket_queues.c           | 2 --
>   test/zdtm/static/socket_snd_addr.c         | 1 -
>   test/zdtm/static/sockets00.c               | 2 --
>   test/zdtm/static/sockets01.c               | 2 --
>   test/zdtm/static/sockets02.c               | 2 --
>   test/zdtm/static/sockets03.c               | 2 --
>   test/zdtm/static/sockets_dgram.c           | 2 --
>   test/zdtm/static/sockets_spair.c           | 2 --
>   test/zdtm/static/tempfs_subns.c            | 1 -
>   test/zdtm/static/uffd-events.c             | 1 -
>   test/zdtm/static/userns00.c                | 1 -
>   test/zdtm/static/userns01.c                | 1 -
>   test/zdtm/static/utsname.c                 | 2 +-
>   test/zdtm/static/vt.c                      | 2 --
>   test/zdtm/static/xids00.c                  | 1 -
>   test/zdtm/transition/Makefile              | 1 +
>   test/zdtm/transition/ipc.c                 | 1 -
>   test/zdtm/transition/maps008.c             | 1 -
>   test/zdtm/transition/shmem.c               | 1 -
>   90 files changed, 4 insertions(+), 116 deletions(-)
>
> diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
> index d2d9f1cc31dc..20b54cdec58a 100644
> --- a/test/zdtm/lib/Makefile
> +++ b/test/zdtm/lib/Makefile
> @@ -1,6 +1,6 @@
>   LIBDIR	:= .
>   
> -CFLAGS	+= $(USERCFLAGS)
> +CFLAGS	+= $(USERCFLAGS) -D_GNU_SOURCE

Please move this to test/zdtm/Makefile.inc (preferably on a separate 
line), so you don't need to repeat it tree times.

Once done, Acked-by: Kir Kolyshkin <kir@openvz.org>
>   
>   LIB	:= libzdtmtst.a
>   
> diff --git a/test/zdtm/lib/fs.c b/test/zdtm/lib/fs.c
> index 04788e9c4539..37f5e4191e78 100644
> --- a/test/zdtm/lib/fs.c
> +++ b/test/zdtm/lib/fs.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdlib.h>
>   #include <stdio.h>
>   #include <stdarg.h>
> diff --git a/test/zdtm/lib/lock.c b/test/zdtm/lib/lock.c
> index 9d2a646a6f29..3c3691d98b73 100644
> --- a/test/zdtm/lib/lock.c
> +++ b/test/zdtm/lib/lock.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdlib.h>
>   #include <stdio.h>
>   #include <stdarg.h>
> diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
> index 19a2b2ae4d25..7a0949f22015 100644
> --- a/test/zdtm/lib/ns.c
> +++ b/test/zdtm/lib/ns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
> index 75b7d93bd9de..a01eac377a8f 100644
> --- a/test/zdtm/lib/test.c
> +++ b/test/zdtm/lib/test.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdio.h>
>   #include <errno.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
> index 861437258010..d699e5adf052 100644
> --- a/test/zdtm/static/Makefile
> +++ b/test/zdtm/static/Makefile
> @@ -2,6 +2,7 @@ LIBDIR	:= ../lib
>   LIB	:= $(LIBDIR)/libzdtmtst.a
>   LDLIBS	+= $(LIB)
>   CPPFLAGS += -I$(LIBDIR)
> +CFLAGS	+= -D_GNU_SOURCE
>   
>   TST_NOFILE	:=				\
>   		busyloop00			\
> diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c
> index 1644a6e10c94..68a62940d929 100644
> --- a/test/zdtm/static/autofs.c
> +++ b/test/zdtm/static/autofs.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <unistd.h>
>   #include <stdio.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/caps00.c b/test/zdtm/static/caps00.c
> index 5911fa19b474..62484c4f4c4c 100644
> --- a/test/zdtm/static/caps00.c
> +++ b/test/zdtm/static/caps00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <unistd.h>
>   #include <sys/types.h>
> diff --git a/test/zdtm/static/cgroup_stray.c b/test/zdtm/static/cgroup_stray.c
> index 9736845c07ab..235434ed2316 100644
> --- a/test/zdtm/static/cgroup_stray.c
> +++ b/test/zdtm/static/cgroup_stray.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <stdbool.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/cgroupns.c b/test/zdtm/static/cgroupns.c
> index 955ab7227cce..cee7043533c1 100644
> --- a/test/zdtm/static/cgroupns.c
> +++ b/test/zdtm/static/cgroupns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <stdbool.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/clone_fs.c b/test/zdtm/static/clone_fs.c
> index 5cebea586e0a..e368aff996cd 100644
> --- a/test/zdtm/static/clone_fs.c
> +++ b/test/zdtm/static/clone_fs.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdlib.h>
>   #include <syscall.h>
>   #include <pthread.h>
> diff --git a/test/zdtm/static/console.c b/test/zdtm/static/console.c
> index 41246aea0298..026eacb2ee8b 100644
> --- a/test/zdtm/static/console.c
> +++ b/test/zdtm/static/console.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c
> index 0fd3795bf2f6..b512ff710fd3 100644
> --- a/test/zdtm/static/del_standalone_un.c
> +++ b/test/zdtm/static/del_standalone_un.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <stdlib.h>
>   #include <string.h>
> diff --git a/test/zdtm/static/deleted_unix_sock.c b/test/zdtm/static/deleted_unix_sock.c
> index 793c96884a3e..bcc33f3deccb 100644
> --- a/test/zdtm/static/deleted_unix_sock.c
> +++ b/test/zdtm/static/deleted_unix_sock.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <unistd.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/different_creds.c b/test/zdtm/static/different_creds.c
> index af7aa3c6f95a..59fd1fa7f95c 100644
> --- a/test/zdtm/static/different_creds.c
> +++ b/test/zdtm/static/different_creds.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <alloca.h>
>   #include <unistd.h>
>   #include <stdbool.h>
> diff --git a/test/zdtm/static/eventfs00.c b/test/zdtm/static/eventfs00.c
> index e05f514c4abc..72fd38a9cfa2 100644
> --- a/test/zdtm/static/eventfs00.c
> +++ b/test/zdtm/static/eventfs00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   
>   #include <errno.h>
> diff --git a/test/zdtm/static/fanotify00.c b/test/zdtm/static/fanotify00.c
> index 3084e185038b..9fc3d7a3b1d4 100644
> --- a/test/zdtm/static/fanotify00.c
> +++ b/test/zdtm/static/fanotify00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   #include <limits.h>
>   
> diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c
> index e66f9f56de3e..b1c74d0ae972 100644
> --- a/test/zdtm/static/fdt_shared.c
> +++ b/test/zdtm/static/fdt_shared.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE             /* See feature_test_macros(7) */
>   #include <sys/types.h>
>   #include <sys/stat.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/fifo-rowo-pair.c b/test/zdtm/static/fifo-rowo-pair.c
> index b967147724c5..85aad027d2ce 100644
> --- a/test/zdtm/static/fifo-rowo-pair.c
> +++ b/test/zdtm/static/fifo-rowo-pair.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   
>   #include <errno.h>
> diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c
> index c0732e72ac17..f29ba45af536 100644
> --- a/test/zdtm/static/file_fown.c
> +++ b/test/zdtm/static/file_fown.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   
>   #include <errno.h>
> diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c
> index 82888709e46a..8a1ecc26fee9 100644
> --- a/test/zdtm/static/file_locks00.c
> +++ b/test/zdtm/static/file_locks00.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c
> index 24f54acc78dd..aadc5e422222 100644
> --- a/test/zdtm/static/file_locks01.c
> +++ b/test/zdtm/static/file_locks01.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks02.c b/test/zdtm/static/file_locks02.c
> index 2db3bd0a0575..4e2e31b60ef5 100644
> --- a/test/zdtm/static/file_locks02.c
> +++ b/test/zdtm/static/file_locks02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks03.c b/test/zdtm/static/file_locks03.c
> index 167fd2e19324..9d5f198ef39d 100644
> --- a/test/zdtm/static/file_locks03.c
> +++ b/test/zdtm/static/file_locks03.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks04.c b/test/zdtm/static/file_locks04.c
> index 28ed497b8a81..96170d51e840 100644
> --- a/test/zdtm/static/file_locks04.c
> +++ b/test/zdtm/static/file_locks04.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks05.c b/test/zdtm/static/file_locks05.c
> index f7d34b19e884..33877f842c6b 100644
> --- a/test/zdtm/static/file_locks05.c
> +++ b/test/zdtm/static/file_locks05.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks06.c b/test/zdtm/static/file_locks06.c
> index 8eafa7c580e7..53f088f0dcbb 100644
> --- a/test/zdtm/static/file_locks06.c
> +++ b/test/zdtm/static/file_locks06.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <sys/file.h>
>   #include <unistd.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks07.c b/test/zdtm/static/file_locks07.c
> index 25051b92581e..8bd517491293 100644
> --- a/test/zdtm/static/file_locks07.c
> +++ b/test/zdtm/static/file_locks07.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <sys/file.h>
>   #include <unistd.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/file_locks08.c b/test/zdtm/static/file_locks08.c
> index 7963704da836..a654c205bea4 100644
> --- a/test/zdtm/static/file_locks08.c
> +++ b/test/zdtm/static/file_locks08.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <sys/wait.h>
>   #include <sys/file.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/groups.c b/test/zdtm/static/groups.c
> index f7548eacf38c..01ec3a12bab7 100644
> --- a/test/zdtm/static/groups.c
> +++ b/test/zdtm/static/groups.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <errno.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/helper_zombie_child.c b/test/zdtm/static/helper_zombie_child.c
> index 1e6b4bda7117..657d56f27e11 100644
> --- a/test/zdtm/static/helper_zombie_child.c
> +++ b/test/zdtm/static/helper_zombie_child.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <stdlib.h>
>   #include <stdbool.h>
> diff --git a/test/zdtm/static/inotify00.c b/test/zdtm/static/inotify00.c
> index 00190dc58ca2..3c7cab0a7d34 100644
> --- a/test/zdtm/static/inotify00.c
> +++ b/test/zdtm/static/inotify00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   #include <limits.h>
>   
> diff --git a/test/zdtm/static/inotify02.c b/test/zdtm/static/inotify02.c
> index eca36dde81f7..9b343a873f94 100644
> --- a/test/zdtm/static/inotify02.c
> +++ b/test/zdtm/static/inotify02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <unistd.h>
>   #include <limits.h>
>   
> diff --git a/test/zdtm/static/inotify_irmap.c b/test/zdtm/static/inotify_irmap.c
> index 872201018d53..cf35886e2a5e 100644
> --- a/test/zdtm/static/inotify_irmap.c
> +++ b/test/zdtm/static/inotify_irmap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   #include <limits.h>
>   
> diff --git a/test/zdtm/static/maps01.c b/test/zdtm/static/maps01.c
> index 024dff1fc36e..8940119ef894 100644
> --- a/test/zdtm/static/maps01.c
> +++ b/test/zdtm/static/maps01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <fcntl.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/mnt_ext_auto.c b/test/zdtm/static/mnt_ext_auto.c
> index 69d8149393ab..947ea00cb9d8 100644
> --- a/test/zdtm/static/mnt_ext_auto.c
> +++ b/test/zdtm/static/mnt_ext_auto.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <sys/mount.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/mnt_ext_master.c b/test/zdtm/static/mnt_ext_master.c
> index c0ef7ad5fee4..f2c8e38d4e90 100644
> --- a/test/zdtm/static/mnt_ext_master.c
> +++ b/test/zdtm/static/mnt_ext_master.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   
>   #include <sys/mount.h>
> diff --git a/test/zdtm/static/mnt_tracefs.c b/test/zdtm/static/mnt_tracefs.c
> index 968658b5b259..99d60870afc8 100644
> --- a/test/zdtm/static/mnt_tracefs.c
> +++ b/test/zdtm/static/mnt_tracefs.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <sys/mount.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/mntns_deleted.c b/test/zdtm/static/mntns_deleted.c
> index b38d8340bee7..39f9d0b47cea 100644
> --- a/test/zdtm/static/mntns_deleted.c
> +++ b/test/zdtm/static/mntns_deleted.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_ghost.c b/test/zdtm/static/mntns_ghost.c
> index dca0c34507d0..e0d31572a4e8 100644
> --- a/test/zdtm/static/mntns_ghost.c
> +++ b/test/zdtm/static/mntns_ghost.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_link_remap.c b/test/zdtm/static/mntns_link_remap.c
> index a148a9e0cca5..642641b1617b 100644
> --- a/test/zdtm/static/mntns_link_remap.c
> +++ b/test/zdtm/static/mntns_link_remap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_open.c b/test/zdtm/static/mntns_open.c
> index 629d762750ae..e19c4ea72dee 100644
> --- a/test/zdtm/static/mntns_open.c
> +++ b/test/zdtm/static/mntns_open.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_overmount.c b/test/zdtm/static/mntns_overmount.c
> index 541355c54f3c..aa297a055f7c 100644
> --- a/test/zdtm/static/mntns_overmount.c
> +++ b/test/zdtm/static/mntns_overmount.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_remap.c b/test/zdtm/static/mntns_remap.c
> index f7cdba443bf3..fd62cbf4081c 100644
> --- a/test/zdtm/static/mntns_remap.c
> +++ b/test/zdtm/static/mntns_remap.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <stdbool.h>
>   #include <string.h>
> diff --git a/test/zdtm/static/mntns_ro_root.c b/test/zdtm/static/mntns_ro_root.c
> index 365be50e02e5..8415eec30a57 100644
> --- a/test/zdtm/static/mntns_ro_root.c
> +++ b/test/zdtm/static/mntns_ro_root.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_root_bind.c b/test/zdtm/static/mntns_root_bind.c
> index 3bd0bece0695..3f15a2726da6 100644
> --- a/test/zdtm/static/mntns_root_bind.c
> +++ b/test/zdtm/static/mntns_root_bind.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_bind.c b/test/zdtm/static/mntns_shared_bind.c
> index f11b2df98d7a..ef48bd8a2235 100644
> --- a/test/zdtm/static/mntns_shared_bind.c
> +++ b/test/zdtm/static/mntns_shared_bind.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_bind03.c b/test/zdtm/static/mntns_shared_bind03.c
> index 32d08691ff4e..e75fe629778a 100644
> --- a/test/zdtm/static/mntns_shared_bind03.c
> +++ b/test/zdtm/static/mntns_shared_bind03.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mntns_shared_vs_private.c b/test/zdtm/static/mntns_shared_vs_private.c
> index 771480b833be..5849bbbdb222 100644
> --- a/test/zdtm/static/mntns_shared_vs_private.c
> +++ b/test/zdtm/static/mntns_shared_vs_private.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/mountpoints.c b/test/zdtm/static/mountpoints.c
> index ba88cd99c9d3..17fa9311c99e 100644
> --- a/test/zdtm/static/mountpoints.c
> +++ b/test/zdtm/static/mountpoints.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/msgque.c b/test/zdtm/static/msgque.c
> index a855bec3603e..6bbb103bdf61 100644
> --- a/test/zdtm/static/msgque.c
> +++ b/test/zdtm/static/msgque.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   
>   #include <stdio.h>
> diff --git a/test/zdtm/static/netns_sub.c b/test/zdtm/static/netns_sub.c
> index d36fdeeba9c3..8428bca74d89 100644
> --- a/test/zdtm/static/netns_sub.c
> +++ b/test/zdtm/static/netns_sub.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <errno.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/netns_sub_veth.c b/test/zdtm/static/netns_sub_veth.c
> index 6262456040eb..733072f26bfe 100644
> --- a/test/zdtm/static/netns_sub_veth.c
> +++ b/test/zdtm/static/netns_sub_veth.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <errno.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/static/pid00.c b/test/zdtm/static/pid00.c
> index 0b03ef596389..e40bf73ae0ca 100644
> --- a/test/zdtm/static/pid00.c
> +++ b/test/zdtm/static/pid00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <unistd.h>
>   #include <sys/types.h>
> diff --git a/test/zdtm/static/proc-self.c b/test/zdtm/static/proc-self.c
> index 54cc5f1f3db6..8292c08cca5b 100644
> --- a/test/zdtm/static/proc-self.c
> +++ b/test/zdtm/static/proc-self.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   
>   #include <errno.h>
> diff --git a/test/zdtm/static/remap_dead_pid.c b/test/zdtm/static/remap_dead_pid.c
> index b46fd2b0b741..1ee61a9d06f6 100644
> --- a/test/zdtm/static/remap_dead_pid.c
> +++ b/test/zdtm/static/remap_dead_pid.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <string.h>
>   #include <fcntl.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/sem.c b/test/zdtm/static/sem.c
> index c3603cb3c8be..6e459a8837f5 100644
> --- a/test/zdtm/static/sem.c
> +++ b/test/zdtm/static/sem.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   
>   #include <stdio.h>
> diff --git a/test/zdtm/static/session00.c b/test/zdtm/static/session00.c
> index 2c79f0391599..5889a92b96d9 100644
> --- a/test/zdtm/static/session00.c
> +++ b/test/zdtm/static/session00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <stdlib.h>
>   #include <sys/wait.h>
> diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c
> index 9bea83d92852..155e9a4603d8 100644
> --- a/test/zdtm/static/session01.c
> +++ b/test/zdtm/static/session01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <stdlib.h>
>   #include <string.h>
> diff --git a/test/zdtm/static/session02.c b/test/zdtm/static/session02.c
> index 02458520240e..37f245d2e85e 100644
> --- a/test/zdtm/static/session02.c
> +++ b/test/zdtm/static/session02.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sys/mman.h>
>   #include <sched.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/session03.c b/test/zdtm/static/session03.c
> index 2504d0179e0f..04fb8346138b 100644
> --- a/test/zdtm/static/session03.c
> +++ b/test/zdtm/static/session03.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sys/mman.h>
>   #include <sched.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c
> index e29904f3adac..084796ae21d9 100644
> --- a/test/zdtm/static/shm-mp.c
> +++ b/test/zdtm/static/shm-mp.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <sys/mman.h>
>   #include <sys/types.h>
> diff --git a/test/zdtm/static/shm.c b/test/zdtm/static/shm.c
> index fc90a99558f9..d033321356eb 100644
> --- a/test/zdtm/static/shm.c
> +++ b/test/zdtm/static/shm.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   
>   #include <stdio.h>
> diff --git a/test/zdtm/static/sigaltstack.c b/test/zdtm/static/sigaltstack.c
> index 71b316ab2c92..3ccd18277b8d 100644
> --- a/test/zdtm/static/sigaltstack.c
> +++ b/test/zdtm/static/sigaltstack.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <signal.h>
> diff --git a/test/zdtm/static/signalfd00.c b/test/zdtm/static/signalfd00.c
> index 5a152738271b..61b1f0398184 100644
> --- a/test/zdtm/static/signalfd00.c
> +++ b/test/zdtm/static/signalfd00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <unistd.h>
>   
>   #include <errno.h>
> diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c
> index 70c2580a1115..4adcfa6269d5 100644
> --- a/test/zdtm/static/sigpending.c
> +++ b/test/zdtm/static/sigpending.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <signal.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c
> index d341ce9afee9..f69a81697757 100644
> --- a/test/zdtm/static/sk-unix-rel.c
> +++ b/test/zdtm/static/sk-unix-rel.c
> @@ -1,6 +1,4 @@
>   
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sock_peercred.c b/test/zdtm/static/sock_peercred.c
> index 1a9cfe20b90a..e681ecec9376 100644
> --- a/test/zdtm/static/sock_peercred.c
> +++ b/test/zdtm/static/sock_peercred.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   #include <sys/socket.h>
>   #include <sys/types.h>
> diff --git a/test/zdtm/static/socket-ext.c b/test/zdtm/static/socket-ext.c
> index 46bf6c9ffb18..4e550534bc2e 100644
> --- a/test/zdtm/static/socket-ext.c
> +++ b/test/zdtm/static/socket-ext.c
> @@ -1,6 +1,4 @@
>   
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/socket-tcp.c b/test/zdtm/static/socket-tcp.c
> index 02f4c559b550..19dc53b855d1 100644
> --- a/test/zdtm/static/socket-tcp.c
> +++ b/test/zdtm/static/socket-tcp.c
> @@ -1,6 +1,3 @@
> -#ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> -#endif
>   #include "zdtmtst.h"
>   
>   #ifdef ZDTM_IPV6
> diff --git a/test/zdtm/static/socket_dgram_data.c b/test/zdtm/static/socket_dgram_data.c
> index 7464a46ac718..9437d44a305b 100644
> --- a/test/zdtm/static/socket_dgram_data.c
> +++ b/test/zdtm/static/socket_dgram_data.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <stdlib.h>
>   #include <string.h>
> diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c
> index 486d12a58436..375b449e048c 100644
> --- a/test/zdtm/static/socket_queues.c
> +++ b/test/zdtm/static/socket_queues.c
> @@ -1,6 +1,4 @@
>   
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/socket_snd_addr.c b/test/zdtm/static/socket_snd_addr.c
> index 1d72d4e4aba3..fa587a03e018 100644
> --- a/test/zdtm/static/socket_snd_addr.c
> +++ b/test/zdtm/static/socket_snd_addr.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <stdlib.h>
>   #include <string.h>
> diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c
> index 9d0095740a9a..a9558d7ad2b3 100644
> --- a/test/zdtm/static/sockets00.c
> +++ b/test/zdtm/static/sockets00.c
> @@ -1,6 +1,4 @@
>   
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c
> index a111e9d40672..12650536fc22 100644
> --- a/test/zdtm/static/sockets01.c
> +++ b/test/zdtm/static/sockets01.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c
> index a7bec03f7404..ed4afbbe0ace 100644
> --- a/test/zdtm/static/sockets02.c
> +++ b/test/zdtm/static/sockets02.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
> index 9247d16a736e..309e7a0804f2 100644
> --- a/test/zdtm/static/sockets03.c
> +++ b/test/zdtm/static/sockets03.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sockets_dgram.c b/test/zdtm/static/sockets_dgram.c
> index a34bb144c461..952453d0155f 100644
> --- a/test/zdtm/static/sockets_dgram.c
> +++ b/test/zdtm/static/sockets_dgram.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c
> index f2c916f34093..ed9ffa94fe72 100644
> --- a/test/zdtm/static/sockets_spair.c
> +++ b/test/zdtm/static/sockets_spair.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <ctype.h>
> diff --git a/test/zdtm/static/tempfs_subns.c b/test/zdtm/static/tempfs_subns.c
> index 413d0a1e26e1..42195b57cfd0 100644
> --- a/test/zdtm/static/tempfs_subns.c
> +++ b/test/zdtm/static/tempfs_subns.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE         /* See feature_test_macros(7) */
>   #include <sys/types.h>
>   #include <sys/stat.h>
>   #include <sys/wait.h>
> diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c
> index 9939c86b8b30..5a46d7e6d232 100644
> --- a/test/zdtm/static/uffd-events.c
> +++ b/test/zdtm/static/uffd-events.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <fcntl.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/userns00.c b/test/zdtm/static/userns00.c
> index ac68eef2fbc4..1b6f5c13b73c 100644
> --- a/test/zdtm/static/userns00.c
> +++ b/test/zdtm/static/userns00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/userns01.c b/test/zdtm/static/userns01.c
> index 4d2a9d937dbf..8e4401ecac38 100644
> --- a/test/zdtm/static/userns01.c
> +++ b/test/zdtm/static/userns01.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdbool.h>
>   #include <string.h>
>   #include <fcntl.h>
> diff --git a/test/zdtm/static/utsname.c b/test/zdtm/static/utsname.c
> index 5e1e0cb88e78..964548a8f145 100644
> --- a/test/zdtm/static/utsname.c
> +++ b/test/zdtm/static/utsname.c
> @@ -36,7 +36,7 @@ int main(int argc, char **argv)
>   		fail("Nodename doesn't match");
>   		return 1;
>   	}
> -	if (strcmp(ZDTM_DOMAIN, after.__domainname)) {
> +	if (strcmp(ZDTM_DOMAIN, after.domainname)) {
>   		fail("Domainname doesn't match");
>   		return 1;
>   	}
> diff --git a/test/zdtm/static/vt.c b/test/zdtm/static/vt.c
> index ab688402e8ff..0db0f2cd861c 100644
> --- a/test/zdtm/static/vt.c
> +++ b/test/zdtm/static/vt.c
> @@ -1,5 +1,3 @@
> -#define _GNU_SOURCE
> -
>   #include <stdio.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/test/zdtm/static/xids00.c b/test/zdtm/static/xids00.c
> index c3ddfb4835d7..0e8f324f6e7c 100644
> --- a/test/zdtm/static/xids00.c
> +++ b/test/zdtm/static/xids00.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <unistd.h>
>   #include <errno.h>
>   #include <stdlib.h>
> diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
> index cd9892159fed..681df6cf50c0 100644
> --- a/test/zdtm/transition/Makefile
> +++ b/test/zdtm/transition/Makefile
> @@ -2,6 +2,7 @@ LIBDIR	:= ../lib
>   LIB	:= $(LIBDIR)/libzdtmtst.a
>   LDLIBS	+= $(LIB)
>   CPPFLAGS += -I$(LIBDIR)
> +CFLAGS	+= -D_GNU_SOURCE
>   
>   TST_NOFILE	=	\
>   		ipc		\
> diff --git a/test/zdtm/transition/ipc.c b/test/zdtm/transition/ipc.c
> index 4affe04b21ce..be52d7396866 100644
> --- a/test/zdtm/transition/ipc.c
> +++ b/test/zdtm/transition/ipc.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <sched.h>
>   
>   #include <stdio.h>
> diff --git a/test/zdtm/transition/maps008.c b/test/zdtm/transition/maps008.c
> index ce4b4f411db9..a89309d2fb65 100644
> --- a/test/zdtm/transition/maps008.c
> +++ b/test/zdtm/transition/maps008.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <stdlib.h>
>   #include <stdbool.h>
>   #include <string.h>
> diff --git a/test/zdtm/transition/shmem.c b/test/zdtm/transition/shmem.c
> index 5cca2744ad8b..56b0f678b1ce 100644
> --- a/test/zdtm/transition/shmem.c
> +++ b/test/zdtm/transition/shmem.c
> @@ -1,4 +1,3 @@
> -#define _GNU_SOURCE
>   #include <errno.h>
>   #include <stdlib.h>
>   #include <string.h>