public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: New autoconf tests - let's try this again
@ 2001-01-09 10:31 Janis Johnson
  0 siblings, 0 replies; 10+ messages in thread
From: Janis Johnson @ 2001-01-09 10:31 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

Have mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
mmap with MAP_ANON(YMOUS) works.
-rw-r-----    1 janis    sequent        0 Jan  9 10:07 test1a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:07 test1z.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:07 test2a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:07 test2z.l
DYNIX/ptx eng2 4.0 V4.6.0 i386


Before DYNIX/ptx V4.6.0, getpagesize() was in libseq rather than libc,
so the tests failed.  I got the following results by either adding
-lseq or by substituting PAGE_SIZE for getpagesize().  Perhaps the
tests could check that getpagesize() is available.

Have mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
mmap with MAP_ANON(YMOUS) works.
-rw-r-----    1 janis    sequent        0 Jan  9 10:17 test1a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:17 test1z.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:17 test2a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:17 test2z.l
DYNIX/ptx eng4 4.0 V4.5.2 i386


Have mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
mmap with MAP_ANON(YMOUS) works.
-rw-r-----    1 janis    sequent        0 Jan  9 10:22 test1a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:22 test1z.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:22 test2a.l
-rw-r-----    1 janis    sequent        0 Jan  9 10:22 test2z.l
DYNIX/ptx crg2 4.0 V4.4.7 i386

Janis Johnson
IBM Linux Technology Center
(503) 578-5458
janis@us.ibm.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
                   ` (4 preceding siblings ...)
  2001-01-10  3:20 ` Gerrit P. Haase
@ 2001-01-10  4:14 ` Phil Edwards
  5 siblings, 0 replies; 10+ messages in thread
From: Phil Edwards @ 2001-01-10  4:14 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

Freshly-installed 1.1.7 running under freshly-installed Lose2000.


No mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap with MAP_ANON(YMOUS) is buggy. (3)
-rw-r--r--   1 administ None            0 Jan 10 07:05 test1a.l
-rw-r--r--   1 administ None           21 Jan 10 07:05 test1z.l
-rw-r--r--   1 administ None           34 Jan 10 07:05 test2a.l
CYGWIN_NT-5.0 hostnameelided 1.1.7(0.31/3/2) 2000-12-25 12:39 i686 unknown


-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
                   ` (3 preceding siblings ...)
  2001-01-09 11:20 ` Jose M. Moya
@ 2001-01-10  3:20 ` Gerrit P. Haase
  2001-01-10  4:14 ` Phil Edwards
  5 siblings, 0 replies; 10+ messages in thread
From: Gerrit P. Haase @ 2001-01-10  3:20 UTC (permalink / raw)
  To: cygwin

<2001-01-9 9:49 Uhr, hat Zack Weinberg geschrieben:>
< New autoconf tests - let's try this >

> If you tried the previous version of this script and got "buggy"
> reports, I'd appreciate it if you would try this one.

$ ./autotest.sh
No mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap with MAP_ANON(YMOUS) is buggy. (3)
-rw-rw-rw-   1 administ Kein            0 Jan 10 11:17 test1a.l
-rw-rw-rw-   1 administ Kein           21 Jan 10 11:17 test1z.l
-rw-rw-rw-   1 administ Kein           34 Jan 10 11:17 test2a.l
CYGWIN_NT-4.0 ISMENE 1.1.7(0.31/3/2) 2000-12-25 12:39 i586 unknown
gph

-- 
gerrit.haase@convey.de
PGP Version: 6.5.8 Public Key Information
KeyID: 0xC8C9D69A, Type/Size: DH/DSS 2048/1024bit 
Key fingerprint = 57C8 1B1D CFE4 8515 AA3E  4499 A326 0F3C C8C9 D69A

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: New autoconf tests - let's try this again
@ 2001-01-10  2:19 biswapesh.chattopadhyay
  0 siblings, 0 replies; 10+ messages in thread
From: biswapesh.chattopadhyay @ 2001-01-10  2:19 UTC (permalink / raw)
  To: zackw, gcc; +Cc: cygwin

Results on Alpha (probably you don't want this but still)
---------------------------------------------------------
Have mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
mmap with MAP_ANON(YMOUS) works.
-rw-r--r--   1 chattob  dev            0 Jan 10 10:15 test1a.l
-rw-r--r--   1 chattob  dev            0 Jan 10 10:15 test1z.l
-rw-r--r--   1 chattob  dev            0 Jan 10 10:15 test2a.l
-rw-r--r--   1 chattob  dev            0 Jan 10 10:15 test2z.l
OSF1 hwicip3 V4.0 878 alpha
-------------------------------------------------------

- Biswa.


> -----Original Message-----
> From: Zack Weinberg [ mailto:zackw@stanford.edu ]
> Sent: 09 January 2001 17:50
> To: gcc@gcc.gnu.org
> Cc: cygwin@sources.redhat.com
> Subject: New autoconf tests - let's try this again
> 
> 
> The previous generation of this test script got a bunch of spurious
> failures (code 7) because it didn't try hard enough to get two
> consecutive maps allocated next to each other.  This one should work
> better - I still can't get a success on HP/UX, though (clues
> appreciated).
> 
> If you tried the previous version of this script and got "buggy"
> reports, I'd appreciate it if you would try this one.
> 
> [Russ - SGI cc doesn't work on the raptors.]
> 
> zw
> 
> #! /bin/sh
> 
> mkdir mmt$$ || exit 1
> cd mmt$$ || exit 1
> 
> if test -z "$CC"; then
>   if command -v cc >/dev/null 2>&1; then
>     CC=cc
>   elif command -v gcc >/dev/null 2>&1; then
>     CC=gcc
>   else
>     echo "Cannot find compiler, set CC in environment"
>     exit 1
>   fi
> fi
> 
> cat >testcore.h <<EOF
> /* Test by Richard Henderson and Alexandre Oliva.
>    Check whether mmap MAP_ANONYMOUS or mmap from /dev/zero works. */
> #include <sys/types.h>
> #include <sys/param.h>
> #include <sys/mman.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <stdio.h>
> 
> #ifndef MAP_ANON
> # ifdef MAP_ANONYMOUS
> #  define MAP_ANON MAP_ANONYMOUS
> # else
> #  define MAP_ANON 0
> # endif
> #endif
> 
> #ifndef MAP_FAILED
> # define MAP_FAILED -1
> #endif
> 
> #undef perror_exit
> #define perror_exit(str, val) \
>   do { perror(str); exit(val); } while (0)
> 
> static char *
> anonmap (size, loc)
>      size_t size;
>      char *loc;
> {
>   int flags;
> #ifndef USE_MAP_ANON
>   static int devzero = -1;
> #endif
> 
>   if (loc)
>     flags = MAP_PRIVATE|MAP_FIXED;
>   else
>     flags = MAP_PRIVATE;
> 
> #ifdef USE_MAP_ANON
>   return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, 
> flags|MAP_ANON, -1, 0);
> #else
>   if (devzero == -1)
>     {
>       devzero = open ("/dev/zero", O_RDWR);
>       if (devzero < 0)
> 	perror_exit ("open /dev/zero", 64);
>     }
>   return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, 
> flags, devzero, 0);
> #endif
> }
> EOF
> 
> cat >test1.c <<EOF
> #include "testcore.h"
> 
> int
> main()
> {
>   int pg = getpagesize ();
>   char *x = anonmap (pg, 0);
> 
>   if (x == (char *) MAP_FAILED)
>     perror_exit("mmap", 1);
> 
>   *(int *)x += 1;
> 
>   if (munmap(x, pg) < 0)
>     perror_exit("munmap", 2);
> 
>   exit(0);
> }
> EOF
> 
> if $CC test1.c -o test1z.x >test1z.l 2>&1 && ./test1z.x 
> >>test1z.l 2>&1
> then echo "Have mmap from /dev/zero."
>      have_dev_zero=y
> else echo "No mmap from /dev/zero."
> fi
> 
> if $CC test1.c -DUSE_MAP_ANON -o test1a.x >test1a.l 2>&1 \
>     && ./test1a.x >>test1a.l 2>&1
> then echo "Have mmap with MAP_ANON(YMOUS)."
>      have_map_anon=y
> else echo "No mmap with MAP_ANON(YMOUS)."
> fi
> 
> cat >test2.c <<EOF
> #include "testcore.h"
> #include <signal.h>
> #include <setjmp.h>
> 
> /* Some versions of cygwin mmap require that munmap is called with the
>    same parameters as mmap.  GCC expects that this is not the case.
>    Test for various forms of this problem.  Warning - icky 
> signal games.  */
> static jmp_buf r;
> static size_t pg;
> 
> static void
> sigsegv (unused)
>      int unused;
> {
>   longjmp (r, 1);
> }
> 
> /* 1. If we map a 2-page region and unmap its second page, 
> the first page
>    must remain.  */
> void
> test_1 ()
> {
>   char *x = anonmap (pg * 2, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 1 mmap", 1);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 1 fault", 2);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x + pg, pg);
>   x[0] = 2;
> 
>   if (setjmp (r))
>     {
>       munmap (x, pg);
>       return;
>     }
>   x[pg] = 1;
>   perror_exit ("test 1 no fault", 3);
> }
> 
> /* 2. If we map a 2-page region and unmap its first page, the second
>    page must remain.  */
> void
> test_2 ()
> {
>   char *x = anonmap (pg * 2, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 2 mmap", 4);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 2 fault", 5);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x, pg);
>   x[pg] = 2;
> 
>   if (setjmp (r))
>     {
>       munmap (x + pg, pg);
>       return;
>     }
>   x[0] = 1;
>   perror_exit ("test 2 no fault", 6);
> }
> 
> /* 3. If we map two consecutive 1-page regions and unmap them 
> both with
>    one munmap, both must go away.  */
> 
> void
> test_3 ()
> {
>   char *x, *y;
>   x = anonmap (pg, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 3 mmap 1", 7);
>   y = anonmap (pg, x+pg);
>   if (y == (char *)MAP_FAILED || x + pg != y)
>     perror_exit ("test 3 mmap 2", 7);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 3 fault", 8);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x, pg * 2);
> 
>   if (setjmp (r) == 0)
>     {
>       x[0] = 1;
>       perror_exit ("test 3 no fault 1", 9);
>     }
>   
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r) == 0)
>     {
>       x[pg] = 1;
>       perror_exit ("test 3 no fault 2", 10);
>     }
> }
> 
> 
> int
> main ()
> {
>   pg = getpagesize ();
> 
>   test_1();
>   test_2();
>   test_3();
> 
>   exit(0);
> }
> EOF
> 
> if test -n "$have_dev_zero"; then
>   if $CC test2.c  -o test2z.x >test2z.l 2>&1 \
>      && ./test2z.x >>test2z.l 2>&1
>   then echo "mmap of /dev/zero works."
>   else echo "mmap of /dev/zero is buggy. ($?)"
>   fi
> fi
> 
> if test -n "$have_map_anon"; then 
>   if $CC test2.c -DUSE_MAP_ANON -o test2a.x >test2a.l 2>&1 \
>      && ./test2a.x >>test2a.l 2>&1
>   then echo "mmap with MAP_ANON(YMOUS) works."
>   else echo "mmap with MAP_ANON(YMOUS) is buggy. ($?)"
>   fi
> fi
> 
> ls -l *.l
> uname -a
> 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: New autoconf tests - let's try this again
@ 2001-01-10  2:15 biswapesh.chattopadhyay
  0 siblings, 0 replies; 10+ messages in thread
From: biswapesh.chattopadhyay @ 2001-01-10  2:15 UTC (permalink / raw)
  To: zackw, gcc; +Cc: cygwin

Results on Dynix/ptx 4.4.8:
---------------------------------------------------------------------------
No mmap from /dev/zero.
No mmap with MAP_ANON(YMOUS).
-rw-rw----   1 swbxc01  swift2        147 Jan 10 10:08 test1a.l
-rw-rw----   1 swbxc01  swift2        147 Jan 10 10:08 test1z.l
DYNIX/ptx hwcmcr1 4.0 V4.4.8 i386
----------------------------------------------------------------------------
/usr/home/swbxc01/mmt26444>cat test1z.l
/var/tmp/ccoZcvYa.o: In function `main':
/var/tmp/ccoZcvYa.o(.text+0xa7): undefined reference to `getpagesize'
collect2: ld returned 1 exit status
-----------------------------------------
/usr/home/swbxc01/mmt26444>cat test1a.l
/var/tmp/ccX9Ja3b.o: In function `main':
/var/tmp/ccX9Ja3b.o(.text+0x4f): undefined reference to `getpagesize'
collect2: ld returned 1 exit status
----------------------------------------------------------------------------
-
The above error is probably because in Dynix/ptx, to use syscalls, you need
to
use '-lseq'. Here the extract from 'man getpagesize':
----------------------------------------------------------------------------
---
NAME
          getpagesize - get system page size

     SYNOPSIS
          #include <unistd.h>
          int getpagesize(void);

     DESCRIPTION
          getpagesize returns the number of bytes in a page.  Page
          granularity is the granularity of many of the memory
          management calls.

          The page size is a system page size and may not be the same
          as the underlying hardware page size.

     SEE ALSO
          brk(2), getrlimit(2), mmap(2), mprotect(2), munmap(2),
          msync(2), sysconf(2), sbrk(2)

     NOTES
          This is a Sequent library routine.  To use it, specify the
          -lseq option to link with the Sequent library.  Since this
          is a Sequent extension, code using this routine may not be
          portable to other systems.
--------------------------------------------------------------------

Hope this helps.
Biswa.


> -----Original Message-----
> From: Zack Weinberg [ mailto:zackw@stanford.edu ]
> Sent: 09 January 2001 17:50
> To: gcc@gcc.gnu.org
> Cc: cygwin@sources.redhat.com
> Subject: New autoconf tests - let's try this again
> 
> 
> The previous generation of this test script got a bunch of spurious
> failures (code 7) because it didn't try hard enough to get two
> consecutive maps allocated next to each other.  This one should work
> better - I still can't get a success on HP/UX, though (clues
> appreciated).
> 
> If you tried the previous version of this script and got "buggy"
> reports, I'd appreciate it if you would try this one.
> 
> [Russ - SGI cc doesn't work on the raptors.]
> 
> zw
> 
> #! /bin/sh
> 
> mkdir mmt$$ || exit 1
> cd mmt$$ || exit 1
> 
> if test -z "$CC"; then
>   if command -v cc >/dev/null 2>&1; then
>     CC=cc
>   elif command -v gcc >/dev/null 2>&1; then
>     CC=gcc
>   else
>     echo "Cannot find compiler, set CC in environment"
>     exit 1
>   fi
> fi
> 
> cat >testcore.h <<EOF
> /* Test by Richard Henderson and Alexandre Oliva.
>    Check whether mmap MAP_ANONYMOUS or mmap from /dev/zero works. */
> #include <sys/types.h>
> #include <sys/param.h>
> #include <sys/mman.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <stdio.h>
> 
> #ifndef MAP_ANON
> # ifdef MAP_ANONYMOUS
> #  define MAP_ANON MAP_ANONYMOUS
> # else
> #  define MAP_ANON 0
> # endif
> #endif
> 
> #ifndef MAP_FAILED
> # define MAP_FAILED -1
> #endif
> 
> #undef perror_exit
> #define perror_exit(str, val) \
>   do { perror(str); exit(val); } while (0)
> 
> static char *
> anonmap (size, loc)
>      size_t size;
>      char *loc;
> {
>   int flags;
> #ifndef USE_MAP_ANON
>   static int devzero = -1;
> #endif
> 
>   if (loc)
>     flags = MAP_PRIVATE|MAP_FIXED;
>   else
>     flags = MAP_PRIVATE;
> 
> #ifdef USE_MAP_ANON
>   return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, 
> flags|MAP_ANON, -1, 0);
> #else
>   if (devzero == -1)
>     {
>       devzero = open ("/dev/zero", O_RDWR);
>       if (devzero < 0)
> 	perror_exit ("open /dev/zero", 64);
>     }
>   return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, 
> flags, devzero, 0);
> #endif
> }
> EOF
> 
> cat >test1.c <<EOF
> #include "testcore.h"
> 
> int
> main()
> {
>   int pg = getpagesize ();
>   char *x = anonmap (pg, 0);
> 
>   if (x == (char *) MAP_FAILED)
>     perror_exit("mmap", 1);
> 
>   *(int *)x += 1;
> 
>   if (munmap(x, pg) < 0)
>     perror_exit("munmap", 2);
> 
>   exit(0);
> }
> EOF
> 
> if $CC test1.c -o test1z.x >test1z.l 2>&1 && ./test1z.x 
> >>test1z.l 2>&1
> then echo "Have mmap from /dev/zero."
>      have_dev_zero=y
> else echo "No mmap from /dev/zero."
> fi
> 
> if $CC test1.c -DUSE_MAP_ANON -o test1a.x >test1a.l 2>&1 \
>     && ./test1a.x >>test1a.l 2>&1
> then echo "Have mmap with MAP_ANON(YMOUS)."
>      have_map_anon=y
> else echo "No mmap with MAP_ANON(YMOUS)."
> fi
> 
> cat >test2.c <<EOF
> #include "testcore.h"
> #include <signal.h>
> #include <setjmp.h>
> 
> /* Some versions of cygwin mmap require that munmap is called with the
>    same parameters as mmap.  GCC expects that this is not the case.
>    Test for various forms of this problem.  Warning - icky 
> signal games.  */
> static jmp_buf r;
> static size_t pg;
> 
> static void
> sigsegv (unused)
>      int unused;
> {
>   longjmp (r, 1);
> }
> 
> /* 1. If we map a 2-page region and unmap its second page, 
> the first page
>    must remain.  */
> void
> test_1 ()
> {
>   char *x = anonmap (pg * 2, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 1 mmap", 1);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 1 fault", 2);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x + pg, pg);
>   x[0] = 2;
> 
>   if (setjmp (r))
>     {
>       munmap (x, pg);
>       return;
>     }
>   x[pg] = 1;
>   perror_exit ("test 1 no fault", 3);
> }
> 
> /* 2. If we map a 2-page region and unmap its first page, the second
>    page must remain.  */
> void
> test_2 ()
> {
>   char *x = anonmap (pg * 2, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 2 mmap", 4);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 2 fault", 5);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x, pg);
>   x[pg] = 2;
> 
>   if (setjmp (r))
>     {
>       munmap (x + pg, pg);
>       return;
>     }
>   x[0] = 1;
>   perror_exit ("test 2 no fault", 6);
> }
> 
> /* 3. If we map two consecutive 1-page regions and unmap them 
> both with
>    one munmap, both must go away.  */
> 
> void
> test_3 ()
> {
>   char *x, *y;
>   x = anonmap (pg, 0);
>   if (x == (char *)MAP_FAILED)
>     perror_exit ("test 3 mmap 1", 7);
>   y = anonmap (pg, x+pg);
>   if (y == (char *)MAP_FAILED || x + pg != y)
>     perror_exit ("test 3 mmap 2", 7);
> 
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r))
>     perror_exit ("test 3 fault", 8);
> 
>   x[0] = 1;
>   x[pg] = 1;
> 
>   munmap (x, pg * 2);
> 
>   if (setjmp (r) == 0)
>     {
>       x[0] = 1;
>       perror_exit ("test 3 no fault 1", 9);
>     }
>   
>   signal (SIGSEGV, sigsegv);
>   if (setjmp (r) == 0)
>     {
>       x[pg] = 1;
>       perror_exit ("test 3 no fault 2", 10);
>     }
> }
> 
> 
> int
> main ()
> {
>   pg = getpagesize ();
> 
>   test_1();
>   test_2();
>   test_3();
> 
>   exit(0);
> }
> EOF
> 
> if test -n "$have_dev_zero"; then
>   if $CC test2.c  -o test2z.x >test2z.l 2>&1 \
>      && ./test2z.x >>test2z.l 2>&1
>   then echo "mmap of /dev/zero works."
>   else echo "mmap of /dev/zero is buggy. ($?)"
>   fi
> fi
> 
> if test -n "$have_map_anon"; then 
>   if $CC test2.c -DUSE_MAP_ANON -o test2a.x >test2a.l 2>&1 \
>      && ./test2a.x >>test2a.l 2>&1
>   then echo "mmap with MAP_ANON(YMOUS) works."
>   else echo "mmap with MAP_ANON(YMOUS) is buggy. ($?)"
>   fi
> fi
> 
> ls -l *.l
> uname -a
> 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
                   ` (2 preceding siblings ...)
  2001-01-09 10:35 ` Bruce Korb
@ 2001-01-09 11:20 ` Jose M. Moya
  2001-01-10  3:20 ` Gerrit P. Haase
  2001-01-10  4:14 ` Phil Edwards
  5 siblings, 0 replies; 10+ messages in thread
From: Jose M. Moya @ 2001-01-09 11:20 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

On Tue, Jan 09, 2001 at 09:49:44AM -0800, Zack Weinberg wrote:
> 
> If you tried the previous version of this script and got "buggy"
> reports, I'd appreciate it if you would try this one.

Have mmap from /dev/zero.
No mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
-rw-r--r--  1 root           22 Jan  9 20:18 test1a.l
-rw-r--r--  1 root            0 Jan  9 20:18 test1z.l
-rw-r--r--  1 root            0 Jan  9 20:18 test2z.l
SunOS jazmin 4.1.3_U1 1 sun4m

bash# cat mmt26360/test1a.l 
mmap: Bad file number


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
  2001-01-09 10:04 ` Alexandre Oliva
  2001-01-09 10:12 ` Charles S. Wilson
@ 2001-01-09 10:35 ` Bruce Korb
  2001-01-09 11:20 ` Jose M. Moya
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Bruce Korb @ 2001-01-09 10:35 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

Zack Weinberg wrote:
> 
> The previous generation of this test script got a bunch of spurious
> failures (code 7) because it didn't try hard enough to get two
> consecutive maps allocated next to each other.

   Have mmap from /dev/zero.
   No mmap with MAP_ANON(YMOUS).
   mmap of /dev/zero works.
   -rw-r--r--   1 bkorb    dev           22 Jan  9 10:21 test1a.l
   -rw-r--r--   1 bkorb    dev            0 Jan  9 10:20 test1z.l
   -rw-r--r--   1 bkorb    dev            0 Jan  9 10:21 test2z.l
   SCO_SV ellen 3.2 5.0.5 i386 unknown

   $ cat test1a.l
   mmap: Bad file number

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
  2001-01-09 10:04 ` Alexandre Oliva
@ 2001-01-09 10:12 ` Charles S. Wilson
  2001-01-09 10:35 ` Bruce Korb
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Charles S. Wilson @ 2001-01-09 10:12 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

cygwin, solaris, hpux-10.20

CYGWIN:
-------------------------------------------------
No mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap with MAP_ANON(YMOUS) is buggy. (3)
-rw-rw-r--   1 cwilson  Users           0 Jan  9 13:04 test1a.l
-rw-rw-r--   1 cwilson  Users          21 Jan  9 13:04 test1z.l
-rw-rw-r--   1 cwilson  Users          34 Jan  9 13:05 test2a.l
CYGWIN_NT-4.0 BELGARION 1.1.7(0.31/3/2) 2000-12-25 12:39 i586 unknown

cat test1z.l
mmap: No such device

cat test2a.l
test 1 no fault: Invalid argument

SOLARIS:
-------------------------------------------------
Have mmap from /dev/zero.
No mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
-rw-rw-r--   1 cwilson  neuro          22 Jan  9 13:06 test1a.l
-rw-rw-r--   1 cwilson  neuro           0 Jan  9 13:06 test1z.l
-rw-rw-r--   1 cwilson  neuro           0 Jan  9 13:06 test2z.l
SunOS frontal.ibb.gatech.edu 5.7 Generic_106541-12 sun4u sparc

cat mmt14318/test1a.l 
mmap: Bad file number

HPUX:
-------------------------------------------------
No mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap with MAP_ANON(YMOUS) is buggy. (7)
-rw-rw-r--   1 cwilson    neuro            0 Jan  9 13:08 test1a.l
-rw-rw-r--   1 cwilson    neuro           42 Jan  9 13:08 test1z.l
-rw-rw-r--   1 cwilson    neuro           32 Jan  9 13:08 test2a.l
HP-UX jalapeno B.10.20 A 9000/778 2006019201 two-user license

cat mmt20622/test1z.l
open /dev/zero: No such file or directory

cat mmt20622/test2a.l 
test 3 mmap 2: Not enough space

-------------------------------------------------

--Chuck

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: New autoconf tests - let's try this again
  2001-01-09  9:49 Zack Weinberg
@ 2001-01-09 10:04 ` Alexandre Oliva
  2001-01-09 10:12 ` Charles S. Wilson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Alexandre Oliva @ 2001-01-09 10:04 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, cygwin

On Jan  9, 2001, "Zack Weinberg" <zackw@stanford.edu> wrote:

> If you tried the previous version of this script and got "buggy"
> reports, I'd appreciate it if you would try this one.

Have mmap from /dev/zero.
No mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
-rw-r--r--   1 oliva    phd            22 Jan  9 15:01 test1a.l
-rw-r--r--   1 oliva    phd             0 Jan  9 15:00 test1z.l
-rw-r--r--   1 oliva    phd             0 Jan  9 15:01 test2z.l
IRIX escher 5.2 02282016 IP22 mips


Have mmap from /dev/zero.
Have mmap with MAP_ANON(YMOUS).
mmap of /dev/zero works.
mmap with MAP_ANON(YMOUS) works.
-rw-r--r--   1 oliva    pos             0 Jan  9 15:01 test1a.l
-rw-r--r--   1 oliva    pos             0 Jan  9 15:00 test1z.l
-rw-r--r--   1 oliva    pos             0 Jan  9 15:01 test2a.l
-rw-r--r--   1 oliva    pos             0 Jan  9 15:01 test2z.l
AIX visconde 1 4 000045059100 unknown
(this is AIX 4.1.5.0)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* New autoconf tests - let's try this again
@ 2001-01-09  9:49 Zack Weinberg
  2001-01-09 10:04 ` Alexandre Oliva
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Zack Weinberg @ 2001-01-09  9:49 UTC (permalink / raw)
  To: gcc; +Cc: cygwin

