… | |
… | |
13 | |
13 | |
14 | #include <sched.h> |
14 | #include <sched.h> |
15 | |
15 | |
16 | #include <sys/ioctl.h> |
16 | #include <sys/ioctl.h> |
17 | #include <net/if.h> |
17 | #include <net/if.h> |
|
|
18 | |
|
|
19 | #include <linux/nsfs.h> |
|
|
20 | #include <linux/kcmp.h> |
|
|
21 | |
|
|
22 | /* kcmp.h does not define symbols, so there is no way to detect preesence of enum */ |
|
|
23 | /* members, so we just hardcode new symbols here. */ |
|
|
24 | #ifndef KCMP_EPOLL_TFD |
|
|
25 | #define KCMP_EPOLL_TFD 7 |
|
|
26 | #endif |
18 | |
27 | |
19 | #ifdef __has_include |
28 | #ifdef __has_include |
20 | #if !__has_include("linux/kcmp.h") // use "" as GCC wrongly expands macros |
29 | #if !__has_include("linux/kcmp.h") // use "" as GCC wrongly expands macros |
21 | #undef SYS_kcmp |
30 | #undef SYS_kcmp |
22 | #endif |
31 | #endif |
… | |
… | |
114 | const_iv_clone (NEWIPC) |
123 | const_iv_clone (NEWIPC) |
115 | # endif |
124 | # endif |
116 | # ifdef CLONE_NEWNET |
125 | # ifdef CLONE_NEWNET |
117 | const_iv_clone (NEWNET) |
126 | const_iv_clone (NEWNET) |
118 | # endif |
127 | # endif |
|
|
128 | # ifdef CLONE_NEWTIME |
|
|
129 | const_iv_clone (NEWTIME) |
|
|
130 | # endif |
119 | # ifdef CLONE_PTRACE |
131 | # ifdef CLONE_PTRACE |
120 | const_iv_clone (PTRACE) |
132 | const_iv_clone (PTRACE) |
121 | # endif |
133 | # endif |
122 | # ifdef CLONE_VFORK |
134 | # ifdef CLONE_VFORK |
123 | const_iv_clone (VFORK) |
135 | const_iv_clone (VFORK) |
… | |
… | |
161 | const_iv (KCMP_FILES) |
173 | const_iv (KCMP_FILES) |
162 | const_iv (KCMP_FS) |
174 | const_iv (KCMP_FS) |
163 | const_iv (KCMP_SIGHAND) |
175 | const_iv (KCMP_SIGHAND) |
164 | const_iv (KCMP_IO) |
176 | const_iv (KCMP_IO) |
165 | const_iv (KCMP_SYSVSEM) |
177 | const_iv (KCMP_SYSVSEM) |
166 | const_iv (KCMP_FILE) |
178 | const_iv (KCMP_EPOLL_TFD) |
|
|
179 | # endif |
|
|
180 | # ifdef NS_GET_USERNS |
|
|
181 | const_iv (NS_GET_USERNS) |
|
|
182 | # endif |
|
|
183 | # ifdef NS_GET_PARENT |
|
|
184 | const_iv (NS_GET_PARENT) |
|
|
185 | # endif |
|
|
186 | # ifdef NS_GET_NSTYPE |
|
|
187 | const_iv (NS_GET_NSTYPE) |
|
|
188 | # endif |
|
|
189 | # ifdef NS_OWNER_UID |
|
|
190 | const_iv (NS_OWNER_UID |
167 | # endif |
191 | # endif |
168 | }; |
192 | }; |
169 | |
193 | |
170 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
194 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
171 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
195 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
… | |
… | |
203 | } |
227 | } |
204 | OUTPUT: RETVAL |
228 | OUTPUT: RETVAL |
205 | |
229 | |
206 | int |
230 | int |
207 | unshare (int flags) |
231 | unshare (int flags) |
|
|
232 | PROTOTYPE: @ |
208 | |
233 | |
209 | int |
234 | int |
210 | setns (SV *fh_or_fd, int nstype = 0) |
235 | setns (SV *fh_or_fd, int nstype = 0) |
211 | C_ARGS: s_fileno (fh_or_fd, 0), nstype |
236 | C_ARGS: s_fileno (fh_or_fd, 0), nstype |
212 | |
237 | |