make: Generate crtools version from Makefile definition

This allows us to have a unique place where version lives
and what is more important other subsystems (such as docs
generation) may reuse version definitions.

At moment EXTRA (which corresponds kernels -rc tag) and
NAME is not yet used, but I desided to put them in place
for future needs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
dump: Make sure we're dumping task not running in compat mode

It's been reported that we do not test if the tracee is 32bit
task running kn 64bit kernel. This patch adds such test.

https://bugzilla.openvz.org/show_bug.cgi?id=2505

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
tcp: dump and restore tcp_timestamp for each socket (v2)

If a TCP socket will get live-migrated from one box to another the
timestamps (which are typically ON) will get screwed up -- the new
kernel will generate TS values that has nothing to do with what they
were on dump. The solution is to yet again fix the kernel and put a
"timestamp offset" on a socket.

v2: don't fail if TCP_TIMESTAMP is unsupported

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Check for ability to get tcp timestamp

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
headers: Change "../protobuf/" to "protobuf/"

No need to walk up the directories if we need
to include protobuf file. This was always a bad
use of ability to walk the filesystem from other
headers.

Same time we don't need -I$(SRC_DIR)/protobuf/
in general makefile anymore.

[xemul: Small fixlet in head Makefile, since patch
 it out-of-order]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
include/compiler.h: Cleanup

- Drop parasite \Space in NORETURN definition
- Align likely/unlikely

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Drop -r flag from $(RM)

It's already defined as RM := rm -f

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Define dummy target for scripts/Makefile.version

At moment built-in .SUFFIXES variable is not cleaned
which slows down the building procedure. Add a dummy
rule thus the make won't try to lookup rules for
scripts/Makefile.version (this happens when last
resort rule is used).

Note that this is rather a stub for future convenience
which doesn't affect much current build procedure.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Add scripts/Makefile.rules

This helpers will be used in rules generation
for new make infrastructure.

At moment only a few helpers here -- to compile
*.c and *.S files, and generate *.d,*.s,*.i files.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Add scripts/Makefile.build

This script is engine for simplified Makefiles.
I tried to make it somewhat close to what is used
to build linux kernel.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
docs: Add documentation about scritps/Makefile.build

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: arch -- Switch to a new build scheme

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: protobuf -- Switch to a new scheme

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: pie -- Switch to a new scheme

Because we need util-net.c for both PIE code and
a regular code, just move it to pie/ directory
and build with -fpie option, this way we can reuse
compiled file in main program without additional
compilation pass.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: No need for shell call, use CURDIR builtin instead

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Use relative pathes where possible

We're building project from toplevel directory so
no need for absolute paths.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Switch main Makefile to simplified form

This is a bit tricky since the build infrastructure
we're switching to is targeted to per-directory targets
if simplified Makefiles are used.

So I did the following

 - move rules to compile general sources to Makefile.crtools
 - main Makefiles now simply calls for scritps/Makefile.build
   help to generate built-in.o target

Also note that we clean up suffixes for implicit rules with

	.SUFFIXES:

this is done on purpose to eliminate any possible side effect
in future -- all rules _must_ be described explicitly.

Because of implicit rules used in zdtm building procedure
I can't use of stict makefile mode and add

	MAKEFLAGS := -r

to the top of the general Makefile. This should be done
one day latter (if ever).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: docs -- Append manpages generation

I occasionally used assignments instead of
appending manpages for generation. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
docs: crtools -- Use bold format for parameters

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
lock: Move inline attribute before function type

That's correct syntax.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>