… | |
… | |
3 | #include <errno.h> |
3 | #include <errno.h> |
4 | |
4 | |
5 | #include "EXTERN.h" |
5 | #include "EXTERN.h" |
6 | #include "perl.h" |
6 | #include "perl.h" |
7 | #include "XSUB.h" |
7 | #include "XSUB.h" |
|
|
8 | #include "perliol.h" |
8 | |
9 | |
9 | #if !defined mg_findext |
10 | #if !defined mg_findext |
10 | # define mg_findext(sv,type,vtbl) mg_find (sv, type) |
11 | # define mg_findext(sv,type,vtbl) mg_find (sv, type) |
11 | #endif |
12 | #endif |
12 | |
13 | |
… | |
… | |
816 | } |
817 | } |
817 | else |
818 | else |
818 | PUSHs (sv_result); |
819 | PUSHs (sv_result); |
819 | break; |
820 | break; |
820 | |
821 | |
|
|
822 | #if 0 |
|
|
823 | case EIO_CLOSE: |
|
|
824 | PerlIOUnix_refcnt_dec (req->int1); |
|
|
825 | break; |
|
|
826 | #endif |
|
|
827 | |
821 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
828 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
822 | if (req->result > 0) |
829 | if (req->result > 0) |
823 | SvIV_set (sv_result, 0); |
830 | SvIV_set (sv_result, 0); |
824 | /* FALLTHROUGH */ |
831 | /* FALLTHROUGH */ |
825 | |
832 | |
… | |
… | |
1473 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1480 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1474 | PPCODE: |
1481 | PPCODE: |
1475 | { |
1482 | { |
1476 | int fd = s_fileno_croak (fh, 0); |
1483 | int fd = s_fileno_croak (fh, 0); |
1477 | dREQ; |
1484 | dREQ; |
|
|
1485 | #if 0 |
|
|
1486 | /* partially duplicate logic in s_fileno */ |
|
|
1487 | SvGETMAGIC (fh); |
1478 | |
1488 | |
|
|
1489 | if (SvROK (fh)) |
|
|
1490 | { |
|
|
1491 | fh = SvRV (fh); |
|
|
1492 | SvGETMAGIC (fh); |
|
|
1493 | } |
|
|
1494 | |
|
|
1495 | if (SvTYPE (fh) == SVt_PVGV) |
|
|
1496 | { |
|
|
1497 | /* perl filehandle */ |
|
|
1498 | PerlIOUnix_refcnt_inc (fd); |
|
|
1499 | do_close ((GV *)fh, 1); |
|
|
1500 | |
|
|
1501 | req->type = EIO_CLOSE; |
|
|
1502 | req->int1 = fd; |
|
|
1503 | /*req->sv2 = newSVsv (fh);*/ /* since we stole the fd, no need to keep the fh */ |
|
|
1504 | } |
|
|
1505 | else |
|
|
1506 | #endif |
|
|
1507 | { |
|
|
1508 | /* fd number */ |
1479 | req->type = EIO_DUP2; |
1509 | req->type = EIO_DUP2; |
1480 | req->int1 = close_fd; |
1510 | req->int1 = close_fd; |
1481 | req->sv2 = newSVsv (fh); |
1511 | req->sv2 = newSVsv (fh); |
1482 | req->int2 = fd; |
1512 | req->int2 = fd; |
|
|
1513 | } |
1483 | |
1514 | |
1484 | REQ_SEND; |
1515 | REQ_SEND; |
1485 | } |
1516 | } |
1486 | |
1517 | |
1487 | void |
1518 | void |