fifo: Fix false failure on fifo image reading

The ret var is set to -1 at the beginning and the very first loop
will break and report it to the caller thus stopping the restore :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ghost-files: Merge dump and restore helper structs

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inet: Report error if inet socket collect failed

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe: Remove ID arg from pipe data dump fn

This routine checks for pipe data being dumped based on pipe ID, but the arg in questoin
is the pipe's end ID which makes code reading confusing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe: Don't intermix pipe and fifo data when dumping

The existing code checks for ID to be already dumped. But pipe and fifo may have the same ID
since they reside on different filesystems.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe/fifo: Fix and cleanup data restore

Make it in two stages.

First -- collect pipe data into hash without checking for pipe/fifo existance.
Next -- when pipe/fifo gets restored walk the hash and search where the pipe data
is.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe/fifo: Remove unused members from rst structures

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Wait for test finish with increasing intervals

This makes tests that finish some time run smoother -- no tons of Waiting... messages
on the screen

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
event*: Move proc parsing stuff to proc_parse

And prepare it for inotify (oh my...)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inotify: Wire into and use Generic fdinfo parsing engine

With this the code looks clearer and finally a ground for "check" code is prepared.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add check for evetfd is shown proerly in fdinfo

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Fix set_mm_exe_file prctl retcode

Now it is EBADF for bogus descriptor we pass

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add check for epoll is shown proerly in fdinfo

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add check for inotify is shown proerly in fdinfo

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe: Add helper for getting pipe_id from fdparms

Just to explicitly state that a pipe ID is its inode number.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipe: Shorten array for self link path

To open /proc/self/fd/%d PATH_MAX array is too long :) We can use shorter.
Plus fix the snprintf size argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
util: Shorten array for anon_inode link checking

Strictly speaking the fd link can point to PATH_MAX string, but for the sake of
is_anonfd_link 32 bytes is enough -- even if the target string is longer it will not
match the required anon_inode:xxx string.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipes: Use pde as a reference in pipe_data_rst

Need it for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pipes: Plug memory leak on pipd data image EOF

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
util: More traditional xfree macro

Using do { } while (0) for statemets macro like this is a good practice.

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