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.229 by root, Fri Apr 11 05:19:40 2014 UTC vs.
Revision 1.231 by root, Wed Feb 11 19:32:36 2015 UTC

308} 308}
309 309
310static SV * 310static SV *
311newSVaio_wd (aio_wd wd) 311newSVaio_wd (aio_wd wd)
312{ 312{
313 return sv_bless (newRV_noinc (newSViv ((IV)wd)), aio_wd_stash); 313 return sv_bless (newRV_noinc (newSViv ((intptr_t)wd)), aio_wd_stash);
314} 314}
315 315
316static aio_req 316static aio_req
317SvAIO_REQ (SV *sv) 317SvAIO_REQ (SV *sv)
318{ 318{
1264 len = svlen - dataoffset; 1264 len = svlen - dataoffset;
1265 } 1265 }
1266 else 1266 else
1267 { 1267 {
1268 /* read: check type and grow scalar as necessary */ 1268 /* read: check type and grow scalar as necessary */
1269 SvUPGRADE (data, SVt_PV);
1270 if (SvLEN (data) >= SvCUR (data)) 1269 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data))
1271 svptr = SvGROW (data, len + dataoffset + 1); 1270 svptr = sv_grow (data, len + dataoffset + 1);
1272 else if (SvCUR (data) < len + dataoffset) 1271 else if (SvCUR (data) < len + dataoffset)
1273 croak ("length + dataoffset outside of scalar, and cannot grow"); 1272 croak ("length + dataoffset outside of scalar, and cannot grow");
1274 } 1273 }
1275 1274
1276 { 1275 {
1742 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count); 1741 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count);
1743 OUTPUT: 1742 OUTPUT:
1744 RETVAL 1743 RETVAL
1745 1744
1746void 1745void
1747mmap (SV *scalar, size_t length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0) 1746mmap (SV *scalar, STRLEN length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0)
1748 PPCODE: 1747 PPCODE:
1749 sv_unmagic (scalar, MMAP_MAGIC); 1748 sv_unmagic (scalar, MMAP_MAGIC);
1750{ 1749{
1751 int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1; 1750 int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1;
1752 void *addr = (void *)mmap (0, length, prot, flags, fd, offset); 1751 void *addr = (void *)mmap (0, length, prot, flags, fd, offset);
1779munmap (SV *scalar) 1778munmap (SV *scalar)
1780 CODE: 1779 CODE:
1781 sv_unmagic (scalar, MMAP_MAGIC); 1780 sv_unmagic (scalar, MMAP_MAGIC);
1782 1781
1783int 1782int
1784madvise (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot) 1783madvise (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot)
1785 ALIAS: 1784 ALIAS:
1786 mprotect = 1 1785 mprotect = 1
1787 CODE: 1786 CODE:
1788{ 1787{
1789 STRLEN svlen; 1788 STRLEN svlen;
1790 void *addr = SvPVbyte (scalar, svlen); 1789 void *addr = SvPVbyte (scalar, svlen);
1791 size_t len = SvUV (length); 1790 STRLEN len = SvUV (length);
1792 1791
1793 if (offset < 0) 1792 if (offset < 0)
1794 offset += svlen; 1793 offset += svlen;
1795 1794
1796 if (offset < 0 || offset > svlen) 1795 if (offset < 0 || offset > svlen)
1810} 1809}
1811 OUTPUT: 1810 OUTPUT:
1812 RETVAL 1811 RETVAL
1813 1812
1814int 1813int
1815munlock (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef) 1814munlock (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef)
1816 CODE: 1815 CODE:
1817{ 1816{
1818 STRLEN svlen; 1817 STRLEN svlen;
1819 void *addr = SvPVbyte (scalar, svlen); 1818 void *addr = SvPVbyte (scalar, svlen);
1820 size_t len = SvUV (length); 1819 size_t len = SvUV (length);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines