| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| #include "ppport.h" |
| 6 |
|
| |
| 7 |
|
| #include <stdio.h> |
| 8 |
|
| #include <sys/types.h> |
| 9 |
|
| #include <sys/stat.h> |
| 10 |
|
| #include <unistd.h> |
| 11 |
|
| #include <fcntl.h> |
| 12 |
|
| #include <sys/stat.h> |
| 13 |
|
| |
| 14 |
3 |
| static double t2d (const struct timespec * ts) |
| 15 |
|
| { |
| 16 |
3 |
| double d = (double)ts->tv_sec + ((double)ts->tv_nsec) / 1000000000; |
| 17 |
3 |
| return d; |
| 18 |
|
| } |
| 19 |
|
| |
| 20 |
|
| MODULE = File::stat2 PACKAGE = File::stat2 |
| 21 |
|
| |
| 22 |
|
| void |
| 23 |
|
| _stat2 (path) |
| 24 |
|
| const char * path |
| 25 |
|
| INIT: |
| 26 |
|
| struct stat st; |
| 27 |
|
| char ino[128]; |
| 28 |
|
| PPCODE: |
| 29 |
2 |
▶ | if (stat (path, &st) == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (stat (path, &st) == 0) |
1 |
1 |
2 |
|
| 30 |
|
| { |
| 31 |
1 |
| sprintf (ino, "%llu", (unsigned long long)st.st_ino); |
| 32 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_dev ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_dev ))); |
0 |
1 |
1 |
|
| 33 |
1 |
▶ | XPUSHs (sv_2mortal (newSVpv (ino , 0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSVpv (ino , 0))); |
0 |
1 |
1 |
|
| 34 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_mode ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_mode ))); |
0 |
1 |
1 |
|
| 35 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_nlink ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_nlink ))); |
0 |
1 |
1 |
|
| 36 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_uid ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_uid ))); |
0 |
1 |
1 |
|
| 37 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_gid ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_gid ))); |
0 |
1 |
1 |
|
| 38 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_rdev ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_rdev ))); |
0 |
1 |
1 |
|
| 39 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_size ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_size ))); |
0 |
1 |
1 |
|
| 40 |
1 |
▶ | XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_atim)))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_atim)))); |
0 |
1 |
1 |
|
| 41 |
1 |
▶ | XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_mtim)))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_mtim)))); |
0 |
1 |
1 |
|
| 42 |
1 |
▶ | XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_ctim)))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSVnv (t2d (&st.st_ctim)))); |
0 |
1 |
1 |
|
| 43 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_blksize))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_blksize))); |
0 |
1 |
1 |
|
| 44 |
1 |
▶ | XPUSHs (sv_2mortal (newSViv (st.st_blocks ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs (sv_2mortal (newSViv (st.st_blocks ))); |
0 |
1 |
1 |
|
| 45 |
|
| } |
| 46 |
|
| |
| 47 |
|
| |
| 48 |
|
| |
| 49 |
|
| |