The previous generation of this test script got a bunch of spurious
failures (code 7) because it didn't try hard enough to get two
consecutive maps allocated next to each other.  This one should work
better - I still can't get a success on HP/UX, though (clues
appreciated).

If you tried the previous version of this script and got "buggy"
reports, I'd appreciate it if you would try this one.

[Russ - SGI cc doesn't work on the raptors.]

zw

#! /bin/sh

mkdir mmt$$ || exit 1
cd mmt$$ || exit 1

if test -z "$CC"; then
  if command -v cc >/dev/null 2>&1; then
    CC=cc
  elif command -v gcc >/dev/null 2>&1; then
    CC=gcc
  else
    echo "Cannot find compiler, set CC in environment"
    exit 1
  fi
fi

cat >testcore.h <<EOF
/* Test by Richard Henderson and Alexandre Oliva.
   Check whether mmap MAP_ANONYMOUS or mmap from /dev/zero works. */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

#ifndef MAP_ANON
# ifdef MAP_ANONYMOUS
#  define MAP_ANON MAP_ANONYMOUS
# else
#  define MAP_ANON 0
# endif
#endif

#ifndef MAP_FAILED
# define MAP_FAILED -1
#endif

#undef perror_exit
#define perror_exit(str, val) \
  do { perror(str); exit(val); } while (0)

static char *
anonmap (size, loc)
     size_t size;
     char *loc;
{
  int flags;
#ifndef USE_MAP_ANON
  static int devzero = -1;
#endif

  if (loc)
    flags = MAP_PRIVATE|MAP_FIXED;
  else
    flags = MAP_PRIVATE;

#ifdef USE_MAP_ANON
  return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, flags|MAP_ANON, -1, 0);
#else
  if (devzero == -1)
    {
      devzero = open ("/dev/zero", O_RDWR);
      if (devzero < 0)
	perror_exit ("open /dev/zero", 64);
    }
  return (char *) mmap (loc, size, PROT_READ|PROT_WRITE, flags, devzero, 0);
#endif
}
EOF

cat >test1.c <<EOF
#include "testcore.h"

int
main()
{
  int pg = getpagesize ();
  char *x = anonmap (pg, 0);

  if (x == (char *) MAP_FAILED)
    perror_exit("mmap", 1);

  *(int *)x += 1;

  if (munmap(x, pg) < 0)
    perror_exit("munmap", 2);

  exit(0);
}
EOF

if $CC test1.c -o test1z.x >test1z.l 2>&1 && ./test1z.x >>test1z.l 2>&1
then echo "Have mmap from /dev/zero."
     have_dev_zero=y
else echo "No mmap from /dev/zero."
fi

if $CC test1.c -DUSE_MAP_ANON -o test1a.x >test1a.l 2>&1 \
    && ./test1a.x >>test1a.l 2>&1
then echo "Have mmap with MAP_ANON(YMOUS)."
     have_map_anon=y
else echo "No mmap with MAP_ANON(YMOUS)."
fi

cat >test2.c <<EOF
#include "testcore.h"
#include <signal.h>
#include <setjmp.h>

/* Some versions of cygwin mmap require that munmap is called with the
   same parameters as mmap.  GCC expects that this is not the case.
   Test for various forms of this problem.  Warning - icky signal games.  */
static jmp_buf r;
static size_t pg;

static void
sigsegv (unused)
     int unused;
{
  longjmp (r, 1);
}

