Subject: | bugs with perl-5.20.0 |
Date: | Wed, 28 May 2014 14:37:27 -0700 |
To: | bug-Sys-Mmap [...] rt.cpan.org |
From: | Greg Lindahl <lindahl [...] pbm.com> |
sys-mmap 0.16 is getting a bit old, here are patches for copy on write
and adding the MAP_LOCKED flag.
1) Fix bug with COW
--- Mmap.xs~ 2014-05-28 14:28:56.000000000 -0700
+++ Mmap.xs 2014-05-28 14:32:01.000000000 -0700
@@ -208,6 +214,12 @@
croak("mmap: mmap call failed: errno: %d errmsg: %s ", errno, strerror(errno));
}
+#if PERL_VERSION >= 20
+ if (SvIsCOW(var)) {
+ sv_force_normal_flags(var, 0);
+ }
+#endif
+
SvUPGRADE(var, SVt_PV);
if (!(prot & PROT_WRITE))
SvREADONLY_on(var);
2) Add MAP_LOCKED
--- Mmap.pm~ 2014-05-28 14:25:33.000000000 -0700
+++ Mmap.pm 2014-05-28 14:32:21.000000000 -0700
@@ -185,7 +185,7 @@
@ISA = qw(Exporter);
@EXPORT = qw(mmap munmap
- MAP_ANON MAP_ANONYMOUS MAP_FILE MAP_PRIVATE MAP_SHARED
+ MAP_ANON MAP_ANONYMOUS MAP_FILE MAP_LOCKED MAP_PRIVATE MAP_SHARED
PROT_EXEC PROT_NONE PROT_READ PROT_WRITE);
[lindahl@greg-desk ~]$ diff -u Mmap.xs~ Mmap.xs
--- Mmap.xs~ 2014-05-28 14:28:56.000000000 -0700
+++ Mmap.xs 2014-05-28 14:32:01.000000000 -0700
@@ -76,6 +76,12 @@
#else
goto not_there;
#endif
+ if (strEQ(name, "MAP_LOCKED"))
+#ifdef MAP_LOCKED
+ return MAP_LOCKED;
+#else
+ goto not_there;
+#endif
break;
case 'P':
if (strEQ(name, "PROT_EXEC"))