From 010301e968b4aa9a37dfd437f89c054016b2de0f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 18 Feb 2006 07:03:24 +0000 Subject: tweak the idea between having a MMU and actually using it --- libc/inet/rpc/rcmd.c | 22 +++++++++++----------- libc/misc/internals/__uClibc_main.c | 10 +++++----- libc/stdlib/malloc-simple/alloc.c | 2 +- libc/stdlib/malloc-standard/malloc.h | 2 +- libc/stdlib/malloc/malloc.c | 2 +- libc/stdlib/malloc/malloc.h | 2 +- libc/sysdeps/linux/arm/crt1.S | 2 +- libc/sysdeps/linux/common/bits/posix_opt.h | 6 +++--- libc/sysdeps/linux/common/fork.c | 2 +- libc/sysdeps/linux/common/ioperm.c | 2 +- libc/sysdeps/linux/common/iopl.c | 2 +- libc/sysdeps/linux/common/mlock.c | 2 +- libc/sysdeps/linux/common/mlockall.c | 2 +- libc/sysdeps/linux/common/munlock.c | 2 +- libc/sysdeps/linux/common/munlockall.c | 2 +- libc/unistd/Makefile.in | 2 +- libc/unistd/exec.c | 2 +- 17 files changed, 33 insertions(+), 33 deletions(-) (limited to 'libc') diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index 472212f54..b4fe8cfe7 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -174,7 +174,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ hstbuflen = 1024; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ tmphstbuf = alloca (hstbuflen); #else tmphstbuf = malloc (hstbuflen); @@ -186,7 +186,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) if (herr != NETDB_INTERNAL || errno != ERANGE) { __set_h_errno (herr); -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(tmphstbuf); #endif herror(*ahost); @@ -196,7 +196,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) { /* Enlarge the buffer. */ hstbuflen *= 2; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ tmphstbuf = alloca (hstbuflen); #else if (tmphstbuf) { @@ -206,7 +206,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #endif } } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(tmphstbuf); #endif #else /* call the non-reentrant version */ @@ -388,7 +388,7 @@ int ruserok(rhost, superuser, ruser, luser) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ buflen = 1024; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ buffer = alloca (buflen); #else buffer = malloc (buflen); @@ -398,7 +398,7 @@ int ruserok(rhost, superuser, ruser, luser) buflen, &hp, &herr) != 0 || hp == NULL) { if (herr != NETDB_INTERNAL || errno != ERANGE) { -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif return -1; @@ -406,7 +406,7 @@ int ruserok(rhost, superuser, ruser, luser) { /* Enlarge the buffer. */ buflen *= 2; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ buffer = alloca (buflen); #else if (buffer) { @@ -416,7 +416,7 @@ int ruserok(rhost, superuser, ruser, luser) #endif } } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif #else @@ -513,7 +513,7 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); struct passwd pwdbuf; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ char *buffer = alloca (buflen); #else char *buffer = malloc (buflen); @@ -522,12 +522,12 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0 || pwd == NULL) { -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif return -1; } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif #else diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 687585860..c50244494 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -33,7 +33,7 @@ libc_hidden_proto(exit) #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ libc_hidden_proto(strrchr) #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ libc_hidden_proto(memcpy) libc_hidden_proto(getgid) libc_hidden_proto(getuid) @@ -131,7 +131,7 @@ libc_hidden_data_def(__pagesize) # define O_NOFOLLOW 0 #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ @@ -272,7 +272,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, char **argv, void (*app_init)(void), void (*app_fini)(void), void (*rtld_fini)(void), void *stack_end) { -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ unsigned long *aux_dat; ElfW(auxv_t) auxvt[AT_EGID + 1]; #endif @@ -293,7 +293,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, __environ = &argv[argc]; } -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Pull stuff from the ELF header when possible */ aux_dat = (unsigned long*)__environ; while (*aux_dat) { @@ -314,7 +314,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, * __uClibc_init() regardless, to be sure the right thing happens. */ __uClibc_init(); -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Make certain getpagesize() gives the correct answer */ __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 65d4bb277..e382cee55 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -36,7 +36,7 @@ void *malloc(size_t size) #endif } -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define MMAP_FLAGS MAP_PRIVATE | MAP_ANONYMOUS #else # define MMAP_FLAGS MAP_SHARED | MAP_ANONYMOUS diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 628b47dc3..a3fabb0c4 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -354,7 +354,7 @@ libc_hidden_proto(__malloc_lock) #define MAP_ANONYMOUS MAP_ANON #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #define MMAP(addr, size, prot) \ (mmap((addr), (size), (prot), MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c index 329788aec..2ec8b07da 100644 --- a/libc/stdlib/malloc/malloc.c +++ b/libc/stdlib/malloc/malloc.c @@ -106,7 +106,7 @@ malloc_from_heap (size_t size, struct heap *heap) #else /* !MALLOC_USE_SBRK */ /* Otherwise, use mmap. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); #else diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 9360eecda..753205443 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -44,7 +44,7 @@ libc_hidden_proto(__pagesize) heap, instead of mmap/munmap. This is a tradeoff -- sbrk is faster than mmap/munmap, and guarantees contiguous allocation, but is also less flexible, and causes the heap to only be shrinkable from the end. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define MALLOC_USE_SBRK #endif diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S index 8e0faab47..02c2f8de9 100644 --- a/libc/sysdeps/linux/arm/crt1.S +++ b/libc/sysdeps/linux/arm/crt1.S @@ -110,7 +110,7 @@ _start: mov fp, #0 mov lr, #0 -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Pop argc off the stack and save a pointer to argv */ ldr a2, [sp], #4 mov a3, sp diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h index 330989128..b2cae9d41 100644 --- a/libc/sysdeps/linux/common/bits/posix_opt.h +++ b/libc/sysdeps/linux/common/bits/posix_opt.h @@ -43,21 +43,21 @@ #define _POSIX_MAPPED_FILES 200112L /* Locking of all memory is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMLOCK 200112L #else # undef _POSIX_MEMLOCK #endif /* Locking of ranges of memory is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMLOCK_RANGE 200112L #else # define _POSIX_MEMLOCK_RANGE #endif /* Setting of memory protections is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMORY_PROTECTION 1 #else # undef _POSIX_MEMORY_PROTECTION diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 7c94843ec..884e986ab 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -10,7 +10,7 @@ #include "syscalls.h" #include -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #ifdef __NR_fork extern __typeof(fork) __libc_fork; #define __NR___libc_fork __NR_fork diff --git a/libc/sysdeps/linux/common/ioperm.c b/libc/sysdeps/linux/common/ioperm.c index fc57a97e1..e9ca964cc 100644 --- a/libc/sysdeps/linux/common/ioperm.c +++ b/libc/sysdeps/linux/common/ioperm.c @@ -8,7 +8,7 @@ */ #include "syscalls.h" -#if defined __ARCH_HAS_MMU__ && defined __NR_ioperm +#if defined __ARCH_USE_MMU__ && defined __NR_ioperm /* psm: can't #include , some archs miss it */ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on) __THROW; _syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on); diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c index 90069c08e..2a6b619d5 100644 --- a/libc/sysdeps/linux/common/iopl.c +++ b/libc/sysdeps/linux/common/iopl.c @@ -8,7 +8,7 @@ */ #include "syscalls.h" -#if defined __ARCH_HAS_MMU__ && defined __NR_iopl +#if defined __ARCH_USE_MMU__ && defined __NR_iopl /* psm: can't #include , some archs miss it */ extern int iopl(int __level) __THROW; _syscall1(int, iopl, int, level); diff --git a/libc/sysdeps/linux/common/mlock.c b/libc/sysdeps/linux/common/mlock.c index 28a6e7927..3eb72bb07 100644 --- a/libc/sysdeps/linux/common/mlock.c +++ b/libc/sysdeps/linux/common/mlock.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_mlock +#if defined __ARCH_USE_MMU__ && defined __NR_mlock _syscall2(int, mlock, const void *, addr, size_t, len); #endif diff --git a/libc/sysdeps/linux/common/mlockall.c b/libc/sysdeps/linux/common/mlockall.c index ea48811ae..6e6d3bc36 100644 --- a/libc/sysdeps/linux/common/mlockall.c +++ b/libc/sysdeps/linux/common/mlockall.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_mlockall +#if defined __ARCH_USE_MMU__ && defined __NR_mlockall _syscall1(int, mlockall, int, flags); #endif diff --git a/libc/sysdeps/linux/common/munlock.c b/libc/sysdeps/linux/common/munlock.c index 80fd898fa..1d6870ecc 100644 --- a/libc/sysdeps/linux/common/munlock.c +++ b/libc/sysdeps/linux/common/munlock.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_munlock +#if defined __ARCH_USE_MMU__ && defined __NR_munlock _syscall2(int, munlock, const void *, addr, size_t, len); #endif diff --git a/libc/sysdeps/linux/common/munlockall.c b/libc/sysdeps/linux/common/munlockall.c index d0a086a37..4ee729292 100644 --- a/libc/sysdeps/linux/common/munlockall.c +++ b/libc/sysdeps/linux/common/munlockall.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ +#if defined __ARCH_USE_MMU__ _syscall0(int, munlockall); #endif diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in index 198a4eab2..4a0bb0734 100644 --- a/libc/unistd/Makefile.in +++ b/libc/unistd/Makefile.in @@ -12,7 +12,7 @@ CSRC := $(notdir $(wildcard $(UNISTD_DIR)/*.c)) # multi source CSRC := $(filter-out exec.c,$(CSRC)) -ifeq ($(ARCH_HAS_MMU),y) +ifeq ($(ARCH_USE_MMU),y) CSRC := $(filter-out __exec_alloc.c,$(CSRC)) else CSRC := $(filter-out daemon.c,$(CSRC)) diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 1e574825a..3563723ad 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -53,7 +53,7 @@ libc_hidden_proto(getenv) libc_hidden_proto(__environ) /**********************************************************************/ -#if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) +#if defined(__ARCH_USE_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) /* We have an MMU, so use alloca() to grab space for buffers and * arg lists. Also fall back to alloca() if munmap() is broken. */ -- cgit v1.2.3