mmap() on 64K aligned address fails

Sam Steingold sds@gnu.org
Mon Nov 28 15:40:00 GMT 2005


> * Corinna Vinschen <pbevaan-pltjva@pltjva.pbz> [2005-11-28 12:51:09 +0100]:
>
> Many mmap tests make such invalid assumptions about the memory.

This is not just "tests" and the assumptions are not necessarily
"invalid".  The appended test fails on cygwin but passes on just about
every unix (linux, *bsd &c).
This means that the cygwin version of CLISP lacks generational GC (while
the win32 native version as well as linux, *bsd, solaris &c have it!)
which is a major feature for memory-intensive computations.


-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
http://www.openvotingconsortium.org/ http://www.camera.org
http://www.dhimmi.com/ http://www.savegushkatif.org http://www.iris.org.il
The early worm gets caught by the bird.


configure:22543: checking for working mmap
configure:22709: gcc -o conftest.exe -g -O2 -I/usr/local/libsigsegv-cygwin/include  conftest.c  >&5
configure:22712: $? = 0
configure:22714: ./conftest.exe
configure:22717: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "GNU CLISP"
| #define PACKAGE_TARNAME "clisp"
| #define PACKAGE_VERSION "2.35 (2005-08-29)"
| #define PACKAGE_STRING "GNU CLISP 2.35 (2005-08-29)"
| #define PACKAGE_BUGREPORT "http://clisp.cons.org/"
| #define _GNU_SOURCE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define ASM_UNDERSCORE
| #ifndef __i386__
| #define __i386__ 1
| #endif
| #define HAVE_ICONV 1
| #define ICONV_CONST const
| #define HAVE_ICONV 1
| #define ENABLE_NLS 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_SIGSEGV 1
| #define return_void return
| #define HAVE_LONG_LONG 1
| #define HAVE_LONGLONG
| #define STDC_HEADERS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_OFFSETOF
| #define HAVE_STDBOOL_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_FILE_H 1
| #define DIRENT
| #define HAVE_SYS_UTSNAME_H
| #define HAVE_NETDB_H 1
| #define HAVE_SYS_SHM_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_TERMIO_H 1
| #define HAVE_SYS_TERMIO_H 1
| #define HAVE_TCGETATTR
| #define HAVE_TCSAFLUSH
| #define HAVE_X11
| #define CADDR_T caddr_t
| #define SOCKLEN_T int
| #define SIZEOF_OFF_T 8
| #define SIZEOF_INO_T 8
| #define SIZEOF_STRUCT_TIMEVAL 8
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE__JMP
| #define RETSIGTYPE void
| #define SIGNALBLOCK_SYSV
| #define SIGNALBLOCK_POSIX
| #define SIGNAL_NEED_REINSTALL
| #define SIGNAL_NEED_UNBLOCK
| #define SIGNAL_NEED_UNBLOCK_OTHERS
| #define HAVE_SIGACTION 1
| #define HAVE_SIGINTERRUPT 1
| #define HAVE_RAISE
| #define RETABORTTYPE void
| #define ABORT_VOLATILE 
| #define HAVE_PERROR_DECL
| #define HAVE_STRERROR 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETDTABLESIZE 1
| #define HAVE_MEMSET 1
| #define HAVE_SETSID 1
| #define HAVE_SETPGID 1
| #define HAVE_FSYNC 1
| #define HAVE_FLOCK 1
| #define HAVE_SHUTDOWN 1
| #define HAVE_USLEEP 1
| #define HAVE_UALARM 1
| #define HAVE_SETITIMER 1
| #define HAVE_NICE 1
| #define HAVE_FTIME 1
| #define HAVE_REALPATH 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_DECL_ENVIRON 1
| #define HAVE_LC_MESSAGES 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_SETRLIMIT 1
| #define SIZEOF_RLIM_T 4
| #define RLIMIT_RESOURCE_T int
| #define SETRLIMIT_CONST const
| #define HAVE_UNISTD_H 1
| #define HAVE_FORK 1
| #define HAVE_VFORK 1
| #define HAVE_WORKING_VFORK 1
| #define HAVE_WORKING_FORK 1
| #define PID_T pid_t
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_TIMES_H 1
| #define HAVE_GETRUSAGE
| #define RUSAGE_WHO_T int
| #define HAVE_GETCWD
| #define GETCWD_SIZE_T size_t
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_LSTAT
| #define HAVE_READLINK 1
| #define ELOOP_VALUE ELOOP
| #define RETCLOSEDIRTYPE int
| #define HAVE_IOCTL 1
| #define IOCTL_REQUEST_T int
| #define IOCTL_DOTS
| #define HAVE_POLL 1
| #define HAVE_RELIABLE_POLL
| #define HAVE_SELECT 1
| #define HAVE_SYS_SELECT_H
| #define SELECT_WIDTH_T int
| #define SELECT_SET_T fd_set
| #define SELECT_CONST 
| #define HAVE_RELIABLE_SELECT
| #define HAVE_GETTIMEOFDAY 1
| #define GETTIMEOFDAY_TZP_T struct timezone *
| #define HAVE_GETHOSTNAME 1
| #define HAVE_GETHOSTBYNAME
| #define HAVE_CONNECT 1
| #define CONNECT_CONST const
| #define CONNECT_NAME_T struct sockaddr *
| #define CONNECT_ADDRLEN_T int
| #define HAVE_SYS_UN_H 1
| #define HAVE_IPV4
| #define HAVE_INET_PTON 1
| #define HAVE_INET_NTOP 1
| #define HAVE_INET_ADDR 1
| #define HAVE_SETSOCKOPT 1
| #define HAVE_GETSOCKOPT 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_ARPA_INET_H 1
| #define RET_INET_ADDR_TYPE unsigned long
| #define INET_ADDR_CONST const
| #define INET_ADDR_SUFFIX
| #define SETSOCKOPT_CONST const
| #define SETSOCKOPT_ARG_T void*
| #define SETSOCKOPT_OPTLEN_T int
| #define CODE_ADDRESS_RANGE 0x00000000UL
| #define MALLOC_ADDRESS_RANGE 0x00000000UL
| #define SHLIB_ADDRESS_RANGE 0x00000000UL
| #define STACK_ADDRESS_RANGE 0x00000000UL
| #define HAVE_GETPAGESIZE
| #define RETGETPAGESIZETYPE size_t
| #define HAVE_MMAP
| /* end confdefs.h.  */
| 
| #include <stdlib.h>
| #if defined __MACH__ && defined __APPLE__
| /* Avoid a crash on MacOS X.  */
| #include <mach/mach.h>
| #include <mach/mach_error.h>
| #include <mach/thread_status.h>
| #include <mach/exception.h>
| #include <mach/task.h>
| #include <pthread.h>
| /* The exception port on which our thread listens.  */
| static mach_port_t our_exception_port;
| /* The main function of the thread listening for exceptions of type
|    EXC_BAD_ACCESS.  */
| static void *
| mach_exception_thread (void *arg)
| {
|   /* Buffer for a message to be received.  */
|   struct {
|     mach_msg_header_t head;
|     mach_msg_body_t msgh_body;
|     char data[1024];
|   } msg;
|   mach_msg_return_t retval;
|   /* Wait for a message on the exception port.  */
|   retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
|                      our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
|   if (retval != MACH_MSG_SUCCESS)
|     abort ();
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
|   mach_port_t self = mach_task_self ();
|   /* Allocate a port on which the thread shall listen for exceptions.  */
|   if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
|       == KERN_SUCCESS) {
|     /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
|     if (mach_port_insert_right (self, our_exception_port, our_exception_port,
|                                 MACH_MSG_TYPE_MAKE_SEND)
|         == KERN_SUCCESS) {
|       /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
|          for us.  */
|       exception_mask_t mask = EXC_MASK_BAD_ACCESS;
|       /* Create the thread listening on the exception port.  */
|       pthread_attr_t attr;
|       pthread_t thread;
|       if (pthread_attr_init (&attr) == 0
|           && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
|           && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
|         pthread_attr_destroy (&attr);
|         /* Replace the exception port info for these exceptions with our own.
|            Note that we replace the exception port for the entire task, not only
|            for a particular thread.  This has the effect that when our exception
|            port gets the message, the thread specific exception port has already
|            been asked, and we don't need to bother about it.
|            See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
|         task_set_exception_ports (self, mask, our_exception_port,
|                                   EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
|       }
|     }
|   }
| }
| #else
| /* Avoid a crash on POSIX systems.  */
| #include <signal.h>
| /* A POSIX signal handler.  */
| static void
| exception_handler (int sig)
| {
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
| #ifdef SIGSEGV
|   signal (SIGSEGV, exception_handler);
| #endif
| #ifdef SIGBUS
|   signal (SIGBUS, exception_handler);
| #endif
| }
| #endif
| 
| #include <stdlib.h>
| #ifdef HAVE_UNISTD_H
| #include <unistd.h>
| #endif
| #include <fcntl.h>
| #ifdef OPEN_NEEDS_SYS_FILE_H
| #include <sys/file.h>
| #endif
| #include <sys/types.h>
| #include <sys/mman.h>
| int main () {
| 
|   int flags = MAP_ANON | MAP_PRIVATE;
|   int fd = -1;
|   nocrash_init();
| #define bits_to_avoid 0
| #define my_shift 24
| #define my_low   1
| #ifdef FOR_SUN4_29
| #define my_high  31
| #define my_size  32768 /* hope that 32768 is a multiple of the page size */
| /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
| #else
| #define my_high  64
| #define my_size  8192 /* hope that 8192 is a multiple of the page size */
| /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
| #endif
|  {long i;
| #define i_ok(i)  ((i) & (bits_to_avoid >> my_shift) == 0)
|   for (i=my_low; i<=my_high; i++)
|     if (i_ok(i))
|       { caddr_t addr = (caddr_t)(i << my_shift);
| /* Check for 8 MB, not 16 MB. This is more likely to work on Solaris 2. */
| #if bits_to_avoid
|         long size = i*my_size;
| #else
|         long size = ((i+1)/2)*my_size;
| #endif
|         if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (void*)-1) exit(1);
|     }
| #define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
| #define y(i)  (unsigned char)((3*i-4)*(7*i+3))
|   for (i=my_low; i<=my_high; i++) if (i_ok(i)) { x(i) = y(i); }
|   for (i=my_high; i>=my_low; i--) if (i_ok(i)) { if (x(i) != y(i)) exit(1); }
|   exit(0);
| }}
| 
| 
configure:22831: gcc -o conftest.exe -g -O2 -I/usr/local/libsigsegv-cygwin/include  conftest.c  >&5
configure:22834: $? = 0
configure:22836: ./conftest.exe
configure:22839: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "GNU CLISP"
| #define PACKAGE_TARNAME "clisp"
| #define PACKAGE_VERSION "2.35 (2005-08-29)"
| #define PACKAGE_STRING "GNU CLISP 2.35 (2005-08-29)"
| #define PACKAGE_BUGREPORT "http://clisp.cons.org/"
| #define _GNU_SOURCE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define ASM_UNDERSCORE
| #ifndef __i386__
| #define __i386__ 1
| #endif
| #define HAVE_ICONV 1
| #define ICONV_CONST const
| #define HAVE_ICONV 1
| #define ENABLE_NLS 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_SIGSEGV 1
| #define return_void return
| #define HAVE_LONG_LONG 1
| #define HAVE_LONGLONG
| #define STDC_HEADERS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_OFFSETOF
| #define HAVE_STDBOOL_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_FILE_H 1
| #define DIRENT
| #define HAVE_SYS_UTSNAME_H
| #define HAVE_NETDB_H 1
| #define HAVE_SYS_SHM_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_TERMIO_H 1
| #define HAVE_SYS_TERMIO_H 1
| #define HAVE_TCGETATTR
| #define HAVE_TCSAFLUSH
| #define HAVE_X11
| #define CADDR_T caddr_t
| #define SOCKLEN_T int
| #define SIZEOF_OFF_T 8
| #define SIZEOF_INO_T 8
| #define SIZEOF_STRUCT_TIMEVAL 8
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE__JMP
| #define RETSIGTYPE void
| #define SIGNALBLOCK_SYSV
| #define SIGNALBLOCK_POSIX
| #define SIGNAL_NEED_REINSTALL
| #define SIGNAL_NEED_UNBLOCK
| #define SIGNAL_NEED_UNBLOCK_OTHERS
| #define HAVE_SIGACTION 1
| #define HAVE_SIGINTERRUPT 1
| #define HAVE_RAISE
| #define RETABORTTYPE void
| #define ABORT_VOLATILE 
| #define HAVE_PERROR_DECL
| #define HAVE_STRERROR 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETDTABLESIZE 1
| #define HAVE_MEMSET 1
| #define HAVE_SETSID 1
| #define HAVE_SETPGID 1
| #define HAVE_FSYNC 1
| #define HAVE_FLOCK 1
| #define HAVE_SHUTDOWN 1
| #define HAVE_USLEEP 1
| #define HAVE_UALARM 1
| #define HAVE_SETITIMER 1
| #define HAVE_NICE 1
| #define HAVE_FTIME 1
| #define HAVE_REALPATH 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_DECL_ENVIRON 1
| #define HAVE_LC_MESSAGES 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_SETRLIMIT 1
| #define SIZEOF_RLIM_T 4
| #define RLIMIT_RESOURCE_T int
| #define SETRLIMIT_CONST const
| #define HAVE_UNISTD_H 1
| #define HAVE_FORK 1
| #define HAVE_VFORK 1
| #define HAVE_WORKING_VFORK 1
| #define HAVE_WORKING_FORK 1
| #define PID_T pid_t
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_TIMES_H 1
| #define HAVE_GETRUSAGE
| #define RUSAGE_WHO_T int
| #define HAVE_GETCWD
| #define GETCWD_SIZE_T size_t
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_LSTAT
| #define HAVE_READLINK 1
| #define ELOOP_VALUE ELOOP
| #define RETCLOSEDIRTYPE int
| #define HAVE_IOCTL 1
| #define IOCTL_REQUEST_T int
| #define IOCTL_DOTS
| #define HAVE_POLL 1
| #define HAVE_RELIABLE_POLL
| #define HAVE_SELECT 1
| #define HAVE_SYS_SELECT_H
| #define SELECT_WIDTH_T int
| #define SELECT_SET_T fd_set
| #define SELECT_CONST 
| #define HAVE_RELIABLE_SELECT
| #define HAVE_GETTIMEOFDAY 1
| #define GETTIMEOFDAY_TZP_T struct timezone *
| #define HAVE_GETHOSTNAME 1
| #define HAVE_GETHOSTBYNAME
| #define HAVE_CONNECT 1
| #define CONNECT_CONST const
| #define CONNECT_NAME_T struct sockaddr *
| #define CONNECT_ADDRLEN_T int
| #define HAVE_SYS_UN_H 1
| #define HAVE_IPV4
| #define HAVE_INET_PTON 1
| #define HAVE_INET_NTOP 1
| #define HAVE_INET_ADDR 1
| #define HAVE_SETSOCKOPT 1
| #define HAVE_GETSOCKOPT 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_ARPA_INET_H 1
| #define RET_INET_ADDR_TYPE unsigned long
| #define INET_ADDR_CONST const
| #define INET_ADDR_SUFFIX
| #define SETSOCKOPT_CONST const
| #define SETSOCKOPT_ARG_T void*
| #define SETSOCKOPT_OPTLEN_T int
| #define CODE_ADDRESS_RANGE 0x00000000UL
| #define MALLOC_ADDRESS_RANGE 0x00000000UL
| #define SHLIB_ADDRESS_RANGE 0x00000000UL
| #define STACK_ADDRESS_RANGE 0x00000000UL
| #define HAVE_GETPAGESIZE
| #define RETGETPAGESIZETYPE size_t
| #define HAVE_MMAP
| /* end confdefs.h.  */
| 
| #include <stdlib.h>
| #if defined __MACH__ && defined __APPLE__
| /* Avoid a crash on MacOS X.  */
| #include <mach/mach.h>
| #include <mach/mach_error.h>
| #include <mach/thread_status.h>
| #include <mach/exception.h>
| #include <mach/task.h>
| #include <pthread.h>
| /* The exception port on which our thread listens.  */
| static mach_port_t our_exception_port;
| /* The main function of the thread listening for exceptions of type
|    EXC_BAD_ACCESS.  */
| static void *
| mach_exception_thread (void *arg)
| {
|   /* Buffer for a message to be received.  */
|   struct {
|     mach_msg_header_t head;
|     mach_msg_body_t msgh_body;
|     char data[1024];
|   } msg;
|   mach_msg_return_t retval;
|   /* Wait for a message on the exception port.  */
|   retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
|                      our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
|   if (retval != MACH_MSG_SUCCESS)
|     abort ();
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
|   mach_port_t self = mach_task_self ();
|   /* Allocate a port on which the thread shall listen for exceptions.  */
|   if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
|       == KERN_SUCCESS) {
|     /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
|     if (mach_port_insert_right (self, our_exception_port, our_exception_port,
|                                 MACH_MSG_TYPE_MAKE_SEND)
|         == KERN_SUCCESS) {
|       /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
|          for us.  */
|       exception_mask_t mask = EXC_MASK_BAD_ACCESS;
|       /* Create the thread listening on the exception port.  */
|       pthread_attr_t attr;
|       pthread_t thread;
|       if (pthread_attr_init (&attr) == 0
|           && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
|           && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
|         pthread_attr_destroy (&attr);
|         /* Replace the exception port info for these exceptions with our own.
|            Note that we replace the exception port for the entire task, not only
|            for a particular thread.  This has the effect that when our exception
|            port gets the message, the thread specific exception port has already
|            been asked, and we don't need to bother about it.
|            See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
|         task_set_exception_ports (self, mask, our_exception_port,
|                                   EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
|       }
|     }
|   }
| }
| #else
| /* Avoid a crash on POSIX systems.  */
| #include <signal.h>
| /* A POSIX signal handler.  */
| static void
| exception_handler (int sig)
| {
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
| #ifdef SIGSEGV
|   signal (SIGSEGV, exception_handler);
| #endif
| #ifdef SIGBUS
|   signal (SIGBUS, exception_handler);
| #endif
| }
| #endif
| 
| #include <stdlib.h>
| #ifdef HAVE_UNISTD_H
| #include <unistd.h>
| #endif
| #include <fcntl.h>
| #ifdef OPEN_NEEDS_SYS_FILE_H
| #include <sys/file.h>
| #endif
| #include <sys/types.h>
| #include <sys/mman.h>
| int main () {
| 
|   int flags = MAP_ANONYMOUS | MAP_PRIVATE;
|   int fd = -1;
|   nocrash_init();
| #define bits_to_avoid 0
| #define my_shift 24
| #define my_low   1
| #ifdef FOR_SUN4_29
| #define my_high  31
| #define my_size  32768 /* hope that 32768 is a multiple of the page size */
| /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
| #else
| #define my_high  64
| #define my_size  8192 /* hope that 8192 is a multiple of the page size */
| /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
| #endif
|  {long i;
| #define i_ok(i)  ((i) & (bits_to_avoid >> my_shift) == 0)
|   for (i=my_low; i<=my_high; i++)
|     if (i_ok(i))
|       { caddr_t addr = (caddr_t)(i << my_shift);
| /* Check for 8 MB, not 16 MB. This is more likely to work on Solaris 2. */
| #if bits_to_avoid
|         long size = i*my_size;
| #else
|         long size = ((i+1)/2)*my_size;
| #endif
|         if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (void*)-1) exit(1);
|     }
| #define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
| #define y(i)  (unsigned char)((3*i-4)*(7*i+3))
|   for (i=my_low; i<=my_high; i++) if (i_ok(i)) { x(i) = y(i); }
|   for (i=my_high; i>=my_low; i--) if (i_ok(i)) { if (x(i) != y(i)) exit(1); }
|   exit(0);
| }}
| 
| 
configure:22957: gcc -o conftest.exe -g -O2 -I/usr/local/libsigsegv-cygwin/include  conftest.c  >&5
configure:22960: $? = 0
configure:22962: ./conftest.exe
configure:22965: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "GNU CLISP"
| #define PACKAGE_TARNAME "clisp"
| #define PACKAGE_VERSION "2.35 (2005-08-29)"
| #define PACKAGE_STRING "GNU CLISP 2.35 (2005-08-29)"
| #define PACKAGE_BUGREPORT "http://clisp.cons.org/"
| #define _GNU_SOURCE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define ASM_UNDERSCORE
| #ifndef __i386__
| #define __i386__ 1
| #endif
| #define HAVE_ICONV 1
| #define ICONV_CONST const
| #define HAVE_ICONV 1
| #define ENABLE_NLS 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_SIGSEGV 1
| #define return_void return
| #define HAVE_LONG_LONG 1
| #define HAVE_LONGLONG
| #define STDC_HEADERS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_OFFSETOF
| #define HAVE_STDBOOL_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_FILE_H 1
| #define DIRENT
| #define HAVE_SYS_UTSNAME_H
| #define HAVE_NETDB_H 1
| #define HAVE_SYS_SHM_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_TERMIO_H 1
| #define HAVE_SYS_TERMIO_H 1
| #define HAVE_TCGETATTR
| #define HAVE_TCSAFLUSH
| #define HAVE_X11
| #define CADDR_T caddr_t
| #define SOCKLEN_T int
| #define SIZEOF_OFF_T 8
| #define SIZEOF_INO_T 8
| #define SIZEOF_STRUCT_TIMEVAL 8
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE__JMP
| #define RETSIGTYPE void
| #define SIGNALBLOCK_SYSV
| #define SIGNALBLOCK_POSIX
| #define SIGNAL_NEED_REINSTALL
| #define SIGNAL_NEED_UNBLOCK
| #define SIGNAL_NEED_UNBLOCK_OTHERS
| #define HAVE_SIGACTION 1
| #define HAVE_SIGINTERRUPT 1
| #define HAVE_RAISE
| #define RETABORTTYPE void
| #define ABORT_VOLATILE 
| #define HAVE_PERROR_DECL
| #define HAVE_STRERROR 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETDTABLESIZE 1
| #define HAVE_MEMSET 1
| #define HAVE_SETSID 1
| #define HAVE_SETPGID 1
| #define HAVE_FSYNC 1
| #define HAVE_FLOCK 1
| #define HAVE_SHUTDOWN 1
| #define HAVE_USLEEP 1
| #define HAVE_UALARM 1
| #define HAVE_SETITIMER 1
| #define HAVE_NICE 1
| #define HAVE_FTIME 1
| #define HAVE_REALPATH 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_DECL_ENVIRON 1
| #define HAVE_LC_MESSAGES 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_SETRLIMIT 1
| #define SIZEOF_RLIM_T 4
| #define RLIMIT_RESOURCE_T int
| #define SETRLIMIT_CONST const
| #define HAVE_UNISTD_H 1
| #define HAVE_FORK 1
| #define HAVE_VFORK 1
| #define HAVE_WORKING_VFORK 1
| #define HAVE_WORKING_FORK 1
| #define PID_T pid_t
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_TIMES_H 1
| #define HAVE_GETRUSAGE
| #define RUSAGE_WHO_T int
| #define HAVE_GETCWD
| #define GETCWD_SIZE_T size_t
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_LSTAT
| #define HAVE_READLINK 1
| #define ELOOP_VALUE ELOOP
| #define RETCLOSEDIRTYPE int
| #define HAVE_IOCTL 1
| #define IOCTL_REQUEST_T int
| #define IOCTL_DOTS
| #define HAVE_POLL 1
| #define HAVE_RELIABLE_POLL
| #define HAVE_SELECT 1
| #define HAVE_SYS_SELECT_H
| #define SELECT_WIDTH_T int
| #define SELECT_SET_T fd_set
| #define SELECT_CONST 
| #define HAVE_RELIABLE_SELECT
| #define HAVE_GETTIMEOFDAY 1
| #define GETTIMEOFDAY_TZP_T struct timezone *
| #define HAVE_GETHOSTNAME 1
| #define HAVE_GETHOSTBYNAME
| #define HAVE_CONNECT 1
| #define CONNECT_CONST const
| #define CONNECT_NAME_T struct sockaddr *
| #define CONNECT_ADDRLEN_T int
| #define HAVE_SYS_UN_H 1
| #define HAVE_IPV4
| #define HAVE_INET_PTON 1
| #define HAVE_INET_NTOP 1
| #define HAVE_INET_ADDR 1
| #define HAVE_SETSOCKOPT 1
| #define HAVE_GETSOCKOPT 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_ARPA_INET_H 1
| #define RET_INET_ADDR_TYPE unsigned long
| #define INET_ADDR_CONST const
| #define INET_ADDR_SUFFIX
| #define SETSOCKOPT_CONST const
| #define SETSOCKOPT_ARG_T void*
| #define SETSOCKOPT_OPTLEN_T int
| #define CODE_ADDRESS_RANGE 0x00000000UL
| #define MALLOC_ADDRESS_RANGE 0x00000000UL
| #define SHLIB_ADDRESS_RANGE 0x00000000UL
| #define STACK_ADDRESS_RANGE 0x00000000UL
| #define HAVE_GETPAGESIZE
| #define RETGETPAGESIZETYPE size_t
| #define HAVE_MMAP
| /* end confdefs.h.  */
| 
| #include <stdlib.h>
| #if defined __MACH__ && defined __APPLE__
| /* Avoid a crash on MacOS X.  */
| #include <mach/mach.h>
| #include <mach/mach_error.h>
| #include <mach/thread_status.h>
| #include <mach/exception.h>
| #include <mach/task.h>
| #include <pthread.h>
| /* The exception port on which our thread listens.  */
| static mach_port_t our_exception_port;
| /* The main function of the thread listening for exceptions of type
|    EXC_BAD_ACCESS.  */
| static void *
| mach_exception_thread (void *arg)
| {
|   /* Buffer for a message to be received.  */
|   struct {
|     mach_msg_header_t head;
|     mach_msg_body_t msgh_body;
|     char data[1024];
|   } msg;
|   mach_msg_return_t retval;
|   /* Wait for a message on the exception port.  */
|   retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
|                      our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
|   if (retval != MACH_MSG_SUCCESS)
|     abort ();
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
|   mach_port_t self = mach_task_self ();
|   /* Allocate a port on which the thread shall listen for exceptions.  */
|   if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
|       == KERN_SUCCESS) {
|     /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
|     if (mach_port_insert_right (self, our_exception_port, our_exception_port,
|                                 MACH_MSG_TYPE_MAKE_SEND)
|         == KERN_SUCCESS) {
|       /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
|          for us.  */
|       exception_mask_t mask = EXC_MASK_BAD_ACCESS;
|       /* Create the thread listening on the exception port.  */
|       pthread_attr_t attr;
|       pthread_t thread;
|       if (pthread_attr_init (&attr) == 0
|           && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
|           && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
|         pthread_attr_destroy (&attr);
|         /* Replace the exception port info for these exceptions with our own.
|            Note that we replace the exception port for the entire task, not only
|            for a particular thread.  This has the effect that when our exception
|            port gets the message, the thread specific exception port has already
|            been asked, and we don't need to bother about it.
|            See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
|         task_set_exception_ports (self, mask, our_exception_port,
|                                   EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
|       }
|     }
|   }
| }
| #else
| /* Avoid a crash on POSIX systems.  */
| #include <signal.h>
| /* A POSIX signal handler.  */
| static void
| exception_handler (int sig)
| {
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
| #ifdef SIGSEGV
|   signal (SIGSEGV, exception_handler);
| #endif
| #ifdef SIGBUS
|   signal (SIGBUS, exception_handler);
| #endif
| }
| #endif
| 
| #include <stdlib.h>
| #ifdef HAVE_UNISTD_H
| #include <unistd.h>
| #endif
| #include <fcntl.h>
| #ifdef OPEN_NEEDS_SYS_FILE_H
| #include <sys/file.h>
| #endif
| #include <sys/types.h>
| #include <sys/mman.h>
| int main () {
| 
| #ifndef MAP_FILE
| #define MAP_FILE 0
| #endif
|   int flags = MAP_FILE | MAP_PRIVATE;
|   int fd = open("/dev/zero",O_RDONLY,0666);
|   if (fd<0) exit(1);
|   nocrash_init();
| #define bits_to_avoid 0
| #define my_shift 24
| #define my_low   1
| #ifdef FOR_SUN4_29
| #define my_high  31
| #define my_size  32768 /* hope that 32768 is a multiple of the page size */
| /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
| #else
| #define my_high  64
| #define my_size  8192 /* hope that 8192 is a multiple of the page size */
| /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
| #endif
|  {long i;
| #define i_ok(i)  ((i) & (bits_to_avoid >> my_shift) == 0)
|   for (i=my_low; i<=my_high; i++)
|     if (i_ok(i))
|       { caddr_t addr = (caddr_t)(i << my_shift);
| /* Check for 8 MB, not 16 MB. This is more likely to work on Solaris 2. */
| #if bits_to_avoid
|         long size = i*my_size;
| #else
|         long size = ((i+1)/2)*my_size;
| #endif
|         if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (void*)-1) exit(1);
|     }
| #define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
| #define y(i)  (unsigned char)((3*i-4)*(7*i+3))
|   for (i=my_low; i<=my_high; i++) if (i_ok(i)) { x(i) = y(i); }
|   for (i=my_high; i>=my_low; i--) if (i_ok(i)) { if (x(i) != y(i)) exit(1); }
|   exit(0);
| }}
| 
| 
configure:23087: gcc -o conftest.exe -g -O2 -I/usr/local/libsigsegv-cygwin/include  conftest.c  >&5
configure:23090: $? = 0
configure:23092: ./conftest.exe
configure:23095: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "GNU CLISP"
| #define PACKAGE_TARNAME "clisp"
| #define PACKAGE_VERSION "2.35 (2005-08-29)"
| #define PACKAGE_STRING "GNU CLISP 2.35 (2005-08-29)"
| #define PACKAGE_BUGREPORT "http://clisp.cons.org/"
| #define _GNU_SOURCE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define ASM_UNDERSCORE
| #ifndef __i386__
| #define __i386__ 1
| #endif
| #define HAVE_ICONV 1
| #define ICONV_CONST const
| #define HAVE_ICONV 1
| #define ENABLE_NLS 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_SIGSEGV 1
| #define return_void return
| #define HAVE_LONG_LONG 1
| #define HAVE_LONGLONG
| #define STDC_HEADERS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_OFFSETOF
| #define HAVE_STDBOOL_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_FILE_H 1
| #define DIRENT
| #define HAVE_SYS_UTSNAME_H
| #define HAVE_NETDB_H 1
| #define HAVE_SYS_SHM_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_TERMIO_H 1
| #define HAVE_SYS_TERMIO_H 1
| #define HAVE_TCGETATTR
| #define HAVE_TCSAFLUSH
| #define HAVE_X11
| #define CADDR_T caddr_t
| #define SOCKLEN_T int
| #define SIZEOF_OFF_T 8
| #define SIZEOF_INO_T 8
| #define SIZEOF_STRUCT_TIMEVAL 8
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE__JMP
| #define RETSIGTYPE void
| #define SIGNALBLOCK_SYSV
| #define SIGNALBLOCK_POSIX
| #define SIGNAL_NEED_REINSTALL
| #define SIGNAL_NEED_UNBLOCK
| #define SIGNAL_NEED_UNBLOCK_OTHERS
| #define HAVE_SIGACTION 1
| #define HAVE_SIGINTERRUPT 1
| #define HAVE_RAISE
| #define RETABORTTYPE void
| #define ABORT_VOLATILE 
| #define HAVE_PERROR_DECL
| #define HAVE_STRERROR 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETDTABLESIZE 1
| #define HAVE_MEMSET 1
| #define HAVE_SETSID 1
| #define HAVE_SETPGID 1
| #define HAVE_FSYNC 1
| #define HAVE_FLOCK 1
| #define HAVE_SHUTDOWN 1
| #define HAVE_USLEEP 1
| #define HAVE_UALARM 1
| #define HAVE_SETITIMER 1
| #define HAVE_NICE 1
| #define HAVE_FTIME 1
| #define HAVE_REALPATH 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_DECL_ENVIRON 1
| #define HAVE_LC_MESSAGES 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_SETRLIMIT 1
| #define SIZEOF_RLIM_T 4
| #define RLIMIT_RESOURCE_T int
| #define SETRLIMIT_CONST const
| #define HAVE_UNISTD_H 1
| #define HAVE_FORK 1
| #define HAVE_VFORK 1
| #define HAVE_WORKING_VFORK 1
| #define HAVE_WORKING_FORK 1
| #define PID_T pid_t
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_TIMES_H 1
| #define HAVE_GETRUSAGE
| #define RUSAGE_WHO_T int
| #define HAVE_GETCWD
| #define GETCWD_SIZE_T size_t
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_LSTAT
| #define HAVE_READLINK 1
| #define ELOOP_VALUE ELOOP
| #define RETCLOSEDIRTYPE int
| #define HAVE_IOCTL 1
| #define IOCTL_REQUEST_T int
| #define IOCTL_DOTS
| #define HAVE_POLL 1
| #define HAVE_RELIABLE_POLL
| #define HAVE_SELECT 1
| #define HAVE_SYS_SELECT_H
| #define SELECT_WIDTH_T int
| #define SELECT_SET_T fd_set
| #define SELECT_CONST 
| #define HAVE_RELIABLE_SELECT
| #define HAVE_GETTIMEOFDAY 1
| #define GETTIMEOFDAY_TZP_T struct timezone *
| #define HAVE_GETHOSTNAME 1
| #define HAVE_GETHOSTBYNAME
| #define HAVE_CONNECT 1
| #define CONNECT_CONST const
| #define CONNECT_NAME_T struct sockaddr *
| #define CONNECT_ADDRLEN_T int
| #define HAVE_SYS_UN_H 1
| #define HAVE_IPV4
| #define HAVE_INET_PTON 1
| #define HAVE_INET_NTOP 1
| #define HAVE_INET_ADDR 1
| #define HAVE_SETSOCKOPT 1
| #define HAVE_GETSOCKOPT 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_ARPA_INET_H 1
| #define RET_INET_ADDR_TYPE unsigned long
| #define INET_ADDR_CONST const
| #define INET_ADDR_SUFFIX
| #define SETSOCKOPT_CONST const
| #define SETSOCKOPT_ARG_T void*
| #define SETSOCKOPT_OPTLEN_T int
| #define CODE_ADDRESS_RANGE 0x00000000UL
| #define MALLOC_ADDRESS_RANGE 0x00000000UL
| #define SHLIB_ADDRESS_RANGE 0x00000000UL
| #define STACK_ADDRESS_RANGE 0x00000000UL
| #define HAVE_GETPAGESIZE
| #define RETGETPAGESIZETYPE size_t
| #define HAVE_MMAP
| /* end confdefs.h.  */
| 
| #include <stdlib.h>
| #if defined __MACH__ && defined __APPLE__
| /* Avoid a crash on MacOS X.  */
| #include <mach/mach.h>
| #include <mach/mach_error.h>
| #include <mach/thread_status.h>
| #include <mach/exception.h>
| #include <mach/task.h>
| #include <pthread.h>
| /* The exception port on which our thread listens.  */
| static mach_port_t our_exception_port;
| /* The main function of the thread listening for exceptions of type
|    EXC_BAD_ACCESS.  */
| static void *
| mach_exception_thread (void *arg)
| {
|   /* Buffer for a message to be received.  */
|   struct {
|     mach_msg_header_t head;
|     mach_msg_body_t msgh_body;
|     char data[1024];
|   } msg;
|   mach_msg_return_t retval;
|   /* Wait for a message on the exception port.  */
|   retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
|                      our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
|   if (retval != MACH_MSG_SUCCESS)
|     abort ();
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
|   mach_port_t self = mach_task_self ();
|   /* Allocate a port on which the thread shall listen for exceptions.  */
|   if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
|       == KERN_SUCCESS) {
|     /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
|     if (mach_port_insert_right (self, our_exception_port, our_exception_port,
|                                 MACH_MSG_TYPE_MAKE_SEND)
|         == KERN_SUCCESS) {
|       /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
|          for us.  */
|       exception_mask_t mask = EXC_MASK_BAD_ACCESS;
|       /* Create the thread listening on the exception port.  */
|       pthread_attr_t attr;
|       pthread_t thread;
|       if (pthread_attr_init (&attr) == 0
|           && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
|           && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
|         pthread_attr_destroy (&attr);
|         /* Replace the exception port info for these exceptions with our own.
|            Note that we replace the exception port for the entire task, not only
|            for a particular thread.  This has the effect that when our exception
|            port gets the message, the thread specific exception port has already
|            been asked, and we don't need to bother about it.
|            See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
|         task_set_exception_ports (self, mask, our_exception_port,
|                                   EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
|       }
|     }
|   }
| }
| #else
| /* Avoid a crash on POSIX systems.  */
| #include <signal.h>
| /* A POSIX signal handler.  */
| static void
| exception_handler (int sig)
| {
|   exit (1);
| }
| static void
| nocrash_init (void)
| {
| #ifdef SIGSEGV
|   signal (SIGSEGV, exception_handler);
| #endif
| #ifdef SIGBUS
|   signal (SIGBUS, exception_handler);
| #endif
| }
| #endif
| #define FOR_SUN4_29
| 
| #include <stdlib.h>
| #ifdef HAVE_UNISTD_H
| #include <unistd.h>
| #endif
| #include <fcntl.h>
| #ifdef OPEN_NEEDS_SYS_FILE_H
| #include <sys/file.h>
| #endif
| #include <sys/types.h>
| #include <sys/mman.h>
| int main () {
| 
| #ifndef MAP_FILE
| #define MAP_FILE 0
| #endif
|   int flags = MAP_FILE | MAP_PRIVATE;
|   int fd = open("/dev/zero",O_RDONLY,0666);
|   if (fd<0) exit(1);
|   nocrash_init();
| #define bits_to_avoid 0
| #define my_shift 24
| #define my_low   1
| #ifdef FOR_SUN4_29
| #define my_high  31
| #define my_size  32768 /* hope that 32768 is a multiple of the page size */
| /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
| #else
| #define my_high  64
| #define my_size  8192 /* hope that 8192 is a multiple of the page size */
| /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
| #endif
|  {long i;
| #define i_ok(i)  ((i) & (bits_to_avoid >> my_shift) == 0)
|   for (i=my_low; i<=my_high; i++)
|     if (i_ok(i))
|       { caddr_t addr = (caddr_t)(i << my_shift);
| /* Check for 8 MB, not 16 MB. This is more likely to work on Solaris 2. */
| #if bits_to_avoid
|         long size = i*my_size;
| #else
|         long size = ((i+1)/2)*my_size;
| #endif
|         if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (void*)-1) exit(1);
|     }
| #define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
| #define y(i)  (unsigned char)((3*i-4)*(7*i+3))
|   for (i=my_low; i<=my_high; i++) if (i_ok(i)) { x(i) = y(i); }
|   for (i=my_high; i>=my_low; i--) if (i_ok(i)) { if (x(i) != y(i)) exit(1); }
|   exit(0);
| }}
| 
| 
configure:23115: result: no

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list