Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
6ff5e517
Unverified
Commit
6ff5e517
authored
Nov 20, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a8ea0131
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
25 deletions
+22
-25
commands.c
src/lxc/commands.c
+5
-6
commands.h
src/lxc/commands.h
+1
-2
commands_utils.c
src/lxc/commands_utils.c
+5
-7
commands_utils.h
src/lxc/commands_utils.h
+1
-1
start.c
src/lxc/start.c
+10
-9
No files found.
src/lxc/commands.c
View file @
6ff5e517
...
...
@@ -220,7 +220,7 @@ static int lxc_cmd_send(const char *name, struct lxc_cmd_rr *cmd,
int
client_fd
;
ssize_t
ret
=
-
1
;
client_fd
=
lxc_cmd_connect
(
name
,
lxcpath
,
hashed_sock_name
);
client_fd
=
lxc_cmd_connect
(
name
,
lxcpath
,
hashed_sock_name
,
"command"
);
if
(
client_fd
<
0
)
{
if
(
client_fd
==
-
ECONNREFUSED
)
return
-
ECONNREFUSED
;
...
...
@@ -1064,8 +1064,7 @@ out_close:
goto
out
;
}
int
lxc_cmd_init
(
const
char
*
name
,
struct
lxc_handler
*
handler
,
const
char
*
lxcpath
)
int
lxc_cmd_init
(
const
char
*
name
,
const
char
*
lxcpath
,
const
char
*
suffix
)
{
int
fd
,
len
,
ret
;
char
path
[
sizeof
(((
struct
sockaddr_un
*
)
0
)
->
sun_path
)]
=
{
0
};
...
...
@@ -1077,9 +1076,10 @@ int lxc_cmd_init(const char *name, struct lxc_handler *handler,
* because we print the sockname out sometimes.
*/
len
=
sizeof
(
path
)
-
2
;
ret
=
lxc_make_abstract_socket_name
(
offset
,
len
,
name
,
lxcpath
,
NULL
,
"command"
);
ret
=
lxc_make_abstract_socket_name
(
offset
,
len
,
name
,
lxcpath
,
NULL
,
suffix
);
if
(
ret
<
0
)
return
-
1
;
TRACE
(
"Creating abstract unix socket
\"
%s
\"
"
,
offset
);
fd
=
lxc_abstract_unix_open
(
path
,
SOCK_STREAM
,
0
);
if
(
fd
<
0
)
{
...
...
@@ -1097,8 +1097,7 @@ int lxc_cmd_init(const char *name, struct lxc_handler *handler,
return
-
1
;
}
handler
->
conf
->
maincmd_fd
=
fd
;
return
0
;
return
fd
;
}
int
lxc_cmd_mainloop_add
(
const
char
*
name
,
struct
lxc_epoll_descr
*
descr
,
...
...
src/lxc/commands.h
View file @
6ff5e517
...
...
@@ -110,8 +110,7 @@ extern int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
struct
lxc_epoll_descr
;
struct
lxc_handler
;
extern
int
lxc_cmd_init
(
const
char
*
name
,
struct
lxc_handler
*
handler
,
const
char
*
lxcpath
);
extern
int
lxc_cmd_init
(
const
char
*
name
,
const
char
*
lxcpath
,
const
char
*
suffix
);
extern
int
lxc_cmd_mainloop_add
(
const
char
*
name
,
struct
lxc_epoll_descr
*
descr
,
struct
lxc_handler
*
handler
);
extern
int
lxc_try_cmd
(
const
char
*
name
,
const
char
*
lxcpath
);
...
...
src/lxc/commands_utils.c
View file @
6ff5e517
...
...
@@ -68,16 +68,14 @@ again:
goto
again
;
}
ERROR
(
"
f
ailed to receive message: %s"
,
strerror
(
errno
));
ERROR
(
"
F
ailed to receive message: %s"
,
strerror
(
errno
));
return
-
1
;
}
if
(
ret
==
0
)
{
ERROR
(
"length of message was 0"
);
if
(
ret
<
0
)
return
-
1
;
}
TRACE
(
"
r
eceived state %s from state client %d"
,
TRACE
(
"
R
eceived state %s from state client %d"
,
lxc_state2str
(
msg
.
value
),
state_client_fd
);
return
msg
.
value
;
...
...
@@ -163,7 +161,7 @@ int lxc_make_abstract_socket_name(char *path, int len, const char *lxcname,
}
int
lxc_cmd_connect
(
const
char
*
name
,
const
char
*
lxcpath
,
const
char
*
hashed_sock_name
)
const
char
*
hashed_sock_name
,
const
char
*
suffix
)
{
int
ret
,
client_fd
;
char
path
[
sizeof
(((
struct
sockaddr_un
*
)
0
)
->
sun_path
)]
=
{
0
};
...
...
@@ -176,7 +174,7 @@ int lxc_cmd_connect(const char *name, const char *lxcpath,
*/
size_t
len
=
sizeof
(
path
)
-
2
;
ret
=
lxc_make_abstract_socket_name
(
offset
,
len
,
name
,
lxcpath
,
hashed_sock_name
,
"command"
);
hashed_sock_name
,
suffix
);
if
(
ret
<
0
)
return
-
1
;
...
...
src/lxc/commands_utils.h
View file @
6ff5e517
...
...
@@ -79,6 +79,6 @@ extern int lxc_add_state_client(int state_client_fd,
* >= 0 client fd
*/
extern
int
lxc_cmd_connect
(
const
char
*
name
,
const
char
*
lxcpath
,
const
char
*
hashed_sock_name
);
const
char
*
hashed_sock_name
,
const
char
*
suffix
);
#endif
/* __LXC_COMMANDS_UTILS_H */
src/lxc/start.c
View file @
6ff5e517
...
...
@@ -370,10 +370,10 @@ static int lxc_serve_state_clients(const char *name,
* lxc_cmd_add_state_client() to miss a state.
*/
handler
->
state
=
state
;
TRACE
(
"
s
et container state to %s"
,
lxc_state2str
(
state
));
TRACE
(
"
S
et container state to %s"
,
lxc_state2str
(
state
));
if
(
lxc_list_empty
(
&
handler
->
state_clients
))
{
TRACE
(
"
n
o state clients registered"
);
TRACE
(
"
N
o state clients registered"
);
process_unlock
();
lxc_monitor_send_state
(
name
,
state
,
handler
->
lxcpath
);
return
0
;
...
...
@@ -386,12 +386,12 @@ static int lxc_serve_state_clients(const char *name,
client
=
cur
->
elem
;
if
(
!
client
->
states
[
state
])
{
TRACE
(
"
s
tate %s not registered for state client %d"
,
TRACE
(
"
S
tate %s not registered for state client %d"
,
lxc_state2str
(
state
),
client
->
clientfd
);
continue
;
}
TRACE
(
"
s
ending state %s to state client %d"
,
TRACE
(
"
S
ending state %s to state client %d"
,
lxc_state2str
(
state
),
client
->
clientfd
);
again:
...
...
@@ -402,7 +402,8 @@ static int lxc_serve_state_clients(const char *name,
goto
again
;
}
ERROR
(
"failed to send message to client"
);
ERROR
(
"%s - Failed to send message to client"
,
strerror
(
errno
));
}
/* kick client from list */
...
...
@@ -576,12 +577,12 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
handler
->
state_socket_pair
[
1
]);
}
if
(
lxc_cmd_init
(
name
,
handler
,
lxcpath
))
{
ERROR
(
"failed to set up command socket"
);
handler
->
conf
->
maincmd_fd
=
lxc_cmd_init
(
name
,
lxcpath
,
"command"
);
if
(
handler
->
conf
->
maincmd_fd
<
0
)
{
ERROR
(
"Failed to set up command socket"
);
goto
on_error
;
}
TRACE
(
"unix domain socket %d for command server is ready"
,
TRACE
(
"Unix domain socket %d for command server is ready"
,
handler
->
conf
->
maincmd_fd
);
return
handler
;
...
...
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