pre-dump: avoid sleeping in the open() syscall

For example opening the FIFO blocks until the other end is opened also.

We can use O_PATH to avoid sleeping in the open() call.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
core: Allocate CoreEntry (except arch) with single xmalloc

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
core: Allocate x76 core entry with single (almost) xmalloc

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
core: Don't free not-allocated thread_info

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
x86: Fix compiler warning

arch/x86/crtools.c: In function ‘arch_alloc_thread_info’:
arch/x86/crtools.c:271:6: error: ‘with_xsave’ may be used uninitialized in this function [-Werror=uninitialized]

Actually the with_xsave is with_fpu dependant, but some gccs
can't guess that fact :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
image: open_image_at -- Add O_OPT flag

This allows us to distinguish the situation where image
to be opened is missing but optional, thus no error message
should be printed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: protobuf -- Add task_rlimits member to Core

We will carry rlimits inside Core itself instead of separate image.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: Allocate and free appropriate Core entry, v2

On Thu, Mar 13, 2014 at 04:20:37PM +0400, Pavel Emelyanov wrote:
>
> Would you rework this patch on top of my recent
> "allocate Core in on xmalloc call" one?

Attached.

>From c2233d4fafce30c4e7214a1a7ab3677824a30d75 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@openvz.org>
Date: Thu, 13 Mar 2014 16:57:14 +0400
Subject: [PATCH] rlimit: Allocate and free appropriate Core entry

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: Dump task rlimits into Core entry

Note the restore remains as is for a while, it'll
be addressed later.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: Restore rlimist from Core data

To save backward compatibility try to read
data from old image if Core entry doesn't
has rlimits bound.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: Stop writting old rlimits image entries

We're using new image format, but old image file
is still generated. This will be addressed in
next patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlimit: Move CR_FD_RLIMIT out of _CR_FD_TASK, v2

On Thu, Mar 13, 2014 at 02:30:50PM +0400, Cyrill Gorcunov wrote:
>
> This image is deprecated now so move it out of
> _CR_FD_TASK thus we won't be even generating it
> on the dump.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>

Updated

>From cb9c3953beac7d42de80635e7a6e537cc867c479 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@openvz.org>
Date: Thu, 13 Mar 2014 14:24:50 +0400
Subject: [PATCH 7/7] rlimit: Move CR_FD_RLIMIT out of _CR_FD_TASK

This image is deprecated now so move it out of
_CR_FD_TASK thus we won't be even generating it
on the dump.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rlims: Unscrew up core->rlimits[i] assignment

The array element is RlimitEntry properly initialized,
no need in additional memcpy-s and size-checks.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>