… | |
… | |
11 | #include <stddef.h> |
11 | #include <stddef.h> |
12 | #include <stdlib.h> |
12 | #include <stdlib.h> |
13 | #include <errno.h> |
13 | #include <errno.h> |
14 | #include <sys/types.h> |
14 | #include <sys/types.h> |
15 | #include <sys/stat.h> |
15 | #include <sys/stat.h> |
|
|
16 | #include <sys/statvfs.h> |
16 | #include <limits.h> |
17 | #include <limits.h> |
17 | #include <fcntl.h> |
18 | #include <fcntl.h> |
18 | #include <sched.h> |
19 | #include <sched.h> |
|
|
20 | |
|
|
21 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
|
|
22 | # include <sys/mman.h> |
|
|
23 | #endif |
19 | |
24 | |
20 | /* perl namespace pollution */ |
25 | /* perl namespace pollution */ |
21 | #undef VERSION |
26 | #undef VERSION |
22 | |
27 | |
23 | #ifdef _WIN32 |
28 | #ifdef _WIN32 |
… | |
… | |
113 | STRLEN stroffset; \ |
118 | STRLEN stroffset; \ |
114 | SV *self; |
119 | SV *self; |
115 | |
120 | |
116 | #define EIO_NO_WRAPPERS 1 |
121 | #define EIO_NO_WRAPPERS 1 |
117 | |
122 | |
|
|
123 | #include "libeio/config.h" |
118 | #include "libeio/eio.h" |
124 | #include "libeio/eio.h" |
119 | |
125 | |
120 | #ifndef POSIX_FADV_NORMAL |
126 | #ifndef POSIX_FADV_NORMAL |
121 | # define POSIX_FADV_NORMAL 0 |
127 | # define POSIX_FADV_NORMAL 0 |
122 | # define NO_FADVISE 1 |
|
|
123 | #endif |
128 | #endif |
124 | |
|
|
125 | #ifndef POSIX_FADV_SEQUENTIAL |
129 | #ifndef POSIX_FADV_SEQUENTIAL |
126 | # define POSIX_FADV_SEQUENTIAL 0 |
130 | # define POSIX_FADV_SEQUENTIAL 0 |
127 | #endif |
131 | #endif |
128 | |
|
|
129 | #ifndef POSIX_FADV_RANDOM |
132 | #ifndef POSIX_FADV_RANDOM |
130 | # define POSIX_FADV_RANDOM 0 |
133 | # define POSIX_FADV_RANDOM 0 |
131 | #endif |
134 | #endif |
132 | |
|
|
133 | #ifndef POSIX_FADV_NOREUSE |
135 | #ifndef POSIX_FADV_NOREUSE |
134 | # define POSIX_FADV_NOREUSE 0 |
136 | # define POSIX_FADV_NOREUSE 0 |
135 | #endif |
137 | #endif |
136 | |
|
|
137 | #ifndef POSIX_FADV_WILLNEED |
138 | #ifndef POSIX_FADV_WILLNEED |
138 | # define POSIX_FADV_WILLNEED 0 |
139 | # define POSIX_FADV_WILLNEED 0 |
139 | #endif |
140 | #endif |
140 | |
|
|
141 | #ifndef POSIX_FADV_DONTNEED |
141 | #ifndef POSIX_FADV_DONTNEED |
142 | # define POSIX_FADV_DONTNEED 0 |
142 | # define POSIX_FADV_DONTNEED 0 |
|
|
143 | #endif |
|
|
144 | |
|
|
145 | #if !HAVE_POSIX_FADVISE |
|
|
146 | # define posix_fadvise(a,b,c,d) errno = ENOSYS /* also return ENOSYS */ |
|
|
147 | #endif |
|
|
148 | |
|
|
149 | #ifndef POSIX_MADV_NORMAL |
|
|
150 | # define POSIX_MADV_NORMAL 0 |
|
|
151 | #endif |
|
|
152 | #ifndef POSIX_MADV_SEQUENTIAL |
|
|
153 | # define POSIX_MADV_SEQUENTIAL 0 |
|
|
154 | #endif |
|
|
155 | #ifndef POSIX_MADV_RANDOM |
|
|
156 | # define POSIX_MADV_RANDOM 0 |
|
|
157 | #endif |
|
|
158 | #ifndef POSIX_MADV_WILLNEED |
|
|
159 | # define POSIX_MADV_WILLNEED 0 |
|
|
160 | #endif |
|
|
161 | #ifndef POSIX_MADV_DONTNEED |
|
|
162 | # define POSIX_MADV_DONTNEED 0 |
|
|
163 | #endif |
|
|
164 | |
|
|
165 | #if !HAVE_POSIX_MADVISE |
|
|
166 | # define posix_madvise(a,b,c) errno = ENOSYS /* also return ENOSYS */ |
|
|
167 | #endif |
|
|
168 | |
|
|
169 | #ifndef PROT_NONE |
|
|
170 | # define PROT_NONE 0 |
|
|
171 | #endif |
|
|
172 | #ifndef PROT_READ |
|
|
173 | # define PROT_READ 0 |
|
|
174 | #endif |
|
|
175 | #ifndef PROT_WRITE |
|
|
176 | # define PROT_READ 0 |
|
|
177 | #endif |
|
|
178 | #ifndef PROT_EXEC |
|
|
179 | # define PROT_EXEC 0 |
|
|
180 | #endif |
|
|
181 | |
|
|
182 | #ifndef ST_NODEV |
|
|
183 | # define ST_NODEV 0 |
|
|
184 | #endif |
|
|
185 | #ifndef ST_NOEXEC |
|
|
186 | # define ST_NOEXEC 0 |
|
|
187 | #endif |
|
|
188 | #ifndef ST_SYNCHRONOUS |
|
|
189 | # define ST_SYNCHRONOUS 0 |
|
|
190 | #endif |
|
|
191 | #ifndef ST_MANDLOCK |
|
|
192 | # define ST_MANDLOCK 0 |
|
|
193 | #endif |
|
|
194 | #ifndef ST_WRITE |
|
|
195 | # define ST_WRITE 0 |
|
|
196 | #endif |
|
|
197 | #ifndef ST_APPEND |
|
|
198 | # define ST_APPEND 0 |
|
|
199 | #endif |
|
|
200 | #ifndef ST_IMMUTABLE |
|
|
201 | # define ST_IMMUTABLE 0 |
|
|
202 | #endif |
|
|
203 | #ifndef ST_NOATIME |
|
|
204 | # define ST_NOATIME 0 |
|
|
205 | #endif |
|
|
206 | #ifndef ST_NODIRATIME |
|
|
207 | # define ST_NODIRATIME 0 |
|
|
208 | #endif |
|
|
209 | #ifndef ST_RELATIME |
|
|
210 | # define ST_RELATIME 0 |
|
|
211 | #endif |
|
|
212 | |
|
|
213 | #ifndef MAP_ANONYMOUS |
|
|
214 | # ifdef MAP_ANON |
|
|
215 | # define MAP_ANONYMOUS MAP_ANON |
|
|
216 | # else |
|
|
217 | # define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ |
|
|
218 | # endif |
|
|
219 | #endif |
|
|
220 | #ifndef MAP_HUGETLB |
|
|
221 | # define MAP_HUGETLB 0 |
|
|
222 | #endif |
|
|
223 | #ifndef MAP_LOCKED |
|
|
224 | # define MAP_LOCKED 0 |
|
|
225 | #endif |
|
|
226 | #ifndef MAP_NORESERVE |
|
|
227 | # define MAP_NORESERVE 0 |
|
|
228 | #endif |
|
|
229 | #ifndef MAP_POPULATE |
|
|
230 | # define MAP_POPULATE 0 |
|
|
231 | #endif |
|
|
232 | #ifndef MAP_NONBLOCK |
|
|
233 | # define MAP_NONBLOCK 0 |
|
|
234 | #endif |
|
|
235 | |
|
|
236 | #ifndef PAGESIZE |
|
|
237 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
143 | #endif |
238 | #endif |
144 | |
239 | |
145 | static int req_invoke (eio_req *req); |
240 | static int req_invoke (eio_req *req); |
146 | #define EIO_FINISH(req) req_invoke (req) |
241 | #define EIO_FINISH(req) req_invoke (req) |
147 | static void req_destroy (eio_req *grp); |
242 | static void req_destroy (eio_req *grp); |
… | |
… | |
239 | } |
334 | } |
240 | } |
335 | } |
241 | |
336 | |
242 | static int req_invoke (eio_req *req) |
337 | static int req_invoke (eio_req *req) |
243 | { |
338 | { |
244 | dSP; |
|
|
245 | |
|
|
246 | if (req->flags & FLAG_SV2_RO_OFF) |
339 | if (req->flags & FLAG_SV2_RO_OFF) |
247 | SvREADONLY_off (req->sv2); |
340 | SvREADONLY_off (req->sv2); |
248 | |
341 | |
249 | if (!EIO_CANCELLED (req) && req->callback) |
342 | if (!EIO_CANCELLED (req) && req->callback) |
250 | { |
343 | { |
|
|
344 | dSP; |
|
|
345 | static SV *sv_result_cache; /* caches the result integer SV */ |
|
|
346 | SV *sv_result; |
|
|
347 | |
251 | ENTER; |
348 | ENTER; |
252 | SAVETMPS; |
349 | SAVETMPS; |
253 | PUSHMARK (SP); |
350 | PUSHMARK (SP); |
254 | EXTEND (SP, 1); |
351 | EXTEND (SP, 1); |
|
|
352 | |
|
|
353 | /* do not recreate the result IV from scratch each time */ |
|
|
354 | if (expect_true (sv_result_cache)) |
|
|
355 | { |
|
|
356 | sv_result = sv_result_cache; sv_result_cache = 0; |
|
|
357 | SvIV_set (sv_result, req->result); |
|
|
358 | SvIOK_only (sv_result); |
|
|
359 | } |
|
|
360 | else |
|
|
361 | { |
|
|
362 | sv_result = newSViv (req->result); |
|
|
363 | SvREADONLY_on (sv_result); |
|
|
364 | } |
255 | |
365 | |
256 | switch (req->type) |
366 | switch (req->type) |
257 | { |
367 | { |
258 | case EIO_READDIR: |
368 | case EIO_READDIR: |
259 | { |
369 | { |
… | |
… | |
345 | |
455 | |
346 | PUSHs (fh); |
456 | PUSHs (fh); |
347 | } |
457 | } |
348 | break; |
458 | break; |
349 | |
459 | |
|
|
460 | case EIO_STATVFS: |
|
|
461 | case EIO_FSTATVFS: |
|
|
462 | { |
|
|
463 | SV *rv = &PL_sv_undef; |
|
|
464 | |
|
|
465 | if (req->result >= 0) |
|
|
466 | { |
|
|
467 | EIO_STRUCT_STATVFS *f = EIO_STATVFS_BUF (req); |
|
|
468 | HV *hv = newHV (); |
|
|
469 | |
|
|
470 | rv = sv_2mortal (newRV_noinc ((SV *)hv)); |
|
|
471 | |
|
|
472 | hv_store (hv, "bsize" , sizeof ("bsize" ) - 1, newSVval64 (f->f_bsize ), 0); |
|
|
473 | hv_store (hv, "frsize" , sizeof ("frsize" ) - 1, newSVval64 (f->f_frsize ), 0); |
|
|
474 | hv_store (hv, "blocks" , sizeof ("blocks" ) - 1, newSVval64 (f->f_blocks ), 0); |
|
|
475 | hv_store (hv, "bfree" , sizeof ("bfree" ) - 1, newSVval64 (f->f_bfree ), 0); |
|
|
476 | hv_store (hv, "bavail" , sizeof ("bavail" ) - 1, newSVval64 (f->f_bavail ), 0); |
|
|
477 | hv_store (hv, "files" , sizeof ("files" ) - 1, newSVval64 (f->f_files ), 0); |
|
|
478 | hv_store (hv, "ffree" , sizeof ("ffree" ) - 1, newSVval64 (f->f_ffree ), 0); |
|
|
479 | hv_store (hv, "favail" , sizeof ("favail" ) - 1, newSVval64 (f->f_favail ), 0); |
|
|
480 | hv_store (hv, "fsid" , sizeof ("fsid" ) - 1, newSVval64 (f->f_fsid ), 0); |
|
|
481 | hv_store (hv, "flag" , sizeof ("flag" ) - 1, newSVval64 (f->f_flag ), 0); |
|
|
482 | hv_store (hv, "namemax", sizeof ("namemax") - 1, newSVval64 (f->f_namemax), 0); |
|
|
483 | } |
|
|
484 | |
|
|
485 | PUSHs (rv); |
|
|
486 | } |
|
|
487 | |
|
|
488 | break; |
|
|
489 | |
350 | case EIO_GROUP: |
490 | case EIO_GROUP: |
351 | req->int1 = 2; /* mark group as finished */ |
491 | req->int1 = 2; /* mark group as finished */ |
352 | |
492 | |
353 | if (req->sv1) |
493 | if (req->sv1) |
354 | { |
494 | { |
… | |
… | |
374 | case EIO_LSTAT: |
514 | case EIO_LSTAT: |
375 | case EIO_FSTAT: |
515 | case EIO_FSTAT: |
376 | PL_laststype = req->type == EIO_LSTAT ? OP_LSTAT : OP_STAT; |
516 | PL_laststype = req->type == EIO_LSTAT ? OP_LSTAT : OP_STAT; |
377 | PL_laststatval = req->result; |
517 | PL_laststatval = req->result; |
378 | PL_statcache = *(EIO_STRUCT_STAT *)(req->ptr2); |
518 | PL_statcache = *(EIO_STRUCT_STAT *)(req->ptr2); |
379 | PUSHs (sv_2mortal (newSViv (req->result))); |
519 | PUSHs (sv_result); |
380 | break; |
520 | break; |
381 | |
521 | |
382 | case EIO_READ: |
522 | case EIO_READ: |
383 | { |
523 | { |
384 | SvCUR_set (req->sv2, req->stroffset + (req->result > 0 ? req->result : 0)); |
524 | SvCUR_set (req->sv2, req->stroffset + (req->result > 0 ? req->result : 0)); |
385 | *SvEND (req->sv2) = 0; |
525 | *SvEND (req->sv2) = 0; |
386 | SvPOK_only (req->sv2); |
526 | SvPOK_only (req->sv2); |
387 | SvSETMAGIC (req->sv2); |
527 | SvSETMAGIC (req->sv2); |
388 | PUSHs (sv_2mortal (newSViv (req->result))); |
528 | PUSHs (sv_result); |
389 | } |
529 | } |
390 | break; |
530 | break; |
391 | |
531 | |
392 | case EIO_DUP2: |
532 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
393 | if (req->result > 0) |
533 | if (req->result > 0) |
394 | req->result = 0; |
534 | SvIV_set (sv_result, 0); |
395 | /* FALLTHROUGH */ |
535 | /* FALLTHROUGH */ |
396 | |
536 | |
397 | default: |
537 | default: |
398 | PUSHs (sv_2mortal (newSViv (req->result))); |
538 | PUSHs (sv_result); |
399 | break; |
539 | break; |
400 | } |
540 | } |
401 | |
541 | |
402 | errno = req->errorno; |
542 | errno = req->errorno; |
403 | |
543 | |
404 | PUTBACK; |
544 | PUTBACK; |
405 | call_sv (req->callback, G_VOID | G_EVAL | G_DISCARD); |
545 | call_sv (req->callback, G_VOID | G_EVAL | G_DISCARD); |
406 | SPAGAIN; |
546 | SPAGAIN; |
|
|
547 | |
|
|
548 | if (expect_false (SvREFCNT (sv_result) != 1 || sv_result_cache)) |
|
|
549 | SvREFCNT_dec (sv_result); |
|
|
550 | else |
|
|
551 | sv_result_cache = sv_result; |
407 | |
552 | |
408 | FREETMPS; |
553 | FREETMPS; |
409 | LEAVE; |
554 | LEAVE; |
410 | |
555 | |
411 | PUTBACK; |
556 | PUTBACK; |
… | |
… | |
486 | |
631 | |
487 | static void atfork_child (void) |
632 | static void atfork_child (void) |
488 | { |
633 | { |
489 | create_respipe (); |
634 | create_respipe (); |
490 | } |
635 | } |
|
|
636 | |
|
|
637 | /*****************************************************************************/ |
|
|
638 | |
|
|
639 | #if !_POSIX_MAPPED_FILES |
|
|
640 | # define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, -1) |
|
|
641 | # define munmap(addr,length) (errno = ENOSYS, -1) |
|
|
642 | #endif |
|
|
643 | |
|
|
644 | #if !_POSIX_MEMORY_PROTECTION |
|
|
645 | # define mprotect(addr,len,prot) (errno = ENOSYS, -1) |
|
|
646 | # define PROT_NONE 0 |
|
|
647 | # define PROT_WRITE 0 |
|
|
648 | # define MAP_PRIVATE 0 |
|
|
649 | # define MAP_SHARED 0 |
|
|
650 | # define MAP_FIXED 0 |
|
|
651 | #endif |
|
|
652 | |
|
|
653 | #define MMAP_MAGIC PERL_MAGIC_ext |
|
|
654 | |
|
|
655 | static int |
|
|
656 | mmap_free (pTHX_ SV *sv, MAGIC *mg) |
|
|
657 | { |
|
|
658 | int old_errno = errno; |
|
|
659 | munmap (mg->mg_ptr, (size_t)mg->mg_obj); |
|
|
660 | errno = old_errno; |
|
|
661 | |
|
|
662 | mg->mg_obj = 0; /* just in case */ |
|
|
663 | |
|
|
664 | SvREADONLY_off (sv); |
|
|
665 | |
|
|
666 | if (SvPVX (sv) != mg->mg_ptr) |
|
|
667 | croak ("ERROR: IO::AIO::mmap-mapped scalar changed location, detected"); |
|
|
668 | |
|
|
669 | SvCUR_set (sv, 0); |
|
|
670 | SvPVX (sv) = 0; |
|
|
671 | SvOK_off (sv); |
|
|
672 | |
|
|
673 | return 0; |
|
|
674 | } |
|
|
675 | |
|
|
676 | static MGVTBL mmap_vtbl = { |
|
|
677 | 0, 0, 0, 0, mmap_free |
|
|
678 | }; |
|
|
679 | |
|
|
680 | /*****************************************************************************/ |
491 | |
681 | |
492 | static SV * |
682 | static SV * |
493 | get_cb (SV *cb_sv) |
683 | get_cb (SV *cb_sv) |
494 | { |
684 | { |
495 | SvGETMAGIC (cb_sv); |
685 | SvGETMAGIC (cb_sv); |
… | |
… | |
527 | { |
717 | { |
528 | static const struct { |
718 | static const struct { |
529 | const char *name; |
719 | const char *name; |
530 | IV iv; |
720 | IV iv; |
531 | } *civ, const_iv[] = { |
721 | } *civ, const_iv[] = { |
532 | # define const_iv(name, value) { # name, (IV) value }, |
722 | # define const_niv(name, value) { # name, (IV) value }, |
|
|
723 | # define const_iv(name) { # name, (IV) name }, |
533 | # define const_eio(name) { # name, (IV) EIO_ ## name }, |
724 | # define const_eio(name) { # name, (IV) EIO_ ## name }, |
534 | const_iv (EXDEV , EXDEV) |
725 | const_iv (EXDEV) |
535 | const_iv (ENOSYS , ENOSYS) |
726 | const_iv (ENOSYS) |
536 | const_iv (O_RDONLY, O_RDONLY) |
727 | const_iv (O_RDONLY) |
537 | const_iv (O_WRONLY, O_WRONLY) |
728 | const_iv (O_WRONLY) |
|
|
729 | const_iv (O_RDWR) |
538 | const_iv (O_CREAT , O_CREAT) |
730 | const_iv (O_CREAT) |
539 | const_iv (O_TRUNC , O_TRUNC) |
731 | const_iv (O_TRUNC) |
|
|
732 | const_iv (O_EXCL) |
|
|
733 | const_iv (O_APPEND) |
540 | #ifndef _WIN32 |
734 | #ifndef _WIN32 |
541 | const_iv (S_IFIFO , S_IFIFO) |
735 | const_iv (S_IFIFO) |
542 | #endif |
736 | #endif |
543 | const_iv (FADV_NORMAL , POSIX_FADV_NORMAL) |
737 | const_niv (FADV_NORMAL , POSIX_FADV_NORMAL) |
544 | const_iv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL) |
738 | const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL) |
545 | const_iv (FADV_RANDOM , POSIX_FADV_RANDOM) |
739 | const_niv (FADV_RANDOM , POSIX_FADV_RANDOM) |
546 | const_iv (FADV_NOREUSE , POSIX_FADV_NOREUSE) |
740 | const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE) |
547 | const_iv (FADV_WILLNEED , POSIX_FADV_WILLNEED) |
741 | const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED) |
548 | const_iv (FADV_DONTNEED , POSIX_FADV_DONTNEED) |
742 | const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED) |
|
|
743 | |
|
|
744 | const_niv (MADV_NORMAL , POSIX_MADV_NORMAL) |
|
|
745 | const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL) |
|
|
746 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
|
|
747 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
|
|
748 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
|
|
749 | |
|
|
750 | const_iv (ST_RDONLY) |
|
|
751 | const_iv (ST_NOSUID) |
|
|
752 | const_iv (ST_NODEV) |
|
|
753 | const_iv (ST_NOEXEC) |
|
|
754 | const_iv (ST_SYNCHRONOUS) |
|
|
755 | const_iv (ST_MANDLOCK) |
|
|
756 | const_iv (ST_WRITE) |
|
|
757 | const_iv (ST_APPEND) |
|
|
758 | const_iv (ST_IMMUTABLE) |
|
|
759 | const_iv (ST_NOATIME) |
|
|
760 | const_iv (ST_NODIRATIME) |
|
|
761 | const_iv (ST_RELATIME) |
|
|
762 | |
|
|
763 | const_iv (PROT_NONE) |
|
|
764 | const_iv (PROT_EXEC) |
|
|
765 | const_iv (PROT_READ) |
|
|
766 | const_iv (PROT_WRITE) |
|
|
767 | |
|
|
768 | /*const_iv (MAP_FIXED)*/ |
|
|
769 | const_iv (MAP_PRIVATE) |
|
|
770 | const_iv (MAP_SHARED) |
|
|
771 | const_iv (MAP_ANONYMOUS) |
|
|
772 | |
|
|
773 | /* linuxish */ |
|
|
774 | const_iv (MAP_HUGETLB) |
|
|
775 | const_iv (MAP_LOCKED) |
|
|
776 | const_iv (MAP_NORESERVE) |
|
|
777 | const_iv (MAP_POPULATE) |
|
|
778 | const_iv (MAP_NONBLOCK) |
|
|
779 | |
|
|
780 | const_eio (MCL_FUTURE) |
|
|
781 | const_eio (MCL_CURRENT) |
|
|
782 | |
|
|
783 | const_eio (MS_ASYNC) |
|
|
784 | const_eio (MS_INVALIDATE) |
|
|
785 | const_eio (MS_SYNC) |
|
|
786 | |
|
|
787 | const_eio (MT_MODIFY) |
549 | |
788 | |
550 | const_eio (SYNC_FILE_RANGE_WAIT_BEFORE) |
789 | const_eio (SYNC_FILE_RANGE_WAIT_BEFORE) |
551 | const_eio (SYNC_FILE_RANGE_WRITE) |
790 | const_eio (SYNC_FILE_RANGE_WRITE) |
552 | const_eio (SYNC_FILE_RANGE_WAIT_AFTER) |
791 | const_eio (SYNC_FILE_RANGE_WAIT_AFTER) |
553 | |
792 | |
… | |
… | |
572 | aio_grp_stash = gv_stashpv ("IO::AIO::GRP", 1); |
811 | aio_grp_stash = gv_stashpv ("IO::AIO::GRP", 1); |
573 | |
812 | |
574 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
813 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
575 | newCONSTSUB (aio_stash, (char *)civ->name, newSViv (civ->iv)); |
814 | newCONSTSUB (aio_stash, (char *)civ->name, newSViv (civ->iv)); |
576 | |
815 | |
|
|
816 | newCONSTSUB (aio_stash, "PAGESIZE", newSViv (PAGESIZE)); |
|
|
817 | |
577 | create_respipe (); |
818 | create_respipe (); |
578 | |
819 | |
579 | if (eio_init (want_poll, done_poll) < 0) |
820 | if (eio_init (want_poll, done_poll) < 0) |
580 | croak ("IO::AIO: unable to initialise eio library"); |
821 | croak ("IO::AIO: unable to initialise eio library"); |
581 | |
822 | |
… | |
… | |
619 | CODE: |
860 | CODE: |
620 | max_outstanding = maxreqs; |
861 | max_outstanding = maxreqs; |
621 | |
862 | |
622 | void |
863 | void |
623 | aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef) |
864 | aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef) |
624 | PROTOTYPE: $$$;$ |
|
|
625 | PPCODE: |
865 | PPCODE: |
626 | { |
866 | { |
627 | dREQ; |
867 | dREQ; |
628 | |
868 | |
629 | req->type = EIO_OPEN; |
869 | req->type = EIO_OPEN; |
… | |
… | |
635 | REQ_SEND; |
875 | REQ_SEND; |
636 | } |
876 | } |
637 | |
877 | |
638 | void |
878 | void |
639 | aio_fsync (SV *fh, SV *callback=&PL_sv_undef) |
879 | aio_fsync (SV *fh, SV *callback=&PL_sv_undef) |
640 | PROTOTYPE: $;$ |
|
|
641 | ALIAS: |
880 | ALIAS: |
642 | aio_fsync = EIO_FSYNC |
881 | aio_fsync = EIO_FSYNC |
643 | aio_fdatasync = EIO_FDATASYNC |
882 | aio_fdatasync = EIO_FDATASYNC |
644 | PPCODE: |
883 | PPCODE: |
645 | { |
884 | { |
… | |
… | |
653 | REQ_SEND (req); |
892 | REQ_SEND (req); |
654 | } |
893 | } |
655 | |
894 | |
656 | void |
895 | void |
657 | aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback=&PL_sv_undef) |
896 | aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback=&PL_sv_undef) |
658 | PROTOTYPE: $$$$;$ |
|
|
659 | PPCODE: |
897 | PPCODE: |
660 | { |
898 | { |
661 | int fd = s_fileno_croak (fh, 0); |
899 | int fd = s_fileno_croak (fh, 0); |
662 | dREQ; |
900 | dREQ; |
663 | |
901 | |
… | |
… | |
671 | REQ_SEND (req); |
909 | REQ_SEND (req); |
672 | } |
910 | } |
673 | |
911 | |
674 | void |
912 | void |
675 | aio_close (SV *fh, SV *callback=&PL_sv_undef) |
913 | aio_close (SV *fh, SV *callback=&PL_sv_undef) |
676 | PROTOTYPE: $;$ |
|
|
677 | PPCODE: |
914 | PPCODE: |
678 | { |
915 | { |
679 | static int close_pipe = -1; /* dummy fd to close fds via dup2 */ |
916 | static int close_pipe = -1; /* dummy fd to close fds via dup2 */ |
680 | int fd = s_fileno_croak (fh, 0); |
917 | int fd = s_fileno_croak (fh, 0); |
681 | dREQ; |
918 | dREQ; |
… | |
… | |
703 | void |
940 | void |
704 | aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback=&PL_sv_undef) |
941 | aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback=&PL_sv_undef) |
705 | ALIAS: |
942 | ALIAS: |
706 | aio_read = EIO_READ |
943 | aio_read = EIO_READ |
707 | aio_write = EIO_WRITE |
944 | aio_write = EIO_WRITE |
708 | PROTOTYPE: $$$$$;$ |
|
|
709 | PPCODE: |
945 | PPCODE: |
710 | { |
946 | { |
711 | STRLEN svlen; |
947 | STRLEN svlen; |
712 | int fd = s_fileno_croak (fh, ix == EIO_WRITE); |
948 | int fd = s_fileno_croak (fh, ix == EIO_WRITE); |
713 | char *svptr = SvPVbyte (data, svlen); |
949 | char *svptr = SvPVbyte (data, svlen); |
… | |
… | |
754 | } |
990 | } |
755 | } |
991 | } |
756 | |
992 | |
757 | void |
993 | void |
758 | aio_readlink (SV8 *path, SV *callback=&PL_sv_undef) |
994 | aio_readlink (SV8 *path, SV *callback=&PL_sv_undef) |
759 | PROTOTYPE: $$;$ |
|
|
760 | PPCODE: |
995 | PPCODE: |
761 | { |
996 | { |
762 | SV *data; |
997 | SV *data; |
763 | dREQ; |
998 | dREQ; |
764 | |
999 | |
… | |
… | |
769 | REQ_SEND; |
1004 | REQ_SEND; |
770 | } |
1005 | } |
771 | |
1006 | |
772 | void |
1007 | void |
773 | aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback=&PL_sv_undef) |
1008 | aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback=&PL_sv_undef) |
774 | PROTOTYPE: $$$$;$ |
|
|
775 | PPCODE: |
1009 | PPCODE: |
776 | { |
1010 | { |
777 | int ifd = s_fileno_croak (in_fh , 0); |
1011 | int ifd = s_fileno_croak (in_fh , 0); |
778 | int ofd = s_fileno_croak (out_fh, 1); |
1012 | int ofd = s_fileno_croak (out_fh, 1); |
779 | dREQ; |
1013 | dREQ; |
… | |
… | |
789 | REQ_SEND; |
1023 | REQ_SEND; |
790 | } |
1024 | } |
791 | |
1025 | |
792 | void |
1026 | void |
793 | aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef) |
1027 | aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef) |
794 | PROTOTYPE: $$$;$ |
|
|
795 | PPCODE: |
1028 | PPCODE: |
796 | { |
1029 | { |
797 | int fd = s_fileno_croak (fh, 0); |
1030 | int fd = s_fileno_croak (fh, 0); |
798 | dREQ; |
1031 | dREQ; |
799 | |
1032 | |
… | |
… | |
807 | } |
1040 | } |
808 | |
1041 | |
809 | void |
1042 | void |
810 | aio_stat (SV8 *fh_or_path, SV *callback=&PL_sv_undef) |
1043 | aio_stat (SV8 *fh_or_path, SV *callback=&PL_sv_undef) |
811 | ALIAS: |
1044 | ALIAS: |
812 | aio_stat = EIO_STAT |
1045 | aio_stat = EIO_STAT |
813 | aio_lstat = EIO_LSTAT |
1046 | aio_lstat = EIO_LSTAT |
|
|
1047 | aio_statvfs = EIO_STATVFS |
814 | PPCODE: |
1048 | PPCODE: |
815 | { |
1049 | { |
816 | dREQ; |
1050 | dREQ; |
817 | |
1051 | |
818 | req->sv1 = newSVsv (fh_or_path); |
1052 | req->sv1 = newSVsv (fh_or_path); |
… | |
… | |
822 | req->type = ix; |
1056 | req->type = ix; |
823 | req->ptr1 = SvPVbyte_nolen (req->sv1); |
1057 | req->ptr1 = SvPVbyte_nolen (req->sv1); |
824 | } |
1058 | } |
825 | else |
1059 | else |
826 | { |
1060 | { |
827 | req->type = EIO_FSTAT; |
1061 | req->type = ix == EIO_STATVFS ? EIO_FSTATVFS : EIO_FSTAT; |
828 | req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
1062 | req->int1 = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
829 | } |
1063 | } |
830 | |
1064 | |
831 | REQ_SEND; |
1065 | REQ_SEND; |
832 | } |
1066 | } |
… | |
… | |
995 | |
1229 | |
996 | REQ_SEND; |
1230 | REQ_SEND; |
997 | } |
1231 | } |
998 | |
1232 | |
999 | void |
1233 | void |
|
|
1234 | aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback=&PL_sv_undef) |
|
|
1235 | ALIAS: |
|
|
1236 | aio_mtouch = EIO_MTOUCH |
|
|
1237 | aio_msync = EIO_MSYNC |
|
|
1238 | PPCODE: |
|
|
1239 | { |
|
|
1240 | STRLEN svlen; |
|
|
1241 | char *svptr = SvPVbyte (data, svlen); |
|
|
1242 | UV len = SvUV (length); |
|
|
1243 | |
|
|
1244 | if (offset < 0) |
|
|
1245 | offset += svlen; |
|
|
1246 | |
|
|
1247 | if (offset < 0 || offset > svlen) |
|
|
1248 | croak ("offset outside of scalar"); |
|
|
1249 | |
|
|
1250 | if (!SvOK (length) || len + offset > svlen) |
|
|
1251 | len = svlen - offset; |
|
|
1252 | |
|
|
1253 | { |
|
|
1254 | dREQ; |
|
|
1255 | |
|
|
1256 | req->type = ix; |
|
|
1257 | req->sv2 = SvREFCNT_inc (data); |
|
|
1258 | req->ptr2 = (char *)svptr + offset; |
|
|
1259 | req->size = len; |
|
|
1260 | req->int1 = flags; |
|
|
1261 | |
|
|
1262 | REQ_SEND; |
|
|
1263 | } |
|
|
1264 | } |
|
|
1265 | |
|
|
1266 | void |
|
|
1267 | aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback=&PL_sv_undef) |
|
|
1268 | PPCODE: |
|
|
1269 | { |
|
|
1270 | STRLEN svlen; |
|
|
1271 | char *svptr = SvPVbyte (data, svlen); |
|
|
1272 | UV len = SvUV (length); |
|
|
1273 | |
|
|
1274 | if (offset < 0) |
|
|
1275 | offset += svlen; |
|
|
1276 | |
|
|
1277 | if (offset < 0 || offset > svlen) |
|
|
1278 | croak ("offset outside of scalar"); |
|
|
1279 | |
|
|
1280 | if (!SvOK (length) || len + offset > svlen) |
|
|
1281 | len = svlen - offset; |
|
|
1282 | |
|
|
1283 | { |
|
|
1284 | dREQ; |
|
|
1285 | |
|
|
1286 | req->type = EIO_MLOCK; |
|
|
1287 | req->sv2 = SvREFCNT_inc (data); |
|
|
1288 | req->ptr2 = (char *)svptr + offset; |
|
|
1289 | req->size = len; |
|
|
1290 | |
|
|
1291 | REQ_SEND; |
|
|
1292 | } |
|
|
1293 | } |
|
|
1294 | |
|
|
1295 | void |
|
|
1296 | aio_mlockall (IV flags, SV *callback=&PL_sv_undef) |
|
|
1297 | PPCODE: |
|
|
1298 | { |
|
|
1299 | dREQ; |
|
|
1300 | |
|
|
1301 | req->type = EIO_MLOCKALL; |
|
|
1302 | req->int1 = flags; |
|
|
1303 | |
|
|
1304 | REQ_SEND; |
|
|
1305 | } |
|
|
1306 | |
|
|
1307 | void |
1000 | aio_busy (double delay, SV *callback=&PL_sv_undef) |
1308 | aio_busy (double delay, SV *callback=&PL_sv_undef) |
1001 | PPCODE: |
1309 | PPCODE: |
1002 | { |
1310 | { |
1003 | dREQ; |
1311 | dREQ; |
1004 | |
1312 | |
… | |
… | |
1008 | REQ_SEND; |
1316 | REQ_SEND; |
1009 | } |
1317 | } |
1010 | |
1318 | |
1011 | void |
1319 | void |
1012 | aio_group (SV *callback=&PL_sv_undef) |
1320 | aio_group (SV *callback=&PL_sv_undef) |
1013 | PROTOTYPE: ;$ |
|
|
1014 | PPCODE: |
1321 | PPCODE: |
1015 | { |
1322 | { |
1016 | dREQ; |
1323 | dREQ; |
1017 | |
1324 | |
1018 | req->type = EIO_GROUP; |
1325 | req->type = EIO_GROUP; |
… | |
… | |
1035 | REQ_SEND; |
1342 | REQ_SEND; |
1036 | } |
1343 | } |
1037 | |
1344 | |
1038 | int |
1345 | int |
1039 | aioreq_pri (int pri = 0) |
1346 | aioreq_pri (int pri = 0) |
1040 | PROTOTYPE: ;$ |
|
|
1041 | CODE: |
1347 | CODE: |
1042 | RETVAL = next_pri; |
1348 | RETVAL = next_pri; |
1043 | if (items > 0) |
1349 | if (items > 0) |
1044 | { |
1350 | { |
1045 | if (pri < EIO_PRI_MIN) pri = EIO_PRI_MIN; |
1351 | if (pri < EIO_PRI_MIN) pri = EIO_PRI_MIN; |
… | |
… | |
1057 | if (nice > EIO_PRI_MAX) nice = EIO_PRI_MAX; |
1363 | if (nice > EIO_PRI_MAX) nice = EIO_PRI_MAX; |
1058 | next_pri = nice; |
1364 | next_pri = nice; |
1059 | |
1365 | |
1060 | void |
1366 | void |
1061 | flush () |
1367 | flush () |
1062 | PROTOTYPE: |
|
|
1063 | CODE: |
1368 | CODE: |
1064 | while (eio_nreqs ()) |
1369 | while (eio_nreqs ()) |
1065 | { |
1370 | { |
1066 | poll_wait (); |
1371 | poll_wait (); |
1067 | poll_cb (); |
1372 | poll_cb (); |
1068 | } |
1373 | } |
1069 | |
1374 | |
1070 | int |
1375 | int |
1071 | poll() |
1376 | poll () |
1072 | PROTOTYPE: |
|
|
1073 | CODE: |
1377 | CODE: |
1074 | poll_wait (); |
1378 | poll_wait (); |
1075 | RETVAL = poll_cb (); |
1379 | RETVAL = poll_cb (); |
1076 | OUTPUT: |
1380 | OUTPUT: |
1077 | RETVAL |
1381 | RETVAL |
1078 | |
1382 | |
1079 | int |
1383 | int |
1080 | poll_fileno() |
1384 | poll_fileno () |
1081 | PROTOTYPE: |
|
|
1082 | CODE: |
1385 | CODE: |
1083 | RETVAL = s_epipe_fd (&respipe); |
1386 | RETVAL = s_epipe_fd (&respipe); |
1084 | OUTPUT: |
1387 | OUTPUT: |
1085 | RETVAL |
1388 | RETVAL |
1086 | |
1389 | |
1087 | int |
1390 | int |
1088 | poll_cb(...) |
1391 | poll_cb (...) |
1089 | PROTOTYPE: |
1392 | PROTOTYPE: |
1090 | CODE: |
1393 | CODE: |
1091 | RETVAL = poll_cb (); |
1394 | RETVAL = poll_cb (); |
1092 | OUTPUT: |
1395 | OUTPUT: |
1093 | RETVAL |
1396 | RETVAL |
1094 | |
1397 | |
1095 | void |
1398 | void |
1096 | poll_wait() |
1399 | poll_wait () |
1097 | PROTOTYPE: |
|
|
1098 | CODE: |
1400 | CODE: |
1099 | poll_wait (); |
1401 | poll_wait (); |
1100 | |
1402 | |
1101 | int |
1403 | int |
1102 | nreqs() |
1404 | nreqs () |
1103 | PROTOTYPE: |
|
|
1104 | CODE: |
1405 | CODE: |
1105 | RETVAL = eio_nreqs (); |
1406 | RETVAL = eio_nreqs (); |
1106 | OUTPUT: |
1407 | OUTPUT: |
1107 | RETVAL |
1408 | RETVAL |
1108 | |
1409 | |
1109 | int |
1410 | int |
1110 | nready() |
1411 | nready () |
1111 | PROTOTYPE: |
|
|
1112 | CODE: |
1412 | CODE: |
1113 | RETVAL = eio_nready (); |
1413 | RETVAL = eio_nready (); |
1114 | OUTPUT: |
1414 | OUTPUT: |
1115 | RETVAL |
1415 | RETVAL |
1116 | |
1416 | |
1117 | int |
1417 | int |
1118 | npending() |
1418 | npending () |
1119 | PROTOTYPE: |
|
|
1120 | CODE: |
1419 | CODE: |
1121 | RETVAL = eio_npending (); |
1420 | RETVAL = eio_npending (); |
1122 | OUTPUT: |
1421 | OUTPUT: |
1123 | RETVAL |
1422 | RETVAL |
1124 | |
1423 | |
1125 | int |
1424 | int |
1126 | nthreads() |
1425 | nthreads () |
1127 | PROTOTYPE: |
|
|
1128 | CODE: |
1426 | CODE: |
1129 | RETVAL = eio_nthreads (); |
1427 | RETVAL = eio_nthreads (); |
1130 | OUTPUT: |
1428 | OUTPUT: |
1131 | RETVAL |
1429 | RETVAL |
1132 | |
1430 | |
1133 | int |
1431 | int |
1134 | fadvise (aio_rfd fh, off_t offset, off_t length, IV advice) |
1432 | fadvise (aio_rfd fh, off_t offset, off_t length, IV advice) |
1135 | PROTOTYPE: $$$$ |
|
|
1136 | CODE: |
1433 | CODE: |
1137 | #if _XOPEN_SOURCE >= 600 && !NO_FADVISE |
|
|
1138 | RETVAL = posix_fadvise (fh, offset, length, advice); |
1434 | RETVAL = posix_fadvise (fh, offset, length, advice); |
1139 | #else |
|
|
1140 | RETVAL = errno = ENOSYS; |
|
|
1141 | #endif |
|
|
1142 | OUTPUT: |
1435 | OUTPUT: |
1143 | RETVAL |
1436 | RETVAL |
1144 | |
1437 | |
1145 | ssize_t |
1438 | ssize_t |
1146 | sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count) |
1439 | sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count) |
1147 | PROTOTYPE: $$$$ |
|
|
1148 | CODE: |
1440 | CODE: |
1149 | eio_sendfile_sync (ofh, ifh, offset, count); |
1441 | RETVAL = eio_sendfile_sync (ofh, ifh, offset, count); |
|
|
1442 | OUTPUT: |
|
|
1443 | RETVAL |
|
|
1444 | |
|
|
1445 | void |
|
|
1446 | mmap (SV *scalar, size_t length, int prot, int flags, SV *fh, off_t offset = 0) |
|
|
1447 | PPCODE: |
|
|
1448 | sv_unmagic (scalar, MMAP_MAGIC); |
|
|
1449 | { |
|
|
1450 | int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1; |
|
|
1451 | void *addr = (void *)mmap (0, length, prot, flags, fd, offset); |
|
|
1452 | if (addr == (void *)-1) |
|
|
1453 | XSRETURN_NO; |
|
|
1454 | |
|
|
1455 | sv_force_normal (scalar); |
|
|
1456 | |
|
|
1457 | /* we store the length in mg_obj, as namlen is I32 :/ */ |
|
|
1458 | sv_magicext (scalar, 0, MMAP_MAGIC, &mmap_vtbl, (char *)addr, 0) |
|
|
1459 | ->mg_obj = (SV *)length; |
|
|
1460 | |
|
|
1461 | SvUPGRADE (scalar, SVt_PV); /* nop... */ |
|
|
1462 | |
|
|
1463 | if (!(prot & PROT_WRITE)) |
|
|
1464 | SvREADONLY_on (scalar); |
|
|
1465 | |
|
|
1466 | if (SvLEN (scalar)) |
|
|
1467 | Safefree (SvPVX (scalar)); |
|
|
1468 | |
|
|
1469 | SvPVX (scalar) = (char *)addr; |
|
|
1470 | SvCUR_set (scalar, length); |
|
|
1471 | SvLEN_set (scalar, 0); |
|
|
1472 | SvPOK_only (scalar); |
|
|
1473 | |
|
|
1474 | XSRETURN_YES; |
|
|
1475 | } |
|
|
1476 | |
|
|
1477 | void |
|
|
1478 | munmap (SV *scalar) |
|
|
1479 | CODE: |
|
|
1480 | sv_unmagic (scalar, MMAP_MAGIC); |
|
|
1481 | |
|
|
1482 | int |
|
|
1483 | madvise (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot) |
|
|
1484 | ALIAS: |
|
|
1485 | mprotect = 1 |
|
|
1486 | CODE: |
|
|
1487 | { |
|
|
1488 | STRLEN svlen; |
|
|
1489 | void *addr = SvPVbyte (scalar, svlen); |
|
|
1490 | size_t len = SvUV (length); |
|
|
1491 | |
|
|
1492 | if (offset < 0) |
|
|
1493 | offset += svlen; |
|
|
1494 | |
|
|
1495 | if (offset < 0 || offset > svlen) |
|
|
1496 | croak ("offset outside of scalar"); |
|
|
1497 | |
|
|
1498 | if (!SvOK (length) || len + offset > svlen) |
|
|
1499 | len = svlen - offset; |
|
|
1500 | |
|
|
1501 | addr = (void *)(((intptr_t)addr) + offset); |
|
|
1502 | eio_page_align (&addr, &len); |
|
|
1503 | |
|
|
1504 | switch (ix) |
|
|
1505 | { |
|
|
1506 | case 0: RETVAL = posix_madvise (addr, len, advice_or_prot); break; |
|
|
1507 | case 1: RETVAL = mprotect (addr, len, advice_or_prot); break; |
|
|
1508 | } |
|
|
1509 | } |
|
|
1510 | OUTPUT: |
|
|
1511 | RETVAL |
|
|
1512 | |
|
|
1513 | int |
|
|
1514 | munlock (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef) |
|
|
1515 | CODE: |
|
|
1516 | { |
|
|
1517 | STRLEN svlen; |
|
|
1518 | void *addr = SvPVbyte (scalar, svlen); |
|
|
1519 | size_t len = SvUV (length); |
|
|
1520 | |
|
|
1521 | if (offset < 0) |
|
|
1522 | offset += svlen; |
|
|
1523 | |
|
|
1524 | if (offset < 0 || offset > svlen) |
|
|
1525 | croak ("offset outside of scalar"); |
|
|
1526 | |
|
|
1527 | if (!SvOK (length) || len + offset > svlen) |
|
|
1528 | len = svlen - offset; |
|
|
1529 | |
|
|
1530 | addr = (void *)(((intptr_t)addr) + offset); |
|
|
1531 | eio_page_align (&addr, &len); |
|
|
1532 | #if _POSIX_MEMLOCK_RANGE |
|
|
1533 | RETVAL = munlock (addr, len); |
|
|
1534 | #else |
|
|
1535 | RETVAL = ((errno = ENOSYS), -1); |
|
|
1536 | #endif |
|
|
1537 | } |
|
|
1538 | OUTPUT: |
|
|
1539 | RETVAL |
|
|
1540 | |
|
|
1541 | int |
|
|
1542 | munlockall () |
|
|
1543 | CODE: |
|
|
1544 | #if _POSIX_MEMLOCK |
|
|
1545 | munlockall (); |
|
|
1546 | #else |
|
|
1547 | RETVAL = -1; |
|
|
1548 | errno = ENOSYS; |
|
|
1549 | #endif |
|
|
1550 | OUTPUT: |
|
|
1551 | RETVAL |
1150 | |
1552 | |
1151 | void _on_next_submit (SV *cb) |
1553 | void _on_next_submit (SV *cb) |
1152 | CODE: |
1554 | CODE: |
1153 | SvREFCNT_dec (on_next_submit); |
1555 | SvREFCNT_dec (on_next_submit); |
1154 | on_next_submit = SvOK (cb) ? newSVsv (cb) : 0; |
1556 | on_next_submit = SvOK (cb) ? newSVsv (cb) : 0; |