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.251 by root, Sat Jan 6 01:04:42 2018 UTC vs.
Revision 1.253 by root, Tue Feb 20 04:32:59 2018 UTC

106 106
107/*****************************************************************************/ 107/*****************************************************************************/
108 108
109#include "libeio/config.h" 109#include "libeio/config.h"
110 110
111#if HAVE_EVENTFD
112# include <sys/eventfd.h>
113#endif
114
111#if HAVE_RLIMITS 115#if HAVE_RLIMITS
112 #include <sys/time.h> 116 #include <sys/time.h>
113 #include <sys/resource.h> 117 #include <sys/resource.h>
114#endif 118#endif
115 119
699 { 703 {
700 req->flags &= ~EIO_FLAG_PTR2_FREE; 704 req->flags &= ~EIO_FLAG_PTR2_FREE;
701 sv_set_foreign (req->sv2, &sysfree_vtbl, req->ptr2, req->result); 705 sv_set_foreign (req->sv2, &sysfree_vtbl, req->ptr2, req->result);
702 } 706 }
703 else 707 else
708 {
704 SvCUR_set (req->sv2, req->result); 709 SvCUR_set (req->sv2, req->result);
710 *SvEND (req->sv2) = 0;
711 SvPOK_only (req->sv2);
712 }
713
714 SvSETMAGIC (req->sv2);
705 } 715 }
706 716
707 PUSHs (sv_result); 717 PUSHs (sv_result);
708 } 718 }
709 break; 719 break;
1155 const_iv (SPLICE_F_MOVE) 1165 const_iv (SPLICE_F_MOVE)
1156 const_iv (SPLICE_F_NONBLOCK) 1166 const_iv (SPLICE_F_NONBLOCK)
1157 const_iv (SPLICE_F_MORE) 1167 const_iv (SPLICE_F_MORE)
1158 const_iv (SPLICE_F_GIFT) 1168 const_iv (SPLICE_F_GIFT)
1159 1169
1170 const_iv (EFD_CLOEXEC)
1171 const_iv (EFD_NONBLOCK)
1172 const_iv (EFD_SEMAPHORE)
1173
1160 /* these are libeio constants, and are independent of gendef0 */ 1174 /* these are libeio constants, and are independent of gendef0 */
1161 const_eio (SEEK_SET) 1175 const_eio (SEEK_SET)
1162 const_eio (SEEK_CUR) 1176 const_eio (SEEK_CUR)
1163 const_eio (SEEK_END) 1177 const_eio (SEEK_END)
1164 1178
1415 } 1429 }
1416 else 1430 else
1417 { 1431 {
1418 /* read: check type and grow scalar as necessary */ 1432 /* read: check type and grow scalar as necessary */
1419 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data)) 1433 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data))
1420 svptr = sv_grow (data, len + dataoffset); 1434 svptr = sv_grow (data, len + dataoffset + 1);
1421 else if (SvCUR (data) < len + dataoffset) 1435 else if (SvCUR (data) < len + dataoffset)
1422 croak ("length + dataoffset outside of scalar, and cannot grow"); 1436 croak ("length + dataoffset outside of scalar, and cannot grow");
1423 } 1437 }
1424 1438
1425 { 1439 {
1819 sv_clear_foreign (data); 1833 sv_clear_foreign (data);
1820 1834
1821 if (length) /* known length, directly read into scalar */ 1835 if (length) /* known length, directly read into scalar */
1822 { 1836 {
1823 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data)) 1837 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data))
1824 svptr = sv_grow (data, length); 1838 svptr = sv_grow (data, length + 1);
1825 else if (SvCUR (data) < length) 1839 else if (SvCUR (data) < length)
1826 croak ("length outside of scalar, and cannot grow"); 1840 croak ("length outside of scalar, and cannot grow");
1827 else 1841 else
1828 svptr = SvPVbyte_nolen (data); 1842 svptr = SvPVbyte_nolen (data);
1829 } 1843 }
2148 { 2162 {
2149 EXTEND (SP, 2); 2163 EXTEND (SP, 2);
2150 PUSHs (newmortalFH (fd[0], O_RDONLY)); 2164 PUSHs (newmortalFH (fd[0], O_RDONLY));
2151 PUSHs (newmortalFH (fd[1], O_WRONLY)); 2165 PUSHs (newmortalFH (fd[1], O_WRONLY));
2152 } 2166 }
2167}
2168
2169void
2170eventfd (unsigned int initval = 0, int flags = 0)
2171 PPCODE:
2172{
2173 int fd;
2174#if HAVE_EVENTFD
2175 fd = eventfd (initval, flags);
2176#else
2177 fd = (errno = ENOSYS, -1);
2178#endif
2179
2180 XPUSHs (newmortalFH (fd, O_RDWR));
2153} 2181}
2154 2182
2155UV 2183UV
2156get_fdlimit () 2184get_fdlimit ()
2157 CODE: 2185 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines