mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
service: Put service sk inode into separate variable
I'm about to get rid of service state struct. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "cr-service.h"
|
||||
|
||||
struct _cr_service_client *cr_service_client;
|
||||
unsigned int service_sk_ino = 0;
|
||||
|
||||
static int recv_criu_msg(int socket_fd, CriuReq **msg)
|
||||
{
|
||||
@@ -94,7 +95,8 @@ static int setup_dump_from_req(int sk, CriuDumpReq *req)
|
||||
return -1;
|
||||
}
|
||||
|
||||
cr_service_client->sk_ino = st.st_ino;
|
||||
BUG_ON(st.st_ino == 0);
|
||||
service_sk_ino = st.st_ino;
|
||||
|
||||
/* going to dir, where to place images*/
|
||||
sprintf(images_dir_path, "/proc/%d/fd/%d", ids.pid, req->images_dir_fd);
|
||||
|
@@ -11,10 +11,10 @@ int cr_service(bool deamon_mode);
|
||||
int send_criu_dump_resp(int socket_fd, bool success, bool restored);
|
||||
|
||||
struct _cr_service_client {
|
||||
int sk_ino;
|
||||
int uid;
|
||||
};
|
||||
|
||||
extern struct _cr_service_client *cr_service_client;
|
||||
extern unsigned int service_sk_ino;
|
||||
|
||||
#endif
|
||||
|
@@ -88,11 +88,6 @@ static void show_one_unix_img(const char *act, const UnixSkEntry *e)
|
||||
act, e->id, e->ino, e->peer, e->type, e->state, (int)e->name.len);
|
||||
}
|
||||
|
||||
static bool service_socket(unsigned int sk_ino)
|
||||
{
|
||||
return cr_service_client && (cr_service_client->sk_ino == sk_ino);
|
||||
}
|
||||
|
||||
static int can_dump_unix_sk(const struct unix_sk_desc *sk)
|
||||
{
|
||||
/*
|
||||
@@ -156,7 +151,7 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
|
||||
* Check if this socket is connected to criu service.
|
||||
* Dump it like closed one and mark it for restore.
|
||||
*/
|
||||
if (service_socket(ue.peer)) {
|
||||
if (unlikely(ue.peer == service_sk_ino)) {
|
||||
ue.state = TCP_CLOSE;
|
||||
ue.peer = 0;
|
||||
ue.uflags |= USK_SERVICE;
|
||||
|
Reference in New Issue
Block a user