… | |
… | |
8 | #undef _GNU_SOURCE |
8 | #undef _GNU_SOURCE |
9 | #define _GNU_SOURCE |
9 | #define _GNU_SOURCE |
10 | #include <sched.h> |
10 | #include <sched.h> |
11 | #include <unistd.h> |
11 | #include <unistd.h> |
12 | #include <sys/syscall.h> |
12 | #include <sys/syscall.h> |
|
|
13 | |
|
|
14 | #include <sched.h> |
|
|
15 | |
|
|
16 | #include <sys/ioctl.h> |
|
|
17 | #include <net/if.h> |
13 | |
18 | |
14 | #ifdef __has_include |
19 | #ifdef __has_include |
15 | #if !__has_include("linux/kcmp.h") // use "" as GCC wrongly expands macros |
20 | #if !__has_include("linux/kcmp.h") // use "" as GCC wrongly expands macros |
16 | #undef SYS_kcmp |
21 | #undef SYS_kcmp |
17 | #endif |
22 | #endif |
… | |
… | |
76 | const char *name; |
81 | const char *name; |
77 | IV iv; |
82 | IV iv; |
78 | } *civ, const_iv[] = { |
83 | } *civ, const_iv[] = { |
79 | # define const_iv(name) { # name, (IV)name }, |
84 | # define const_iv(name) { # name, (IV)name }, |
80 | # define const_iv_clone(name) { # name, (IV) CLONE_ ## name }, |
85 | # define const_iv_clone(name) { # name, (IV) CLONE_ ## name }, |
|
|
86 | # ifdef CSIGNAL |
|
|
87 | const_iv (CSIGNAL) |
|
|
88 | # endif |
81 | # ifdef CLONE_FILES |
89 | # ifdef CLONE_FILES |
82 | const_iv_clone (FILES) |
90 | const_iv_clone (FILES) |
83 | # endif |
91 | # endif |
84 | # ifdef CLONE_FS |
92 | # ifdef CLONE_FS |
85 | const_iv_clone (FS) |
93 | const_iv_clone (FS) |
… | |
… | |
191 | munmap (stack_ptr, stacksize); |
199 | munmap (stack_ptr, stacksize); |
192 | errno = old_errno; |
200 | errno = old_errno; |
193 | } |
201 | } |
194 | } |
202 | } |
195 | } |
203 | } |
196 | OUTPUT: |
204 | OUTPUT: RETVAL |
197 | RETVAL |
|
|
198 | |
205 | |
199 | int |
206 | int |
200 | unshare (int flags) |
207 | unshare (int flags) |
201 | |
208 | |
202 | int |
209 | int |
… | |
… | |
207 | pivot_root (SV *new_root, SV *old_root) |
214 | pivot_root (SV *new_root, SV *old_root) |
208 | CODE: |
215 | CODE: |
209 | RETVAL = syscall (SYS_pivot_root, |
216 | RETVAL = syscall (SYS_pivot_root, |
210 | (const char *)SvPVbyte_nolen (new_root), |
217 | (const char *)SvPVbyte_nolen (new_root), |
211 | (const char *)SvPVbyte_nolen (old_root)); |
218 | (const char *)SvPVbyte_nolen (old_root)); |
212 | OUTPUT: |
219 | OUTPUT: RETVAL |
213 | RETVAL |
|
|
214 | |
220 | |
215 | int |
221 | int |
216 | kcmp (IV pid1, IV pid2, IV type, UV idx1 = 0, UV idx2 = 0) |
222 | kcmp (IV pid1, IV pid2, IV type, UV idx1 = 0, UV idx2 = 0) |
217 | |
223 | |
|
|
224 | int |
|
|
225 | siocsifflags (char *ifname, U32 flags = IFF_UP) |
|
|
226 | CODE: |
|
|
227 | { |
|
|
228 | int saved_errno; |
|
|
229 | struct ifreq ifr; |
|
|
230 | int fd = socket (AF_INET, SOCK_DGRAM, 0); |
|
|
231 | strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); |
|
|
232 | RETVAL = ioctl (fd, SIOCSIFFLAGS, &ifr); |
|
|
233 | saved_errno = errno; |
|
|
234 | close (fd); |
|
|
235 | errno = saved_errno; |
|
|
236 | } |
|
|
237 | OUTPUT: RETVAL |
|
|
238 | |