ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.270 by root, Thu Nov 29 21:51:22 2018 UTC vs.
Revision 1.271 by root, Fri Dec 28 12:43:00 2018 UTC

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
1471 1472
1472void 1473void
1473aio_close (SV *fh, SV *callback = &PL_sv_undef) 1474aio_close (SV *fh, SV *callback = &PL_sv_undef)
1474 PPCODE: 1475 PPCODE:
1475{ 1476{
1477 dREQ;
1476 int fd = s_fileno_croak (fh, 0); 1478 int fd = s_fileno_croak (fh, 0);
1477 dREQ;
1478 1479
1480 /* partially duplicate logic in s_fileno */
1481 SvGETMAGIC (fh);
1482
1483 if (SvROK (fh))
1484 {
1485 fh = SvRV (fh);
1486 SvGETMAGIC (fh);
1487 }
1488
1489 if (SvTYPE (fh) == SVt_PVGV)
1490 {
1491 /* perl filehandle */
1492 PerlIOUnix_refcnt_inc (fd);
1493 do_close ((GV *)fh, 1);
1494
1479 req->type = EIO_DUP2; 1495 req->type = EIO_CLOSE;
1480 req->int1 = close_fd; 1496 req->int1 = fd;
1481 req->sv2 = newSVsv (fh); 1497 req->sv2 = newSVsv (fh);
1498 }
1499 else
1500 {
1501 /* fd number */
1502 req->type = EIO_DUP2;
1503 req->int1 = close_fd;
1504 req->sv2 = newSVsv (fh);
1482 req->int2 = fd; 1505 req->int2 = fd;
1506 }
1483 1507
1484 REQ_SEND; 1508 REQ_SEND;
1485} 1509}
1486 1510
1487void 1511void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines