[PATCH 1/2] mlock incorrectly marked as broken on FreeBSD

Ruben Kerkhof ruben at rubenkerkhof.com
Thu Aug 11 16:08:34 CEST 2016


On FreeBSD, if there are not enough free pages, mlock() can return
EAGAIN, as documented in mlock(2). That doesn't mean that mlock is
broken. I suspect this same issue also exists on the other BSD's.
---
 acinclude.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 96be833..dcdadfd 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -242,7 +242,7 @@ int main()
     pool += (pgsize - ((long int)pool % pgsize));
 
     err = mlock( pool, 4096 );
-    if( !err || errno == EPERM )
+    if( !err || errno == EPERM || errno == EAGAIN)
         return 0; /* okay */
 
     return 1;  /* hmmm */
-- 
2.9.2




More information about the Gcrypt-devel mailing list