bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] valloc()?


From: Bruno Haible
Subject: Re: [bug-gnulib] valloc()?
Date: Thu, 3 Mar 2005 21:47:51 +0100
User-agent: KMail/1.5

Derek Price wrote:
> I've attached a patch to fix a few more nits

Committed, with small wording tweaks in the comments.

>     - I noticed that I assumed mmap() returns NULL on error when it
> actually returns MAP_FAILED according to POSIX.

Ouch, this was a major bug. Glad that you found it.

>     - Note in the header that pagealign_alloc sets errno on failure.

But it doesn't do so if malloc() fails on non-POSIX systems (like mingw
or so). I think one should set errno = ENOMEM if malloc() fails.

> I had two further thoughts on the naming of mmap-anon.m4.  First, in my
> original decision to name it mmap.m4, I did take into consideration that
> there might be other mmap.m4 implementations but, ideally, I would hope
> that their requirements could be merged into this mmap(-anon).m4, at the
> least for simplicity's sake.

I don't have this hope: The requirements of different programs regarding
mmap are so different that, if all tests were merged into a common mmap.m4
file, some people would say "this test is insane - it disables mmap on
SVR4 [or Linux 1.2 or HP-UX or ...] although it is perfectly sane".
SVR4 had problems with PRIVATE READ-WRITE mappings of files.
Linux 1.2 didn't support MAP_SHARED on files.
HP-UX doesn't support mapping files at fixed addresses in most cases.

> Second, technically what we are currently
> calling gl_FUNC_MMAP_ANON calls AC_FUNC_MMAP, so it also verifies that
> private, fixed maps to files work as well, not just anonymous maps.

Yes, this is one of the problems with AC_FUNC_MMAP. But fortunately we
can ignore it because nowadays most systems have a working mmap(), therefore
not many people will complain "it disables mmap() on my system".

Bruno





reply via email to

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