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
01bfae14
Commit
01bfae14
authored
Aug 19, 2013
by
Christian Seiler
Committed by
Serge Hallyn
Aug 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python/attach: export CLONE_NEW* constants to Python
Signed-off-by:
Christian Seiler
<
christian@iwakd.de
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
4f17323e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
lxc.c
src/python-lxc/lxc.c
+28
-8
__init__.py
src/python-lxc/lxc/__init__.py
+6
-0
No files found.
src/python-lxc/lxc.c
View file @
01bfae14
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "structmember.h"
#include "structmember.h"
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include <lxc/utils.h>
#include <lxc/utils.h>
#include <lxc/namespace.h>
#include <stdio.h>
#include <stdio.h>
#include <sys/wait.h>
#include <sys/wait.h>
...
@@ -718,6 +719,8 @@ static int lxc_attach_python_exec(void* _payload)
...
@@ -718,6 +719,8 @@ static int lxc_attach_python_exec(void* _payload)
return
-
1
;
return
-
1
;
}
}
static
void
lxc_attach_free_options
(
lxc_attach_options_t
*
options
);
static
lxc_attach_options_t
*
lxc_attach_parse_options
(
PyObject
*
kwds
)
static
lxc_attach_options_t
*
lxc_attach_parse_options
(
PyObject
*
kwds
)
{
{
static
char
*
kwlist
[]
=
{
"attach_flags"
,
"namespaces"
,
"personality"
,
"initial_cwd"
,
"uid"
,
"gid"
,
"env_policy"
,
"extra_env_vars"
,
"extra_keep_env"
,
"stdin"
,
"stdout"
,
"stderr"
,
NULL
};
static
char
*
kwlist
[]
=
{
"attach_flags"
,
"namespaces"
,
"personality"
,
"initial_cwd"
,
"uid"
,
"gid"
,
"env_policy"
,
"extra_env_vars"
,
"extra_keep_env"
,
"stdin"
,
"stdout"
,
"stderr"
,
NULL
};
...
@@ -1170,14 +1173,31 @@ PyInit__lxc(void)
...
@@ -1170,14 +1173,31 @@ PyInit__lxc(void)
/* add constants */
/* add constants */
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
PyDict_SetItemString
(
d
,
"LXC_ATTACH_KEEP_ENV"
,
PyLong_FromLong
(
LXC_ATTACH_KEEP_ENV
));
PyDict_SetItemString
(
d
,
"LXC_ATTACH_CLEAR_ENV"
,
PyLong_FromLong
(
LXC_ATTACH_CLEAR_ENV
));
#define PYLXC_EXPORT_CONST(c) PyDict_SetItemString(d, #c, PyLong_FromLong(c))
PyDict_SetItemString
(
d
,
"LXC_ATTACH_MOVE_TO_CGROUP"
,
PyLong_FromLong
(
LXC_ATTACH_MOVE_TO_CGROUP
));
PyDict_SetItemString
(
d
,
"LXC_ATTACH_DROP_CAPABILITIES"
,
PyLong_FromLong
(
LXC_ATTACH_DROP_CAPABILITIES
));
/* environment variable handling */
PyDict_SetItemString
(
d
,
"LXC_ATTACH_SET_PERSONALITY"
,
PyLong_FromLong
(
LXC_ATTACH_SET_PERSONALITY
));
PYLXC_EXPORT_CONST
(
LXC_ATTACH_KEEP_ENV
);
PyDict_SetItemString
(
d
,
"LXC_ATTACH_APPARMOR"
,
PyLong_FromLong
(
LXC_ATTACH_APPARMOR
));
PYLXC_EXPORT_CONST
(
LXC_ATTACH_CLEAR_ENV
);
PyDict_SetItemString
(
d
,
"LXC_ATTACH_REMOUNT_PROC_SYS"
,
PyLong_FromLong
(
LXC_ATTACH_REMOUNT_PROC_SYS
));
PyDict_SetItemString
(
d
,
"LXC_ATTACH_DEFAULT"
,
PyLong_FromLong
(
LXC_ATTACH_DEFAULT
));
/* attach options */
PYLXC_EXPORT_CONST
(
LXC_ATTACH_MOVE_TO_CGROUP
);
PYLXC_EXPORT_CONST
(
LXC_ATTACH_DROP_CAPABILITIES
);
PYLXC_EXPORT_CONST
(
LXC_ATTACH_SET_PERSONALITY
);
PYLXC_EXPORT_CONST
(
LXC_ATTACH_APPARMOR
);
PYLXC_EXPORT_CONST
(
LXC_ATTACH_REMOUNT_PROC_SYS
);
PYLXC_EXPORT_CONST
(
LXC_ATTACH_DEFAULT
);
/* namespace flags (no other python lib exports this) */
PYLXC_EXPORT_CONST
(
CLONE_NEWUTS
);
PYLXC_EXPORT_CONST
(
CLONE_NEWIPC
);
PYLXC_EXPORT_CONST
(
CLONE_NEWUSER
);
PYLXC_EXPORT_CONST
(
CLONE_NEWPID
);
PYLXC_EXPORT_CONST
(
CLONE_NEWNET
);
PYLXC_EXPORT_CONST
(
CLONE_NEWNS
);
#undef PYLXC_EXPORT_CONST
return
m
;
return
m
;
}
}
...
...
src/python-lxc/lxc/__init__.py
View file @
01bfae14
...
@@ -459,3 +459,9 @@ LXC_ATTACH_SET_PERSONALITY = _lxc.LXC_ATTACH_SET_PERSONALITY
...
@@ -459,3 +459,9 @@ LXC_ATTACH_SET_PERSONALITY = _lxc.LXC_ATTACH_SET_PERSONALITY
LXC_ATTACH_APPARMOR
=
_lxc
.
LXC_ATTACH_APPARMOR
LXC_ATTACH_APPARMOR
=
_lxc
.
LXC_ATTACH_APPARMOR
LXC_ATTACH_REMOUNT_PROC_SYS
=
_lxc
.
LXC_ATTACH_REMOUNT_PROC_SYS
LXC_ATTACH_REMOUNT_PROC_SYS
=
_lxc
.
LXC_ATTACH_REMOUNT_PROC_SYS
LXC_ATTACH_DEFAULT
=
_lxc
.
LXC_ATTACH_DEFAULT
LXC_ATTACH_DEFAULT
=
_lxc
.
LXC_ATTACH_DEFAULT
CLONE_NEWUTS
=
_lxc
.
CLONE_NEWUTS
CLONE_NEWIPC
=
_lxc
.
CLONE_NEWIPC
CLONE_NEWUSER
=
_lxc
.
CLONE_NEWUSER
CLONE_NEWPID
=
_lxc
.
CLONE_NEWPID
CLONE_NEWNET
=
_lxc
.
CLONE_NEWNET
CLONE_NEWNS
=
_lxc
.
CLONE_NEWNS
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