summaryrefslogtreecommitdiffstats
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
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.
-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
-rw-r--r--wscript16
-rw-r--r--wscript_build.py3
6 files changed, 2 insertions, 163 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,
diff --git a/wscript b/wscript
index d0a5833dd9..96fab9d5e6 100644
--- a/wscript
+++ b/wscript
@@ -242,22 +242,6 @@ iconv support use --disable-iconv.",
'deps': 'os-win32 || os-cygwin',
'func': check_true
}, {
- 'name': 'posix-spawn-native',
- 'desc': 'spawnp()/kill() POSIX support',
- 'func': check_statement(['spawn.h', 'signal.h'],
- 'posix_spawnp(0,0,0,0,0,0); kill(0,0)'),
- 'deps': '!mingw && !tvos',
- }, {
- 'name': 'posix-spawn-android',
- 'desc': 'spawnp()/kill() Android replacement',
- 'func': check_true,
- 'deps': 'android && !posix-spawn-native',
- },{
- 'name': 'posix-spawn',
- 'desc': 'any spawnp()/kill() support',
- 'deps': 'posix-spawn-native || posix-spawn-android',
- 'func': check_true,
- }, {
'name': 'glob-posix',
'desc': 'glob() POSIX support',
'deps': '!(os-win32 || os-cygwin)',
diff --git a/wscript_build.py b/wscript_build.py
index 93933e7371..a35d1039e5 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -222,7 +222,7 @@ def build(ctx):
])
subprocess_c = ctx.pick_first_matching_dep([
- ( "osdep/subprocess-posix.c", "posix-spawn" ),
+ ( "osdep/subprocess-posix.c", "posix" ),
( "osdep/subprocess-win.c", "win32-desktop" ),
( "osdep/subprocess-dummy.c" ),
])
@@ -545,7 +545,6 @@ def build(ctx):
( timer_c ),
( "osdep/polldev.c", "posix" ),
- ( "osdep/android/posix-spawn.c", "android"),
( "osdep/android/strnlen.c", "android"),
( "osdep/glob-win.c", "glob-win32" ),
( "osdep/macosx_application.m", "cocoa" ),