[CRIU] [PATCH] build: Move generated config.h into include/common/
Adrian Reber
areber at redhat.com
Thu Jul 20 10:24:13 MSK 2017
You can add
Tested-by: Adrian Reber <areber at redhat.com>
I will send a patch based on this patch soon. I first want to make sure
it also works on ppc64le.
Adrian
On Wed, Jul 19, 2017 at 09:14:24PM +0300, Dmitry Safonov wrote:
> config.h is a generated file with "build-features" defines.
> We use it for several purposes:
> o to check that compiler can do it's job
> o to complement user-visible API between distributions
> o to add compile-time options from .config global file
>
> It's used in criu and soccr, but compel also needs such thing.
>
> Previously, soccr has a link to config.h in criu includes,
> but it would be much cleaner to move it to other headers,
> that are shared between sub-projects into include/common.
>
> Reported-by: Adrian Reber <areber at redhat.com>
> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
> ---
> .gitignore | 3 +--
> Makefile | 10 +++-------
> criu/cgroup-props.c | 2 +-
> criu/filesystems.c | 2 +-
> criu/include/cr_options.h | 2 +-
> criu/include/kerndat.h | 2 +-
> criu/include/parasite-syscall.h | 2 +-
> criu/include/parasite-vdso.h | 2 +-
> criu/include/ptrace-compat.h | 2 +-
> criu/include/restorer.h | 2 +-
> criu/include/string.h | 2 +-
> criu/include/vdso.h | 2 +-
> criu/kerndat.c | 2 +-
> criu/lsm.c | 2 +-
> criu/page-pipe.c | 2 +-
> criu/parasite-syscall.c | 2 +-
> criu/pie/parasite.c | 2 +-
> criu/pie/pie-relocs.h | 2 +-
> criu/pie/restorer.c | 2 +-
> criu/seccomp.c | 2 +-
> criu/shmem.c | 2 +-
> criu/sk-tcp.c | 2 +-
> soccr/soccr.h | 2 +-
> 23 files changed, 25 insertions(+), 30 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index d1725af2de60..0486689057e6 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -28,10 +28,8 @@ criu/arch/*/sys-exec-tbl*.c
> # x86 syscalls-table is not generated
> !criu/arch/x86/sys-exec-tbl.c
> criu/arch/*/syscalls*.S
> -criu/include/config.h
> criu/include/syscall-codes*.h
> criu/include/syscall*.h
> -soccr/config.h
> criu/include/version.h
> criu/pie/restorer-blob.h
> criu/pie/parasite-blob.h
> @@ -42,3 +40,4 @@ scripts/build/qemu-user-static/*
> lib/.crit-setup.files
> compel/include/asm
> include/common/asm
> +include/common/config.h
> diff --git a/Makefile b/Makefile
> index 848cf0fca920..cb5731a39c46 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -173,7 +173,7 @@ criu-deps += include/common/asm
>
> #
> # Configure variables.
> -export CONFIG_HEADER := criu/include/config.h
> +export CONFIG_HEADER := include/common/config.h
> ifeq ($(filter tags etags cscope clean mrproper,$(MAKECMDGOALS)),)
> include Makefile.config
> else
> @@ -197,13 +197,10 @@ include Makefile.compel
> # Next the socket CR library
> #
> SOCCR_A := soccr/libsoccr.a
> -SOCCR_CONFIG := soccr/config.h
> -$(SOCCR_CONFIG): $(CONFIG_HEADER)
> - $(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
> soccr/Makefile: ;
> -soccr/%: $(SOCCR_CONFIG) .FORCE
> +soccr/%: $(CONFIG_HEADER) .FORCE
> $(Q) $(MAKE) $(build)=soccr $@
> -soccr/built-in.o: $(SOCCR_CONFIG) .FORCE
> +soccr/built-in.o: $(CONFIG_HEADER) .FORCE
> $(Q) $(MAKE) $(build)=soccr all
> $(SOCCR_A): |soccr/built-in.o
> criu-deps += $(SOCCR_A)
> @@ -256,7 +253,6 @@ clean: clean-top
>
> mrproper-top: clean-top
> $(Q) $(RM) $(CONFIG_HEADER)
> - $(Q) $(RM) $(SOCCR_CONFIG)
> $(Q) $(RM) $(VERSION_HEADER)
> $(Q) $(RM) $(COMPEL_VERSION_HEADER)
> $(Q) $(RM) include/common/asm
> diff --git a/criu/cgroup-props.c b/criu/cgroup-props.c
> index 251c4631e7c7..f7032bd7e94d 100644
> --- a/criu/cgroup-props.c
> +++ b/criu/cgroup-props.c
> @@ -9,10 +9,10 @@
> #include <sys/stat.h>
>
> #include "int.h"
> +#include "common/config.h"
> #include "common/compiler.h"
> #include "cgroup-props.h"
> #include "cr_options.h"
> -#include "config.h"
> #include "xmalloc.h"
> #include "string.h"
> #include "util.h"
> diff --git a/criu/filesystems.c b/criu/filesystems.c
> index 8211e396a9f3..5a88788d710d 100644
> --- a/criu/filesystems.c
> +++ b/criu/filesystems.c
> @@ -4,7 +4,7 @@
> #include <fcntl.h>
> #include <sys/mount.h>
>
> -#include "config.h"
> +#include "common/config.h"
> #include "int.h"
> #include "common/compiler.h"
> #include "xmalloc.h"
> diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
> index 4e4a1d0a6b00..bc74b39a9b7c 100644
> --- a/criu/include/cr_options.h
> +++ b/criu/include/cr_options.h
> @@ -2,7 +2,7 @@
> #define __CR_OPTIONS_H__
>
> #include <stdbool.h>
> -#include "config.h"
> +#include "common/config.h"
> #include "common/list.h"
>
> /*
> diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h
> index ff10228c36a0..7ba545d2ae72 100644
> --- a/criu/include/kerndat.h
> +++ b/criu/include/kerndat.h
> @@ -3,7 +3,7 @@
>
> #include <stdbool.h>
> #include "int.h"
> -#include "config.h"
> +#include "common/config.h"
> #ifdef CONFIG_VDSO
> #include "util-vdso.h"
> #endif
> diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
> index bbd3e34a6c08..d5fad184353c 100644
> --- a/criu/include/parasite-syscall.h
> +++ b/criu/include/parasite-syscall.h
> @@ -3,7 +3,7 @@
>
> #include "pid.h"
> #include "common/list.h"
> -#include "config.h"
> +#include "common/config.h"
> #include "asm/parasite-syscall.h"
>
> struct parasite_dump_thread;
> diff --git a/criu/include/parasite-vdso.h b/criu/include/parasite-vdso.h
> index 2a7f10ed298c..31980565db83 100644
> --- a/criu/include/parasite-vdso.h
> +++ b/criu/include/parasite-vdso.h
> @@ -1,7 +1,7 @@
> #ifndef __CR_PARASITE_VDSO_H__
> #define __CR_PARASITE_VDSO_H__
>
> -#include "config.h"
> +#include "common/config.h"
>
> #ifdef CONFIG_VDSO
>
> diff --git a/criu/include/ptrace-compat.h b/criu/include/ptrace-compat.h
> index b23df2dfde3b..476da3536b8c 100644
> --- a/criu/include/ptrace-compat.h
> +++ b/criu/include/ptrace-compat.h
> @@ -3,7 +3,7 @@
>
> #include <compel/ptrace.h>
> #include <linux/types.h>
> -#include "config.h"
> +#include "common/config.h"
>
> #ifndef CONFIG_HAS_PTRACE_PEEKSIGINFO
> struct ptrace_peeksiginfo_args {
> diff --git a/criu/include/restorer.h b/criu/include/restorer.h
> index ac0b4e1f4d18..8cb90b6f1ff8 100644
> --- a/criu/include/restorer.h
> +++ b/criu/include/restorer.h
> @@ -5,6 +5,7 @@
> #include <limits.h>
> #include <sys/resource.h>
>
> +#include "common/config.h"
> #include "types.h"
> #include "int.h"
> #include "types.h"
> @@ -13,7 +14,6 @@
> #include "common/lock.h"
> #include "util.h"
> #include "asm/restorer.h"
> -#include "config.h"
> #include "posix-timer.h"
> #include "timerfd.h"
> #include "shmem.h"
> diff --git a/criu/include/string.h b/criu/include/string.h
> index f9b4a38289aa..bc5f9d21967a 100644
> --- a/criu/include/string.h
> +++ b/criu/include/string.h
> @@ -7,7 +7,7 @@
> # include <bsd/string.h>
> #endif
>
> -#include "config.h"
> +#include "common/config.h"
>
> #ifndef CONFIG_HAS_STRLCPY
> extern size_t strlcpy(char *dest, const char *src, size_t size);
> diff --git a/criu/include/vdso.h b/criu/include/vdso.h
> index b6110e442e04..11038242d102 100644
> --- a/criu/include/vdso.h
> +++ b/criu/include/vdso.h
> @@ -4,7 +4,7 @@
> #include <sys/mman.h>
> #include <stdbool.h>
>
> -#include "config.h"
> +#include "common/config.h"
>
> #ifdef CONFIG_VDSO
>
> diff --git a/criu/kerndat.c b/criu/kerndat.c
> index 85f4256547a5..93152a8044db 100644
> --- a/criu/kerndat.c
> +++ b/criu/kerndat.c
> @@ -14,6 +14,7 @@
> #include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
> #include <sys/prctl.h>
>
> +#include "common/config.h"
> #include "int.h"
> #include "log.h"
> #include "restorer.h"
> @@ -26,7 +27,6 @@
> #include "util.h"
> #include "lsm.h"
> #include "proc_parse.h"
> -#include "config.h"
> #include "sk-inet.h"
> #include "sockets.h"
> #include "net.h"
> diff --git a/criu/lsm.c b/criu/lsm.c
> index 2d77f62771d3..fd098581ffe7 100644
> --- a/criu/lsm.c
> +++ b/criu/lsm.c
> @@ -5,8 +5,8 @@
> #include <sys/types.h>
> #include <unistd.h>
>
> +#include "common/config.h"
> #include "kerndat.h"
> -#include "config.h"
> #include "pstree.h"
> #include "util.h"
> #include "cr_options.h"
> diff --git a/criu/page-pipe.c b/criu/page-pipe.c
> index 63c5a8a75019..a47119b180f8 100644
> --- a/criu/page-pipe.c
> +++ b/criu/page-pipe.c
> @@ -3,8 +3,8 @@
> #undef LOG_PREFIX
> #define LOG_PREFIX "page-pipe: "
>
> +#include "common/config.h"
> #include "page.h"
> -#include "config.h"
> #include "util.h"
> #include "criu-log.h"
> #include "page-pipe.h"
> diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
> index 69dba60dffe9..89ec06f532ee 100644
> --- a/criu/parasite-syscall.c
> +++ b/criu/parasite-syscall.c
> @@ -5,6 +5,7 @@
> #include <sys/wait.h>
> #include <sys/mman.h>
>
> +#include "common/config.h"
> #include "common/compiler.h"
> #include "types.h"
> #include "protobuf.h"
> @@ -20,7 +21,6 @@
> #include "crtools.h"
> #include "namespaces.h"
> #include "kerndat.h"
> -#include "config.h"
> #include "pstree.h"
> #include "posix-timer.h"
> #include "mem.h"
> diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
> index 78bbe9e3b66c..8e4c805f21e3 100644
> --- a/criu/pie/parasite.c
> +++ b/criu/pie/parasite.c
> @@ -7,11 +7,11 @@
> #include <stdarg.h>
> #include <sys/ioctl.h>
>
> +#include "common/config.h"
> #include "int.h"
> #include "types.h"
> #include <compel/plugins/std/syscall.h>
> #include "parasite.h"
> -#include "config.h"
> #include "fcntl.h"
> #include "prctl.h"
> #include "common/lock.h"
> diff --git a/criu/pie/pie-relocs.h b/criu/pie/pie-relocs.h
> index 5a18d8c9dea9..6797486c2df0 100644
> --- a/criu/pie/pie-relocs.h
> +++ b/criu/pie/pie-relocs.h
> @@ -3,8 +3,8 @@
>
> #include <compel/compel.h>
>
> +#include "common/config.h"
> #include "common/compiler.h"
> -#include "config.h"
>
> #define pie_size(__pie_name) (round_up(sizeof(__pie_name##_blob) + \
> __pie_name ## _nr_gotpcrel * sizeof(long), page_size()))
> diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
> index efcac8389e79..a6953412ca45 100644
> --- a/criu/pie/restorer.c
> +++ b/criu/pie/restorer.c
> @@ -19,6 +19,7 @@
>
> #include "linux/userfaultfd.h"
>
> +#include "common/config.h"
> #include "int.h"
> #include "types.h"
> #include "common/compiler.h"
> @@ -26,7 +27,6 @@
> #include <compel/plugins/std/log.h>
> #include <compel/ksigset.h>
> #include "signal.h"
> -#include "config.h"
> #include "prctl.h"
> #include "criu-log.h"
> #include "util.h"
> diff --git a/criu/seccomp.c b/criu/seccomp.c
> index c5e7a7d93813..6416e793c61f 100644
> --- a/criu/seccomp.c
> +++ b/criu/seccomp.c
> @@ -3,7 +3,7 @@
> #include <sys/wait.h>
> #include <unistd.h>
>
> -#include "config.h"
> +#include "common/config.h"
> #include "imgset.h"
> #include "kcmp.h"
> #include "pstree.h"
> diff --git a/criu/shmem.c b/criu/shmem.c
> index 2de8cb422263..013811635708 100644
> --- a/criu/shmem.c
> +++ b/criu/shmem.c
> @@ -4,6 +4,7 @@
> #include <fcntl.h>
> #include <stdbool.h>
>
> +#include "common/config.h"
> #include "common/list.h"
> #include "pid.h"
> #include "shmem.h"
> @@ -15,7 +16,6 @@
> #include "rst-malloc.h"
> #include "vma.h"
> #include "mem.h"
> -#include "config.h"
> #include <compel/plugins/std/syscall-codes.h>
> #include "bitops.h"
> #include "log.h"
> diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
> index 13853bbe4d9e..3f934249576f 100644
> --- a/criu/sk-tcp.c
> +++ b/criu/sk-tcp.c
> @@ -8,6 +8,7 @@
>
> #include "../soccr/soccr.h"
>
> +#include "common/config.h"
> #include "cr_options.h"
> #include "util.h"
> #include "common/list.h"
> @@ -19,7 +20,6 @@
> #include "image.h"
> #include "namespaces.h"
> #include "xmalloc.h"
> -#include "config.h"
> #include "kerndat.h"
> #include "restorer.h"
> #include "rst-malloc.h"
> diff --git a/soccr/soccr.h b/soccr/soccr.h
> index c9d138bfc194..2c34e169b2e7 100644
> --- a/soccr/soccr.h
> +++ b/soccr/soccr.h
> @@ -5,7 +5,7 @@
> #include <stdint.h> /* uint32_t */
> #include <sys/socket.h> /* sockaddr */
>
> -#include "config.h"
> +#include "common/config.h"
>
> /* All packets with this mark have not to be blocked. */
> #define SOCCR_MARK 0xC114
> --
> 2.13.1
>
More information about the CRIU
mailing list