zdtm: uptime_grow test

new testcase important for rebootless update testing:
we query system timer CLOCK_MONOTONIC continuously
and fail in case it stepped backwards

Signed-off-by: Evgeny Antyshev <eantyshev@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Escape using unsafe sprintf helper

Util it's very critical for speed we should
not use unsafe sprintf helper, we're root-granted
program and must be as safe as possible.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fd: Remove ID from fd_parm

It's only required for making pipe_id, but making it is better to
be done in place and using the st_ino only.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fd: Cleanup in dump_one_file

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sk: Do not lookup a socket twice

The socket_desc is being looked up in dump_unix/dump_inet. In
the dump_socket this desc is only required to obtain a family,
which in turn can be done with a getsockopt.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: fix adding test cases to the list

bash returned the error : No such file or directory
and doesn't add three test cases to the list.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Move regular files handling code to files-reg

Instead of spreading regular files handling code over
files.c and cr-dump.c move it to files-reg.c.

This allows to extend regular file handling code in
future without disturbing other source files and
make code logically coupled, where files.c is mostly
a place for general file handling code unrelated to
file type specifics.

While mostly it was code tossing there is some change
I have to notice -- the structure ghost_file was previously
declared in two paces cr-dump.c and files.c, in cr-dump.c
it was used for dumping while in files.c it was used
for restore. The structure had different members.

So to resolve this conflict the ghost_file structure
was renamed to ghost_file_dumpee.

Nothing else is changed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files-reg: Use stack variable in dump_one_reg_file

No need to carry static per-file variable, we need
it in one non-recursive function only so make it
stack based instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files-reg: Add missing new line before open_reg_by_id helper

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files-reg: Align and reorder structure members

This eliminates holes in structures. No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files-reg: Eliminate memory leak in open_remap_ghost on errors

xmalloc'ed gf and gf->path are not freed if something failed.
Not a big deal since we're ususally interrupt program execution
on error and do exit, but anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: remove unused code from sockets_dgram

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Victor konyashkin <vkonyashkin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
dump: rename dump_tid_addr to dump_tid_info

because now it cares about tid_addr and thread id.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
crtools: add comments to fields of struct pid

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