From 467c76b0c7f5463ab034041e0350926a4c60eeb2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 22 Feb 2006 00:56:29 +0000 Subject: move _dl_mmap_check_error() to related mmap bits of code as pointed out by Nicolas Bellido --- ldso/include/dl-syscall.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 27af703e8..7845ad9de 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -45,18 +45,6 @@ #define S_IWRITE 0200 /* Write by owner. */ #define S_IEXEC 0100 /* Execute by owner. */ -/* Stuff for _dl_mmap */ -#if 0 -#define MAP_FAILED ((void *) -1) -#define _dl_mmap_check_error(X) (((void *)X) == MAP_FAILED) -#else -#ifndef _dl_MAX_ERRNO -#define _dl_MAX_ERRNO 4096 -#endif -#define _dl_mmap_check_error(__res) \ - (((long)__res) < 0 && ((long)__res) >= -_dl_MAX_ERRNO) -#endif - /* Here are the definitions for some syscalls that are used @@ -134,6 +122,12 @@ static inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv, struct time #endif #ifdef __NR_mmap +#ifndef _dl_MAX_ERRNO +# define _dl_MAX_ERRNO 4096 +#endif +#define _dl_mmap_check_error(__res) \ + (((long)__res) < 0 && ((long)__res) >= -_dl_MAX_ERRNO) + #ifdef __UCLIBC_MMAP_HAS_6_ARGS__ #define __NR__dl_mmap __NR_mmap static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length, @@ -157,6 +151,9 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot, } #endif #elif defined __NR_mmap2 + +#define MAP_FAILED ((void *) -1) +#define _dl_mmap_check_error(X) (((void *)X) == MAP_FAILED) #define __NR___syscall_mmap2 __NR_mmap2 static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, off_t, offset); @@ -171,7 +168,7 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } #else -#error "Your architecture doesn't seem to provide mmap() !?" +# error "Your architecture doesn't seem to provide mmap() !?" #endif #endif /* _LD_SYSCALL_H_ */ -- cgit v1.2.3