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.226 by root, Sun Jan 6 11:48:14 2013 UTC vs.
Revision 1.232 by root, Sat Jun 13 00:06:13 2015 UTC

19 19
20#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES 20#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
21# include <sys/mman.h> 21# include <sys/mman.h>
22#endif 22#endif
23 23
24#if __linux__ 24/* the incompetent fool that created musl keeps __linux__, refuses
25 * to implement any linux standard apis, and also has no way to test
26 * for his broken iplementation. on't complain if this fails for you.
27 */
28#if __linux__ && (defined __GLIBC__ || defined __UCLIBC__)
25# include <linux/fs.h> 29# include <linux/fs.h>
26# ifdef FS_IOC_FIEMAP 30# ifdef FS_IOC_FIEMAP
27# include <linux/types.h> 31# include <linux/types.h>
28# include <linux/fiemap.h> 32# include <linux/fiemap.h>
29# define HAVE_FIEMAP 1 33# define HAVE_FIEMAP 1
304} 308}
305 309
306static SV * 310static SV *
307newSVaio_wd (aio_wd wd) 311newSVaio_wd (aio_wd wd)
308{ 312{
309 return sv_bless (newRV_noinc (newSViv ((IV)wd)), aio_wd_stash); 313 return sv_bless (newRV_noinc (newSViv ((intptr_t)wd)), aio_wd_stash);
310} 314}
311 315
312static aio_req 316static aio_req
313SvAIO_REQ (SV *sv) 317SvAIO_REQ (SV *sv)
314{ 318{
1029 const_eio (SYNC_FILE_RANGE_WRITE) 1033 const_eio (SYNC_FILE_RANGE_WRITE)
1030 const_eio (SYNC_FILE_RANGE_WAIT_AFTER) 1034 const_eio (SYNC_FILE_RANGE_WAIT_AFTER)
1031 1035
1032 const_eio (FALLOC_FL_KEEP_SIZE) 1036 const_eio (FALLOC_FL_KEEP_SIZE)
1033 const_eio (FALLOC_FL_PUNCH_HOLE) 1037 const_eio (FALLOC_FL_PUNCH_HOLE)
1038 const_eio (FALLOC_FL_COLLAPSE_RANGE)
1039 const_eio (FALLOC_FL_ZERO_RANGE)
1034 1040
1035 const_eio (READDIR_DENTS) 1041 const_eio (READDIR_DENTS)
1036 const_eio (READDIR_DIRS_FIRST) 1042 const_eio (READDIR_DIRS_FIRST)
1037 const_eio (READDIR_STAT_ORDER) 1043 const_eio (READDIR_STAT_ORDER)
1038 const_eio (READDIR_FOUND_UNKNOWN) 1044 const_eio (READDIR_FOUND_UNKNOWN)
1106 PROTOTYPE: $ 1112 PROTOTYPE: $
1107 CODE: 1113 CODE:
1108 max_outstanding = maxreqs; 1114 max_outstanding = maxreqs;
1109 1115
1110void 1116void
1111aio_wd (SV8 *pathname, SV *callback=&PL_sv_undef) 1117aio_wd (SV8 *pathname, SV *callback = &PL_sv_undef)
1112 PPCODE: 1118 PPCODE:
1113{ 1119{
1114 dREQ; 1120 dREQ;
1115 1121
1116 req->type = EIO_WD_OPEN; 1122 req->type = EIO_WD_OPEN;
1118 1124
1119 REQ_SEND; 1125 REQ_SEND;
1120} 1126}
1121 1127
1122void 1128void
1123aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef) 1129aio_open (SV8 *pathname, int flags, int mode, SV *callback = &PL_sv_undef)
1124 PPCODE: 1130 PPCODE:
1125{ 1131{
1126 dREQ; 1132 dREQ;
1127 1133
1128 req->type = EIO_OPEN; 1134 req->type = EIO_OPEN;
1132 1138
1133 REQ_SEND; 1139 REQ_SEND;
1134} 1140}
1135 1141
1136void 1142void
1137aio_fsync (SV *fh, SV *callback=&PL_sv_undef) 1143aio_fsync (SV *fh, SV *callback = &PL_sv_undef)
1138 ALIAS: 1144 ALIAS:
1139 aio_fsync = EIO_FSYNC 1145 aio_fsync = EIO_FSYNC
1140 aio_fdatasync = EIO_FDATASYNC 1146 aio_fdatasync = EIO_FDATASYNC
1141 aio_syncfs = EIO_SYNCFS 1147 aio_syncfs = EIO_SYNCFS
1142 PPCODE: 1148 PPCODE:
1150 1156
1151 REQ_SEND; 1157 REQ_SEND;
1152} 1158}
1153 1159
1154void 1160void
1155aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback=&PL_sv_undef) 1161aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback = &PL_sv_undef)
1156 PPCODE: 1162 PPCODE:
1157{ 1163{
1158 int fd = s_fileno_croak (fh, 0); 1164 int fd = s_fileno_croak (fh, 0);
1159 dREQ; 1165 dREQ;
1160 1166
1167 1173
1168 REQ_SEND; 1174 REQ_SEND;
1169} 1175}
1170 1176
1171void 1177void
1172aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_undef) 1178aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback = &PL_sv_undef)
1173 PPCODE: 1179 PPCODE:
1174{ 1180{
1175 int fd = s_fileno_croak (fh, 0); 1181 int fd = s_fileno_croak (fh, 0);
1176 dREQ; 1182 dREQ;
1177 1183
1184 1190
1185 REQ_SEND; 1191 REQ_SEND;
1186} 1192}
1187 1193
1188void 1194void
1189aio_close (SV *fh, SV *callback=&PL_sv_undef) 1195aio_close (SV *fh, SV *callback = &PL_sv_undef)
1190 PPCODE: 1196 PPCODE:
1191{ 1197{
1192 static int close_fd = -1; /* dummy fd to close fds via dup2 */ 1198 static int close_fd = -1; /* dummy fd to close fds via dup2 */
1193 int fd = s_fileno_croak (fh, 0); 1199 int fd = s_fileno_croak (fh, 0);
1194 dREQ; 1200 dREQ;
1218 1224
1219 REQ_SEND; 1225 REQ_SEND;
1220} 1226}
1221 1227
1222void 1228void
1223aio_seek (SV *fh, SV *offset, int whence, SV *callback=&PL_sv_undef) 1229aio_seek (SV *fh, SV *offset, int whence, SV *callback = &PL_sv_undef)
1224 PPCODE: 1230 PPCODE:
1225{ 1231{
1226 int fd = s_fileno_croak (fh, 0); 1232 int fd = s_fileno_croak (fh, 0);
1227 dREQ; 1233 dREQ;
1228 1234
1234 1240
1235 REQ_SEND; 1241 REQ_SEND;
1236} 1242}
1237 1243
1238void 1244void
1239aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback=&PL_sv_undef) 1245aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback = &PL_sv_undef)
1240 ALIAS: 1246 ALIAS:
1241 aio_read = EIO_READ 1247 aio_read = EIO_READ
1242 aio_write = EIO_WRITE 1248 aio_write = EIO_WRITE
1243 PPCODE: 1249 PPCODE:
1244{ 1250{
1260 len = svlen - dataoffset; 1266 len = svlen - dataoffset;
1261 } 1267 }
1262 else 1268 else
1263 { 1269 {
1264 /* read: check type and grow scalar as necessary */ 1270 /* read: check type and grow scalar as necessary */
1265 SvUPGRADE (data, SVt_PV);
1266 if (SvLEN (data) >= SvCUR (data)) 1271 if (!SvPOK (data) || SvLEN (data) >= SvCUR (data))
1267 svptr = SvGROW (data, len + dataoffset + 1); 1272 svptr = sv_grow (data, len + dataoffset + 1);
1268 else if (SvCUR (data) < len + dataoffset) 1273 else if (SvCUR (data) < len + dataoffset)
1269 croak ("length + dataoffset outside of scalar, and cannot grow"); 1274 croak ("length + dataoffset outside of scalar, and cannot grow");
1270 } 1275 }
1271 1276
1272 { 1277 {
1290 REQ_SEND; 1295 REQ_SEND;
1291 } 1296 }
1292} 1297}
1293 1298
1294void 1299void
1295aio_readlink (SV8 *pathname, SV *callback=&PL_sv_undef) 1300aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef)
1296 ALIAS: 1301 ALIAS:
1297 aio_readlink = EIO_READLINK 1302 aio_readlink = EIO_READLINK
1298 aio_realpath = EIO_REALPATH 1303 aio_realpath = EIO_REALPATH
1299 PPCODE: 1304 PPCODE:
1300{ 1305{
1305 1310
1306 REQ_SEND; 1311 REQ_SEND;
1307} 1312}
1308 1313
1309void 1314void
1310aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback=&PL_sv_undef) 1315aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback = &PL_sv_undef)
1311 PPCODE: 1316 PPCODE:
1312{ 1317{
1313 int ifd = s_fileno_croak (in_fh , 0); 1318 int ifd = s_fileno_croak (in_fh , 0);
1314 int ofd = s_fileno_croak (out_fh, 1); 1319 int ofd = s_fileno_croak (out_fh, 1);
1315 dREQ; 1320 dREQ;
1324 1329
1325 REQ_SEND; 1330 REQ_SEND;
1326} 1331}
1327 1332
1328void 1333void
1329aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef) 1334aio_readahead (SV *fh, off_t offset, size_t length, SV *callback = &PL_sv_undef)
1330 PPCODE: 1335 PPCODE:
1331{ 1336{
1332 int fd = s_fileno_croak (fh, 0); 1337 int fd = s_fileno_croak (fh, 0);
1333 dREQ; 1338 dREQ;
1334 1339
1340 1345
1341 REQ_SEND; 1346 REQ_SEND;
1342} 1347}
1343 1348
1344void 1349void
1345aio_stat (SV8 *fh_or_path, SV *callback=&PL_sv_undef) 1350aio_stat (SV8 *fh_or_path, SV *callback = &PL_sv_undef)
1346 ALIAS: 1351 ALIAS:
1347 aio_stat = EIO_STAT 1352 aio_stat = EIO_STAT
1348 aio_lstat = EIO_LSTAT 1353 aio_lstat = EIO_LSTAT
1349 aio_statvfs = EIO_STATVFS 1354 aio_statvfs = EIO_STATVFS
1350 PPCODE: 1355 PPCODE:
1371 RETVAL = makedev (maj, min); 1376 RETVAL = makedev (maj, min);
1372 OUTPUT: 1377 OUTPUT:
1373 RETVAL 1378 RETVAL
1374 1379
1375void 1380void
1376aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback=&PL_sv_undef) 1381aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback = &PL_sv_undef)
1377 PPCODE: 1382 PPCODE:
1378{ 1383{
1379 dREQ; 1384 dREQ;
1380 1385
1381 req->nv1 = SvOK (atime) ? SvNV (atime) : -1.; 1386 req->nv1 = SvOK (atime) ? SvNV (atime) : -1.;
1384 1389
1385 REQ_SEND; 1390 REQ_SEND;
1386} 1391}
1387 1392
1388void 1393void
1389aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback=&PL_sv_undef) 1394aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback = &PL_sv_undef)
1390 PPCODE: 1395 PPCODE:
1391{ 1396{
1392 dREQ; 1397 dREQ;
1393 1398
1394 req->offs = SvOK (offset) ? SvVAL64 (offset) : -1; 1399 req->offs = SvOK (offset) ? SvVAL64 (offset) : -1;
1396 1401
1397 REQ_SEND; 1402 REQ_SEND;
1398} 1403}
1399 1404
1400void 1405void
1401aio_chmod (SV8 *fh_or_path, int mode, SV *callback=&PL_sv_undef) 1406aio_chmod (SV8 *fh_or_path, int mode, SV *callback = &PL_sv_undef)
1402 PPCODE: 1407 PPCODE:
1403{ 1408{
1404 dREQ; 1409 dREQ;
1405 1410
1406 req->int2 = mode; 1411 req->int2 = mode;
1408 1413
1409 REQ_SEND; 1414 REQ_SEND;
1410} 1415}
1411 1416
1412void 1417void
1413aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback=&PL_sv_undef) 1418aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback = &PL_sv_undef)
1414 PPCODE: 1419 PPCODE:
1415{ 1420{
1416 dREQ; 1421 dREQ;
1417 1422
1418 req->int2 = SvOK (uid) ? SvIV (uid) : -1; 1423 req->int2 = SvOK (uid) ? SvIV (uid) : -1;
1421 1426
1422 REQ_SEND; 1427 REQ_SEND;
1423} 1428}
1424 1429
1425void 1430void
1426aio_readdirx (SV8 *pathname, IV flags, SV *callback=&PL_sv_undef) 1431aio_readdirx (SV8 *pathname, IV flags, SV *callback = &PL_sv_undef)
1427 PPCODE: 1432 PPCODE:
1428{ 1433{
1429 dREQ; 1434 dREQ;
1430 1435
1431 req->type = EIO_READDIR; 1436 req->type = EIO_READDIR;
1438 1443
1439 REQ_SEND; 1444 REQ_SEND;
1440} 1445}
1441 1446
1442void 1447void
1443aio_mkdir (SV8 *pathname, int mode, SV *callback=&PL_sv_undef) 1448aio_mkdir (SV8 *pathname, int mode, SV *callback = &PL_sv_undef)
1444 PPCODE: 1449 PPCODE:
1445{ 1450{
1446 dREQ; 1451 dREQ;
1447 1452
1448 req->type = EIO_MKDIR; 1453 req->type = EIO_MKDIR;
1451 1456
1452 REQ_SEND; 1457 REQ_SEND;
1453} 1458}
1454 1459
1455void 1460void
1456aio_unlink (SV8 *pathname, SV *callback=&PL_sv_undef) 1461aio_unlink (SV8 *pathname, SV *callback = &PL_sv_undef)
1457 ALIAS: 1462 ALIAS:
1458 aio_unlink = EIO_UNLINK 1463 aio_unlink = EIO_UNLINK
1459 aio_rmdir = EIO_RMDIR 1464 aio_rmdir = EIO_RMDIR
1460 aio_readdir = EIO_READDIR 1465 aio_readdir = EIO_READDIR
1461 PPCODE: 1466 PPCODE:
1467 1472
1468 REQ_SEND; 1473 REQ_SEND;
1469} 1474}
1470 1475
1471void 1476void
1472aio_link (SV8 *oldpath, SV8 *newpath, SV *callback=&PL_sv_undef) 1477aio_link (SV8 *oldpath, SV8 *newpath, SV *callback = &PL_sv_undef)
1473 ALIAS: 1478 ALIAS:
1474 aio_link = EIO_LINK 1479 aio_link = EIO_LINK
1475 aio_symlink = EIO_SYMLINK 1480 aio_symlink = EIO_SYMLINK
1476 aio_rename = EIO_RENAME 1481 aio_rename = EIO_RENAME
1477 PPCODE: 1482 PPCODE:
1486 1491
1487 REQ_SEND; 1492 REQ_SEND;
1488} 1493}
1489 1494
1490void 1495void
1491aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback=&PL_sv_undef) 1496aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef)
1492 PPCODE: 1497 PPCODE:
1493{ 1498{
1494 dREQ; 1499 dREQ;
1495 1500
1496 req->type = EIO_MKNOD; 1501 req->type = EIO_MKNOD;
1500 1505
1501 REQ_SEND; 1506 REQ_SEND;
1502} 1507}
1503 1508
1504void 1509void
1505aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback=&PL_sv_undef) 1510aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback = &PL_sv_undef)
1506 ALIAS: 1511 ALIAS:
1507 aio_mtouch = EIO_MTOUCH 1512 aio_mtouch = EIO_MTOUCH
1508 aio_msync = EIO_MSYNC 1513 aio_msync = EIO_MSYNC
1509 PPCODE: 1514 PPCODE:
1510{ 1515{
1533 REQ_SEND; 1538 REQ_SEND;
1534 } 1539 }
1535} 1540}
1536 1541
1537void 1542void
1538aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback=&PL_sv_undef) 1543aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback = &PL_sv_undef)
1539 PPCODE: 1544 PPCODE:
1540{ 1545{
1541 STRLEN svlen; 1546 STRLEN svlen;
1542 char *svptr = SvPVbyte (data, svlen); 1547 char *svptr = SvPVbyte (data, svlen);
1543 UV len = SvUV (length); 1548 UV len = SvUV (length);
1562 REQ_SEND; 1567 REQ_SEND;
1563 } 1568 }
1564} 1569}
1565 1570
1566void 1571void
1567aio_mlockall (IV flags, SV *callback=&PL_sv_undef) 1572aio_mlockall (IV flags, SV *callback = &PL_sv_undef)
1568 PPCODE: 1573 PPCODE:
1569{ 1574{
1570 dREQ; 1575 dREQ;
1571 1576
1572 req->type = EIO_MLOCKALL; 1577 req->type = EIO_MLOCKALL;
1574 1579
1575 REQ_SEND; 1580 REQ_SEND;
1576} 1581}
1577 1582
1578void 1583void
1579aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=&PL_sv_undef) 1584aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback = &PL_sv_undef)
1580 PPCODE: 1585 PPCODE:
1581{ 1586{
1582 int fd = s_fileno_croak (fh, 0); 1587 int fd = s_fileno_croak (fh, 0);
1583 dREQ; 1588 dREQ;
1584 1589
1597 1602
1598 REQ_SEND; 1603 REQ_SEND;
1599} 1604}
1600 1605
1601void 1606void
1602aio_busy (double delay, SV *callback=&PL_sv_undef) 1607aio_busy (double delay, SV *callback = &PL_sv_undef)
1603 PPCODE: 1608 PPCODE:
1604{ 1609{
1605 dREQ; 1610 dREQ;
1606 1611
1607 req->type = EIO_BUSY; 1612 req->type = EIO_BUSY;
1609 1614
1610 REQ_SEND; 1615 REQ_SEND;
1611} 1616}
1612 1617
1613void 1618void
1614aio_group (SV *callback=&PL_sv_undef) 1619aio_group (SV *callback = &PL_sv_undef)
1615 PPCODE: 1620 PPCODE:
1616{ 1621{
1617 dREQ; 1622 dREQ;
1618 1623
1619 req->type = EIO_GROUP; 1624 req->type = EIO_GROUP;
1620 1625
1626 PUTBACK;
1621 req_submit (req); 1627 req_submit (req);
1628 SPAGAIN;
1629
1622 XPUSHs (req_sv (req, aio_grp_stash)); 1630 XPUSHs (req_sv (req, aio_grp_stash));
1623} 1631}
1624 1632
1625void 1633void
1626aio_nop (SV *callback=&PL_sv_undef) 1634aio_nop (SV *callback = &PL_sv_undef)
1627 ALIAS: 1635 ALIAS:
1628 aio_nop = EIO_NOP 1636 aio_nop = EIO_NOP
1629 aio_sync = EIO_SYNC 1637 aio_sync = EIO_SYNC
1630 PPCODE: 1638 PPCODE:
1631{ 1639{
1635 1643
1636 REQ_SEND; 1644 REQ_SEND;
1637} 1645}
1638 1646
1639int 1647int
1640aioreq_pri (int pri = 0) 1648aioreq_pri (int pri = NO_INIT)
1641 CODE: 1649 CODE:
1642 RETVAL = next_pri; 1650 RETVAL = next_pri;
1643 if (items > 0) 1651 if (items > 0)
1644 { 1652 {
1645 if (pri < EIO_PRI_MIN) pri = EIO_PRI_MIN; 1653 if (pri < EIO_PRI_MIN) pri = EIO_PRI_MIN;
1735 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count); 1743 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count);
1736 OUTPUT: 1744 OUTPUT:
1737 RETVAL 1745 RETVAL
1738 1746
1739void 1747void
1740mmap (SV *scalar, size_t length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0) 1748mmap (SV *scalar, STRLEN length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0)
1741 PPCODE: 1749 PPCODE:
1742 sv_unmagic (scalar, MMAP_MAGIC); 1750 sv_unmagic (scalar, MMAP_MAGIC);
1743{ 1751{
1744 int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1; 1752 int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1;
1745 void *addr = (void *)mmap (0, length, prot, flags, fd, offset); 1753 void *addr = (void *)mmap (0, length, prot, flags, fd, offset);
1772munmap (SV *scalar) 1780munmap (SV *scalar)
1773 CODE: 1781 CODE:
1774 sv_unmagic (scalar, MMAP_MAGIC); 1782 sv_unmagic (scalar, MMAP_MAGIC);
1775 1783
1776int 1784int
1777madvise (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot) 1785madvise (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot)
1778 ALIAS: 1786 ALIAS:
1779 mprotect = 1 1787 mprotect = 1
1780 CODE: 1788 CODE:
1781{ 1789{
1782 STRLEN svlen; 1790 STRLEN svlen;
1783 void *addr = SvPVbyte (scalar, svlen); 1791 void *addr = SvPVbyte (scalar, svlen);
1784 size_t len = SvUV (length); 1792 STRLEN len = SvUV (length);
1785 1793
1786 if (offset < 0) 1794 if (offset < 0)
1787 offset += svlen; 1795 offset += svlen;
1788 1796
1789 if (offset < 0 || offset > svlen) 1797 if (offset < 0 || offset > svlen)
1803} 1811}
1804 OUTPUT: 1812 OUTPUT:
1805 RETVAL 1813 RETVAL
1806 1814
1807int 1815int
1808munlock (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef) 1816munlock (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef)
1809 CODE: 1817 CODE:
1810{ 1818{
1811 STRLEN svlen; 1819 STRLEN svlen;
1812 void *addr = SvPVbyte (scalar, svlen); 1820 void *addr = SvPVbyte (scalar, svlen);
1813 size_t len = SvUV (length); 1821 size_t len = SvUV (length);
1868 RETVAL = tee (rfh, wfh, length, flags); 1876 RETVAL = tee (rfh, wfh, length, flags);
1869#else 1877#else
1870 RETVAL = EIO_ENOSYS (); 1878 RETVAL = EIO_ENOSYS ();
1871#endif 1879#endif
1872 OUTPUT: 1880 OUTPUT:
1881 RETVAL
1882
1883int
1884pipesize (aio_rfd rfh, int new_size = -1)
1885 PROTOTYPE: $;$
1886 CODE:
1887#if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ)
1888 if (new_size >= 0)
1889 RETVAL = fcntl (rfh, F_SETPIPE_SZ, new_size);
1890 else
1891 RETVAL = fcntl (rfh, F_GETPIPE_SZ);
1892#else
1893 errno = ENOSYS;
1894 RETVAL = -1;
1895#endif
1896 OUTPUT:
1873 RETVAL 1897 RETVAL
1874 1898
1875void _on_next_submit (SV *cb) 1899void _on_next_submit (SV *cb)
1876 CODE: 1900 CODE:
1877 SvREFCNT_dec (on_next_submit); 1901 SvREFCNT_dec (on_next_submit);
1913cancel (aio_req_ornot req) 1937cancel (aio_req_ornot req)
1914 CODE: 1938 CODE:
1915 eio_cancel (req); 1939 eio_cancel (req);
1916 1940
1917void 1941void
1918cb (aio_req_ornot req, SV *callback=&PL_sv_undef) 1942cb (aio_req_ornot req, SV *callback = NO_INIT)
1919 PPCODE: 1943 PPCODE:
1920{ 1944{
1921 if (GIMME_V != G_VOID) 1945 if (GIMME_V != G_VOID)
1922 XPUSHs (req->callback ? sv_2mortal (newRV_inc (req->callback)) : &PL_sv_undef); 1946 XPUSHs (req->callback ? sv_2mortal (newRV_inc (req->callback)) : &PL_sv_undef);
1923 1947
1924 if (items > 1) 1948 if (items > 1)
1925 { 1949 {
1926 SV *cb_cv =get_cb (callback); 1950 SV *cb_cv = get_cb (callback);
1927 1951
1928 SvREFCNT_dec (req->callback); 1952 SvREFCNT_dec (req->callback);
1929 req->callback = SvREFCNT_inc (cb_cv); 1953 req->callback = SvREFCNT_inc (cb_cv);
1930 } 1954 }
1931} 1955}
1988limit (aio_req grp, int limit) 2012limit (aio_req grp, int limit)
1989 CODE: 2013 CODE:
1990 eio_grp_limit (grp, limit); 2014 eio_grp_limit (grp, limit);
1991 2015
1992void 2016void
1993feed (aio_req grp, SV *callback=&PL_sv_undef) 2017feed (aio_req grp, SV *callback = &PL_sv_undef)
1994 CODE: 2018 CODE:
1995{ 2019{
1996 SvREFCNT_dec (grp->sv2); 2020 SvREFCNT_dec (grp->sv2);
1997 grp->sv2 = newSVsv (callback); 2021 grp->sv2 = newSVsv (callback);
1998 grp->feed = aio_grp_feed; 2022 grp->feed = aio_grp_feed;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines