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.187 by root, Sat Jul 16 16:46:10 2011 UTC vs.
Revision 1.195 by root, Mon Sep 26 20:19:08 2011 UTC

30#undef opendir 30#undef opendir
31#undef closedir 31#undef closedir
32 32
33#ifdef _WIN32 33#ifdef _WIN32
34 34
35# define EIO_STRUCT_DIRENT Direntry_t
36# undef malloc
37# undef free
38
39// perl overrides all those nice win32 functions 35 // perl overrides all those nice libc functions
36
37 #undef malloc
38 #undef free
40# undef open 39 #undef open
41# undef read 40 #undef read
42# undef write 41 #undef write
43# undef send 42 #undef send
44# undef recv 43 #undef recv
44 #undef stat
45# undef lstat 45 #undef lstat
46 #undef fstat
46# undef truncate 47 #undef truncate
47# undef ftruncate 48 #undef ftruncate
48# undef open 49 #undef open
49# undef link 50 #undef link
50# undef close 51 #undef close
51# undef unlink 52 #undef unlink
52# undef mkdir 53 #undef mkdir
53# undef rmdir 54 #undef rmdir
54# undef rename 55 #undef rename
55# undef lseek 56 #undef lseek
56# undef opendir 57 #undef opendir
57# undef readdir 58 #undef readdir
58# undef closedir 59 #undef closedir
59# undef chmod 60 #undef chmod
60# undef fchmod 61 #undef fchmod
61 62 #undef dup
62# define opendir(fd) EIO_ERRNO (ENOSYS, 0) 63 #undef dup2
63# define readdir(fd) EIO_ENOSYS () 64 #undef abort
64# define closedir(fd) EIO_ENOSYS () 65 #undef pipe
65 66
66#else 67#else
67 68
68# include <sys/time.h> 69 #include <sys/time.h>
69# include <sys/select.h> 70 #include <sys/select.h>
70# include <unistd.h> 71 #include <unistd.h>
71# include <utime.h> 72 #include <utime.h>
72# include <signal.h> 73 #include <signal.h>
73 74
74#endif 75#endif
75 76
76#define EIO_STRUCT_STAT Stat_t 77#define EIO_STRUCT_STAT Stat_t
77 78
101 102
102typedef SV SV8; /* byte-sv, used for argument-checking */ 103typedef SV SV8; /* byte-sv, used for argument-checking */
103typedef int aio_rfd; /* read file desriptor */ 104typedef int aio_rfd; /* read file desriptor */
104typedef int aio_wfd; /* write file descriptor */ 105typedef int aio_wfd; /* write file descriptor */
105 106
106static HV *aio_stash, *aio_req_stash, *aio_grp_stash; 107static HV *aio_stash, *aio_req_stash, *aio_grp_stash, *aio_wd_stash;
107 108
108#define EIO_REQ_MEMBERS \ 109#define EIO_REQ_MEMBERS \
109 SV *callback; \ 110 SV *callback; \
110 SV *sv1, *sv2; \ 111 SV *sv1, *sv2; \
112 SV *sv3, *sv4; \
111 STRLEN stroffset; \ 113 STRLEN stroffset; \
112 SV *self; 114 SV *self;
113 115
114#define EIO_NO_WRAPPERS 1 116#define EIO_NO_WRAPPERS 1
115 117
116#include "libeio/config.h" 118#include "libeio/config.h"
117#include "libeio/eio.h" 119#include "libeio/eio.h"
120
121static int req_invoke (eio_req *req);
122#define EIO_FINISH(req) req_invoke (req)
123static void req_destroy (eio_req *grp);
124#define EIO_DESTROY(req) req_destroy (req)
125
126#include "libeio/eio.c"
118 127
119/* Linux/others */ 128/* Linux/others */
120#ifndef O_ASYNC 129#ifndef O_ASYNC
121# define O_ASYNC 0 130# define O_ASYNC 0
122#endif 131#endif
315 324
316#ifndef PAGESIZE 325#ifndef PAGESIZE
317# define PAGESIZE sysconf (_SC_PAGESIZE) 326# define PAGESIZE sysconf (_SC_PAGESIZE)
318#endif 327#endif
319 328
320static int req_invoke (eio_req *req);
321#define EIO_FINISH(req) req_invoke (req)
322static void req_destroy (eio_req *grp);
323#define EIO_DESTROY(req) req_destroy (req)
324
325enum { 329enum {
326 FLAG_SV2_RO_OFF = 0x40, /* data was set readonly */ 330 FLAG_SV2_RO_OFF = 0x40, /* data was set readonly */
327}; 331};
328 332
329#include "libeio/eio.c"
330
331typedef eio_req *aio_req; 333typedef eio_req *aio_req;
332typedef eio_req *aio_req_ornot; 334typedef eio_req *aio_req_ornot;
335typedef eio_wd *aio_wd;
333 336
334static SV *on_next_submit; 337static SV *on_next_submit;
335static int next_pri = EIO_PRI_DEFAULT; 338static int next_pri = EIO_PRI_DEFAULT;
336static int max_outstanding; 339static int max_outstanding;
337 340
375 croak ("object of class IO::AIO::REQ expected"); 378 croak ("object of class IO::AIO::REQ expected");
376 379
377 mg = mg_find (SvRV (sv), PERL_MAGIC_ext); 380 mg = mg_find (SvRV (sv), PERL_MAGIC_ext);
378 381
379 return mg ? (aio_req)mg->mg_ptr : 0; 382 return mg ? (aio_req)mg->mg_ptr : 0;
383}
384
385static aio_wd SvAIO_WD (SV *sv)
386{
387 if (!SvROK (sv)
388 || SvSTASH (SvRV (sv)) != aio_wd_stash
389 || SvTYPE (SvRV (sv)) != SVt_PVMG)
390 croak ("IO::AIO: expected a working directory object as returned by aio_wd");
391
392 return (aio_wd)(long)SvIVX (SvRV (sv));
380} 393}
381 394
382static void aio_grp_feed (aio_req grp) 395static void aio_grp_feed (aio_req grp)
383{ 396{
384 if (grp->sv2 && SvOK (grp->sv2)) 397 if (grp->sv2 && SvOK (grp->sv2))
443 SvREADONLY_on (sv_result); 456 SvREADONLY_on (sv_result);
444 } 457 }
445 458
446 switch (req->type) 459 switch (req->type)
447 { 460 {
461 case EIO_WD_OPEN:
462 PUSHs (sv_2mortal (sv_bless (newRV_noinc (newSViv (((long)req->wd))), aio_wd_stash)));
463 break;
464
448 case EIO_READDIR: 465 case EIO_READDIR:
449 { 466 {
450 SV *rv = &PL_sv_undef; 467 SV *rv = &PL_sv_undef;
451 468
452 if (req->result >= 0) 469 if (req->result >= 0)
596 case EIO_STAT: 613 case EIO_STAT:
597 case EIO_LSTAT: 614 case EIO_LSTAT:
598 case EIO_FSTAT: 615 case EIO_FSTAT:
599 PL_laststype = req->type == EIO_LSTAT ? OP_LSTAT : OP_STAT; 616 PL_laststype = req->type == EIO_LSTAT ? OP_LSTAT : OP_STAT;
600 PL_laststatval = req->result; 617 PL_laststatval = req->result;
618 /* if compilation fails here then perl's Stat_t is not struct _stati64 */
601 PL_statcache = *(EIO_STRUCT_STAT *)(req->ptr2); 619 PL_statcache = *(EIO_STRUCT_STAT *)(req->ptr2);
602 PUSHs (sv_result); 620 PUSHs (sv_result);
603 break; 621 break;
604 622
605 case EIO_READ: 623 case EIO_READ:
650 SvREFCNT_dec (req->self); 668 SvREFCNT_dec (req->self);
651 } 669 }
652 670
653 SvREFCNT_dec (req->sv1); 671 SvREFCNT_dec (req->sv1);
654 SvREFCNT_dec (req->sv2); 672 SvREFCNT_dec (req->sv2);
673 SvREFCNT_dec (req->sv3);
674 SvREFCNT_dec (req->sv4);
655 SvREFCNT_dec (req->callback); 675 SvREFCNT_dec (req->callback);
656 676
657 Safefree (req); 677 Safefree (req);
658} 678}
659 679
660static void req_cancel_subs (aio_req grp) 680static void req_cancel_subs (aio_req grp)
661{ 681{
662 aio_req sub;
663
664 if (grp->type != EIO_GROUP) 682 if (grp->type != EIO_GROUP)
665 return; 683 return;
666 684
667 SvREFCNT_dec (grp->sv2); 685 SvREFCNT_dec (grp->sv2);
668 grp->sv2 = 0; 686 grp->sv2 = 0;
709 727
710 poll_wait (); 728 poll_wait ();
711 } 729 }
712} 730}
713 731
714static void atfork_child (void) 732static void ecb_cold
733reinit (void)
715{ 734{
716 create_respipe (); 735 create_respipe ();
736
737 if (eio_init (want_poll, done_poll) < 0)
738 croak ("IO::AIO: unable to initialise eio library");
717} 739}
718 740
719/*****************************************************************************/ 741/*****************************************************************************/
720 742
721#if !_POSIX_MAPPED_FILES 743#if !_POSIX_MAPPED_FILES
786 req_submit (req); \ 808 req_submit (req); \
787 SPAGAIN; \ 809 SPAGAIN; \
788 \ 810 \
789 if (GIMME_V != G_VOID) \ 811 if (GIMME_V != G_VOID) \
790 XPUSHs (req_sv (req, aio_req_stash)); 812 XPUSHs (req_sv (req, aio_req_stash));
813
814static void
815req_set_path (aio_req req, SV *path, SV **wdsv, SV **pathsv, eio_wd *wd, void **ptr)
816{
817 if (SvROK (path))
818 {
819 AV *av = (AV *)SvRV (path);
820 SV *wdob;
821
822 if (SvTYPE (av) != SVt_PVAV || AvFILLp (av) != 1)
823 croak ("IO::AIO: pathname arguments must be specified as strings or [wd, path] arrayrefs");
824
825 path = AvARRAY (av)[1];
826 wdob = AvARRAY (av)[0];
827
828 *wd = SvAIO_WD (wdob);
829 *wdsv = SvREFCNT_inc_NN (SvRV (wdob));
830 }
831
832 *pathsv = newSVsv (path);
833 *ptr = SvPVbyte_nolen (*pathsv);
834}
835
836static void
837req_set_path1 (aio_req req, SV *path)
838{
839 req_set_path (req, path, &req->sv1, &req->sv3, &req->wd, &req->ptr1);
840}
841
842static void
843req_set_fh_or_path (aio_req req, int type_path, int type_fh, SV *fh_or_path)
844{
845 SV *rv = SvROK (fh_or_path) ? SvRV (fh_or_path) : fh_or_path;
846
847 switch (SvTYPE (rv))
848 {
849 case SVt_PVIO:
850 case SVt_PVLV:
851 case SVt_PVGV:
852 req->type = type_fh;
853 req->sv1 = newSVsv (fh_or_path);
854 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
855 break;
856
857 default:
858 req->type = type_path;
859 req_set_path1 (req, fh_or_path);
860 break;
861 }
862
863}
791 864
792MODULE = IO::AIO PACKAGE = IO::AIO 865MODULE = IO::AIO PACKAGE = IO::AIO
793 866
794PROTOTYPES: ENABLE 867PROTOTYPES: ENABLE
795 868
913 }; 986 };
914 987
915 aio_stash = gv_stashpv ("IO::AIO" , 1); 988 aio_stash = gv_stashpv ("IO::AIO" , 1);
916 aio_req_stash = gv_stashpv ("IO::AIO::REQ", 1); 989 aio_req_stash = gv_stashpv ("IO::AIO::REQ", 1);
917 aio_grp_stash = gv_stashpv ("IO::AIO::GRP", 1); 990 aio_grp_stash = gv_stashpv ("IO::AIO::GRP", 1);
991 aio_wd_stash = gv_stashpv ("IO::AIO::WD" , 1);
918 992
919 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 993 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
920 newCONSTSUB (aio_stash, (char *)civ->name, newSViv (civ->iv)); 994 newCONSTSUB (aio_stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
921 995
922 newCONSTSUB (aio_stash, "PAGESIZE", newSViv (PAGESIZE)); 996 newCONSTSUB (aio_stash, "PAGESIZE", newSViv (PAGESIZE));
923 997
924 create_respipe (); 998 reinit ();
925
926 if (eio_init (want_poll, done_poll) < 0)
927 croak ("IO::AIO: unable to initialise eio library");
928
929 /* atfork child called in fifo order, so before eio's handler */
930 X_THREAD_ATFORK (0, 0, atfork_child);
931} 999}
1000
1001void
1002reinit ()
1003 PROTOTYPE:
932 1004
933void 1005void
934max_poll_reqs (unsigned int nreqs) 1006max_poll_reqs (unsigned int nreqs)
935 PROTOTYPE: $ 1007 PROTOTYPE: $
936 CODE: 1008 CODE:
971 PROTOTYPE: $ 1043 PROTOTYPE: $
972 CODE: 1044 CODE:
973 max_outstanding = maxreqs; 1045 max_outstanding = maxreqs;
974 1046
975void 1047void
1048aio_wd (SV8 *pathname, SV *callback=&PL_sv_undef)
1049 PPCODE:
1050{
1051 dREQ;
1052
1053 req->type = EIO_WD_OPEN;
1054 req_set_path1 (req, pathname);
1055
1056 REQ_SEND;
1057}
1058
1059void
976aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef) 1060aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef)
977 PPCODE: 1061 PPCODE:
978{ 1062{
979 dREQ; 1063 dREQ;
980 1064
981 req->type = EIO_OPEN; 1065 req->type = EIO_OPEN;
982 req->sv1 = newSVsv (pathname); 1066 req_set_path1 (req, pathname);
983 req->ptr1 = SvPVbyte_nolen (req->sv1);
984 req->int1 = flags; 1067 req->int1 = flags;
985 req->int2 = mode; 1068 req->int2 = mode;
986 1069
987 REQ_SEND; 1070 REQ_SEND;
988} 1071}
990void 1073void
991aio_fsync (SV *fh, SV *callback=&PL_sv_undef) 1074aio_fsync (SV *fh, SV *callback=&PL_sv_undef)
992 ALIAS: 1075 ALIAS:
993 aio_fsync = EIO_FSYNC 1076 aio_fsync = EIO_FSYNC
994 aio_fdatasync = EIO_FDATASYNC 1077 aio_fdatasync = EIO_FDATASYNC
1078 aio_syncfs = EIO_SYNCFS
995 PPCODE: 1079 PPCODE:
996{ 1080{
997 int fd = s_fileno_croak (fh, 0); 1081 int fd = s_fileno_croak (fh, 0);
998 dREQ; 1082 dREQ;
999 1083
1046 int fd = s_fileno_croak (fh, 0); 1130 int fd = s_fileno_croak (fh, 0);
1047 dREQ; 1131 dREQ;
1048 1132
1049 if (expect_false (close_fd < 0)) 1133 if (expect_false (close_fd < 0))
1050 { 1134 {
1135 int pipefd [2];
1136
1137 if (
1051#ifdef _WIN32 1138#ifdef _WIN32
1052 close_fd = _open_osfhandle (socket (AF_INET, SOCK_STREAM, 0), 0); 1139 _pipe (pipefd, 1, _O_BINARY) < 0
1053#else 1140#else
1054 int pipefd [2];
1055
1056 if (pipe (pipefd) < 0 1141 pipe (pipefd) < 0
1057 || close (pipefd [1]) < 0
1058 || fcntl (pipefd [0], F_SETFD, FD_CLOEXEC) < 0) 1142 || fcntl (pipefd [0], F_SETFD, FD_CLOEXEC) < 0
1143#endif
1144 || close (pipefd [1]) < 0
1145 )
1059 abort (); /*D*/ 1146 abort (); /*D*/
1060 1147
1061 close_fd = pipefd [0]; 1148 close_fd = pipefd [0];
1062#endif
1063 } 1149 }
1064 1150
1065 req->type = EIO_DUP2; 1151 req->type = EIO_DUP2;
1066 req->int1 = close_fd; 1152 req->int1 = close_fd;
1067 req->sv2 = newSVsv (fh); 1153 req->sv2 = newSVsv (fh);
1122 REQ_SEND; 1208 REQ_SEND;
1123 } 1209 }
1124} 1210}
1125 1211
1126void 1212void
1127aio_readlink (SV8 *path, SV *callback=&PL_sv_undef) 1213aio_readlink (SV8 *pathname, SV *callback=&PL_sv_undef)
1128 ALIAS: 1214 ALIAS:
1129 aio_readlink = EIO_READLINK 1215 aio_readlink = EIO_READLINK
1130 aio_realpath = EIO_REALPATH 1216 aio_realpath = EIO_REALPATH
1131 PPCODE: 1217 PPCODE:
1132{ 1218{
1133 SV *data;
1134 dREQ; 1219 dREQ;
1135 1220
1136 req->type = ix; 1221 req->type = ix;
1137 req->sv1 = newSVsv (path); 1222 req_set_path1 (req, pathname);
1138 req->ptr1 = SvPVbyte_nolen (req->sv1);
1139 1223
1140 REQ_SEND; 1224 REQ_SEND;
1141} 1225}
1142 1226
1143void 1227void
1184 PPCODE: 1268 PPCODE:
1185{ 1269{
1186 dREQ; 1270 dREQ;
1187 1271
1188 req->sv1 = newSVsv (fh_or_path); 1272 req->sv1 = newSVsv (fh_or_path);
1189 1273 req_set_fh_or_path (req, ix, ix == EIO_STATVFS ? EIO_FSTATVFS : EIO_FSTAT, fh_or_path);
1190 if (SvPOK (req->sv1))
1191 {
1192 req->type = ix;
1193 req->ptr1 = SvPVbyte_nolen (req->sv1);
1194 }
1195 else
1196 {
1197 req->type = ix == EIO_STATVFS ? EIO_FSTATVFS : EIO_FSTAT;
1198 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
1199 }
1200
1201 REQ_SEND; 1274 REQ_SEND;
1202} 1275}
1203 1276
1204UV 1277UV
1205major (UV dev) 1278major (UV dev)
1223{ 1296{
1224 dREQ; 1297 dREQ;
1225 1298
1226 req->nv1 = SvOK (atime) ? SvNV (atime) : -1.; 1299 req->nv1 = SvOK (atime) ? SvNV (atime) : -1.;
1227 req->nv2 = SvOK (mtime) ? SvNV (mtime) : -1.; 1300 req->nv2 = SvOK (mtime) ? SvNV (mtime) : -1.;
1228 req->sv1 = newSVsv (fh_or_path); 1301 req_set_fh_or_path (req, EIO_UTIME, EIO_FUTIME, fh_or_path);
1229
1230 if (SvPOK (req->sv1))
1231 {
1232 req->type = EIO_UTIME;
1233 req->ptr1 = SvPVbyte_nolen (req->sv1);
1234 }
1235 else
1236 {
1237 req->type = EIO_FUTIME;
1238 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
1239 }
1240 1302
1241 REQ_SEND; 1303 REQ_SEND;
1242} 1304}
1243 1305
1244void 1306void
1245aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback=&PL_sv_undef) 1307aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback=&PL_sv_undef)
1246 PPCODE: 1308 PPCODE:
1247{ 1309{
1248 dREQ; 1310 dREQ;
1249 1311
1250 req->sv1 = newSVsv (fh_or_path);
1251 req->offs = SvOK (offset) ? SvVAL64 (offset) : -1; 1312 req->offs = SvOK (offset) ? SvVAL64 (offset) : -1;
1252 1313 req_set_fh_or_path (req, EIO_TRUNCATE, EIO_FTRUNCATE, fh_or_path);
1253 if (SvPOK (req->sv1))
1254 {
1255 req->type = EIO_TRUNCATE;
1256 req->ptr1 = SvPVbyte_nolen (req->sv1);
1257 }
1258 else
1259 {
1260 req->type = EIO_FTRUNCATE;
1261 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
1262 }
1263 1314
1264 REQ_SEND; 1315 REQ_SEND;
1265} 1316}
1266 1317
1267void 1318void
1272 PPCODE: 1323 PPCODE:
1273{ 1324{
1274 dREQ; 1325 dREQ;
1275 1326
1276 req->int2 = mode; 1327 req->int2 = mode;
1277 req->sv1 = newSVsv (fh_or_path); 1328 req_set_fh_or_path (req, EIO_CHMOD, EIO_FCHMOD, fh_or_path);
1278
1279 if (SvPOK (req->sv1))
1280 {
1281 req->type = ix;
1282 req->ptr1 = SvPVbyte_nolen (req->sv1);
1283 }
1284 else
1285 {
1286 req->type = EIO_FCHMOD;
1287 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
1288 }
1289 1329
1290 REQ_SEND; 1330 REQ_SEND;
1291} 1331}
1292 1332
1293void 1333void
1296{ 1336{
1297 dREQ; 1337 dREQ;
1298 1338
1299 req->int2 = SvOK (uid) ? SvIV (uid) : -1; 1339 req->int2 = SvOK (uid) ? SvIV (uid) : -1;
1300 req->int3 = SvOK (gid) ? SvIV (gid) : -1; 1340 req->int3 = SvOK (gid) ? SvIV (gid) : -1;
1301 req->sv1 = newSVsv (fh_or_path); 1341 req_set_fh_or_path (req, EIO_CHOWN, EIO_FCHOWN, fh_or_path);
1302
1303 if (SvPOK (req->sv1))
1304 {
1305 req->type = EIO_CHOWN;
1306 req->ptr1 = SvPVbyte_nolen (req->sv1);
1307 }
1308 else
1309 {
1310 req->type = EIO_FCHOWN;
1311 req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path)));
1312 }
1313 1342
1314 REQ_SEND; 1343 REQ_SEND;
1315} 1344}
1316 1345
1317void 1346void
1340 PPCODE: 1369 PPCODE:
1341{ 1370{
1342 dREQ; 1371 dREQ;
1343 1372
1344 req->type = ix; 1373 req->type = ix;
1345 req->sv1 = newSVsv (pathname); 1374 req_set_path1 (req, pathname);
1346 req->ptr1 = SvPVbyte_nolen (req->sv1);
1347 1375
1348 REQ_SEND; 1376 REQ_SEND;
1349} 1377}
1350 1378
1351void 1379void
1355 aio_symlink = EIO_SYMLINK 1383 aio_symlink = EIO_SYMLINK
1356 aio_rename = EIO_RENAME 1384 aio_rename = EIO_RENAME
1357 PPCODE: 1385 PPCODE:
1358{ 1386{
1359 dREQ; 1387 dREQ;
1388 eio_wd wd2;
1360 1389
1361 req->type = ix; 1390 req->type = ix;
1362 req->sv1 = newSVsv (oldpath); 1391 req_set_path1 (req, oldpath);
1363 req->ptr1 = SvPVbyte_nolen (req->sv1); 1392 req_set_path (req, newpath, &req->sv2, &req->sv4, &wd2, &req->ptr2);
1364 req->sv2 = newSVsv (newpath); 1393 req->int3 = (long)wd2;
1365 req->ptr2 = SvPVbyte_nolen (req->sv2);
1366 1394
1367 REQ_SEND; 1395 REQ_SEND;
1368} 1396}
1369 1397
1370void 1398void
1372 PPCODE: 1400 PPCODE:
1373{ 1401{
1374 dREQ; 1402 dREQ;
1375 1403
1376 req->type = EIO_MKNOD; 1404 req->type = EIO_MKNOD;
1377 req->sv1 = newSVsv (pathname);
1378 req->ptr1 = SvPVbyte_nolen (req->sv1);
1379 req->int2 = (mode_t)mode; 1405 req->int2 = (mode_t)mode;
1380 req->offs = dev; 1406 req->offs = dev;
1407 req_set_path1 (req, pathname);
1381 1408
1382 REQ_SEND; 1409 REQ_SEND;
1383} 1410}
1384 1411
1385void 1412void
1585 CODE: 1612 CODE:
1586 RETVAL = posix_fadvise (fh, offset, length, advice); 1613 RETVAL = posix_fadvise (fh, offset, length, advice);
1587 OUTPUT: 1614 OUTPUT:
1588 RETVAL 1615 RETVAL
1589 1616
1590ssize_t 1617IV
1591sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count) 1618sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count)
1592 CODE: 1619 CODE:
1593 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count); 1620 RETVAL = eio_sendfile_sync (ofh, ifh, offset, count);
1594 OUTPUT: 1621 OUTPUT:
1595 RETVAL 1622 RETVAL
1707 SvREFCNT_dec (on_next_submit); 1734 SvREFCNT_dec (on_next_submit);
1708 on_next_submit = SvOK (cb) ? newSVsv (cb) : 0; 1735 on_next_submit = SvOK (cb) ? newSVsv (cb) : 0;
1709 1736
1710PROTOTYPES: DISABLE 1737PROTOTYPES: DISABLE
1711 1738
1739MODULE = IO::AIO PACKAGE = IO::AIO::WD
1740
1741void
1742DESTROY (SV *self)
1743 CODE:
1744{
1745 aio_wd wd = SvAIO_WD (self);
1746#if HAVE_AT
1747 SV *callback = &PL_sv_undef;
1748 dREQ; /* clobbers next_pri :/ */
1749 req->type = EIO_WD_CLOSE;
1750 req->wd = wd;
1751 REQ_SEND;
1752#else
1753 eio_wd_close_sync (wd);
1754#endif
1755}
1756
1712MODULE = IO::AIO PACKAGE = IO::AIO::REQ 1757MODULE = IO::AIO PACKAGE = IO::AIO::REQ
1713 1758
1714void 1759void
1715cancel (aio_req_ornot req) 1760cancel (aio_req_ornot req)
1716 CODE: 1761 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines