Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
f674cbd6
Commit
f674cbd6
authored
Mar 24, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unix: Collect packets via cinfo engine
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
508cb933
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
41 deletions
+22
-41
cr-restore.c
criu/cr-restore.c
+3
-2
sk-queue.h
criu/include/sk-queue.h
+1
-1
sockets.h
criu/include/sockets.h
+0
-1
sk-queue.c
criu/sk-queue.c
+18
-32
sk-unix.c
criu/sk-unix.c
+0
-5
No files found.
criu/cr-restore.c
View file @
f674cbd6
...
...
@@ -76,6 +76,8 @@
#include "seccomp.h"
#include "bitmap.h"
#include "fault-injection.h"
#include "sk-queue.h"
#include "parasite-syscall.h"
#include "protobuf.h"
...
...
@@ -178,6 +180,7 @@ static struct collect_image_info *cinfos[] = {
&
ext_file_cinfo
,
&
timerfd_cinfo
,
&
file_locks_cinfo
,
&
sk_queues_cinfo
,
};
struct
post_prepare_cb
{
...
...
@@ -242,8 +245,6 @@ static int root_prepare_shared(void)
return
-
1
;
if
(
collect_fifo
())
return
-
1
;
if
(
collect_unix_sockets
())
return
-
1
;
if
(
tty_verify_active_pairs
())
return
-
1
;
...
...
criu/include/sk-queue.h
View file @
f674cbd6
#ifndef __CR_SK_QUEUE_H__
#define __CR_SK_QUEUE_H__
extern
int
read_sk_queues
(
void
)
;
extern
struct
collect_image_info
sk_queues_cinfo
;
extern
int
dump_sk_queue
(
int
sock_fd
,
int
sock_id
);
extern
int
restore_sk_queue
(
int
fd
,
unsigned
int
peer_id
);
...
...
criu/include/sockets.h
View file @
f674cbd6
...
...
@@ -38,7 +38,6 @@ struct ns_id;
extern
int
collect_sockets
(
struct
ns_id
*
);
extern
int
collect_inet_sockets
(
void
);
extern
struct
collect_image_info
unix_sk_cinfo
;
extern
int
collect_unix_sockets
(
void
);
extern
int
fix_external_unix_sockets
(
void
);
extern
struct
collect_image_info
netlink_sk_cinfo
;
...
...
criu/sk-queue.c
View file @
f674cbd6
...
...
@@ -33,43 +33,29 @@ struct sk_packet {
static
LIST_HEAD
(
packets_list
);
int
read_sk_queues
(
void
)
static
int
collect_one_packet
(
void
*
obj
,
ProtobufCMessage
*
msg
,
struct
cr_img
*
img
)
{
struct
sk_packet
*
pkt
;
int
ret
;
struct
cr_img
*
img
;
pr_info
(
"Trying to read socket queues image
\n
"
);
img
=
open_image
(
CR_FD_SK_QUEUES
,
O_RSTR
);
if
(
!
img
)
return
-
1
;
struct
sk_packet
*
pkt
=
obj
;
while
(
1
)
{
ret
=
-
1
;
pkt
=
xmalloc
(
sizeof
(
*
pkt
));
if
(
!
pkt
)
{
pr_err
(
"Failed to allocate packet header
\n
"
);
break
;
}
ret
=
pb_read_one_eof
(
img
,
&
pkt
->
entry
,
PB_SK_QUEUES
);
if
(
ret
<=
0
)
break
;
pkt
->
img_off
=
lseek
(
img_raw_fd
(
img
),
0
,
SEEK_CUR
);
/*
* NOTE: packet must be added to the tail. Otherwise sequence
* will be broken.
*/
list_add_tail
(
&
pkt
->
list
,
&
packets_list
);
lseek
(
img_raw_fd
(
img
),
pkt
->
entry
->
length
,
SEEK_CUR
);
}
close_image
(
img
);
xfree
(
pkt
);
pkt
->
entry
=
pb_msg
(
msg
,
SkPacketEntry
);
pkt
->
img_off
=
lseek
(
img_raw_fd
(
img
),
0
,
SEEK_CUR
);
/*
* NOTE: packet must be added to the tail. Otherwise sequence
* will be broken.
*/
list_add_tail
(
&
pkt
->
list
,
&
packets_list
);
lseek
(
img_raw_fd
(
img
),
pkt
->
entry
->
length
,
SEEK_CUR
);
return
ret
;
return
0
;
}
struct
collect_image_info
sk_queues_cinfo
=
{
.
fd_type
=
CR_FD_SK_QUEUES
,
.
pb_type
=
PB_SK_QUEUES
,
.
priv_size
=
sizeof
(
struct
sk_packet
),
.
collect
=
collect_one_packet
,
};
int
dump_sk_queue
(
int
sock_fd
,
int
sock_id
)
{
SkPacketEntry
pe
=
SK_PACKET_ENTRY__INIT
;
...
...
criu/sk-unix.c
View file @
f674cbd6
...
...
@@ -1330,11 +1330,6 @@ struct collect_image_info unix_sk_cinfo = {
.
flags
=
COLLECT_SHARED
,
};
int
collect_unix_sockets
(
void
)
{
return
read_sk_queues
();
}
static
int
resolve_unix_peers
(
void
*
unused
)
{
struct
unix_sk_info
*
ui
,
*
peer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment