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
93f81bc7
Unverified
Commit
93f81bc7
authored
Jun 28, 2018
by
2xsec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-cgroup: share internal API symbols
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
df3ab009
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
Makefile.am
src/lxc/Makefile.am
+1
-1
lxc_cgroup.c
src/lxc/tools/lxc_cgroup.c
+17
-13
No files found.
src/lxc/Makefile.am
View file @
93f81bc7
...
@@ -267,7 +267,7 @@ LDADD=liblxc.la @CAP_LIBS@ @GNUTLS_LIBS@ @SELINUX_LIBS@ @SECCOMP_LIBS@
...
@@ -267,7 +267,7 @@ LDADD=liblxc.la @CAP_LIBS@ @GNUTLS_LIBS@ @SELINUX_LIBS@ @SECCOMP_LIBS@
if
ENABLE_TOOLS
if
ENABLE_TOOLS
lxc_attach_SOURCES
=
tools/lxc_attach.c tools/arguments.c tools/tool_utils.c
lxc_attach_SOURCES
=
tools/lxc_attach.c tools/arguments.c tools/tool_utils.c
lxc_autostart_SOURCES
=
tools/lxc_autostart.c tools/arguments.c tools/tool_utils.c
lxc_autostart_SOURCES
=
tools/lxc_autostart.c tools/arguments.c tools/tool_utils.c
lxc_cgroup_SOURCES
=
tools/lxc_cgroup.c tools/arguments.c
tools/tool_utils.c
lxc_cgroup_SOURCES
=
tools/lxc_cgroup.c tools/arguments.c
lxc_config_SOURCES
=
tools/lxc_config.c tools/arguments.c tools/tool_utils.c
lxc_config_SOURCES
=
tools/lxc_config.c tools/arguments.c tools/tool_utils.c
lxc_console_SOURCES
=
tools/lxc_console.c tools/arguments.c tools/tool_utils.c
lxc_console_SOURCES
=
tools/lxc_console.c tools/arguments.c tools/tool_utils.c
lxc_destroy_SOURCES
=
tools/lxc_destroy.c tools/arguments.c tools/tool_utils.c
lxc_destroy_SOURCES
=
tools/lxc_destroy.c tools/arguments.c tools/tool_utils.c
...
...
src/lxc/tools/lxc_cgroup.c
View file @
93f81bc7
...
@@ -32,12 +32,14 @@
...
@@ -32,12 +32,14 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include "arguments.h"
#include "arguments.h"
#include "tool_utils.h"
#include "log.h"
lxc_log_define
(
lxc_cgroup
,
lxc
);
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
{
{
if
(
!
args
->
argc
)
{
if
(
!
args
->
argc
)
{
lxc_error
(
args
,
"Missing state object"
);
ERROR
(
"Missing state object"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -94,28 +96,29 @@ int main(int argc, char *argv[])
...
@@ -94,28 +96,29 @@ int main(int argc, char *argv[])
if
(
my_args
.
rcfile
)
{
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
lxc_error
(
&
my_args
,
"Failed to load rcfile"
);
ERROR
(
"Failed to load rcfile"
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
if
(
!
c
->
configfile
)
{
lxc_error
(
&
my_args
,
"Out of memory setting new config filename"
);
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
lxc_error
(
&
my_args
,
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
ERROR
(
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
!
c
->
is_running
(
c
))
{
if
(
!
c
->
is_running
(
c
))
{
lxc_error
(
&
my_args
,
"'%s:%s' is not running"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
ERROR
(
"'%s:%s' is not running"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -124,25 +127,26 @@ int main(int argc, char *argv[])
...
@@ -124,25 +127,26 @@ int main(int argc, char *argv[])
value
=
my_args
.
argv
[
1
];
value
=
my_args
.
argv
[
1
];
if
(
!
c
->
set_cgroup_item
(
c
,
state_object
,
value
))
{
if
(
!
c
->
set_cgroup_item
(
c
,
state_object
,
value
))
{
lxc_error
(
&
my_args
,
"Failed to assign '%s' value to '%s' for '%s'"
,
ERROR
(
"Failed to assign '%s' value to '%s' for '%s'"
,
value
,
state_object
,
my_args
.
name
);
value
,
state_object
,
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
{
}
else
{
char
buffer
[
TOOL_
MAXPATHLEN
];
char
buffer
[
MAXPATHLEN
];
int
ret
;
int
ret
;
ret
=
c
->
get_cgroup_item
(
c
,
state_object
,
buffer
,
TOOL_
MAXPATHLEN
);
ret
=
c
->
get_cgroup_item
(
c
,
state_object
,
buffer
,
MAXPATHLEN
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
lxc_error
(
&
my_args
,
"Failed to retrieve value of '%s' for '%s:%s'"
,
ERROR
(
"Failed to retrieve value of '%s' for '%s:%s'"
,
state_object
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
state_object
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
printf
(
"%*s"
,
ret
,
buffer
);
INFO
(
"%*s"
,
ret
,
buffer
);
}
}
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
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