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.168 by root, Wed Aug 4 14:02:58 2010 UTC vs.
Revision 1.171 by root, Wed Aug 4 17:16:19 2010 UTC

140#endif 140#endif
141#ifndef POSIX_FADV_DONTNEED 141#ifndef POSIX_FADV_DONTNEED
142# define POSIX_FADV_DONTNEED 0 142# define POSIX_FADV_DONTNEED 0
143#endif 143#endif
144 144
145#if _XOPEN_SOURCE < 600 || NO_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# define NO_MADVISE 1
152#endif
153#ifndef POSIX_MADV_SEQUENTIAL
154# define POSIX_MADV_SEQUENTIAL 0
155#endif
156#ifndef POSIX_MADV_RANDOM
157# define POSIX_MADV_RANDOM 0
158#endif
159#ifndef POSIX_MADV_WILLNEED
160# define POSIX_MADV_WILLNEED 0
161#endif
162#ifndef POSIX_MADV_DONTNEED
163# define POSIX_MADV_DONTNEED 0
164#endif
165
166#if _XOPEN_SOURCE < 600 || NO_MADVISE
167# define posix_madvise(a,b,c) errno = ENOSYS /* also return ENOSYS */
168#endif
169
170#ifndef PROT_NONE
171# define PROT_NONE 0
172#endif
173#ifndef PROT_READ
174# define PROT_READ 0
175#endif
176#ifndef PROT_WRITE
177# define PROT_READ 0
178#endif
179#ifndef PROT_EXEC
180# define PROT_EXEC 0
181#endif
182
145#ifndef ST_NODEV 183#ifndef ST_NODEV
146# define ST_NODEV 0 184# define ST_NODEV 0
147#endif 185#endif
148#ifndef ST_NOEXEC 186#ifndef ST_NOEXEC
149# define ST_NOEXEC 0 187# define ST_NOEXEC 0
606/*****************************************************************************/ 644/*****************************************************************************/
607 645
608#if !_POSIX_MAPPED_FILES 646#if !_POSIX_MAPPED_FILES
609# define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, -1) 647# define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, -1)
610# define munmap(addr,length) (errno = ENOSYS, -1) 648# define munmap(addr,length) (errno = ENOSYS, -1)
649# define mprotect(addr,len,prot) (errno = ENOSYS, -1)
611#endif 650#endif
612 651
613#define MMAP_MAGIC PERL_MAGIC_ext 652#define MMAP_MAGIC PERL_MAGIC_ext
614 653
615static int 654static int
699 const_niv (FADV_RANDOM , POSIX_FADV_RANDOM) 738 const_niv (FADV_RANDOM , POSIX_FADV_RANDOM)
700 const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE) 739 const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE)
701 const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED) 740 const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED)
702 const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED) 741 const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED)
703 742
743 const_niv (MADV_NORMAL , POSIX_MADV_NORMAL)
744 const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL)
745 const_niv (MADV_RANDOM , POSIX_MADV_RANDOM)
746 const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED)
747 const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED)
748
704 const_iv (ST_RDONLY) 749 const_iv (ST_RDONLY)
705 const_iv (ST_NOSUID) 750 const_iv (ST_NOSUID)
706 const_iv (ST_NODEV) 751 const_iv (ST_NODEV)
707 const_iv (ST_NOEXEC) 752 const_iv (ST_NOEXEC)
708 const_iv (ST_SYNCHRONOUS) 753 const_iv (ST_SYNCHRONOUS)
712 const_iv (ST_IMMUTABLE) 757 const_iv (ST_IMMUTABLE)
713 const_iv (ST_NOATIME) 758 const_iv (ST_NOATIME)
714 const_iv (ST_NODIRATIME) 759 const_iv (ST_NODIRATIME)
715 const_iv (ST_RELATIME) 760 const_iv (ST_RELATIME)
716 761
762 const_iv (PROT_NONE)
717 const_iv (PROT_EXEC) 763 const_iv (PROT_EXEC)
718 const_iv (PROT_NONE)
719 const_iv (PROT_READ) 764 const_iv (PROT_READ)
720 const_iv (PROT_WRITE) 765 const_iv (PROT_WRITE)
721 766
722 /*const_iv (MAP_FIXED)*/ 767 /*const_iv (MAP_FIXED)*/
723 const_iv (MAP_PRIVATE) 768 const_iv (MAP_PRIVATE)
1362 1407
1363int 1408int
1364fadvise (aio_rfd fh, off_t offset, off_t length, IV advice) 1409fadvise (aio_rfd fh, off_t offset, off_t length, IV advice)
1365 PROTOTYPE: $$$$ 1410 PROTOTYPE: $$$$
1366 CODE: 1411 CODE:
1367#if _XOPEN_SOURCE >= 600 && !NO_FADVISE
1368 RETVAL = posix_fadvise (fh, offset, length, advice); 1412 RETVAL = posix_fadvise (fh, offset, length, advice);
1369#else
1370 RETVAL = errno = ENOSYS; /* yes, this is actually correct */
1371#endif
1372 OUTPUT: 1413 OUTPUT:
1373 RETVAL 1414 RETVAL
1374 1415
1375ssize_t 1416ssize_t
1376sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count) 1417sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count)
1416void 1457void
1417munmap (SV *scalar) 1458munmap (SV *scalar)
1418 PROTOTYPE: $ 1459 PROTOTYPE: $
1419 CODE: 1460 CODE:
1420 sv_unmagic (scalar, MMAP_MAGIC); 1461 sv_unmagic (scalar, MMAP_MAGIC);
1462
1463int
1464madvise (SV *scalar, off_t offset, off_t length, IV advice_or_prot)
1465 ALIAS:
1466 mprotect = 1
1467 PROTOTYPE: $$$$
1468 CODE:
1469{
1470 STRLEN cur;
1471 char *addr = SvPVbyte (scalar, cur);
1472
1473 if (offset > cur)
1474 RETVAL = errno = EFAULT;
1475 else
1476 {
1477 if (!SvOK (ST (2)))
1478 length = cur - offset;
1479
1480 if (offset + length > cur)
1481 RETVAL = errno = EFAULT;
1482 else
1483 switch (ix)
1484 {
1485 case 0: RETVAL = posix_madvise (addr + offset, length, advice_or_prot); break;
1486 case 1: RETVAL = mprotect (addr + offset, length, advice_or_prot); break;
1487 }
1488 }
1489}
1490 OUTPUT:
1491 RETVAL
1421 1492
1422int 1493int
1423mlockall (int flags) 1494mlockall (int flags)
1424 PROTOTYPE: $ 1495 PROTOTYPE: $
1425 CODE: 1496 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines