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:
@@ -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__ */
|
||||
|
Reference in New Issue
Block a user