2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 11:57:52 +00:00

8 Commits

Author SHA1 Message Date
Kirill Tkhai
d3ea14a125 scm: Allow to pass flags argument to recv_fds()
This will be used to pass MSG_DONTWAIT in next patch.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-03 18:04:22 +03:00
Kirill Tkhai
6a3cfcd550 scm: Return sensible error codes in recv_fds()
Replace "-1" return with errno codes.

ENOMSG and EBADFD were choosen to do not cross with
standard recvmsg() errors (described in its man page).

This patch is need as preparation to making recv_msg()
be able to be non-block, and return EAGAIN and EWOULDBLOCK
in case of no data.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-03 18:04:22 +03:00
Pavel Emelyanov
60738eaa78 files: Rework send/recv-fds to be more generic
Remove getting opts from descriptors out from scm engine,
this stuff is pure criu thing, so make it collect the data.

The tricky change here is that parasite code needs memory
to keep fd_opts on. The memory is taken from parasite args
region, which is now bigger than it used to be. But that's
not a big deal, as previously this space was allocated on
the parasite stack (!, but with smaller chunks).

On the other hand, now we have one memcpy less, as opts are
put directly into the destination buffer.

travis-ci: success for files: Rework send/recv-fds to be more generic
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:22:19 +03:00
Cyrill Gorcunov
a1f674e34b scm: common -- Hide struct fd_opts argument
When SCM_FDSET_HAS_OPTS is not set the scm-code.c
can't be built because it declares struct fd_opts
in parameters. Lets rather hide this type and
allow to build without SCM_FDSET_HAS_OPTS definition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:07:50 +03:00
Cyrill Gorcunov
187377a526 scm: scm_fdset_init -- Drop unused @with_flags argument
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:07:41 +03:00
Pavel Emelyanov
7279c0e7b4 scm: Compile out opts management
In pure-compel library messing with opts is not required,
only criu and criu's pie will need it, so make it possible
to compile out common/scm-code's opts management.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:07:15 +03:00
Pavel Emelyanov
bc102ea1bf scm: Define __memcpy
Depending on the code using it, memcpy will be different.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:07:06 +03:00
Pavel Emelyanov
554d0f0ab4 scm: Move fd-sending core code AS IS into include/common/
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-12 16:06:50 +03:00