autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting mmap?


From: Bruce Korb
Subject: Re: detecting mmap?
Date: Thu, 18 Jul 2002 06:36:13 -0700

"Schleicher Ralph (LLI)" wrote:
> 
> Donn Terry <address@hidden> writes:
> 
> > The current code to detect if mmap() is present and operational is
> > excessively draconian, in my opinion.
> 
> The GNU coding standards has a section about how to use mmap.
> Following these guidelines always works for me.  For short: use
> AC_CHECK_FUNCS([mmap]) instead of AC_FUNC_MMAP.  Then write, for
> example,
> 
>     void *p;
> 
>   #if HAVE_MMAP && defined (PROT_*) && defined (MAP_*)
> 
>     p = mmap (NULL, n, PROT_*, MAP_*, fd, 0);
>     if (p != NULL)
>       return p;

RETURN VALUES
     Upon successful completion, the mmap() function returns  the
     address  at which the mapping was placed (pa); otherwise, it
     returns a value of MAP_FAILED and sets errno to indicate the
     error.  The  symbol  MAP_FAILED  is  defined  in  the header
     <sys/mman.h>. No successful return from mmap()  will  return
     the value MAP_FAILED.

"MAP_FAILED" is:  (void*)-1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]