svn commit: trunk/uClibc: extra/Configs include libc/sysdeps/linux etc...

vda at uclibc.org vda at uclibc.org
Tue Jul 8 02:41:22 UTC 2008


Author: vda
Date: 2008-07-07 19:41:21 -0700 (Mon, 07 Jul 2008)
New Revision: 22677

Log:
New .config option UCLIBC_HAS_STUBS, enables fork() stub on NOMMU



Modified:
   trunk/uClibc/extra/Configs/Config.in
   trunk/uClibc/include/unistd.h
   trunk/uClibc/libc/sysdeps/linux/common/fork.c


Changeset:
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in	2008-07-07 23:20:09 UTC (rev 22676)
+++ trunk/uClibc/extra/Configs/Config.in	2008-07-08 02:41:21 UTC (rev 22677)
@@ -515,6 +515,23 @@
 	  Currently applies to bcopy/bzero/bcmp/index/rindex et al.
 	  WARNING! ABI incompatibility.
 
+config UCLIBC_HAS_STUBS
+	bool "Provide stubs for unavailable functionality"
+	default n
+	help
+	  With this option uClibc provides non-functional stubs for
+	  functions which are impossible to implement on the target
+	  architecture. Otherwise, such functions are simply omitted.
+
+	  As of 2008-07, this option makes uClibc provide fork() stub
+	  on NOMMU targets. It always sets errno to ENOSYS and returns -1.
+
+	  This may be useful if you port a lot of software and cannot
+	  audit all of it and replace or disable fork() usage.
+	  With this option, a program which uses fork() will build
+	  successfully. Of course, it may be useless if fork()
+	  is essential for its operation.
+
 config UCLIBC_HAS_SHADOW
 	bool "Shadow Password Support"
 	default y

Modified: trunk/uClibc/include/unistd.h
===================================================================
--- trunk/uClibc/include/unistd.h	2008-07-07 23:20:09 UTC (rev 22676)
+++ trunk/uClibc/include/unistd.h	2008-07-08 02:41:21 UTC (rev 22677)
@@ -717,7 +717,7 @@
 #endif
 
 
-#ifdef __ARCH_USE_MMU__
+#if defined __UCLIBC_HAS_STUBS__ || defined __ARCH_USE_MMU__
 /* Clone the calling process, creating an exact copy.
    Return -1 for errors, 0 to the new process,
    and the process ID of the new process to the old process.  */

Modified: trunk/uClibc/libc/sysdeps/linux/common/fork.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/fork.c	2008-07-07 23:20:09 UTC (rev 22676)
+++ trunk/uClibc/libc/sysdeps/linux/common/fork.c	2008-07-08 02:41:21 UTC (rev 22677)
@@ -11,6 +11,7 @@
 #include <unistd.h>
 
 #ifdef __ARCH_USE_MMU__
+
 #ifdef __NR_fork
 extern __typeof(fork) __libc_fork;
 #define __NR___libc_fork __NR_fork
@@ -19,4 +20,17 @@
 weak_alias(__libc_fork,fork)
 libc_hidden_weak(fork)
 #endif
+
+#elif defined __UCLIBC_HAS_STUBS__
+
+pid_t __libc_fork(void)
+{
+	__set_errno(ENOSYS);
+	return -1;
+}
+libc_hidden_proto(fork)
+weak_alias(__libc_fork,fork)
+libc_hidden_weak(fork)
+link_warning(fork, "fork: this function is not implemented on no-mmu systems")
+
 #endif




More information about the uClibc-cvs mailing list