On Wed, Jan 26, 2005 at 11:38:15AM -0500, linux-os wrote: > On Wed, 26 Jan 2005, Rik van Riel wrote: > > >With some programs the 2.6 kernel can end up allocating memory > >at address zero, for a non-MAP_FIXED mmap call! This causes > >problems with some programs and is generally rude to do. This > >simple patch fixes the problem in my tests. > > Does this mean that we can't mmap the screen regen buffer at > 0x000b8000 anymore?
No. Missed the "non-MAP_FIXED" part? You can always map at 0, you just have to ask for it. > What 'C' standard do you refer to? Malloc uses mmap to get more memory. Malloc returning 0 means no memory, not "the memory happens to be at 0". Not that easy to fix in the glibc if you want to keep the "segfault on null pointer accesses" debugging help too. Given that the man page itself says that unless you're using MAP_FIXED start is only a hint and you should use 0 if you don't care things can get real annoying real fast. Imagine if you want to mmap a <4K file and mmap then returns 0, i.e. NULL, as the mapping address as you asked. It's illegal from the point of view of susv3[1] and it's real annoying in a C/C++ program. OG. [1] When MAP_FIXED is not set, the implementation uses addr in an implementation-defined manner to arrive at pa. The pa so chosen shall be an area of the address space that the implementation deems suitable for a mapping of len bytes to the file. All implementations interpret an addr value of 0 as granting the implementation complete freedom in selecting pa, subject to constraints described below. A non-zero value of addr is taken to be a suggestion of a process address near which the mapping should be placed. When the implementation selects a value for pa, it never places a mapping at address 0, nor does it replace any extant mapping. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/