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
138eda99
Commit
138eda99
authored
Jun 29, 2018
by
2xsec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-console: share internal API symbols
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
b27cdf66
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
Makefile.am
src/lxc/Makefile.am
+1
-1
lxc_console.c
src/lxc/tools/lxc_console.c
+16
-8
No files found.
src/lxc/Makefile.am
View file @
138eda99
...
@@ -269,7 +269,7 @@ lxc_attach_SOURCES = tools/lxc_attach.c tools/arguments.c
...
@@ -269,7 +269,7 @@ lxc_attach_SOURCES = tools/lxc_attach.c tools/arguments.c
lxc_autostart_SOURCES
=
tools/lxc_autostart.c tools/arguments.c
lxc_autostart_SOURCES
=
tools/lxc_autostart.c tools/arguments.c
lxc_cgroup_SOURCES
=
tools/lxc_cgroup.c tools/arguments.c
lxc_cgroup_SOURCES
=
tools/lxc_cgroup.c tools/arguments.c
lxc_config_SOURCES
=
tools/lxc_config.c tools/arguments.c
lxc_config_SOURCES
=
tools/lxc_config.c tools/arguments.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
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
lxc_device_SOURCES
=
tools/lxc_device.c tools/arguments.c tools/tool_utils.c
lxc_device_SOURCES
=
tools/lxc_device.c tools/arguments.c tools/tool_utils.c
lxc_execute_SOURCES
=
tools/lxc_execute.c tools/arguments.c tools/tool_utils.c
lxc_execute_SOURCES
=
tools/lxc_execute.c tools/arguments.c tools/tool_utils.c
...
...
src/lxc/tools/lxc_console.c
View file @
138eda99
...
@@ -39,16 +39,20 @@
...
@@ -39,16 +39,20 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include "arguments.h"
#include "arguments.h"
#include "tool_utils.h"
#include "log.h"
#include "utils.h"
lxc_log_define
(
lxc_console
,
lxc
);
static
char
etoc
(
const
char
*
expr
)
static
char
etoc
(
const
char
*
expr
)
{
{
/* returns "control code" of given expression */
/* returns "control code" of given expression */
char
c
=
expr
[
0
]
==
'^'
?
expr
[
1
]
:
expr
[
0
];
char
c
=
expr
[
0
]
==
'^'
?
expr
[
1
]
:
expr
[
0
];
return
1
+
((
c
>
'Z'
)
?
(
c
-
'a'
)
:
(
c
-
'Z'
));
return
1
+
((
c
>
'Z'
)
?
(
c
-
'a'
)
:
(
c
-
'Z'
));
}
}
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
{
switch
(
c
)
{
switch
(
c
)
{
case
't'
:
case
't'
:
...
@@ -59,6 +63,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
...
@@ -59,6 +63,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
args
->
escape
=
etoc
(
arg
);
args
->
escape
=
etoc
(
arg
);
break
;
break
;
}
}
return
0
;
return
0
;
}
}
...
@@ -95,7 +100,7 @@ int main(int argc, char *argv[])
...
@@ -95,7 +100,7 @@ int main(int argc, char *argv[])
ret
=
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
);
ret
=
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
);
if
(
ret
)
if
(
ret
)
return
EXIT_FAILURE
;
exit
(
EXIT_FAILURE
)
;
/* Only create log if explicitly instructed */
/* Only create log if explicitly instructed */
if
(
my_args
.
log_file
||
my_args
.
log_priority
)
{
if
(
my_args
.
log_file
||
my_args
.
log_priority
)
{
...
@@ -112,33 +117,35 @@ int main(int argc, char *argv[])
...
@@ -112,33 +117,35 @@ int main(int argc, char *argv[])
c
=
lxc_container_new
(
my_args
.
name
,
my_args
.
lxcpath
[
0
]);
c
=
lxc_container_new
(
my_args
.
name
,
my_args
.
lxcpath
[
0
]);
if
(
!
c
)
{
if
(
!
c
)
{
fprintf
(
stderr
,
"System error loading container
\n
"
);
ERROR
(
"System error loading container
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
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
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
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
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
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
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
ERROR
(
"Insufficent privileges to control %s
"
,
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
))
{
fprintf
(
stderr
,
"%s is not running
\n
"
,
my_args
.
name
);
ERROR
(
"%s is not running
"
,
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -148,6 +155,7 @@ int main(int argc, char *argv[])
...
@@ -148,6 +155,7 @@ int main(int argc, char *argv[])
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
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