/* 1. If we map a 2-page region and unmap its second page, the first page
   must remain.  */
void
test_1 ()
{
  char *x = anonmap (pg * 2, 0);
  if (x == (char *)MAP_FAILED)
    perror_exit ("test 1 mmap", 1);

  signal (SIGSEGV, sigsegv);
  if (setjmp (r))
    perror_exit ("test 1 fault", 2);

  x[0] = 1;
  x[pg] = 1;

  munmap (x + pg, pg);
  x[0] = 2;

  if (setjmp (r))
    {
      munmap (x, pg);
      return;
    }
  x[pg] = 1;
  perror_exit ("test 1 no fault", 3);
}

/* 2. If we map a 2-page region and unmap its first page, the second
   page must remain.  */
void
test_2 ()
{
  char *x = anonmap (pg * 2, 0);
  if (x == (char *)MAP_FAILED)
    perror_exit ("test 2 mmap", 4);

  signal (SIGSEGV, sigsegv);
  if (setjmp (r))
    perror_exit ("test 2 fault", 5);

  x[0] = 1;
  x[pg] = 1;

  munmap (x, pg);
  x[pg] = 2;

  if (setjmp (r))
    {
      munmap (x + pg, pg);
      return;
    }
  x[0] = 1;
  perror_exit ("test 2 no fault", 6);
}

