Statvfs.xs

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 87.5% 28 / 32 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/Filesys/Statvfs.pm »
1 #ifdef __cplusplus
2 extern "C" {
3 #endif
4 #include "EXTERN.h"
5 #include "perl.h"
6 #include "XSUB.h"
7 #include <sys/statvfs.h>
8 #ifdef __cplusplus
9 }
10 #endif
11
12 typedef struct statvfs Statvfs;
13
14
15 MODULE = Filesys::Statvfs PACKAGE = Filesys::Statvfs
16
17
18 void
19 statvfs(dir)
20 char *dir
21 PREINIT:
22 Statvfs st;
23 PPCODE:
24 1 ▶ EXTEND(sp, 10);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(sp, 10); 0 1 1
25 1 ▶ if(statvfs(dir, &st) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(statvfs(dir, &st) == 0) { 1 0 1
26 /* Push values as doubles because we don't know size */
27 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bsize)));
28 1 PUSHs(sv_2mortal(newSVnv((double)st.f_frsize)));
29 1 PUSHs(sv_2mortal(newSVnv((double)st.f_blocks)));
30 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bfree)));
31 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bavail)));
32
33 1 PUSHs(sv_2mortal(newSVnv((double)st.f_files)));
34 1 PUSHs(sv_2mortal(newSVnv((double)st.f_ffree)));
35 1 PUSHs(sv_2mortal(newSVnv((double)st.f_favail)));
36
37 1 PUSHs(sv_2mortal(newSVnv((double)st.f_flag)));
38 1 PUSHs(sv_2mortal(newSVnv((double)st.f_namemax)));
39
40 }
41
42 else {
43 /* undef */
44 }
45
46 void
47 fstatvfs(fd)
48 int fd;
49 PREINIT:
50 Statvfs st;
51 PPCODE:
52 1 ▶ EXTEND(sp, 10);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(sp, 10); 0 1 1
53 1 ▶ if(fstatvfs(fd, &st) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(fstatvfs(fd, &st) == 0) { 1 0 1
54 /* Push values as doubles because we don't know size */
55 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bsize)));
56 1 PUSHs(sv_2mortal(newSVnv((double)st.f_frsize)));
57 1 PUSHs(sv_2mortal(newSVnv((double)st.f_blocks)));
58 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bfree)));
59 1 PUSHs(sv_2mortal(newSVnv((double)st.f_bavail)));
60
61 1 PUSHs(sv_2mortal(newSVnv((double)st.f_files)));
62 1 PUSHs(sv_2mortal(newSVnv((double)st.f_ffree)));
63 1 PUSHs(sv_2mortal(newSVnv((double)st.f_favail)));
64
65 1 PUSHs(sv_2mortal(newSVnv((double)st.f_flag)));
66 1 PUSHs(sv_2mortal(newSVnv((double)st.f_namemax)));
67 }
68
69 else {
70 /* undef */
71 }
72
↑ Summary blib/lib/Filesys/Statvfs.pm »