[PATCH] Fix undefined MAP_FAILED in _dl_mmap()

Nicolas Bellido ml at acolin.be
Tue Feb 21 21:53:15 UTC 2006


On Tuesday 21 February 2006 15:20, Mike Frysinger wrote:
> On Tuesday 21 February 2006 04:15, Nicolas Bellido wrote:
>
> > Also, because of the #if 0 ... #endif surrounding the definition of
> > _dl_mmap_check_error in ldso/include/dl-syscall.h, if an architecture
> > does not provide the mmap syscall, _dl_mmap would not compile because it
> > uses MAP_FAILED, and not _dl_MAX_ERRNO.
>
> but this hasnt come up before as everyone provides mmap at this time ...

How about this ?


The _dl_mmap function, when using the mmap2 system call, returns
MAP_FAILED as error value. However, MAP_FAILED is undefined, causing 
a compilation error. _dl_MAX_ERRNO should be used instead.

Signed-Off-By: Nicolas Bellido <ml at acolin.be>

Index: uClibc-20060218/ldso/include/dl-syscall.h
===================================================================
--- uClibc-20060218.orig/ldso/include/dl-syscall.h
+++ uClibc-20060218/ldso/include/dl-syscall.h
@@ -166,7 +166,7 @@ static inline void * _dl_mmap(void * add
 		int flags, int fd, unsigned long offset)
 {
     if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
-	return MAP_FAILED;
+	return (void *)-_dl_MAX_ERRNO;
     return(__syscall_mmap2(addr, size, prot, flags,
 		fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
 }

--

Nicolas



More information about the uClibc mailing list