/* 3. If we map two consecutive 1-page regions and unmap them both with
   one munmap, both must go away.  */

void
test_3 ()
{
  char *x, *y;
  x = anonmap (pg, 0);
  if (x == (char *)MAP_FAILED)
    perror_exit ("test 3 mmap 1", 7);
  y = anonmap (pg, x+pg);
  if (y == (char *)MAP_FAILED || x + pg != y)
    perror_exit ("test 3 mmap 2", 7);

  signal (SIGSEGV, sigsegv);
  if (setjmp (r))
    perror_exit ("test 3 fault", 8);

  x[0] = 1;
  x[pg] = 1;

  munmap (x, pg * 2);

  if (setjmp (r) == 0)
    {
      x[0] = 1;
      perror_exit ("test 3 no fault 1", 9);
    }
  
  signal (SIGSEGV, sigsegv);
  if (setjmp (r) == 0)
    {
      x[pg] = 1;
      perror_exit ("test 3 no fault 2", 10);
    }
}


int
main ()
{
  pg = getpagesize ();

  test_1();
  test_2();
  test_3();

  exit(0);
}
EOF

if test -n "$have_dev_zero"; then
  if $CC test2.c  -o test2z.x >test2z.l 2>&1 \
     && ./test2z.x >>test2z.l 2>&1
  then echo "mmap of /dev/zero works."
  else echo "mmap of /dev/zero is buggy. ($?)"
  fi
fi

if test -n "$have_map_anon"; then 
  if $CC test2.c -DUSE_MAP_ANON -o test2a.x >test2a.l 2>&1 \
     && ./test2a.x >>test2a.l 2>&1
  then echo "mmap with MAP_ANON(YMOUS) works."
  else echo "mmap with MAP_ANON(YMOUS) is buggy. ($?)"
  fi
fi

ls -l *.l
uname -a

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-01-10  4:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-09 10:31 New autoconf tests - let's try this again Janis Johnson
  -- strict thread matches above, loose matches on Subject: below --
2001-01-10  2:19 biswapesh.chattopadhyay
2001-01-10  2:15 biswapesh.chattopadhyay
2001-01-09  9:49 Zack Weinberg
2001-01-09 10:04 ` Alexandre Oliva
2001-01-09 10:12 ` Charles S. Wilson
2001-01-09 10:35 ` Bruce Korb
2001-01-09 11:20 ` Jose M. Moya
2001-01-10  3:20 ` Gerrit P. Haase
2001-01-10  4:14 ` Phil Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).