<div dir="ltr">Sorry for the confusion.<div><br></div><div>I mean t<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.666666984558105px">his is intended for a simple criu library implementation.</span></div>
<div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.666666984558105px"><br></span></div><div><font color="#500050" face="arial, sans-serif"><span style="font-size:12.666666984558105px">The following patch will generate a static library for criu.</span></font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 14, 2013 at 12:52 PM, Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 08/14/2013 10:09 PM, Yicheng Qin wrote:<br>
> Replace main() with criu_main(), and put main() function under<br>
> new 'main' directory.<br>
><br>
> Include some standard header files in list.h and util.h to resolve<br>
> lack of symbol.<br>
><br>
> This is intended for a simple criu binary implementation.<br>
<br>
</div>I don't quite understand where the simplicity is. We have the same<br>
binary after all, but require +26 lines.<br>
<br>
Presumably this is some preparation patch, isn't it? Can you explain<br>
what the final goal is?<br>
<div class="HOEnZb"><div class="h5"><br>
> Signed-off-by: Yicheng Qin <<a href="mailto:yichengq@google.com">yichengq@google.com</a>><br>
> ---<br>
> Makefile | 14 +++++++++++---<br>
> crtools.c | 2 +-<br>
> include/crtools.h | 2 ++<br>
> include/list.h | 1 +<br>
> include/util.h | 1 +<br>
> main/Makefile | 1 +<br>
> main/criu.c | 9 +++++++++<br>
> 7 files changed, 26 insertions(+), 4 deletions(-)<br>
> create mode 100644 main/Makefile<br>
> create mode 100644 main/criu.c<br>
><br>
> diff --git a/Makefile b/Makefile<br>
> index fecc7f5..8e34770 100644<br>
> --- a/Makefile<br>
> +++ b/Makefile<br>
> @@ -120,7 +120,7 @@ build-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj<br>
> PROGRAM := criu<br>
><br>
> .PHONY: all zdtm test rebuild clean distclean tags cscope \<br>
> - docs help pie protobuf arch/$(ARCH) clean-built lib<br>
> + docs help pie protobuf arch/$(ARCH) clean-built lib main<br>
><br>
> ifeq ($(GCOV),1)<br>
> %.o $(PROGRAM): override CFLAGS += --coverage<br>
> @@ -132,7 +132,12 @@ all: config pie $(VERSION_HEADER) lib<br>
> lib: $(VERSION_HEADER)<br>
> $(Q) $(MAKE) -C lib all<br>
><br>
> -protobuf/%::<br>
> +main/%::<br>
> + $(Q) $(MAKE) $(build)=main $@<br>
> +main:<br>
> + $(Q) $(MAKE) $(build)=main all<br>
> +<br>
> +protobuf/%:: main<br>
> $(Q) $(MAKE) $(build)=protobuf $@<br>
> protobuf:<br>
> $(Q) $(MAKE) $(build)=protobuf all<br>
> @@ -152,6 +157,8 @@ pie: arch/$(ARCH)<br>
> built-in.o: $(VERSION_HEADER) pie<br>
> $(Q) $(MAKE) $(build-crtools)=. $@<br>
><br>
> +MAIN-BUILTINS += main/built-in.o<br>
> +<br>
> PROGRAM-BUILTINS += pie/util.o<br>
> PROGRAM-BUILTINS += protobuf/built-in.o<br>
> PROGRAM-BUILTINS += built-in.o<br>
> @@ -160,7 +167,7 @@ $(ARCH_DIR)/vdso-pie.o: pie<br>
> $(Q) $(MAKE) $(build)=pie $(ARCH_DIR)/vdso-pie.o<br>
> PROGRAM-BUILTINS += $(ARCH_DIR)/vdso-pie.o<br>
><br>
> -$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS)<br>
> +$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS) $(MAIN-BUILTINS)<br>
> $(E) " LINK " $@<br>
> $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) -o $@<br>
><br>
> @@ -173,6 +180,7 @@ test: zdtm<br>
> clean-built:<br>
> $(Q) $(RM) $(VERSION_HEADER)<br>
> $(Q) $(MAKE) $(build)=arch/$(ARCH) clean<br>
> + $(Q) $(MAKE) $(build)=main clean<br>
> $(Q) $(MAKE) $(build)=protobuf clean<br>
> $(Q) $(MAKE) $(build)=pie clean<br>
> $(Q) $(MAKE) $(build-crtools)=. clean<br>
> diff --git a/crtools.c b/crtools.c<br>
> index c7bc8b4..e76b429 100644<br>
> --- a/crtools.c<br>
> +++ b/crtools.c<br>
> @@ -60,7 +60,7 @@ bad_ns:<br>
> return -1;<br>
> }<br>
><br>
> -int main(int argc, char *argv[])<br>
> +int criu_main(int argc, char *argv[])<br>
> {<br>
> pid_t pid = 0, tree_id = 0;<br>
> int ret = -1;<br>
> diff --git a/include/crtools.h b/include/crtools.h<br>
> index 65ed166..1cdc35f 100644<br>
> --- a/include/crtools.h<br>
> +++ b/include/crtools.h<br>
> @@ -190,4 +190,6 @@ static inline int in_vma_area(struct vma_area *vma, unsigned long addr)<br>
> addr < (unsigned long)vma->vma.end;<br>
> }<br>
><br>
> +int criu_main(int argc, char *argv[]);<br>
> +<br>
> #endif /* __CR_CRTOOLS_H__ */<br>
> diff --git a/include/list.h b/include/list.h<br>
> index 32d8edd..5af1093 100644<br>
> --- a/include/list.h<br>
> +++ b/include/list.h<br>
> @@ -5,6 +5,7 @@<br>
> * Double linked lists.<br>
> */<br>
><br>
> +#include <stdlib.h><br>
> #include "compiler.h"<br>
><br>
> #define POISON_POINTER_DELTA 0<br>
> diff --git a/include/util.h b/include/util.h<br>
> index 3475700..ddeb716 100644<br>
> --- a/include/util.h<br>
> +++ b/include/util.h<br>
> @@ -4,6 +4,7 @@<br>
> /*<br>
> * Some bits are stolen from perf and kvm tools<br>
> */<br>
> +#include <unistd.h><br>
> #include <signal.h><br>
> #include <stdio.h><br>
> #include <errno.h><br>
> diff --git a/main/Makefile b/main/Makefile<br>
> new file mode 100644<br>
> index 0000000..868d526<br>
> --- /dev/null<br>
> +++ b/main/Makefile<br>
> @@ -0,0 +1 @@<br>
> +obj-y += criu.o<br>
> diff --git a/main/criu.c b/main/criu.c<br>
> new file mode 100644<br>
> index 0000000..398a59f<br>
> --- /dev/null<br>
> +++ b/main/criu.c<br>
> @@ -0,0 +1,9 @@<br>
> +#include "crtools.h"<br>
> +<br>
> +/*<br>
> + * Entry point to criu_main<br>
> + */<br>
> +int main(int argc, char *argv[])<br>
> +{<br>
> + return criu_main(argc, argv);<br>
> +}<br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div>