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
80efa564
Commit
80efa564
authored
Sep 29, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parasite: Reshuffle tsock creation
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
8ad653c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
parasite-syscall.c
parasite-syscall.c
+15
-8
No files found.
parasite-syscall.c
View file @
80efa564
...
...
@@ -434,11 +434,11 @@ static int restore_child_handler()
return
0
;
}
static
int
ssock
=
-
1
;
static
int
prepare_tsock
(
struct
parasite_ctl
*
ctl
,
pid_t
pid
,
struct
parasite_init_args
*
args
)
{
static
int
ssock
=
-
1
;
pr_info
(
"Putting tsock into pid %d
\n
"
,
pid
);
args
->
h_addr_len
=
gen_parasite_saddr
(
&
args
->
h_addr
,
getpid
());
...
...
@@ -469,23 +469,31 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
}
}
/*
* Set to -1 to prevent any accidental misuse. The
* only valid user of it is accept_tsock().
*/
ctl
->
tsock
=
-
ssock
;
return
0
;
err:
close_safe
(
&
ssock
);
return
-
1
;
}
static
int
accept_tsock
()
static
int
accept_tsock
(
struct
parasite_ctl
*
ctl
)
{
int
sock
;
int
ask
=
-
ctl
->
tsock
;
/* this '-' is explained above */
sock
=
accept
(
ssoc
k
,
NULL
,
0
);
sock
=
accept
(
as
k
,
NULL
,
0
);
if
(
sock
<
0
)
{
pr_perror
(
"Can't accept connection to the transport socket"
);
close_safe
(
&
ssock
);
close
(
ask
);
return
-
1
;
}
return
sock
;
ctl
->
tsock
=
sock
;
return
0
;
}
static
int
parasite_init_daemon
(
struct
parasite_ctl
*
ctl
)
...
...
@@ -513,8 +521,7 @@ static int parasite_init_daemon(struct parasite_ctl *ctl)
if
(
parasite_run
(
pid
,
PTRACE_CONT
,
ctl
->
parasite_ip
,
ctl
->
rstack
,
&
regs
,
&
ctl
->
orig
))
goto
err
;
ctl
->
tsock
=
accept_tsock
();
if
(
ctl
->
tsock
<
0
)
if
(
accept_tsock
(
ctl
)
<
0
)
goto
err
;
if
(
parasite_send_fd
(
ctl
,
log_get_fd
()))
...
...
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