Donn Terry <[EMAIL PROTECTED]> 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;

  #endif

    /* mmap() doesn't work, use malloc().  */
    p = malloc (n);
    if (p != NULL && read (fd, p, n) != n)
      {
        free (p);
        p = NULL;
      }

    return p;

-- 
Ralph


Reply via email to