summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-15 16:15:58 +0200
committerwm4 <wm4@nowhere>2020-05-15 16:37:41 +0200
commit60f8cd4072ff244618f2c23dd12d6d8b2a5bf5f2 (patch)
tree9aa1bf8dfe1a8de26dd96917aca0f6818f295dfa /osdep
parent5309497727debfe1b268f915c5a41bdbe93ad9de (diff)
downloadmpv-60f8cd4072ff244618f2c23dd12d6d8b2a5bf5f2.tar.bz2
mpv-60f8cd4072ff244618f2c23dd12d6d8b2a5bf5f2.tar.xz
osdep: remove posix_spawn() helpers and wrappers
See previous commit. Farewell, useless shitty POSIX function.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/android/posix-spawn.c72
-rw-r--r--osdep/android/posix-spawn.h43
-rw-r--r--osdep/posix-spawn.h29
-rw-r--r--osdep/subprocess.c2
4 files changed, 1 insertions, 145 deletions
diff --git a/osdep/android/posix-spawn.c b/osdep/android/posix-spawn.c
deleted file mode 100644
index a9bb27a8d1..0000000000
--- a/osdep/android/posix-spawn.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * posix-spawn replacement for Android
- *
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <unistd.h>
-#include <errno.h>
-#include "osdep/android/posix-spawn.h"
-
-int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *fa, int fd, int newfd)
-{
- if (fa->used >= MAX_FILE_ACTIONS)
- return -1;
- fa->action[fa->used].filedes = fd;
- fa->action[fa->used].newfiledes = newfd;
- fa->used++;
- return 0;
-}
-
-int posix_spawn_file_actions_init(posix_spawn_file_actions_t *fa)
-{
- fa->used = 0;
- return 0;
-}
-
-int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *fa)
-{
- return 0;
-}
-
-int posix_spawnp(pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *fa,
- const posix_spawnattr_t *attrp,
- char *const argv[], char *const envp[])
-{
- pid_t p;
-
- if (attrp != NULL)
- return EINVAL;
-
- p = fork();
- if (p == -1)
- return errno;
-
- if (p == 0) {
- for (int i = 0; i < fa->used; i++) {
- int err = dup2(fa->action[i].filedes, fa->action[i].newfiledes);
- if (err == -1)
- goto fail;
- }
- execvpe(file, argv, envp);
-fail:
- _exit(127);
- }
-
- *pid = p;
- return 0;
-}
diff --git a/osdep/android/posix-spawn.h b/osdep/android/posix-spawn.h
deleted file mode 100644
index d995b993ec..0000000000
--- a/osdep/android/posix-spawn.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * posix-spawn replacement for Android
- *
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-#define MAX_FILE_ACTIONS 4
-
-typedef struct {
- char dummy;
-} posix_spawnattr_t; /* unsupported */
-
-typedef struct {
- int used;
- struct {
- int filedes, newfiledes;
- } action[MAX_FILE_ACTIONS];
-} posix_spawn_file_actions_t;
-
-int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int, int);
-int posix_spawn_file_actions_init(posix_spawn_file_actions_t*);
-int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t*);
-
-int posix_spawnp(pid_t*, const char*,
- const posix_spawn_file_actions_t*, const posix_spawnattr_t *,
- char *const [], char *const []);
diff --git a/osdep/posix-spawn.h b/osdep/posix-spawn.h
deleted file mode 100644
index fdba50149c..0000000000
--- a/osdep/posix-spawn.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * posix-spawn wrapper
- *
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "config.h"
-
-#if HAVE_ANDROID
-// posix_spawn(p) does not exist at all on Android
-#include "osdep/android/posix-spawn.h"
-#else
-#include <spawn.h>
-#endif
diff --git a/osdep/subprocess.c b/osdep/subprocess.c
index 8a930a60df..4b5770bf5c 100644
--- a/osdep/subprocess.c
+++ b/osdep/subprocess.c
@@ -29,7 +29,7 @@ void mp_devnull(void *ctx, char *data, size_t size)
{
}
-#if HAVE_POSIX_SPAWN
+#if HAVE_POSIX
int mp_subprocess(char **args, struct mp_cancel *cancel, void *ctx,
subprocess_read_cb on_stdout, subprocess_read_cb on_stderr,