Codebase list python-unshare / 40b1bdb
Import upstream version 0.2+git20210810.1.2742627 Debian Janitor 2 years ago
5 changed file(s) with 51 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
+0
-3
MANIFEST less more
0 setup.py
1 unshare.c
2 COPYING
0 Metadata-Version: 1.0
1 Name: python-unshare
2 Version: 0.2
3 Summary: Python bindings for the Linux unshare() syscall
4 Home-page: https://github.com/NightTsarina/python-unshare
5 Author: Martina Ferrari
6 Author-email: tina@tina.pm
7 License: GPLv2
8 Description: This simple extension provides bindings to the Linux unshare() syscall, added in kernel version 2.6.16
9
10 By using unshare(), new and interesting features of the Linux kernel can be exploited, such as:
11
12 * Creating a new network name space (CLONE_NEWNET)
13 * Creating a new file system mount name space (CLONE_NEWNS)
14 * Reverting other features shared from clone()
15 Platform: Linux
55 * Creating a new file system mount name space (`CLONE_NEWNS`)
66 * Reverting other features shared from `clone()`
77
8 This library provides an equivalent of the (recently added) util-linux command-line program `unshare`.
8 This library provides an equivalent of the util-linux command-line program `unshare`.
1616 version = '0.2',
1717 description = 'Python bindings for the Linux unshare() syscall',
1818 long_description = longdesc,
19 author = 'Martin Ferrari',
20 author_email = 'martin.ferrari@gmail.com',
21 url = 'http://code.google.com/p/python-unshare/',
19 author = 'Martina Ferrari',
20 author_email = 'tina@tina.pm',
21 url = 'https://github.com/NightTsarina/python-unshare',
2222 license = 'GPLv2',
2323 platforms = 'Linux',
2424 ext_modules = [module1])
00 /* vim:ts=4:sw=4:et:ai:sts=4
11 *
22 * python-unshare: Python bindings for the Linux unshare() syscall
3 * Copyright © 2010 Martín Ferrari <martin.ferrari@gmail.com>
3 * Copyright © 2010 Martina Ferrari <tina@tina.pm>
44 *
55 * This program is free software; you can redistribute it and/or modify it
66 * under the terms of the GNU General Public License as published by the Free
7373 {NULL, NULL, 0, NULL}
7474 };
7575
76 PyMODINIT_FUNC initunshare(void) {
76 #if PY_MAJOR_VERSION >= 3
77 static struct PyModuleDef moduledef =
78 {
79 PyModuleDef_HEAD_INIT,
80 "unshare", /* name of module */
81 "", /* module documentation, may be NULL */
82 -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
83 methods
84 };
85 #endif
86
87 #if PY_MAJOR_VERSION >= 3
88 #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
89 #else
90 #define MOD_INIT(name) PyMODINIT_FUNC init##name(void)
91 #endif
92
93 MOD_INIT(unshare) {
7794 PyObject *m;
78 m = Py_InitModule("unshare", methods);
95
96 #if PY_MAJOR_VERSION >= 3
97 m = PyModule_Create(&moduledef);
98 if (m == NULL)
99 return NULL;
100 #else
101 m = Py_InitModule3("unshare", methods, "");
79102 if (m == NULL)
80103 return;
104 #endif
81105
82106 /* Currently (2.6.33) not-implemented: CLONE_VM, CLONE_SIGHAND,
83107 * CLONE_THREAD, CLONE_NEWUSER, CLONE_NEWPID */
100124 PyModule_AddIntConstant(m, "CLONE_NEWPID", CLONE_NEWPID);
101125 /* CAP_SYS_ADMIN */
102126 PyModule_AddIntConstant(m, "CLONE_NEWNET", CLONE_NEWNET);
127
128 #if PY_MAJOR_VERSION >= 3
129 return m;
130 #endif
103131 }
104132