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.180 by root, Fri Feb 11 00:05:17 2011 UTC vs.
Revision 1.184 by root, Tue Jul 5 20:34:42 2011 UTC

121#define EIO_NO_WRAPPERS 1 121#define EIO_NO_WRAPPERS 1
122 122
123#include "libeio/config.h" 123#include "libeio/config.h"
124#include "libeio/eio.h" 124#include "libeio/eio.h"
125 125
126/* Linux/others */
127#ifndef O_ASYNC
128# define O_ASYNC 0
129#endif
130#ifndef O_DIRECT
131# define O_DIRECT 0
132#endif
133#ifndef O_NOATIME
134# define O_NOATIME 0
135#endif
136
137/* POSIX */
138#ifndef O_CLOEXEC
139# define O_CLOEXEC 0
140#endif
141#ifndef O_NOFOLLOW
142# define O_NOFOLLOW 0
143#endif
144#ifndef O_NOCTTY
145# define O_NOCTTY 0
146#endif
147#ifndef O_NONBLOCK
148# define O_NONBLOCK 0
149#endif
150#ifndef O_EXEC
151# define O_EXEC 0
152#endif
153#ifndef O_SEARCH
154# define O_SEARCH 0
155#endif
156#ifndef O_DIRECTORY
157# define O_DIRECTORY 0
158#endif
159#ifndef O_DSYNC
160# define O_DSYNC 0
161#endif
162#ifndef O_RSYNC
163# define O_RSYNC 0
164#endif
165#ifndef O_SYNC
166# define O_SYNC 0
167#endif
168#ifndef O_TTY_INIT
169# define O_TTY_INIT 0
170#endif
171
126#ifndef POSIX_FADV_NORMAL 172#ifndef POSIX_FADV_NORMAL
127# define POSIX_FADV_NORMAL 0 173# define POSIX_FADV_NORMAL 0
128#endif 174#endif
129#ifndef POSIX_FADV_SEQUENTIAL 175#ifndef POSIX_FADV_SEQUENTIAL
130# define POSIX_FADV_SEQUENTIAL 0 176# define POSIX_FADV_SEQUENTIAL 0
539 case EIO_NOP: 585 case EIO_NOP:
540 case EIO_BUSY: 586 case EIO_BUSY:
541 break; 587 break;
542 588
543 case EIO_READLINK: 589 case EIO_READLINK:
590 case EIO_REALPATH:
544 if (req->result > 0) 591 if (req->result > 0)
545 PUSHs (sv_2mortal (newSVpvn (req->ptr2, req->result))); 592 PUSHs (sv_2mortal (newSVpvn (req->ptr2, req->result)));
546 break; 593 break;
547 594
548 case EIO_STAT: 595 case EIO_STAT:
620 grp->sv2 = 0; 667 grp->sv2 = 0;
621 668
622 eio_grp_cancel (grp); 669 eio_grp_cancel (grp);
623} 670}
624 671
625static void
626create_respipe (void) 672static void create_respipe (void)
627{ 673{
628 if (s_epipe_renew (&respipe)) 674 if (s_epipe_renew (&respipe))
629 croak ("IO::AIO: unable to initialize result pipe"); 675 croak ("IO::AIO: unable to initialize result pipe");
630} 676}
631 677
685# define MAP_FIXED 0 731# define MAP_FIXED 0
686#endif 732#endif
687 733
688#define MMAP_MAGIC PERL_MAGIC_ext 734#define MMAP_MAGIC PERL_MAGIC_ext
689 735
690static int
691mmap_free (pTHX_ SV *sv, MAGIC *mg) 736static int mmap_free (pTHX_ SV *sv, MAGIC *mg)
692{ 737{
693 int old_errno = errno; 738 int old_errno = errno;
694 munmap (mg->mg_ptr, (size_t)mg->mg_obj); 739 munmap (mg->mg_ptr, (size_t)mg->mg_obj);
695 errno = old_errno; 740 errno = old_errno;
696 741
712 0, 0, 0, 0, mmap_free 757 0, 0, 0, 0, mmap_free
713}; 758};
714 759
715/*****************************************************************************/ 760/*****************************************************************************/
716 761
717static SV *
718get_cb (SV *cb_sv) 762static SV * get_cb (SV *cb_sv)
719{ 763{
720 SvGETMAGIC (cb_sv); 764 SvGETMAGIC (cb_sv);
721 return SvOK (cb_sv) ? s_get_cv_croak (cb_sv) : 0; 765 return SvOK (cb_sv) ? s_get_cv_croak (cb_sv) : 0;
722} 766}
723 767
765 const_iv (O_CREAT) 809 const_iv (O_CREAT)
766 const_iv (O_TRUNC) 810 const_iv (O_TRUNC)
767 const_iv (O_EXCL) 811 const_iv (O_EXCL)
768 const_iv (O_APPEND) 812 const_iv (O_APPEND)
769 813
814 const_iv (O_ASYNC)
815 const_iv (O_DIRECT)
816 const_iv (O_NOATIME)
817
818 const_iv (O_CLOEXEC)
819 const_iv (O_NOCTTY)
820 const_iv (O_NOFOLLOW)
821 const_iv (O_NONBLOCK)
822 const_iv (O_EXEC)
823 const_iv (O_SEARCH)
824 const_iv (O_DIRECTORY)
825 const_iv (O_DSYNC)
826 const_iv (O_RSYNC)
827 const_iv (O_SYNC)
828 const_iv (O_TTY_INIT)
829
770 const_iv (S_IFIFO) 830 const_iv (S_IFIFO)
771 const_iv (S_IFCHR) 831 const_iv (S_IFCHR)
772 const_iv (S_IFBLK) 832 const_iv (S_IFBLK)
773 const_iv (S_IFLNK) 833 const_iv (S_IFLNK)
774 const_iv (S_IFREG) 834 const_iv (S_IFREG)
866 /* atfork child called in fifo order, so before eio's handler */ 926 /* atfork child called in fifo order, so before eio's handler */
867 X_THREAD_ATFORK (0, 0, atfork_child); 927 X_THREAD_ATFORK (0, 0, atfork_child);
868} 928}
869 929
870void 930void
871max_poll_reqs (int nreqs) 931max_poll_reqs (unsigned int nreqs)
872 PROTOTYPE: $ 932 PROTOTYPE: $
873 CODE: 933 CODE:
874 eio_set_max_poll_reqs (nreqs); 934 eio_set_max_poll_reqs (nreqs);
875 935
876void 936void
878 PROTOTYPE: $ 938 PROTOTYPE: $
879 CODE: 939 CODE:
880 eio_set_max_poll_time (nseconds); 940 eio_set_max_poll_time (nseconds);
881 941
882void 942void
883min_parallel (int nthreads) 943min_parallel (unsigned int nthreads)
884 PROTOTYPE: $ 944 PROTOTYPE: $
885 CODE: 945 CODE:
886 eio_set_min_parallel (nthreads); 946 eio_set_min_parallel (nthreads);
887 947
888void 948void
889max_parallel (int nthreads) 949max_parallel (unsigned int nthreads)
890 PROTOTYPE: $ 950 PROTOTYPE: $
891 CODE: 951 CODE:
892 eio_set_max_parallel (nthreads); 952 eio_set_max_parallel (nthreads);
893 953
894void 954void
895max_idle (int nthreads) 955max_idle (unsigned int nthreads)
896 PROTOTYPE: $ 956 PROTOTYPE: $
897 CODE: 957 CODE:
898 eio_set_max_idle (nthreads); 958 eio_set_max_idle (nthreads);
899 959
900void 960void
961idle_timeout (unsigned int seconds)
962 PROTOTYPE: $
963 CODE:
964 eio_set_idle_timeout (seconds);
965
966void
901max_outstanding (int maxreqs) 967max_outstanding (unsigned int maxreqs)
902 PROTOTYPE: $ 968 PROTOTYPE: $
903 CODE: 969 CODE:
904 max_outstanding = maxreqs; 970 max_outstanding = maxreqs;
905 971
906void 972void
1033 } 1099 }
1034} 1100}
1035 1101
1036void 1102void
1037aio_readlink (SV8 *path, SV *callback=&PL_sv_undef) 1103aio_readlink (SV8 *path, SV *callback=&PL_sv_undef)
1104 ALIAS:
1105 aio_readlink = EIO_READLINK
1106 aio_realpath = EIO_REALPATH
1038 PPCODE: 1107 PPCODE:
1039{ 1108{
1040 SV *data; 1109 SV *data;
1041 dREQ; 1110 dREQ;
1042 1111
1043 req->type = EIO_READLINK; 1112 req->type = ix;
1044 req->sv1 = newSVsv (path); 1113 req->sv1 = newSVsv (path);
1045 req->ptr1 = SvPVbyte_nolen (req->sv1); 1114 req->ptr1 = SvPVbyte_nolen (req->sv1);
1046 1115
1047 REQ_SEND; 1116 REQ_SEND;
1048} 1117}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines