This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libiberty patch]: Change strncmp test in the way it uses mmap


Ira Ruben <ira@apple.com> writes:

|> 2001-12-28  Ira Ruben	<ira@apple.com>
|> 
|> 	Modify strncmp test.
|> 	* aclocal.m4 (libiberty_AC_FUNC_STRNCMP): Handle mmap differently.
|> 	* configure: Regenerated.
|> 
|> 
|> Index: aclocal.m4
|> ===================================================================
|> RCS file: /cvs/gcc/gcc/libiberty/aclocal.m4,v
|> retrieving revision 1.4
|> diff -c -3 -p -r1.4 aclocal.m4
|> *** aclocal.m4	2001/03/06 09:52:35	1.4
|> --- aclocal.m4	2001/12/28 22:49:29
|> *************** AC_CACHE_CHECK([for working strncmp], ac
|> *** 18,29 ****
|>   #include <sys/mman.h>
|>   #endif
|>   
|> ! #ifndef MAP_ANON
|> ! #ifdef MAP_ANONYMOUS
|> ! #define MAP_ANON MAP_ANONYMOUS
|> ! #else
|> ! #define MAP_ANON MAP_FILE
|> ! #endif
|>   #endif
|>   
|>   #ifndef MAP_FILE
|> --- 18,25 ----
|>   #include <sys/mman.h>
|>   #endif
|>   
|> ! #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
|> ! #define MAP_ANONYMOUS MAP_ANON
|>   #endif
|>   
|>   #ifndef MAP_FILE
|> *************** main ()
|> *** 41,52 ****
|>     char *p;
|>     int dev_zero;
|>   
|>     dev_zero = open ("/dev/zero", O_RDONLY);
|>     if (dev_zero < 0)
|>       exit (1);
|>     
|>     p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|> ! 		     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
|>     if (p == (char *)-1)
|>       exit (2);
|>     else
|> --- 37,54 ----
|>     char *p;
|>     int dev_zero;
|>   
|> + #ifndef MAP_ANONYMOUS
|>     dev_zero = open ("/dev/zero", O_RDONLY);
|>     if (dev_zero < 0)
|>       exit (1);
|>     
|> +   p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|> + 		     MAP_FILE | MAP_PRIVATE, dev_zero, 0);
|> + #else
|>     p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|> ! 		     MAP_ANON|MAP_PRIVATE, -1, 0);

This should probable be MAP_ANONYMOUS instead of MAP_ANON since the
conditional definition above prefers the former over the latter.

Andreas.

-- 
Andreas Schwab                                  "And now for something
Andreas.Schwab@suse.de				completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]