]> granicus.if.org Git - sudo/commitdiff
Add configure checks for the exec functions we will dummy out. This
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 21 Aug 2013 16:09:04 +0000 (10:09 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 21 Aug 2013 16:09:04 +0000 (10:09 -0600)
is only really needed on Mac OS X when symbol interposition is being
performed but won't hurt elsewhere.

config.h.in
configure
configure.in
src/sudo_noexec.c

index c822214102e1e5911aca8243314b70af73c2e2a1..1528cbc3439dd1d88c5f3e07807e0d92f5bf709c 100644 (file)
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
+/* Define to 1 if you have the `exect' function. */
+#undef HAVE_EXECT
+
+/* Define to 1 if you have the `execvP' function. */
+#undef HAVE_EXECVP
+
+/* Define to 1 if you have the `execvpe' function. */
+#undef HAVE_EXECVPE
+
 /* Define to 1 if your system has the F_CLOSEM fcntl. */
 #undef HAVE_FCNTL_CLOSEM
 
+/* Define to 1 if you have the `fexecve' function. */
+#undef HAVE_FEXECVE
+
 /* Define to 1 if you have the `fgetln' function. */
 #undef HAVE_FGETLN
 
 /* Define to 1 if you have the `posix_openpt' function. */
 #undef HAVE_POSIX_OPENPT
 
+/* Define to 1 if you have the `posix_spawn' function. */
+#undef HAVE_POSIX_SPAWN
+
+/* Define to 1 if you have the `posix_spawnp' function. */
+#undef HAVE_POSIX_SPAWNP
+
 /* Define to 1 if you have the `priv_set' function. */
 #undef HAVE_PRIV_SET
 
 /* Define to 1 if the system has the type `_Bool'. */
 #undef HAVE__BOOL
 
+/* Define to 1 if you have the `_execl' function. */
+#undef HAVE__EXECL
+
+/* Define to 1 if you have the `_execle' function. */
+#undef HAVE__EXECLE
+
+/* Define to 1 if you have the `_execlp' function. */
+#undef HAVE__EXECLP
+
+/* Define to 1 if you have the `_exect' function. */
+#undef HAVE__EXECT
+
+/* Define to 1 if you have the `_execv' function. */
+#undef HAVE__EXECV
+
+/* Define to 1 if you have the `_execve' function. */
+#undef HAVE__EXECVE
+
+/* Define to 1 if you have the `_execvP' function. */
+#undef HAVE__EXECVP
+
+/* Define to 1 if you have the `_execvpe' function. */
+#undef HAVE__EXECVPE
+
+/* Define to 1 if you have the `_fexecve' function. */
+#undef HAVE__FEXECVE
+
 /* Define to 1 if you have the `_getpty' function. */
 #undef HAVE__GETPTY
 
 /* Define to 1 if you have the `_nss_XbyY_buf_alloc' function. */
 #undef HAVE__NSS_XBYY_BUF_ALLOC
 
+/* Define to 1 if you have the `_posix_spawn' function. */
+#undef HAVE__POSIX_SPAWN
+
+/* Define to 1 if you have the `_posix_spawnp' function. */
+#undef HAVE__POSIX_SPAWNP
+
 /* Define to 1 if you have the `_ttyname_dev' function. */
 #undef HAVE__TTYNAME_DEV
 
+/* Define to 1 if you have the `__execl' function. */
+#undef HAVE___EXECL
+
+/* Define to 1 if you have the `__execle' function. */
+#undef HAVE___EXECLE
+
+/* Define to 1 if you have the `__execlp' function. */
+#undef HAVE___EXECLP
+
+/* Define to 1 if you have the `__exect' function. */
+#undef HAVE___EXECT
+
+/* Define to 1 if you have the `__execv' function. */
+#undef HAVE___EXECV
+
+/* Define to 1 if you have the `__execve' function. */
+#undef HAVE___EXECVE
+
+/* Define to 1 if you have the `__execvP' function. */
+#undef HAVE___EXECVP
+
+/* Define to 1 if you have the `__execvpe' function. */
+#undef HAVE___EXECVPE
+
+/* Define to 1 if you have the `__fexecve' function. */
+#undef HAVE___FEXECVE
+
 /* Define to 1 if the compiler supports the C99 __func__ variable. */
 #undef HAVE___FUNC__
 
 /* Define to 1 if you have the `__nss_XbyY_buf_alloc' function. */
 #undef HAVE___NSS_XBYY_BUF_ALLOC
 
+/* Define to 1 if you have the `__posix_spawn' function. */
+#undef HAVE___POSIX_SPAWN
+
+/* Define to 1 if you have the `__posix_spawnp' function. */
+#undef HAVE___POSIX_SPAWNP
+
 /* Define to 1 if your crt0.o defines the __progname symbol for you. */
 #undef HAVE___PROGNAME
 
index 42f408a8ac73a9ac4d344f1af0d2c5ba9208d6c7..8dfda0d977a3aea00fa385f09fe55af5cc3a9203 100755 (executable)
--- a/configure
+++ b/configure
@@ -14586,6 +14586,7 @@ done
                if test $OSMAJOR -ge 8; then
                    $as_echo "#define HAVE___INTERPOSE 1" >>confdefs.h
 
+                   dlyld_interpose=yes
                else
                    RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
                fi
 fi
 
 fi
+if test X"$with_noexec" != X"no"; then
+    # Check for underscore versions of standard exec functions
+    # unless we are using dyld symbole interposition
+    if test X"$dlyld_interpose" != X"yes"; then
+       for ac_func in _execl __execl
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       for ac_func in _execle __execle
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       for ac_func in _execlp __execlp
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       for ac_func in _execv __execv
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       for ac_func in _execve __execve
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       for ac_func in _execvp __execvp
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+    fi
+    # Check for non-standard exec functions including underscore versions
+    for ac_func in exect
+do :
+  ac_fn_c_check_func "$LINENO" "exect" "ac_cv_func_exect"
+if test "x$ac_cv_func_exect" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_EXECT 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _exect __exect
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+    for ac_func in execvP
+do :
+  ac_fn_c_check_func "$LINENO" "execvP" "ac_cv_func_execvP"
+if test "x$ac_cv_func_execvP" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_EXECVP 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _execvP __execvP
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+    for ac_func in execvpe
+do :
+  ac_fn_c_check_func "$LINENO" "execvpe" "ac_cv_func_execvpe"
+if test "x$ac_cv_func_execvpe" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_EXECVPE 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _execvpe __execvpe
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+    for ac_func in fexecve
+do :
+  ac_fn_c_check_func "$LINENO" "fexecve" "ac_cv_func_fexecve"
+if test "x$ac_cv_func_fexecve" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_FEXECVE 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _fexecve __fexecve
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+    # Check for posix_spawn, posix_spawnp and any underscore versions
+    for ac_func in posix_spawn
+do :
+  ac_fn_c_check_func "$LINENO" "posix_spawn" "ac_cv_func_posix_spawn"
+if test "x$ac_cv_func_posix_spawn" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_POSIX_SPAWN 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _posix_spawn __posix_spawn
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+    for ac_func in posix_spawnp
+do :
+  ac_fn_c_check_func "$LINENO" "posix_spawnp" "ac_cv_func_posix_spawnp"
+if test "x$ac_cv_func_posix_spawnp" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_POSIX_SPAWNP 1
+_ACEOF
+
+       if test X"$dlyld_interpose" != X"yes"; then
+           for ac_func in _posix_spawnp __posix_spawnp
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+       fi
+
+fi
+done
+
+fi
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
index 72c701a847424a67985aa71a02d1c740c66a4390..383cadc66105a8773e8f9ac33f403c0e75847778 100644 (file)
@@ -1966,6 +1966,7 @@ case "$host" in
                # Darwin 8 and above can interpose library symbols cleanly
                if test $OSMAJOR -ge 8; then
                    AC_DEFINE(HAVE___INTERPOSE)
+                   dlyld_interpose=yes
                else
                    RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
                fi
@@ -2392,6 +2393,54 @@ if test X"$ac_cv_type_struct_timespec" != X"no"; then
        [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
        [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
 fi
+dnl
+dnl Function checks for sudo_noexec
+dnl
+if test X"$with_noexec" != X"no"; then
+    # Check for underscore versions of standard exec functions
+    # unless we are using dyld symbole interposition
+    if test X"$dlyld_interpose" != X"yes"; then
+       AC_CHECK_FUNCS(_execl __execl)
+       AC_CHECK_FUNCS(_execle __execle)
+       AC_CHECK_FUNCS(_execlp __execlp)
+       AC_CHECK_FUNCS(_execv __execv)
+       AC_CHECK_FUNCS(_execve __execve)
+       AC_CHECK_FUNCS(_execvp __execvp)
+    fi
+    # Check for non-standard exec functions including underscore versions
+    AC_CHECK_FUNCS(exect, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_exect __exect)
+       fi
+    ])
+    AC_CHECK_FUNCS(execvP, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_execvP __execvP)
+       fi
+    ])
+    AC_CHECK_FUNCS(execvpe, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_execvpe __execvpe)
+       fi
+    ])
+    AC_CHECK_FUNCS(fexecve, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_fexecve __fexecve)
+       fi
+    ])
+    # Check for posix_spawn, posix_spawnp and any underscore versions
+    AC_CHECK_FUNCS(posix_spawn, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_posix_spawn __posix_spawn)
+       fi
+    ])
+    AC_CHECK_FUNCS(posix_spawnp, [
+       if test X"$dlyld_interpose" != X"yes"; then
+           AC_CHECK_FUNCS(_posix_spawnp __posix_spawnp)
+       fi
+    ])
+fi
+
 dnl
 dnl Check for the dirfd function/macro.  If not found, look for dd_fd in DIR.
 dnl
index 59fb7ce003403be7ab236fa59c2d08ce827db0a7..8bdf1bab156574bc306e392cd66c7ba716255951 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2005, 2010-2012 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2004-2005, 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -39,22 +39,22 @@ typedef struct interpose_s {
     void *orig_func;
 } interpose_t;
 
-# define FN_NAME(fn)   my_ ## fn
+# define FN_NAME(fn)   dummy_ ## fn
 # define INTERPOSE(fn) \
-    __attribute__((used)) static const interpose_t _interpose_ ## fn \
-    __attribute__((section("__DATA,__interpose"))) = \
-       { (void *)my_ ## fn, (void *)fn };
+    __attribute__((__used__)) static const interpose_t interpose_ ## fn \
+    __attribute__((__section__("__DATA,__interpose"))) = \
+       { (void *)dummy_ ## fn, (void *)fn };
 #else
 # define FN_NAME(fn)   fn
 # define INTERPOSE(fn)
 #endif
 
 /*
- * Dummy versions of the execve() family of syscalls.  We don't need
- * to stub out all of them, just the ones that correspond to actual
- * system calls (which varies by OS).  Note that it is still possible
- * to access the real syscalls via the syscall() interface but very
- * few programs actually do that.
+ * Dummy versions of the exec(3) family of syscalls.  It is not enough
+ * to just dummy out execve(2) since some C libraries use direct syscalls
+ * for the other functions instead of calling execve(2).  Note that it is
+ * still possible to access the real syscalls via the syscall(2) interface
+ * but very few programs actually do that.
  */
 
 #define DUMMY_BODY                             \
@@ -87,51 +87,118 @@ FN_NAME(fn)(t1 a1, t2 a2, ...)                     \
 DUMMY_BODY                                     \
 INTERPOSE(fn)
 
+/*
+ * Standard exec(3) family of functions.
+ */
 DUMMY_VA(execl, const char *, const char *)
 DUMMY_VA(execle, const char *, const char *)
 DUMMY_VA(execlp, const char *, const char *)
 DUMMY2(execv, const char *, char * const *)
 DUMMY2(execvp, const char *, char * const *)
-DUMMY3(execvP, const char *, const char *, char * const *)
 DUMMY3(execve, const char *, char * const *, char * const *)
 
-#ifndef __APPLE__
 /*
- * On Mac OS X we can only define functions that actually
- * exist on the system due to how interposition is done.
+ * Private versions of the above.
  */
-DUMMY3(exect, const char *, char * const *, char * const *)
-DUMMY3(execvpe, const char *, char * const *, char * const *)
-DUMMY3(fexecve, int , char * const *, char * const *)
+#ifdef HAVE__EXECL
 DUMMY_VA(_execl, const char *, const char *)
-DUMMY_VA(_execle, const char *, const char *)
-DUMMY_VA(_execlp, const char *, const char *)
-DUMMY3(_exect, const char *, char * const *, char * const *)
-DUMMY2(_execv, const char *, char * const *)
-DUMMY2(_execvp, const char *, char * const *)
-DUMMY3(_execvP, const char *, const char *, char * const *)
-DUMMY3(_execve, const char *, char * const *, char * const *)
-DUMMY3(_execvpe, const char *, char * const *, char * const *)
-DUMMY3(_fexecve, int , char * const *, char * const *)
+#endif
+#ifdef HAVE___EXECL
 DUMMY_VA(__execl, const char *, const char *)
+#endif
+#ifdef HAVE__EXECLE
+DUMMY_VA(_execle, const char *, const char *)
+#endif
+#ifdef HAVE___EXECLE
 DUMMY_VA(__execle, const char *, const char *)
+#endif
+#ifdef HAVE__EXECLP
+DUMMY_VA(_execlp, const char *, const char *)
+#endif
+#ifdef HAVE___EXECLP
 DUMMY_VA(__execlp, const char *, const char *)
-DUMMY3(__exect, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE__EXECV
+DUMMY2(_execv, const char *, char * const *)
+#endif
+#ifdef HAVE___EXECV
 DUMMY2(__execv, const char *, char * const *)
+#endif
+#ifdef HAVE__EXECVP
+DUMMY2(_execvp, const char *, char * const *)
+#endif
+#ifdef HAVE___EXECVP
 DUMMY2(__execvp, const char *, char * const *)
-DUMMY3(__execvP, const char *, const char *, char * const *)
+#endif
+#ifdef HAVE__EXECVE
+DUMMY3(_execve, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE___EXECVE
 DUMMY3(__execve, const char *, char * const *, char * const *)
+#endif
+
+/*
+ * Non-standard exec functions and corresponding private versions.
+ */
+#ifdef HAVE_EXECVP
+DUMMY3(execvP, const char *, const char *, char * const *)
+#endif
+#ifdef HAVE__EXECVP
+DUMMY3(_execvP, const char *, const char *, char * const *)
+#endif
+#ifdef HAVE___EXECVP
+DUMMY3(__execvP, const char *, const char *, char * const *)
+#endif
+
+#ifdef HAVE_EXECVPE
+DUMMY3(execvpe, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE__EXECVPE
+DUMMY3(_execvpe, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE___EXECVPE
 DUMMY3(__execvpe, const char *, char * const *, char * const *)
+#endif
+
+#ifdef HAVE_EXECT
+DUMMY3(exect, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE__EXECT
+DUMMY3(_exect, const char *, char * const *, char * const *)
+#endif
+#ifdef HAVE___EXECT
+DUMMY3(__exect, const char *, char * const *, char * const *)
+#endif
+
+#ifdef HAVE_FEXECVE
+DUMMY3(fexecve, int , char * const *, char * const *)
+#endif
+#ifdef HAVE__FEXECVE
+DUMMY3(_fexecve, int , char * const *, char * const *)
+#endif
+#ifdef HAVE___FEXECVE
 DUMMY3(__fexecve, int , char * const *, char * const *)
-#endif /* __APPLE__ */
+#endif
 
-#ifdef HAVE_SPAWN_H
+/*
+ * posix_spawn, posix_spawnp and any private versions.
+ */
+#ifdef HAVE_POSIX_SPAWN
 DUMMY6(posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
-DUMMY6(posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
-# ifndef __APPLE__
+#endif
+#ifdef HAVE__POSIX_SPAWN
 DUMMY6(_posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
-DUMMY6(_posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
+#endif
+#ifdef HAVE___POSIX_SPAWN
 DUMMY6(__posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
+#endif
+
+#ifdef HAVE_POSIX_SPAWNP
+DUMMY6(posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
+#endif
+#ifdef HAVE_POSIX__SPAWNP
+DUMMY6(_posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
+#endif
+#ifdef HAVE_POSIX___SPAWNP
 DUMMY6(__posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
-# endif /* __APPLE__ */
-#endif /* HAVE_SPAWN_H */
+#endif