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
cc41192f
Commit
cc41192f
authored
Sep 12, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fd: Standartize arguments for fd opening stages handlers
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
b0502e4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
files.c
files.c
+28
-26
No files found.
files.c
View file @
cc41192f
...
@@ -378,21 +378,22 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle, int *sock)
...
@@ -378,21 +378,22 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle, int *sock)
return
0
;
return
0
;
}
}
static
int
post_open_fd
(
int
pid
,
FdinfoEntry
*
fe
,
struct
file_desc
*
d
)
static
int
post_open_fd
(
int
pid
,
struct
fdinfo_list_entry
*
fle
)
{
{
struct
fdinfo_list_entry
*
fle
;
struct
file_desc
*
d
=
fle
->
desc
;
struct
fdinfo_list_entry
*
flem
;
if
(
!
d
->
ops
->
post_open
)
if
(
!
d
->
ops
->
post_open
)
return
0
;
return
0
;
if
(
is_service_fd
(
fe
->
fd
,
CTL_TTY_OFF
))
if
(
is_service_fd
(
f
le
->
f
e
->
fd
,
CTL_TTY_OFF
))
return
d
->
ops
->
post_open
(
d
,
fe
->
fd
);
return
d
->
ops
->
post_open
(
d
,
f
le
->
f
e
->
fd
);
fle
=
file_master
(
d
);
fle
m
=
file_master
(
d
);
if
((
fle
->
pid
!=
pid
)
||
(
fe
->
fd
!=
fle
->
fe
->
fd
))
if
((
fle
m
->
pid
!=
pid
)
||
(
fle
->
fe
->
fd
!=
flem
->
fe
->
fd
))
return
0
;
return
0
;
return
d
->
ops
->
post_open
(
d
,
fle
->
fe
->
fd
);
return
d
->
ops
->
post_open
(
d
,
fle
m
->
fe
->
fd
);
}
}
...
@@ -425,50 +426,51 @@ static int serve_out_fd(int pid, int fd, struct file_desc *d)
...
@@ -425,50 +426,51 @@ static int serve_out_fd(int pid, int fd, struct file_desc *d)
return
0
;
return
0
;
}
}
static
int
open_fd
(
int
pid
,
FdinfoEntry
*
fe
,
struct
file_desc
*
d
)
static
int
open_fd
(
int
pid
,
struct
fdinfo_list_entry
*
fle
)
{
{
struct
file_desc
*
d
=
fle
->
desc
;
int
new_fd
;
int
new_fd
;
struct
fdinfo_list_entry
*
fle
;
struct
fdinfo_list_entry
*
fle
m
;
fle
=
file_master
(
d
);
fle
m
=
file_master
(
d
);
if
((
fle
->
pid
!=
pid
)
||
(
fe
->
fd
!=
fle
->
fe
->
fd
))
if
((
fle
m
->
pid
!=
pid
)
||
(
fle
->
fe
->
fd
!=
flem
->
fe
->
fd
))
return
0
;
return
0
;
new_fd
=
d
->
ops
->
open
(
d
);
new_fd
=
d
->
ops
->
open
(
d
);
if
(
new_fd
<
0
)
if
(
new_fd
<
0
)
return
-
1
;
return
-
1
;
if
(
reopen_fd_as
(
fe
->
fd
,
new_fd
))
if
(
reopen_fd_as
(
f
le
->
f
e
->
fd
,
new_fd
))
return
-
1
;
return
-
1
;
fcntl
(
f
e
->
fd
,
F_SETFD
,
fe
->
flags
);
fcntl
(
f
le
->
fe
->
fd
,
F_SETFD
,
fle
->
fe
->
flags
);
return
serve_out_fd
(
pid
,
fe
->
fd
,
d
);
return
serve_out_fd
(
pid
,
f
le
->
f
e
->
fd
,
d
);
}
}
static
int
receive_fd
(
int
pid
,
FdinfoEntry
*
fe
,
struct
file_desc
*
d
)
static
int
receive_fd
(
int
pid
,
struct
fdinfo_list_entry
*
fle
)
{
{
int
tmp
;
int
tmp
;
struct
fdinfo_list_entry
*
fle
;
struct
fdinfo_list_entry
*
fle
m
;
fle
=
file_master
(
d
);
fle
m
=
file_master
(
fle
->
desc
);
if
(
fle
->
pid
==
pid
)
if
(
fle
m
->
pid
==
pid
)
return
0
;
return
0
;
pr_info
(
"
\t
Receive fd for %d
\n
"
,
fe
->
fd
);
pr_info
(
"
\t
Receive fd for %d
\n
"
,
f
le
->
f
e
->
fd
);
tmp
=
recv_fd
(
fe
->
fd
);
tmp
=
recv_fd
(
f
le
->
f
e
->
fd
);
if
(
tmp
<
0
)
{
if
(
tmp
<
0
)
{
pr_err
(
"Can't get fd %d
\n
"
,
tmp
);
pr_err
(
"Can't get fd %d
\n
"
,
tmp
);
return
-
1
;
return
-
1
;
}
}
close
(
fe
->
fd
);
close
(
f
le
->
f
e
->
fd
);
if
(
reopen_fd_as
(
fe
->
fd
,
tmp
)
<
0
)
if
(
reopen_fd_as
(
f
le
->
f
e
->
fd
,
tmp
)
<
0
)
return
-
1
;
return
-
1
;
fcntl
(
tmp
,
F_SETFD
,
fe
->
flags
);
fcntl
(
tmp
,
F_SETFD
,
f
le
->
f
e
->
flags
);
return
0
;
return
0
;
}
}
...
@@ -492,13 +494,13 @@ static int open_fdinfo(int pid, struct fdinfo_list_entry *fle, int state)
...
@@ -492,13 +494,13 @@ static int open_fdinfo(int pid, struct fdinfo_list_entry *fle, int state)
ret
=
open_transport_fd
(
pid
,
fle
);
ret
=
open_transport_fd
(
pid
,
fle
);
break
;
break
;
case
FD_STATE_CREATE
:
case
FD_STATE_CREATE
:
ret
=
open_fd
(
pid
,
fle
->
fe
,
fle
->
desc
);
ret
=
open_fd
(
pid
,
fle
);
break
;
break
;
case
FD_STATE_RECV
:
case
FD_STATE_RECV
:
ret
=
receive_fd
(
pid
,
fle
->
fe
,
fle
->
desc
);
ret
=
receive_fd
(
pid
,
fle
);
break
;
break
;
case
FD_STATE_POST_CREATE
:
case
FD_STATE_POST_CREATE
:
ret
=
post_open_fd
(
pid
,
fle
->
fe
,
fle
->
desc
);
ret
=
post_open_fd
(
pid
,
fle
);
break
;
break
;
}
}
...
...
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