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
ed70d078
Commit
ed70d078
authored
Nov 07, 2014
by
PiXy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added container:attach() into the Lua API
parent
5d20559c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
core.c
src/lua-lxc/core.c
+26
-0
lxc.lua
src/lua-lxc/lxc.lua
+4
-0
No files found.
src/lua-lxc/core.c
View file @
ed70d078
...
...
@@ -376,8 +376,34 @@ not_found:
return
1
;
}
static
int
container_attach
(
lua_State
*
L
)
{
struct
lxc_container
*
c
=
lua_unboxpointer
(
L
,
1
,
CONTAINER_TYPENAME
);
int
argc
=
lua_gettop
(
L
);
char
**
argv
=
NULL
;
int
i
,
j
;
if
(
argc
>
1
)
{
argv
=
alloca
((
argc
+
1
)
*
sizeof
(
char
*
));
for
(
i
=
0
,
j
=
0
;
i
<
argc
-
1
;
i
++
)
{
const
char
*
arg
=
luaL_checkstring
(
L
,
i
+
2
);
argv
[
j
++
]
=
strdupa
(
arg
);
}
argv
[
j
]
=
NULL
;
}
else
{
lua_pushnil
(
L
);
return
1
;
}
lua_pushboolean
(
L
,
!!
(
c
->
attach_run_wait
(
c
,
NULL
,
argv
[
0
],
(
const
char
**
)
argv
)));
return
1
;
}
static
luaL_Reg
lxc_container_methods
[]
=
{
{
"attach"
,
container_attach
},
{
"create"
,
container_create
},
{
"defined"
,
container_defined
},
{
"destroy"
,
container_destroy
},
...
...
src/lua-lxc/lxc.lua
View file @
ed70d078
...
...
@@ -91,6 +91,10 @@ function container:new(lname, config)
end
-- methods interfacing to core functionality
function
container
:
attach
(
what
,
...
)
return
self
.
core
:
attach
(
what
,
...
)
end
function
container
:
config_file_name
()
return
self
.
core
:
config_file_name
()
end
...
...
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