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
ebc1ac8b
Commit
ebc1ac8b
authored
Mar 23, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
files: Factor out transport name generation
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
a3ed9db8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
files.c
files.c
+11
-12
No files found.
files.c
View file @
ebc1ac8b
...
@@ -226,6 +226,15 @@ struct fdinfo_list_entry *find_fdinfo_list_entry(int pid, int fd, struct fdinfo_
...
@@ -226,6 +226,15 @@ struct fdinfo_list_entry *find_fdinfo_list_entry(int pid, int fd, struct fdinfo_
return
fle
;
return
fle
;
}
}
static
inline
void
transport_name_gen
(
struct
sockaddr_un
*
addr
,
int
*
len
,
int
pid
,
long
fd
)
{
addr
->
sun_family
=
AF_UNIX
;
snprintf
(
addr
->
sun_path
,
UNIX_PATH_MAX
,
"x/crtools-fd-%d-%ld"
,
pid
,
fd
);
*
len
=
SUN_LEN
(
addr
);
*
addr
->
sun_path
=
'\0'
;
}
static
int
open_transport_fd
(
int
pid
,
struct
fdinfo_entry
*
fe
,
static
int
open_transport_fd
(
int
pid
,
struct
fdinfo_entry
*
fe
,
struct
fdinfo_desc
*
fi
)
struct
fdinfo_desc
*
fi
)
{
{
...
@@ -237,12 +246,7 @@ static int open_transport_fd(int pid, struct fdinfo_entry *fe,
...
@@ -237,12 +246,7 @@ static int open_transport_fd(int pid, struct fdinfo_entry *fe,
if
(
fi
->
pid
==
pid
)
if
(
fi
->
pid
==
pid
)
return
0
;
return
0
;
saddr
.
sun_family
=
AF_UNIX
;
transport_name_gen
(
&
saddr
,
&
sun_len
,
getpid
(),
fe
->
addr
);
snprintf
(
saddr
.
sun_path
,
UNIX_PATH_MAX
,
"X/crtools-fd-%d-%ld"
,
getpid
(),
fe
->
addr
);
sun_len
=
SUN_LEN
(
&
saddr
);
*
saddr
.
sun_path
=
'\0'
;
pr_info
(
"
\t
%d: Create transport fd for %lx type %d namelen %d users %d
\n
"
,
pid
,
pr_info
(
"
\t
%d: Create transport fd for %lx type %d namelen %d users %d
\n
"
,
pid
,
(
unsigned
long
)
fe
->
addr
,
fe
->
type
,
fe
->
len
,
fi
->
users
);
(
unsigned
long
)
fe
->
addr
,
fe
->
type
,
fe
->
len
,
fi
->
users
);
...
@@ -314,12 +318,7 @@ static int open_fd(int pid, struct fdinfo_entry *fe,
...
@@ -314,12 +318,7 @@ static int open_fd(int pid, struct fdinfo_entry *fe,
cr_wait_while
(
&
fle
->
real_pid
,
0
);
cr_wait_while
(
&
fle
->
real_pid
,
0
);
pr_info
(
"Send fd %d to %s
\n
"
,
(
int
)
fe
->
addr
,
saddr
.
sun_path
+
1
);
pr_info
(
"Send fd %d to %s
\n
"
,
(
int
)
fe
->
addr
,
saddr
.
sun_path
+
1
);
transport_name_gen
(
&
saddr
,
&
len
,
fle
->
real_pid
,
fle
->
fd
);
saddr
.
sun_family
=
AF_UNIX
;
snprintf
(
saddr
.
sun_path
,
UNIX_PATH_MAX
,
"X/crtools-fd-%d-%d"
,
fle
->
real_pid
,
fle
->
fd
);
len
=
SUN_LEN
(
&
saddr
);
*
saddr
.
sun_path
=
'\0'
;
if
(
send_fd
(
sock
,
&
saddr
,
len
,
fe
->
addr
)
<
0
)
{
if
(
send_fd
(
sock
,
&
saddr
,
len
,
fe
->
addr
)
<
0
)
{
pr_perror
(
"Can't send file descriptor"
);
pr_perror
(
"Can't send file descriptor"
);
...
...
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