vma: Vma allocation helper is now function

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vma: Use vma_area_is helper where appropriate

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
proc_parse: Speedup VMA range parsing

In /proc/<pid>/smaps/ output we may omit testing
for capital hex letters, since we know the format
kernel provides.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mem: Move shmem preparation routine and rename

We'll collect VmaEntries early before fork.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Collect VmaEntries only once on restore

Right now we do it two times -- on shmem prepare and
on the restore itself. Make collection only once as
we do for fdinfo-s -- root task reads all stuff in and
populates tasks' rst_info with it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: config add test for ptrace_peeksiginfo_args

Currently we check PTRACE_PEEKSIGINFO and if it's defined in a system
header, we suppose that ptrace_peeksiginfo_args is defined there too.

But due to a bug in glibc, this check doesn't work. Now we have F20,
where ptrace_peeksiginfo_args is defined in sys/ptrace and F21 where
it isn't defined.

commit 9341dde4d56ca71b61b47c8b87a06e6d5813ed0e
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jan 5 16:07:13 2014 -0500

    ptrace.h: add __ prefix to ptrace_peeksiginfo_args

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: add a bit more messages in error cases

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vma: Use vma_area_is helper where appropriate (p2)

Lost from c8d5f1a2

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
dump: Merge mm and vmas dumping functions

The plan is to merge vma images into mm ones (see further
patching), so prepare the dumping code for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vma: Turn embeded VmaEntry on vma_area into pointer

On restore we will read all VmaEntries in one big MmEntry object,
so to avoif copying them all into vma_areas, make them be pointable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vma: Don't copy VmaEntry on vma_area

After previous patch is't now possible.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mm: Read mmentry early

We'll merge mm and vma images, so mm should be read in the
same place where vmas are.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mm: Move VmaEntries from separate image into Mm one

When writing VMAs we perform too many small writes into vma-.img files.
This can be easily fixed by moving the vma-s into mm-s, all the more
so they cannot be splitted from each other.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pb: Don't crash when showing empty repeated field

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vma: Backward compatible VMA restore

If we've found zero VMAs in MmEntry try to look for
VMAs in vma-.img image file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
stats: Fix restore pages stats

We errorneously report nr_compared as total number of restored pages.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
chdir: need to check return value

otherwise it won't compile:

util.c: In function ‘cr_daemon’:
util.c:594:8: error: ignoring return value of ‘chdir’, declared
with attribute warn_unused_result [-Werror=unused-result]
   chdir("/");
        ^

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
service: Add work_dir support

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
libcriu: add work_dir support

As we've added work_dir_fd to RPC, lets add support for it to libcriu.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: don't write more than buffer size

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>