summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-06-19 14:20:05 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-07-18 19:09:30 +0200
commitc8d9106a0d3217c385f6afe572d904d9d77b8c8b (patch)
treec145461f0f785b4a434b8bc7bf46dd7907068400
parent26a5af8591ca79eb32ca5d510d8be06527b12fc1 (diff)
downloadunit-c8d9106a0d3217c385f6afe572d904d9d77b8c8b.tar.gz
unit-c8d9106a0d3217c385f6afe572d904d9d77b8c8b.tar.bz2
Removed code used when NXT_HAVE_POSIX_SPAWN is false.
posix_spawn(3POSIX) was introduced by POSIX.1d (IEEE Std 1003.1d-1999), and was later consolidated in POSIX.1-2001, requiring it in all POSIX-compliant systems. It's safe to assume it's always available, more than 20 years after its standardization. Link: <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/spawn.h.html>
-rw-r--r--auto/unix15
-rw-r--r--src/nxt_process.c48
-rw-r--r--src/nxt_unix.h2
3 files changed, 0 insertions, 65 deletions
diff --git a/auto/unix b/auto/unix
index 7c241650..45c6a139 100644
--- a/auto/unix
+++ b/auto/unix
@@ -178,21 +178,6 @@ if [ $nxt_found = no ]; then
fi
-nxt_feature="posix_spawn()"
-nxt_feature_name=NXT_HAVE_POSIX_SPAWN
-nxt_feature_run=
-nxt_feature_incs=
-nxt_feature_libs=
-nxt_feature_test="#include <spawn.h>
- #include <unistd.h>
-
- int main(int argc, char *argv[]) {
- (void) posix_spawn(NULL, \"\", NULL, NULL, argv, NULL);
- return 0;
- }"
-. auto/feature
-
-
# NetBSD 1.0, OpenBSD 1.0, FreeBSD 2.2 setproctitle().
nxt_feature="setproctitle()"
diff --git a/src/nxt_process.c b/src/nxt_process.c
index 82e66a99..98636bbe 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -798,8 +798,6 @@ nxt_process_send_ready(nxt_task_t *task, nxt_process_t *process)
}
-#if (NXT_HAVE_POSIX_SPAWN)
-
/*
* Linux glibc 2.2 posix_spawn() is implemented via fork()/execve().
* Linux glibc 2.4 posix_spawn() without file actions and spawn
@@ -834,52 +832,6 @@ nxt_process_execute(nxt_task_t *task, char *name, char **argv, char **envp)
return pid;
}
-#else
-
-nxt_pid_t
-nxt_process_execute(nxt_task_t *task, char *name, char **argv, char **envp)
-{
- nxt_pid_t pid;
-
- /*
- * vfork() is better than fork() because:
- * it is faster several times;
- * its execution time does not depend on private memory mapping size;
- * it has lesser chances to fail due to the ENOMEM error.
- */
-
- pid = vfork();
-
- switch (pid) {
-
- case -1:
- nxt_alert(task, "vfork() failed while executing \"%s\" %E",
- name, nxt_errno);
- break;
-
- case 0:
- /* A child. */
- nxt_debug(task, "execve(\"%s\")", name);
-
- (void) execve(name, argv, envp);
-
- nxt_alert(task, "execve(\"%s\") failed %E", name, nxt_errno);
-
- exit(1);
- nxt_unreachable();
- break;
-
- default:
- /* A parent. */
- nxt_debug(task, "vfork(): %PI", pid);
- break;
- }
-
- return pid;
-}
-
-#endif
-
nxt_int_t
nxt_process_daemon(nxt_task_t *task)
diff --git a/src/nxt_unix.h b/src/nxt_unix.h
index d8eaabc3..6bc6be5e 100644
--- a/src/nxt_unix.h
+++ b/src/nxt_unix.h
@@ -156,9 +156,7 @@
#include <setjmp.h>
#include <sched.h>
#include <signal.h>
-#if (NXT_HAVE_POSIX_SPAWN)
#include <spawn.h>
-#endif
#include <stdarg.h>
#include <stddef.h> /* offsetof() */
#include <stdio.h>