Loading...
--- Libc/Libc-1725.40.4/stdlib/FreeBSD/system.c
+++ Libc/Libc-825.25/stdlib/FreeBSD/system.c
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wstrict-prototypes"
-
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
@@ -52,25 +49,20 @@
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
-#include <TargetConditionals.h>
-
#if __DARWIN_UNIX03
#include <pthread.h>
-#if !(TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS))
static pthread_mutex_t __systemfn_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
extern int __unix_conforming;
+#ifdef VARIANT_CANCELABLE
+extern void _pthread_testcancel(pthread_t thread, int isconforming);
+#endif /* VARIANT_CANCELABLE */
#endif /* __DARWIN_UNIX03 */
int
__system(command)
const char *command;
{
-#if TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS)
- // Don't abort() on iOS for now
- LIBC_ABORT("system() is not supported on this platform.");
-#else
pid_t pid, savedpid;
int pstat, err;
struct sigaction ign, intact, quitact;
@@ -83,19 +75,15 @@
if (__unix_conforming == 0)
__unix_conforming = 1;
#ifdef VARIANT_CANCELABLE
- pthread_testcancel();
+ _pthread_testcancel(pthread_self(), 1);
#endif /* VARIANT_CANCELABLE */
#endif /* __DARWIN_UNIX03 */
if (!command) { /* just checking... */
-#if TARGET_OS_IPHONE
- return(0);
-#else
if (access(_PATH_BSHELL, F_OK) == -1) /* if no sh or no access */
return(0);
else
return(1);
-#endif
}
if ((err = posix_spawnattr_init(&attr)) != 0) {
@@ -154,10 +142,7 @@
pthread_mutex_unlock(&__systemfn_mutex);
#endif /* __DARWIN_UNIX03 */
return(pstat);
-#endif /* TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS) */
}
__weak_reference(__system, system);
__weak_reference(__system, _system);
-
-#pragma clang diagnostic pop