summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/stubs.c
diff options
context:
space:
mode:
authorBen Wolsieffer <Ben.Wolsieffer@hefring.com>2023-09-14 11:02:42 -0400
committerWaldemar Brodkorb <wbx@openadk.org>2023-09-15 07:18:35 +0200
commit170619adce4eb73c175362851118364e143636a2 (patch)
treeccb51e296a88563224cc8037b9f60358cfe9fa2d /libc/sysdeps/linux/common/stubs.c
parentcf0e633c84ce83a5aaf39529b1c7595a0c46170b (diff)
fork: generate stub on no-MMU systems
fork() can be implemented using either the fork or clone syscalls on MMU systems. Therefore the stub is only generated if neither __NR_fork nor __NR_clone are defined. The stub code manually undefines __NR_fork on no-MMU systems in an attempt to enable the stub, but this doesn't work because __NR_clone is still defined. It is not appropriate to undefine __NR_clone because clone is available on no-MMU, it is just not capable of implementing fork. This patch directly enables the fork stub if __ARCH_USE_MMU__ is not defined. This eliminates the need to undefine __NR_fork, so this code is removed Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Diffstat (limited to 'libc/sysdeps/linux/common/stubs.c')
-rw-r--r--libc/sysdeps/linux/common/stubs.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index c17e509b9..634dcde0d 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -34,10 +34,6 @@ __attribute_used__ static int ret_enosys_stub(void)
link_warning(stub, #stub ": this function is not implemented") \
strong_alias(ret_enosys_stub, stub)
-#ifndef __ARCH_USE_MMU__
-# undef __NR_fork
-#endif
-
#ifdef __arm__
# define __NR_fadvise64_64 __NR_arm_fadvise64_64
# define __NR_fadvise64 __NR_arm_fadvise64_64
@@ -120,7 +116,7 @@ make_stub(fgetxattr)
make_stub(flistxattr)
#endif
-#if !defined __NR_fork && !defined __NR_clone
+#if !defined __ARCH_USE_MMU__ || (!defined __NR_fork && !defined __NR_clone)
make_stub(fork)
#endif