2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 00:35:23 +00:00

unix: Add support for shutdown sockets

Get the info from kernel diag message (it should always be there)
and restore the shutdown at the very end.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-10-24 18:31:42 +04:00
parent 223dce83c2
commit 8471081244
5 changed files with 84 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#define CR_SOCKETS_H__
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdbool.h>
@@ -59,5 +60,20 @@ extern int do_dump_opt(int sk, int level, int name, void *val, int len);
extern int do_restore_opt(int sk, int level, int name, void *val, int len);
#define restore_opt(s, l, n, f) do_restore_opt(s, l, n, f, sizeof(*f))
#define sk_encode_shutdown(img, mask) do { \
/* \
* protobuf SK_SHUTDOWN__ bits match those \
* reported by kernel \
*/ \
(img)->shutdown = mask; \
if ((img)->shutdown != SK_SHUTDOWN__NONE) \
(img)->has_shutdown = true; \
} while (0)
static inline int sk_decode_shutdown(int val)
{
static const int hows[] = {-1, SHUT_RD, SHUT_WR, SHUT_RDWR};
return hows[val];
}
#endif /* CR_SOCKETS_H__ */