Setns.xs

filter: Statementstmt 77.7% 7 / 9 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 81.8% 9 / 11 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Linux/Setns.pm ↑ Summary
1 #ifndef __linux
2 #error "No linux. Compile aborted."
3 #endif
4  
5 #include "EXTERN.h"
6 #include "perl.h"
7 #include "XSUB.h"
8 #include "ppport.h"
9 #include <sys/syscall.h>
10  
11 #define CLONE_ALL 0
12  
13 #ifndef setns
14 0 int setns(int fd, int nstype) {
15 0 return syscall(SYS_setns, fd, nstype);
16 }
17 #endif
18  
19 MODULE = Linux::Setns PACKAGE = Linux::Setns
20  
21 SV * setns_wrapper(path,nstype)
22 SV * path;
23 int nstype;
24 CODE:
25 2 int fd = -1;
26 2 int err = 2;
27 2 fd = open(SvPV_nolen(path), O_RDONLY);
28 2 ▶ if (fd == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (fd == -1) { 1 1 2
29 1 err = 2;
30 } else {
31 1 err = setns(fd, nstype);
32 }
33 2 RETVAL = newSVnv(err);
34 OUTPUT:
35 RETVAL
« blib/lib/Linux/Setns.pm ↑ Summary