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.36 by root, Tue Aug 23 01:18:04 2005 UTC vs.
Revision 1.40 by root, Sat Jun 24 16:27:02 2006 UTC

7 7
8#include "autoconf/config.h" 8#include "autoconf/config.h"
9 9
10#include <pthread.h> 10#include <pthread.h>
11 11
12#include <stddef.h>
12#include <sys/types.h> 13#include <sys/types.h>
13#include <sys/stat.h> 14#include <sys/stat.h>
14 15#include <limits.h>
15#include <unistd.h> 16#include <unistd.h>
16#include <fcntl.h> 17#include <fcntl.h>
17#include <signal.h> 18#include <signal.h>
18#include <sched.h> 19#include <sched.h>
19 20
30# else 31# else
31# error sendfile support requested but not available 32# error sendfile support requested but not available
32# endif 33# endif
33#endif 34#endif
34 35
36/* used for struct dirent, AIX doesn't provide it */
37#ifndef NAME_MAX
38# define NAME_MAX 4096
39#endif
40
35#if __ia64 41#if __ia64
36# define STACKSIZE 65536 42# define STACKSIZE 65536
37#else 43#else
38# define STACKSIZE 4096 44# define STACKSIZE 8192
39#endif 45#endif
40 46
41enum { 47enum {
42 REQ_QUIT, 48 REQ_QUIT,
43 REQ_OPEN, REQ_CLOSE, 49 REQ_OPEN, REQ_CLOSE,
44 REQ_READ, REQ_WRITE, REQ_READAHEAD, 50 REQ_READ, REQ_WRITE, REQ_READAHEAD,
45 REQ_SENDFILE, 51 REQ_SENDFILE,
46 REQ_STAT, REQ_LSTAT, REQ_FSTAT, 52 REQ_STAT, REQ_LSTAT, REQ_FSTAT,
47 REQ_FSYNC, REQ_FDATASYNC, 53 REQ_FSYNC, REQ_FDATASYNC,
48 REQ_UNLINK, REQ_RMDIR, 54 REQ_UNLINK, REQ_RMDIR, REQ_RENAME,
49 REQ_SYMLINK, 55 REQ_READDIR,
56 REQ_LINK, REQ_SYMLINK,
50}; 57};
51 58
52typedef struct aio_cb { 59typedef struct aio_cb {
53 struct aio_cb *volatile next; 60 struct aio_cb *volatile next;
54 61
55 int type; 62 int type;
56 63
64 /* should receive a cleanup, with unions */
57 int fd, fd2; 65 int fd, fd2;
58 off_t offset; 66 off_t offset;
59 size_t length; 67 size_t length;
60 ssize_t result; 68 ssize_t result;
61 mode_t mode; /* open */ 69 mode_t mode; /* open */
97 Safefree (req->statdata); 105 Safefree (req->statdata);
98 106
99 if (req->callback) 107 if (req->callback)
100 SvREFCNT_dec (req->callback); 108 SvREFCNT_dec (req->callback);
101 109
110 if (req->type == REQ_READDIR && req->result >= 0)
111 free (req->data2ptr);
112
102 Safefree (req); 113 Safefree (req);
103} 114}
104 115
105static void 116static void
106poll_wait () 117poll_wait ()
170 PL_statcache = *(req->statdata); 181 PL_statcache = *(req->statdata);
171 } 182 }
172 183
173 ENTER; 184 ENTER;
174 PUSHMARK (SP); 185 PUSHMARK (SP);
175 XPUSHs (sv_2mortal (newSViv (req->result)));
176 186
177 if (req->type == REQ_OPEN) 187 if (req->type == REQ_READDIR)
178 { 188 {
189 SV *rv = &PL_sv_undef;
190
191 if (req->result >= 0)
192 {
193 char *buf = req->data2ptr;
194 AV *av = newAV ();
195
196 while (req->result)
197 {
198 SV *sv = newSVpv (buf, 0);
199
200 av_push (av, sv);
201 buf += SvCUR (sv) + 1;
202 req->result--;
203 }
204
205 rv = sv_2mortal (newRV_noinc ((SV *)av));
206 }
207
208 XPUSHs (rv);
209 }
210 else
211 {
212 XPUSHs (sv_2mortal (newSViv (req->result)));
213
214 if (req->type == REQ_OPEN)
215 {
179 /* convert fd to fh */ 216 /* convert fd to fh */
180 SV *fh; 217 SV *fh;
181 218
182 PUTBACK; 219 PUTBACK;
183 call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL); 220 call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL);
184 SPAGAIN; 221 SPAGAIN;
185 222
186 fh = SvREFCNT_inc (POPs); 223 fh = SvREFCNT_inc (POPs);
187 224
188 PUSHMARK (SP); 225 PUSHMARK (SP);
189 XPUSHs (sv_2mortal (fh)); 226 XPUSHs (sv_2mortal (fh));
227 }
190 } 228 }
191 229
192 if (SvOK (req->callback)) 230 if (SvOK (req->callback))
193 { 231 {
194 PUTBACK; 232 PUTBACK;
317 355
318 if (fcntl (respipe [1], F_SETFL, O_NONBLOCK)) 356 if (fcntl (respipe [1], F_SETFL, O_NONBLOCK))
319 croak ("cannot set result pipe to nonblocking mode"); 357 croak ("cannot set result pipe to nonblocking mode");
320} 358}
321 359
322static void atfork_prepare (void)
323{
324 pthread_mutex_lock (&reqlock);
325 pthread_mutex_lock (&reslock);
326}
327
328static void atfork_parent (void)
329{
330 pthread_mutex_unlock (&reslock);
331 pthread_mutex_unlock (&reqlock);
332}
333
334static void atfork_child (void)
335{
336 aio_req prv;
337
338 started = 0;
339
340 while (reqs)
341 {
342 prv = reqs;
343 reqs = prv->next;
344 free_req (prv);
345 }
346
347 reqs = reqe = 0;
348
349 while (ress)
350 {
351 prv = ress;
352 ress = prv->next;
353 free_req (prv);
354 }
355
356 ress = rese = 0;
357
358 close (respipe [0]);
359 close (respipe [1]);
360 create_pipe ();
361
362 atfork_parent ();
363}
364
365/*****************************************************************************/ 360/*****************************************************************************/
366/* work around various missing functions */ 361/* work around various missing functions */
367 362
368#if !HAVE_PREADWRITE 363#if !HAVE_PREADWRITE
369# define pread aio_pread 364# define pread aio_pread
372/* 367/*
373 * make our pread/pwrite safe against themselves, but not against 368 * make our pread/pwrite safe against themselves, but not against
374 * normal read/write by using a mutex. slows down execution a lot, 369 * normal read/write by using a mutex. slows down execution a lot,
375 * but that's your problem, not mine. 370 * but that's your problem, not mine.
376 */ 371 */
377static pthread_mutex_t iolock = PTHREAD_MUTEX_INITIALIZER; 372static pthread_mutex_t preadwritelock = PTHREAD_MUTEX_INITIALIZER;
378 373
379static ssize_t 374static ssize_t
380pread (int fd, void *buf, size_t count, off_t offset) 375pread (int fd, void *buf, size_t count, off_t offset)
381{ 376{
382 ssize_t res; 377 ssize_t res;
383 off_t ooffset; 378 off_t ooffset;
384 379
385 pthread_mutex_lock (&iolock); 380 pthread_mutex_lock (&preadwritelock);
386 ooffset = lseek (fd, 0, SEEK_CUR); 381 ooffset = lseek (fd, 0, SEEK_CUR);
387 lseek (fd, offset, SEEK_SET); 382 lseek (fd, offset, SEEK_SET);
388 res = read (fd, buf, count); 383 res = read (fd, buf, count);
389 lseek (fd, ooffset, SEEK_SET); 384 lseek (fd, ooffset, SEEK_SET);
390 pthread_mutex_unlock (&iolock); 385 pthread_mutex_unlock (&preadwritelock);
391 386
392 return res; 387 return res;
393} 388}
394 389
395static ssize_t 390static ssize_t
396pwrite (int fd, void *buf, size_t count, off_t offset) 391pwrite (int fd, void *buf, size_t count, off_t offset)
397{ 392{
398 ssize_t res; 393 ssize_t res;
399 off_t ooffset; 394 off_t ooffset;
400 395
401 pthread_mutex_lock (&iolock); 396 pthread_mutex_lock (&preadwritelock);
402 ooffset = lseek (fd, 0, SEEK_CUR); 397 ooffset = lseek (fd, 0, SEEK_CUR);
403 lseek (fd, offset, SEEK_SET); 398 lseek (fd, offset, SEEK_SET);
404 res = write (fd, buf, count); 399 res = write (fd, buf, count);
405 lseek (fd, offset, SEEK_SET); 400 lseek (fd, offset, SEEK_SET);
406 pthread_mutex_unlock (&iolock); 401 pthread_mutex_unlock (&preadwritelock);
407 402
408 return res; 403 return res;
409} 404}
410#endif 405#endif
411 406
414#endif 409#endif
415 410
416#if !HAVE_READAHEAD 411#if !HAVE_READAHEAD
417# define readahead aio_readahead 412# define readahead aio_readahead
418 413
419static char readahead_buf[4096];
420
421static ssize_t 414static ssize_t
422readahead (int fd, off_t offset, size_t count) 415readahead (int fd, off_t offset, size_t count)
423{ 416{
417 char readahead_buf[4096];
418
424 while (count > 0) 419 while (count > 0)
425 { 420 {
426 size_t len = count < sizeof (readahead_buf) ? count : sizeof (readahead_buf); 421 size_t len = count < sizeof (readahead_buf) ? count : sizeof (readahead_buf);
427 422
428 pread (fd, readahead_buf, len, offset); 423 pread (fd, readahead_buf, len, offset);
432 427
433 errno = 0; 428 errno = 0;
434} 429}
435#endif 430#endif
436 431
432#if !HAVE_READDIR_R
433# define readdir_r aio_readdir_r
434
435static pthread_mutex_t readdirlock = PTHREAD_MUTEX_INITIALIZER;
436
437static int
438readdir_r (DIR *dirp, struct dirent *ent, struct dirent **res)
439{
440 struct dirent *e;
441 int errorno;
442
443 pthread_mutex_lock (&readdirlock);
444
445 e = readdir (dirp);
446 errorno = errno;
447
448 if (e)
449 {
450 *res = ent;
451 strcpy (ent->d_name, e->d_name);
452 }
453 else
454 *res = 0;
455
456 pthread_mutex_unlock (&readdirlock);
457
458 errno = errorno;
459 return e ? 0 : -1;
460}
461#endif
462
437/* sendfile always needs emulation */ 463/* sendfile always needs emulation */
438static ssize_t 464static ssize_t
439sendfile_ (int ofd, int ifd, off_t offset, size_t count) 465sendfile_ (int ofd, int ifd, off_t offset, size_t count)
440{ 466{
441 ssize_t res; 467 ssize_t res;
442 468
443 if (!count) 469 if (!count)
444 return 0; 470 return 0;
445 471
446#if HAVE_SENDFILE 472#if HAVE_SENDFILE
447# if __linux 473# if __linux
448 res = sendfile (ofd, ifd, &offset, count); 474 res = sendfile (ofd, ifd, &offset, count);
449 475
450# elif __freebsd 476# elif __freebsd
451 /* 477 /*
452 * Of course, the freebsd sendfile is a dire hack with no thoughts 478 * Of course, the freebsd sendfile is a dire hack with no thoughts
453 * wasted on making it similar to other I/O functions. 479 * wasted on making it similar to other I/O functions.
454 */ 480 */
455 { 481 {
456 off_t sbytes; 482 off_t sbytes;
457 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); 483 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0);
458 484
459 if (res < 0 && sbytes) 485 if (res < 0 && sbytes)
460 /* maybe only on EAGAIN only: as usual, the manpage leaves you guessing */ 486 /* maybe only on EAGAIN only: as usual, the manpage leaves you guessing */
461 res = sbytes; 487 res = sbytes;
462 } 488 }
463 489
464# elif __hpux 490# elif __hpux
465 res = sendfile (ofd, ifd, offset, count, 0, 0); 491 res = sendfile (ofd, ifd, offset, count, 0, 0);
466 492
467# elif __solaris 493# elif __solaris
468 { 494 {
469 struct sendfilevec vec; 495 struct sendfilevec vec;
470 size_t sbytes; 496 size_t sbytes;
471 497
472 vec.sfv_fd = ifd; 498 vec.sfv_fd = ifd;
473 vec.sfv_flag = 0; 499 vec.sfv_flag = 0;
474 vec.sfv_off = offset; 500 vec.sfv_off = offset;
475 vec.sfv_len = count; 501 vec.sfv_len = count;
476 502
477 res = sendfilev (ofd, &vec, 1, &sbytes); 503 res = sendfilev (ofd, &vec, 1, &sbytes);
478 504
479 if (res < 0 && sbytes) 505 if (res < 0 && sbytes)
480 res = sbytes; 506 res = sbytes;
481 } 507 }
482 508
483# else
484 res = -1;
485 errno = ENOSYS;
486# endif 509# endif
510#else
511 res = -1;
512 errno = ENOSYS;
487#endif 513#endif
488 514
489 if (res < 0 515 if (res < 0
490 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK 516 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK
491#if __solaris 517#if __solaris
492 || errno == EAFNOSUPPORT || errno == EPROTOTYPE 518 || errno == EAFNOSUPPORT || errno == EPROTOTYPE
493#endif 519#endif
494 ) 520 )
495 ) 521 )
496 { 522 {
497 /* emulate sendfile. this is a major pain in the ass */ 523 /* emulate sendfile. this is a major pain in the ass */
498 char *buf = malloc (4096); 524 char buf[4096];
499 res = 0; 525 res = 0;
500 526
501 for (;;) 527 while (count)
502 { 528 {
503 ssize_t cnt; 529 ssize_t cnt;
504 530
505 cnt = pread (ifd, buf, 4096, offset); 531 cnt = pread (ifd, buf, count > 4096 ? 4096 : count, offset);
506 532
507 if (cnt <= 0) 533 if (cnt <= 0)
508 { 534 {
509 if (cnt && !res) res = -1; 535 if (cnt && !res) res = -1;
510 break; 536 break;
511 } 537 }
512 538
513 cnt = write (ofd, buf, cnt); 539 cnt = write (ofd, buf, cnt);
514 540
515 if (cnt <= 0) 541 if (cnt <= 0)
516 { 542 {
517 if (cnt && !res) res = -1; 543 if (cnt && !res) res = -1;
518 break; 544 break;
519 } 545 }
520 546
521 offset += cnt; 547 offset += cnt;
522 res += cnt; 548 res += cnt;
549 count -= cnt;
523 } 550 }
524
525 {
526 int errorno = errno;
527 free (buf);
528 errno = errorno;
529 }
530 } 551 }
531 552
532 return res; 553 return res;
554}
555
556/* read a full directory */
557static int
558scandir_ (const char *path, void **namesp)
559{
560 DIR *dirp = opendir (path);
561 union
562 {
563 struct dirent d;
564 char b [offsetof (struct dirent, d_name) + NAME_MAX + 1];
565 } u;
566 struct dirent *entp;
567 char *name, *names;
568 int memlen = 4096;
569 int memofs = 0;
570 int res = 0;
571 int errorno;
572
573 if (!dirp)
574 return -1;
575
576 names = malloc (memlen);
577
578 for (;;)
579 {
580 errno = 0, readdir_r (dirp, &u.d, &entp);
581
582 if (!entp)
583 break;
584
585 name = entp->d_name;
586
587 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2])))
588 {
589 int len = strlen (name) + 1;
590
591 res++;
592
593 while (memofs + len > memlen)
594 {
595 memlen *= 2;
596 names = realloc (names, memlen);
597 if (!names)
598 break;
599 }
600
601 memcpy (names + memofs, name, len);
602 memofs += len;
603 }
604 }
605
606 errorno = errno;
607 closedir (dirp);
608
609 if (errorno)
610 {
611 free (names);
612 errno = errorno;
613 res = -1;
614 }
615
616 *namesp = (void *)names;
617 return res;
533} 618}
534 619
535/*****************************************************************************/ 620/*****************************************************************************/
536 621
537static void * 622static void *
580 665
581 case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break; 666 case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break;
582 case REQ_CLOSE: req->result = close (req->fd); break; 667 case REQ_CLOSE: req->result = close (req->fd); break;
583 case REQ_UNLINK: req->result = unlink (req->dataptr); break; 668 case REQ_UNLINK: req->result = unlink (req->dataptr); break;
584 case REQ_RMDIR: req->result = rmdir (req->dataptr); break; 669 case REQ_RMDIR: req->result = rmdir (req->dataptr); break;
670 case REQ_RENAME: req->result = rename (req->data2ptr, req->dataptr); break;
671 case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break;
585 case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; 672 case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break;
586 673
587 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; 674 case REQ_FDATASYNC: req->result = fdatasync (req->fd); break;
588 case REQ_FSYNC: req->result = fsync (req->fd); break; 675 case REQ_FSYNC: req->result = fsync (req->fd); break;
676 case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break;
589 677
590 case REQ_QUIT: 678 case REQ_QUIT:
591 break; 679 break;
592 680
593 default: 681 default:
617 pthread_mutex_unlock (&reslock); 705 pthread_mutex_unlock (&reslock);
618 } 706 }
619 while (type != REQ_QUIT); 707 while (type != REQ_QUIT);
620 708
621 return 0; 709 return 0;
710}
711
712/*****************************************************************************/
713
714static void atfork_prepare (void)
715{
716 pthread_mutex_lock (&reqlock);
717 pthread_mutex_lock (&reslock);
718#if !HAVE_PREADWRITE
719 pthread_mutex_lock (&preadwritelock);
720#endif
721#if !HAVE_READDIR_R
722 pthread_mutex_lock (&readdirlock);
723#endif
724}
725
726static void atfork_parent (void)
727{
728#if !HAVE_READDIR_R
729 pthread_mutex_unlock (&readdirlock);
730#endif
731#if !HAVE_PREADWRITE
732 pthread_mutex_unlock (&preadwritelock);
733#endif
734 pthread_mutex_unlock (&reslock);
735 pthread_mutex_unlock (&reqlock);
736}
737
738static void atfork_child (void)
739{
740 aio_req prv;
741
742 started = 0;
743
744 while (reqs)
745 {
746 prv = reqs;
747 reqs = prv->next;
748 free_req (prv);
749 }
750
751 reqs = reqe = 0;
752
753 while (ress)
754 {
755 prv = ress;
756 ress = prv->next;
757 free_req (prv);
758 }
759
760 ress = rese = 0;
761
762 close (respipe [0]);
763 close (respipe [1]);
764 create_pipe ();
765
766 atfork_parent ();
622} 767}
623 768
624#define dREQ \ 769#define dREQ \
625 aio_req req; \ 770 aio_req req; \
626 \ 771 \
642 create_pipe (); 787 create_pipe ();
643 pthread_atfork (atfork_prepare, atfork_parent, atfork_child); 788 pthread_atfork (atfork_prepare, atfork_parent, atfork_child);
644} 789}
645 790
646void 791void
647min_parallel(nthreads) 792min_parallel (nthreads)
648 int nthreads 793 int nthreads
649 PROTOTYPE: $ 794 PROTOTYPE: $
650 795
651void 796void
652max_parallel(nthreads) 797max_parallel (nthreads)
653 int nthreads 798 int nthreads
654 PROTOTYPE: $ 799 PROTOTYPE: $
655 800
656int 801int
657max_outstanding(nreqs) 802max_outstanding (nreqs)
658 int nreqs 803 int nreqs
659 PROTOTYPE: $ 804 PROTOTYPE: $
660 CODE: 805 CODE:
661 RETVAL = max_outstanding; 806 RETVAL = max_outstanding;
662 max_outstanding = nreqs; 807 max_outstanding = nreqs;
663 808
664void 809void
665aio_open(pathname,flags,mode,callback=&PL_sv_undef) 810aio_open (pathname,flags,mode,callback=&PL_sv_undef)
666 SV * pathname 811 SV * pathname
667 int flags 812 int flags
668 int mode 813 int mode
669 SV * callback 814 SV * callback
670 PROTOTYPE: $$$;$ 815 PROTOTYPE: $$$;$
680 825
681 send_req (req); 826 send_req (req);
682} 827}
683 828
684void 829void
685aio_close(fh,callback=&PL_sv_undef) 830aio_close (fh,callback=&PL_sv_undef)
686 SV * fh 831 SV * fh
687 SV * callback 832 SV * callback
688 PROTOTYPE: $;$ 833 PROTOTYPE: $;$
689 ALIAS: 834 ALIAS:
690 aio_close = REQ_CLOSE 835 aio_close = REQ_CLOSE
700 845
701 send_req (req); 846 send_req (req);
702} 847}
703 848
704void 849void
705aio_read(fh,offset,length,data,dataoffset,callback=&PL_sv_undef) 850aio_read (fh,offset,length,data,dataoffset,callback=&PL_sv_undef)
706 SV * fh 851 SV * fh
707 UV offset 852 UV offset
708 UV length 853 UV length
709 SV * data 854 SV * data
710 UV dataoffset 855 UV dataoffset
764 send_req (req); 909 send_req (req);
765 } 910 }
766} 911}
767 912
768void 913void
769aio_sendfile(out_fh,in_fh,in_offset,length,callback=&PL_sv_undef) 914aio_sendfile (out_fh,in_fh,in_offset,length,callback=&PL_sv_undef)
770 SV * out_fh 915 SV * out_fh
771 SV * in_fh 916 SV * in_fh
772 UV in_offset 917 UV in_offset
773 UV length 918 UV length
774 SV * callback 919 SV * callback
787 932
788 send_req (req); 933 send_req (req);
789} 934}
790 935
791void 936void
792aio_readahead(fh,offset,length,callback=&PL_sv_undef) 937aio_readahead (fh,offset,length,callback=&PL_sv_undef)
793 SV * fh 938 SV * fh
794 UV offset 939 UV offset
795 IV length 940 IV length
796 SV * callback 941 SV * callback
797 PROTOTYPE: $$$;$ 942 PROTOTYPE: $$$;$
807 952
808 send_req (req); 953 send_req (req);
809} 954}
810 955
811void 956void
812aio_stat(fh_or_path,callback=&PL_sv_undef) 957aio_stat (fh_or_path,callback=&PL_sv_undef)
813 SV * fh_or_path 958 SV * fh_or_path
814 SV * callback 959 SV * callback
815 ALIAS: 960 ALIAS:
816 aio_stat = REQ_STAT 961 aio_stat = REQ_STAT
817 aio_lstat = REQ_LSTAT 962 aio_lstat = REQ_LSTAT
841 986
842 send_req (req); 987 send_req (req);
843} 988}
844 989
845void 990void
846aio_unlink(pathname,callback=&PL_sv_undef) 991aio_unlink (pathname,callback=&PL_sv_undef)
847 SV * pathname 992 SV * pathname
848 SV * callback 993 SV * callback
849 ALIAS: 994 ALIAS:
850 aio_unlink = REQ_UNLINK 995 aio_unlink = REQ_UNLINK
851 aio_rmdir = REQ_RMDIR 996 aio_rmdir = REQ_RMDIR
997 aio_readdir = REQ_READDIR
852 CODE: 998 CODE:
853{ 999{
854 dREQ; 1000 dREQ;
855 1001
856 req->type = ix; 1002 req->type = ix;
859 1005
860 send_req (req); 1006 send_req (req);
861} 1007}
862 1008
863void 1009void
864aio_symlink(oldpath,newpath,callback=&PL_sv_undef) 1010aio_link (oldpath,newpath,callback=&PL_sv_undef)
865 SV * oldpath 1011 SV * oldpath
866 SV * newpath 1012 SV * newpath
867 SV * callback 1013 SV * callback
1014 ALIAS:
1015 aio_link = REQ_LINK
1016 aio_symlink = REQ_SYMLINK
1017 aio_rename = REQ_RENAME
868 CODE: 1018 CODE:
869{ 1019{
870 dREQ; 1020 dREQ;
871 1021
872 req->type = REQ_SYMLINK; 1022 req->type = ix;
873 req->fh = newSVsv (oldpath); 1023 req->fh = newSVsv (oldpath);
874 req->data2ptr = SvPVbyte_nolen (req->fh); 1024 req->data2ptr = SvPVbyte_nolen (req->fh);
875 req->data = newSVsv (newpath); 1025 req->data = newSVsv (newpath);
876 req->dataptr = SvPVbyte_nolen (req->data); 1026 req->dataptr = SvPVbyte_nolen (req->data);
877 1027
878 send_req (req); 1028 send_req (req);
879} 1029}
880 1030
881void 1031void
882flush() 1032flush ()
883 PROTOTYPE: 1033 PROTOTYPE:
884 CODE: 1034 CODE:
885 while (nreqs) 1035 while (nreqs)
886 { 1036 {
887 poll_wait (); 1037 poll_wait ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines