You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/03/29 03:11:41 UTC
svn commit: r389646 - /incubator/stdcxx/trunk/src/memattr.cpp
Author: sebor
Date: Tue Mar 28 17:11:39 2006
New Revision: 389646
URL: http://svn.apache.org/viewcvs?rev=389646&view=rev
Log:
2006-03-28 Martin Sebor <se...@roguewave.com>
* memattr.cpp (__rw_memattr): Checked errno for EFAULT and ENOMEM
after caling madvise() on Linux to prevent false negatives when
errno is set to EBADF for mapped address ranges not backed by a
file.
Modified:
incubator/stdcxx/trunk/src/memattr.cpp
Modified: incubator/stdcxx/trunk/src/memattr.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/src/memattr.cpp?rev=389646&r1=389645&r2=389646&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/memattr.cpp (original)
+++ incubator/stdcxx/trunk/src/memattr.cpp Tue Mar 28 17:11:39 2006
@@ -153,7 +153,17 @@
const int err = errno;
errno = errno_save;
- if (err)
+ bool bad_address;
+
+# ifdef _RWSTD_OS_LINUX
+ // Linux fails with EBADF when "the map exists,
+ // but the area maps something that isn't a file"
+ bad_address = EFAULT == err || ENOMEM == err;
+# else // not Linux
+ bad_address = err != 0;
+# endif // Linux
+
+ if (bad_address)
return next == page ? -1 : DIST (next, addr);
}