klibc-bot for Ben Hutchings
2024-Oct-07 21:36 UTC
[klibc] [klibc:master] Remove unused no-MMU support
Commit-ID: 60d3d584e0ed7c09f544b753f764e493b940a6a8 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=60d3d584e0ed7c09f544b753f764e493b940a6a8 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Tue, 1 Oct 2024 19:47:43 +0200 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Wed, 2 Oct 2024 02:07:27 +0200 [klibc] Remove unused no-MMU support There is some conditional logic to handle no-MMU architectures, but no such architectures are defined. We are now having to override the automatic detection for each new architecture because it only checks for fork() and not clone(). Since this is currently unused and therefore untested, it's probably broken. Remove it. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/arch/arm64/klibc/archconfig.h | 1 - usr/include/arch/loongarch64/klibc/archconfig.h | 3 --- usr/include/arch/riscv64/klibc/archconfig.h | 3 --- usr/include/klibc/sysconfig.h | 16 ---------------- usr/kinit/nfsmount/main.c | 5 ----- usr/klibc/SYSCALLS.def | 4 +--- usr/klibc/arch/README.klibc.arch | 2 -- usr/klibc/brk.c | 4 ---- usr/klibc/fork.c | 4 ++-- usr/klibc/sbrk.c | 4 ---- usr/klibc/vfork.c | 2 +- 11 files changed, 4 insertions(+), 44 deletions(-) diff --git a/usr/include/arch/arm64/klibc/archconfig.h b/usr/include/arch/arm64/klibc/archconfig.h index d094c28d..6792fd47 100644 --- a/usr/include/arch/arm64/klibc/archconfig.h +++ b/usr/include/arch/arm64/klibc/archconfig.h @@ -9,7 +9,6 @@ #ifndef _KLIBC_ARCHCONFIG_H #define _KLIBC_ARCHCONFIG_H -#define _KLIBC_NO_MMU 0 #define _KLIBC_REAL_VFORK 1 #endif /* _KLIBC_ARCHCONFIG_H */ diff --git a/usr/include/arch/loongarch64/klibc/archconfig.h b/usr/include/arch/loongarch64/klibc/archconfig.h index 7a47b915..667b94e7 100644 --- a/usr/include/arch/loongarch64/klibc/archconfig.h +++ b/usr/include/arch/loongarch64/klibc/archconfig.h @@ -9,7 +9,4 @@ #ifndef _KLIBC_ARCHCONFIG_H #define _KLIBC_ARCHCONFIG_H -/* We have an MMU but no fork() syscall */ -#define _KLIBC_NO_MMU 0 - #endif /* _KLIBC_ARCHCONFIG_H */ diff --git a/usr/include/arch/riscv64/klibc/archconfig.h b/usr/include/arch/riscv64/klibc/archconfig.h index e85a69c0..20d9b185 100644 --- a/usr/include/arch/riscv64/klibc/archconfig.h +++ b/usr/include/arch/riscv64/klibc/archconfig.h @@ -9,7 +9,4 @@ #ifndef _KLIBC_ARCHCONFIG_H #define _KLIBC_ARCHCONFIG_H -/* We have an MMU but no fork() syscall */ -#define _KLIBC_NO_MMU 0 - #endif /* _KLIBC_ARCHCONFIG_H */ diff --git a/usr/include/klibc/sysconfig.h b/usr/include/klibc/sysconfig.h index 5d16f612..636c3c08 100644 --- a/usr/include/klibc/sysconfig.h +++ b/usr/include/klibc/sysconfig.h @@ -19,22 +19,6 @@ */ -/* - * _KLIBC_NO_MMU: - * - * Indicates this architecture doesn't have an MMU, and therefore - * does not have the sys_fork and sys_brk system calls. - */ -/* Default to having an MMU if we can find the fork system call */ -#ifndef _KLIBC_NO_MMU -# if defined(__NR_fork) -# define _KLIBC_NO_MMU 0 -# else -# define _KLIBC_NO_MMU 1 -# endif -#endif - - /* * _KLIBC_REAL_VFORK: * diff --git a/usr/kinit/nfsmount/main.c b/usr/kinit/nfsmount/main.c index 66969f42..f6b5b4c1 100644 --- a/usr/kinit/nfsmount/main.c +++ b/usr/kinit/nfsmount/main.c @@ -10,7 +10,6 @@ #include <setjmp.h> #include <sys/wait.h> #include <unistd.h> -#include <klibc/sysconfig.h> /* For _KLIBC_NO_MMU */ #include <linux/nfs_mount.h> @@ -257,9 +256,6 @@ int nfsmount_main(int argc, char *argv[]) check_path(path); -#if !_KLIBC_NO_MMU - /* Note: uClinux can't fork(), so the spoof portmapper is not - available on uClinux. */ if (portmap_file) spoof_portmap = start_dummy_portmap(portmap_file); @@ -267,7 +263,6 @@ int nfsmount_main(int argc, char *argv[]) free(rem_name); return 1; } -#endif ret = 0; if (nfs_mount(rem_name, hostname, server, rem_path, path, diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def index 7fd8164c..ff32b2ed 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -19,10 +19,8 @@ */ void _exit,exit::_exit(int); <?> pid_t clone::__clone(unsigned long, void *); -# if ! _KLIBC_NO_MMU <!sparc,sparc64,arm64,riscv64,loongarch64> pid_t fork(); <sparc,sparc64> pid_t fork at forkish(); -#endif #if _KLIBC_REAL_VFORK /* * A lot of architectures need architecture-specific vfork @@ -216,7 +214,7 @@ int settimeofday::__settimeofday(const void *, const struct timezone *); /* * Memory */ -<?> void * brk::__brk(void *); +void * brk::__brk(void *); int munmap(void *, size_t); void * mremap(void *, size_t, size_t, unsigned long); int msync(const void *, size_t, int); diff --git a/usr/klibc/arch/README.klibc.arch b/usr/klibc/arch/README.klibc.arch index 662b9d3f..c50144d0 100644 --- a/usr/klibc/arch/README.klibc.arch +++ b/usr/klibc/arch/README.klibc.arch @@ -77,5 +77,3 @@ e) Any support functions needed by gcc, *unless* they are in libgcc f) A link location for the shared klibc. This should be specified in SHAREDFLAGS in klibc/arch/*/MCONFIG. - - This is not applicable to no-MMU architectures. diff --git a/usr/klibc/brk.c b/usr/klibc/brk.c index df0bb7bd..cb87324d 100644 --- a/usr/klibc/brk.c +++ b/usr/klibc/brk.c @@ -7,8 +7,6 @@ #include <sys/types.h> #include "malloc.h" -#if !_KLIBC_NO_MMU /* uClinux doesn't have brk() */ - char *__current_brk; /* @@ -25,5 +23,3 @@ int brk(void *end_data_segment) __current_brk = new_brk; return 0; } - -#endif diff --git a/usr/klibc/fork.c b/usr/klibc/fork.c index b07486e9..f5c5d753 100644 --- a/usr/klibc/fork.c +++ b/usr/klibc/fork.c @@ -11,11 +11,11 @@ #include <sched.h> #include <klibc/sysconfig.h> -#if !_KLIBC_NO_MMU && !defined(__NR_fork) +#ifndef __NR_fork pid_t fork(void) { return __clone(SIGCHLD, 0); } -#endif /* __NR_fork */ +#endif diff --git a/usr/klibc/sbrk.c b/usr/klibc/sbrk.c index 4896ce0b..07597428 100644 --- a/usr/klibc/sbrk.c +++ b/usr/klibc/sbrk.c @@ -9,8 +9,6 @@ #include <errno.h> #include "malloc.h" -#if !_KLIBC_NO_MMU /* uClinux doesn't have brk() */ - char *__current_brk; /* Common with brk.c */ /* p is an address, a is alignment; must be a power of 2 */ @@ -41,5 +39,3 @@ void *sbrk(ptrdiff_t increment) __current_brk = new_brk; return start; } - -#endif /* !_KLIBC_NO_MMU */ diff --git a/usr/klibc/vfork.c b/usr/klibc/vfork.c index f2b1a85c..58c089b6 100644 --- a/usr/klibc/vfork.c +++ b/usr/klibc/vfork.c @@ -8,7 +8,7 @@ #include <klibc/compiler.h> #include <klibc/sysconfig.h> -#if !_KLIBC_NO_MMU && !_KLIBC_REAL_VFORK +#if !_KLIBC_REAL_VFORK int vfork(void) { return fork();