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.233 by root, Thu Jun 25 13:34:28 2015 UTC vs.
Revision 1.239 by root, Tue Feb 23 19:42:43 2016 UTC

145# define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ 145# define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */
146# endif 146# endif
147#endif 147#endif
148 148
149/* defines all sorts of constants to 0 unless they are already defined */ 149/* defines all sorts of constants to 0 unless they are already defined */
150/* also provides const_iv_ and const_niv_ macros for them */
150#include "def0.h" 151#include "def0.h"
151 152
152#ifndef makedev 153#ifndef makedev
153# define makedev(maj,min) (((maj) << 8) | (min)) 154# define makedev(maj,min) (((maj) << 8) | (min))
154#endif 155#endif
703{ 704{
704 while (eio_nreqs ()) 705 while (eio_nreqs ())
705 { 706 {
706 int size; 707 int size;
707 708
708 X_LOCK (reslock); 709 X_LOCK (EIO_POOL->reslock);
709 size = res_queue.size; 710 size = EIO_POOL->res_queue.size;
710 X_UNLOCK (reslock); 711 X_UNLOCK (EIO_POOL->reslock);
711 712
712 if (size) 713 if (size)
713 return; 714 return;
714 715
715 etp_maybe_start_thread (); 716 etp_maybe_start_thread (EIO_POOL);
716 717
717 s_epipe_wait (&respipe); 718 s_epipe_wait (&respipe);
718 } 719 }
719} 720}
720 721
751# define munmap(addr,length) EIO_ENOSYS () 752# define munmap(addr,length) EIO_ENOSYS ()
752#endif 753#endif
753 754
754#if !_POSIX_MEMORY_PROTECTION 755#if !_POSIX_MEMORY_PROTECTION
755# define mprotect(addr,len,prot) EIO_ENOSYS () 756# define mprotect(addr,len,prot) EIO_ENOSYS ()
756# define PROT_NONE 0
757# define PROT_WRITE 0
758# define MAP_PRIVATE 0
759# define MAP_SHARED 0
760# define MAP_FIXED 0
761#endif 757#endif
762 758
763#define MMAP_MAGIC PERL_MAGIC_ext 759#define MMAP_MAGIC PERL_MAGIC_ext
764 760
765static int ecb_cold 761static int ecb_cold
905 } *civ, const_iv[] = { 901 } *civ, const_iv[] = {
906# define const_niv(name, value) { # name, (IV) value }, 902# define const_niv(name, value) { # name, (IV) value },
907# define const_iv(name) { # name, (IV) name }, 903# define const_iv(name) { # name, (IV) name },
908# define const_eio(name) { # name, (IV) EIO_ ## name }, 904# define const_eio(name) { # name, (IV) EIO_ ## name },
909 905
910 /* you have to re-run ./gendef0 after adding/Removing any constants here */ 906 /* you have to re-run ./gendef0 after adding/removing any constants here */
911 907 /* the first block can be undef if missing */
912 const_iv (ENOSYS) 908 const_iv (ENOSYS)
913 const_iv (EXDEV) 909 const_iv (EXDEV)
914 const_iv (EBADR) 910 const_iv (EBADR)
915 911
912 /* for lseek */
913 const_iv (SEEK_DATA)
914 const_iv (SEEK_HOLE)
915
916 const_niv (FADV_NORMAL , POSIX_FADV_NORMAL)
917 const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL)
918 const_niv (FADV_RANDOM , POSIX_FADV_RANDOM)
919 const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE)
920 const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED)
921 const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED)
922
923 const_niv (MADV_NORMAL , POSIX_MADV_NORMAL)
924 const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL)
925 const_niv (MADV_RANDOM , POSIX_MADV_RANDOM)
926 const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED)
927 const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED)
928
929 /* the second block will be 0 when missing */
916 const_iv (O_RDONLY) 930 const_iv (O_RDONLY)
917 const_iv (O_WRONLY) 931 const_iv (O_WRONLY)
918 const_iv (O_RDWR) 932 const_iv (O_RDWR)
919 const_iv (O_CREAT) 933 const_iv (O_CREAT)
920 const_iv (O_TRUNC) 934 const_iv (O_TRUNC)
933 const_iv (O_SEARCH) 947 const_iv (O_SEARCH)
934 const_iv (O_DIRECTORY) 948 const_iv (O_DIRECTORY)
935 const_iv (O_DSYNC) 949 const_iv (O_DSYNC)
936 const_iv (O_RSYNC) 950 const_iv (O_RSYNC)
937 const_iv (O_SYNC) 951 const_iv (O_SYNC)
952 const_iv (O_PATH)
953 const_iv (O_TMPFILE)
938 const_iv (O_TTY_INIT) 954 const_iv (O_TTY_INIT)
939 955
940 const_iv (S_IFIFO) 956 const_iv (S_IFIFO)
941 const_iv (S_IFCHR) 957 const_iv (S_IFCHR)
942 const_iv (S_IFBLK) 958 const_iv (S_IFBLK)
944 const_iv (S_IFREG) 960 const_iv (S_IFREG)
945 const_iv (S_IFDIR) 961 const_iv (S_IFDIR)
946 const_iv (S_IFWHT) 962 const_iv (S_IFWHT)
947 const_iv (S_IFSOCK) 963 const_iv (S_IFSOCK)
948 const_iv (S_IFMT) 964 const_iv (S_IFMT)
949
950 const_niv (FADV_NORMAL , POSIX_FADV_NORMAL)
951 const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL)
952 const_niv (FADV_RANDOM , POSIX_FADV_RANDOM)
953 const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE)
954 const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED)
955 const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED)
956
957 const_niv (MADV_NORMAL , POSIX_MADV_NORMAL)
958 const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL)
959 const_niv (MADV_RANDOM , POSIX_MADV_RANDOM)
960 const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED)
961 const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED)
962 965
963 const_iv (ST_RDONLY) 966 const_iv (ST_RDONLY)
964 const_iv (ST_NOSUID) 967 const_iv (ST_NOSUID)
965 const_iv (ST_NODEV) 968 const_iv (ST_NODEV)
966 const_iv (ST_NOEXEC) 969 const_iv (ST_NOEXEC)
976 const_iv (PROT_NONE) 979 const_iv (PROT_NONE)
977 const_iv (PROT_EXEC) 980 const_iv (PROT_EXEC)
978 const_iv (PROT_READ) 981 const_iv (PROT_READ)
979 const_iv (PROT_WRITE) 982 const_iv (PROT_WRITE)
980 983
981 /*const_iv (MAP_FIXED)*/
982 const_iv (MAP_PRIVATE) 984 const_iv (MAP_PRIVATE)
983 const_iv (MAP_SHARED) 985 const_iv (MAP_SHARED)
986 const_iv (MAP_FIXED)
984 const_iv (MAP_ANONYMOUS) 987 const_iv (MAP_ANONYMOUS)
985 988
986 /* linuxish */ 989 /* linuxish */
987 const_iv (MAP_HUGETLB)
988 const_iv (MAP_LOCKED) 990 const_iv (MAP_LOCKED)
989 const_iv (MAP_NORESERVE) 991 const_iv (MAP_NORESERVE)
990 const_iv (MAP_POPULATE) 992 const_iv (MAP_POPULATE)
991 const_iv (MAP_NONBLOCK) 993 const_iv (MAP_NONBLOCK)
994 const_iv (MAP_GROWSDOWN)
995 const_iv (MAP_32BIT)
996 const_iv (MAP_HUGETLB)
997 const_iv (MAP_STACK)
992 998
993 const_iv (FIEMAP_FLAG_SYNC) 999 const_iv (FIEMAP_FLAG_SYNC)
994 const_iv (FIEMAP_FLAG_XATTR) 1000 const_iv (FIEMAP_FLAG_XATTR)
995 const_iv (FIEMAP_FLAGS_COMPAT) 1001 const_iv (FIEMAP_FLAGS_COMPAT)
996 const_iv (FIEMAP_EXTENT_LAST) 1002 const_iv (FIEMAP_EXTENT_LAST)
1008 const_iv (SPLICE_F_MOVE) 1014 const_iv (SPLICE_F_MOVE)
1009 const_iv (SPLICE_F_NONBLOCK) 1015 const_iv (SPLICE_F_NONBLOCK)
1010 const_iv (SPLICE_F_MORE) 1016 const_iv (SPLICE_F_MORE)
1011 const_iv (SPLICE_F_GIFT) 1017 const_iv (SPLICE_F_GIFT)
1012 1018
1013 const_iv (SEEK_DATA) 1019 /* these are libeio constants, and are independent of gendef0 */
1014 const_iv (SEEK_HOLE)
1015
1016 /* libeio constants */
1017 const_eio (SEEK_SET) 1020 const_eio (SEEK_SET)
1018 const_eio (SEEK_CUR) 1021 const_eio (SEEK_CUR)
1019 const_eio (SEEK_END) 1022 const_eio (SEEK_END)
1020 1023
1021 const_eio (MCL_FUTURE) 1024 const_eio (MCL_FUTURE)
1293 REQ_SEND; 1296 REQ_SEND;
1294 } 1297 }
1295} 1298}
1296 1299
1297void 1300void
1301aio_ioctl (SV *fh, unsigned long request, SV8 *arg, SV *callback = &PL_sv_undef)
1302 ALIAS:
1303 aio_ioctl = EIO_IOCTL
1304 aio_fcntl = EIO_FCNTL
1305 PPCODE:
1306{
1307 int fd = s_fileno_croak (fh, 0);
1308 char *svptr;
1309
1310 if (SvPOK (arg) || !SvNIOK (arg))
1311 {
1312 STRLEN svlen;
1313 /* perl uses IOCPARM_LEN for fcntl, so we do, too */
1314#ifdef IOCPARM_LEN
1315 STRLEN need = IOCPARM_LEN (request);
1316#else
1317 STRLEN need = 256;
1318#endif
1319
1320 if (svlen < need)
1321 svptr = SvGROW (arg, need + 1);
1322 }
1323 else
1324 svptr = (char *)SvIV (arg);
1325
1326 {
1327 dREQ;
1328
1329 req->type = ix;
1330 req->sv1 = newSVsv (fh);
1331 req->int1 = fd;
1332 req->int2 = (long)request;
1333 req->sv2 = SvREFCNT_inc (arg);
1334 req->ptr2 = svptr;
1335
1336 REQ_SEND;
1337 }
1338}
1339
1340void
1298aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef) 1341aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef)
1299 ALIAS: 1342 ALIAS:
1300 aio_readlink = EIO_READLINK 1343 aio_readlink = EIO_READLINK
1301 aio_realpath = EIO_REALPATH 1344 aio_realpath = EIO_REALPATH
1302 PPCODE: 1345 PPCODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines