Mail Archives: cygwin/2004/09/15/15:21:05
It appears that cygwin mmap() is lacking:
configure:20536: checking for working mmap
configure:20617: gcc -o conftest.exe -g -O2 conftest.c >&5
configure:20620: $? = 0
configure:20622: ./conftest.exe
configure:20625: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h. */
|
| #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;
| #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);
| }}
Thanks!
the above is from the CLISP configure, see
http://cvs.sourceforge.net/viewcvs.py/*checkout*/clisp/clisp/src/m4/mmap.m4
--
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Those who value Life above Freedom are destined to lose both.
--
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/
- Raw text -