@@ -78,6 +78,13 @@ struct __spawn_action
#define SPAWN_XFLAGS_TRY_SHELL 0x2
#define SPAWN_XFLAGS_RET_PIDFD 0x4
+/* The Unix standard contains a long explanation of the way to signal
+ an error after the fork() was successful. Since no new wait status
+ was wanted there is no way to signal an error using one of the
+ available methods. The committee chose to signal an error by a
+ normal program exit with the exit code 127. */
+#define SPAWN_ERROR 127
+
extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *
file_actions)
attribute_hidden;
@@ -19,15 +19,7 @@
#include <errno.h>
#include <spawn.h>
#include "spawn_int.h"
-
-
-/* The Unix standard contains a long explanation of the way to signal
- an error after the fork() was successful. Since no new wait status
- was wanted there is no way to signal an error using one of the
- available methods. The committee chose to signal an error by a
- normal program exit with the exit code 127. */
-#define SPAWN_ERROR 127
-
+#include <arch-spawni.h>
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS. */
@@ -37,8 +29,5 @@ __spawni (pid_t *pid, const char *file,
const posix_spawnattr_t *attrp, char *const argv[],
char *const envp[], int xflags)
{
- __set_errno (ENOSYS);
- return -1;
+ return __arch_spawni (pid, file, file_actions, attrp, argv, envp, xflags);
}
-
-stub_warning (__spawni)
new file mode 100644
@@ -0,0 +1,27 @@
+/* Architecture-specific __spawni implementation. Stub version.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library 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.
+
+ The GNU C Library 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 the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+static int
+__arch_spawni (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[], int xflags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
similarity index 99%
rename from sysdeps/mach/hurd/spawni.c
rename to sysdeps/mach/hurd/arch-spawni.h
@@ -36,12 +36,12 @@
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS. */
-int
-__spawni (pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp,
- char *const argv[], char *const envp[],
- int xflags)
+static int
+__arch_spawni (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp,
+ char *const argv[], char *const envp[],
+ int xflags)
{
pid_t new_pid;
char *path, *p, *name;
similarity index 96%
rename from sysdeps/unix/sysv/linux/spawni.c
rename to sysdeps/unix/sysv/linux/arch-spawni.h
@@ -47,14 +47,6 @@
child has either exec'ed successfully or exited. */
-/* The Unix standard contains a long explanation of the way to signal
- an error after the fork() was successful. Since no new wait status
- was wanted there is no way to signal an error using one of the
- available methods. The committee chose to signal an error by a
- normal program exit with the exit code 127. */
-#define SPAWN_ERROR 127
-
-
struct posix_spawn_args
{
internal_sigset_t oldmask;
@@ -483,11 +475,11 @@ __spawnix (int *pid, const char *file,
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS. */
-int
-__spawni (pid_t * pid, const char *file,
- const posix_spawn_file_actions_t * acts,
- const posix_spawnattr_t * attrp, char *const argv[],
- char *const envp[], int xflags)
+static int
+__arch_spawni (pid_t * pid, const char *file,
+ const posix_spawn_file_actions_t * acts,
+ const posix_spawnattr_t * attrp, char *const argv[],
+ char *const envp[], int xflags)
{
/* It uses __execvpex to avoid run ENOEXEC in non compatibility mode (it
will be handled by maybe_script_execute). */