From d8a7d742cb77cb8c2e8ed8e8b22520097e02e9a4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 28 Mar 2011 20:16:57 +0000 Subject: Pull in HEAD changes --- winsup/cygwin/ChangeLog | 25 +++++++++++++++++++ winsup/cygwin/autoload.cc | 2 +- winsup/cygwin/cygwin.din | 1 + winsup/cygwin/dll_init.cc | 5 +++- winsup/cygwin/include/cygwin/version.h | 5 ++-- winsup/cygwin/mmap.cc | 44 ++++++++++++++++++++++++++++++++++ winsup/cygwin/posix.sgml | 1 + winsup/cygwin/wincap.cc | 2 +- 8 files changed, 80 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 96ef72c..3707532 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,28 @@ +2011-03-27 Yaakov Selkowitz + + * cygwin.din (strchrnul): Export. + * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. + * posix.sgml (std-gnu): Add strchrnul. + +2011-03-27 Christopher Faylor + + * dll_init.cc (dll::init): Accommodate ill-behaved dlls who don't fill + out p.envptr. + +2011-03-25 Corinna Vinschen + + * mmap.cc (mmap64): Add a cheat to let a certain autoconf test succeed + on 64 bit systems. Explain why. + +2011-03-23 Christopher Faylor + + * wincap.cc (wincap_2003): Set use_dont_resolve_hack to true. + +2011-03-23 Christopher Faylor + + * autoload.cc (dll_load): Change error message to make it clear if a + newer DLL is being run. + 2011-03-20 Corinna Vinschen * fenv.cc (_feinitialise): Don't use SSE instructions on systems not diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 9d5a91c..ea3d741 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -278,7 +278,7 @@ std_dll_init () else if ((func->decoration & 1)) dll->handle = INVALID_HANDLE_VALUE; else - api_fatal ("could not load %W, %E", dll_path); + api_fatal ("unable to load %W, %E", dll_path); } fesetenv (&fpuenv); } diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 7f0fb17..10565ad 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -1588,6 +1588,7 @@ strcat NOSIGFE _strcat = strcat NOSIGFE strchr NOSIGFE _strchr = strchr NOSIGFE +strchrnul NOSIGFE strcmp NOSIGFE _strcmp = strcmp NOSIGFE strcoll NOSIGFE diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index 37f0297..1220557 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -76,7 +76,10 @@ dll::init () int ret = 1; /* This should be a no-op. Why didn't we just import this variable? */ - *(p.envptr) = __cygwin_environ; + if (!p.envptr) + p.envptr = &__cygwin_environ; + else + *(p.envptr) = __cygwin_environ; /* Don't run constructors or the "main" if we've forked. */ if (!in_forkee) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 6bccfe9..56f4372 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -400,14 +400,15 @@ details. */ 234: Export program_invocation_name, program_invocation_short_name. 235: Export madvise. 236: Export pthread_yield, __xpg_strerror_r. - 237: Export pthread_spin_destroy, pthread_spin_init, pthread_spin_lock, + 237: Export strchrnul. + 238: Export pthread_spin_destroy, pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 237 +#define CYGWIN_VERSION_API_MINOR 238 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 91c2d7b..8522b6d 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -801,6 +801,50 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) /* mmap /dev/zero is like MAP_ANONYMOUS. */ if (fh->get_device () == FH_ZERO) flags |= MAP_ANONYMOUS; + + /* The autoconf mmap test maps a file of size 1 byte. It then tests + every byte of the entire mapped page of 64K for 0-bytes since that's + what POSIX requires. The problem is, we can't create that mapping on + 64 bit systems. The file mapping will be only a single page, 4K, and + since 64 bit systems don't support the AT_ROUND_TO_PAGE flag, the + remainder of the 64K slot will result in a SEGV when accessed. + + So, what we do here is cheating for the sake of the autoconf test + on 64 bit systems. The justification is that there's very likely + no application actually utilizing the map beyond EOF, and we know that + all bytes beyond EOF are set to 0 anyway. If this test doesn't work + on 64 bit systems, it will result in not using mmap at all in a + package. But we want that mmap is treated as usable by autoconf, + regardless whether the autoconf test runs on a 32 bit or a 64 bit + system. + + Ok, so we know exactly what autoconf is doing. The file is called + "conftest.txt", it has a size of 1 byte, the mapping size is the + pagesize, the requested protection is PROT_READ | PROT_WRITE, the + mapping is MAP_SHARED, the offset is 0. + + If all these requirements are given, we just return an anonymous map. + This will help to get over the autoconf test even on 64 bit systems. + The tests are ordered for speed. */ + if (wincap.is_wow64 ()) + { + UNICODE_STRING fname; + IO_STATUS_BLOCK io; + FILE_STANDARD_INFORMATION fsi; + + if (len == pagesize + && prot == (PROT_READ | PROT_WRITE) + && flags == MAP_SHARED + && off == 0 + && (RtlSplitUnicodePath (fh->pc.get_nt_native_path (), NULL, + &fname), + wcscmp (fname.Buffer, L"conftest.txt") == 0) + && NT_SUCCESS (NtQueryInformationFile (fh->get_handle (), &io, + &fsi, sizeof fsi, + FileStandardInformation)) + && fsi.EndOfFile.QuadPart == 1LL) + flags |= MAP_ANONYMOUS; + } } if (anonymous (flags) || fd == -1) diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index 773833b..53e7606 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -1117,6 +1117,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). pow10f removexattr setxattr + strchrnul tdestroy timegm timelocal diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index ee790eb..cc9cb02 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -319,7 +319,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { has_buggy_thread_startup:false, has_fast_cwd:false, has_restricted_raw_disk_access:false, - use_dont_resolve_hack:false, + use_dont_resolve_hack:true, use_get_sec_info_on_dirs:true, supports_sse:true, }; -- cgit v1.1