|
|
00c0d4 |
commit 2a973ab7f1a6f6cd9be1c7257fd7b5d331515eab
|
|
|
00c0d4 |
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
00c0d4 |
Date: Wed Sep 12 10:30:46 2018 -0300
|
|
|
00c0d4 |
|
|
|
00c0d4 |
posix: Add internal symbols for posix_spawn interface
|
|
|
00c0d4 |
|
|
|
00c0d4 |
This patch adds internal hidden definition for mostly of the posix_spawn
|
|
|
00c0d4 |
function so it can be used internally on both popen and system
|
|
|
00c0d4 |
implementations.
|
|
|
00c0d4 |
|
|
|
00c0d4 |
Checked on x86_64-linux-gnu.
|
|
|
00c0d4 |
|
|
|
00c0d4 |
* include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose,
|
|
|
00c0d4 |
__posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy,
|
|
|
00c0d4 |
__posix_spawn_file_actions_init, __posix_spawnattr_init,
|
|
|
00c0d4 |
__posix_spawnattr_destroy, __posix_spawnattr_setflags,
|
|
|
00c0d4 |
__posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New
|
|
|
00c0d4 |
prototype.
|
|
|
00c0d4 |
* posix/spawn.c (__posix_spawn): Add libc_hidden_def.
|
|
|
00c0d4 |
* posix/spawn_faction_addclose.c
|
|
|
00c0d4 |
(__posix_spawn_file_actions_addclose): Add hidden definition.
|
|
|
00c0d4 |
* posix/spawn_faction_adddup2.c
|
|
|
00c0d4 |
(__posix_spawn_file_actions_adddup2): Likewise.
|
|
|
00c0d4 |
* posix/spawn_faction_destroy.c
|
|
|
00c0d4 |
(__posix_spawn_file_actions_destroy): Likewise.
|
|
|
00c0d4 |
* posix/spawn_faction_init.c (__posix_spawn_file_actions_init):
|
|
|
00c0d4 |
Likewise.
|
|
|
00c0d4 |
* posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise.
|
|
|
00c0d4 |
* posix/spawnattr_init.c (__posix_spawnattr_init): Likewise.
|
|
|
00c0d4 |
* posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault):
|
|
|
00c0d4 |
Likewise.
|
|
|
00c0d4 |
* posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise.
|
|
|
00c0d4 |
* posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask):
|
|
|
00c0d4 |
Likewise.
|
|
|
00c0d4 |
|
|
|
00c0d4 |
diff --git a/include/spawn.h b/include/spawn.h
|
|
|
00c0d4 |
index a6c7a8adc361927e..7fdd965bd780f8de 100644
|
|
|
00c0d4 |
--- a/include/spawn.h
|
|
|
00c0d4 |
+++ b/include/spawn.h
|
|
|
00c0d4 |
@@ -1 +1,36 @@
|
|
|
00c0d4 |
+#ifndef _SPAWN_H
|
|
|
00c0d4 |
#include <posix/spawn.h>
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+# ifndef _ISOMAC
|
|
|
00c0d4 |
+__typeof (posix_spawn) __posix_spawn;
|
|
|
00c0d4 |
+libc_hidden_proto (__posix_spawn)
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawn_file_actions_addclose)
|
|
|
00c0d4 |
+ __posix_spawn_file_actions_addclose attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawn_file_actions_adddup2)
|
|
|
00c0d4 |
+ __posix_spawn_file_actions_adddup2 attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawn_file_actions_destroy)
|
|
|
00c0d4 |
+ __posix_spawn_file_actions_destroy attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawn_file_actions_init) __posix_spawn_file_actions_init
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawnattr_init) __posix_spawnattr_init
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawnattr_destroy) __posix_spawnattr_destroy
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawnattr_setflags) __posix_spawnattr_setflags
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawnattr_setsigdefault) __posix_spawnattr_setsigdefault
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+__typeof (posix_spawnattr_setsigmask) __posix_spawnattr_setsigmask
|
|
|
00c0d4 |
+ attribute_hidden;
|
|
|
00c0d4 |
+
|
|
|
00c0d4 |
+# endif /* !_ISOMAC */
|
|
|
00c0d4 |
+#endif /* spawn.h */
|
|
|
00c0d4 |
diff --git a/posix/spawn.c b/posix/spawn.c
|
|
|
00c0d4 |
index 51f67b2755bd4949..a82f1c84e299f018 100644
|
|
|
00c0d4 |
--- a/posix/spawn.c
|
|
|
00c0d4 |
+++ b/posix/spawn.c
|
|
|
00c0d4 |
@@ -30,6 +30,7 @@ __posix_spawn (pid_t *pid, const char *path,
|
|
|
00c0d4 |
return __spawni (pid, path, file_actions, attrp, argv, envp, 0);
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
versioned_symbol (libc, __posix_spawn, posix_spawn, GLIBC_2_15);
|
|
|
00c0d4 |
+libc_hidden_def (__posix_spawn)
|
|
|
00c0d4 |
|
|
|
00c0d4 |
|
|
|
00c0d4 |
#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15)
|
|
|
00c0d4 |
diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c
|
|
|
00c0d4 |
index 21081e19b55db44c..e1fafe438cf15c91 100644
|
|
|
00c0d4 |
--- a/posix/spawn_faction_addclose.c
|
|
|
00c0d4 |
+++ b/posix/spawn_faction_addclose.c
|
|
|
00c0d4 |
@@ -24,8 +24,8 @@
|
|
|
00c0d4 |
/* Add an action to FILE-ACTIONS which tells the implementation to call
|
|
|
00c0d4 |
`close' for the given file descriptor during the `spawn' call. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
- int fd)
|
|
|
00c0d4 |
+__posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
+ int fd)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
struct __spawn_action *rec;
|
|
|
00c0d4 |
|
|
|
00c0d4 |
@@ -48,3 +48,5 @@ posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawn_file_actions_addclose,
|
|
|
00c0d4 |
+ posix_spawn_file_actions_addclose)
|
|
|
00c0d4 |
diff --git a/posix/spawn_faction_adddup2.c b/posix/spawn_faction_adddup2.c
|
|
|
00c0d4 |
index 363bc29ae502bd60..371b1de3e6f1979a 100644
|
|
|
00c0d4 |
--- a/posix/spawn_faction_adddup2.c
|
|
|
00c0d4 |
+++ b/posix/spawn_faction_adddup2.c
|
|
|
00c0d4 |
@@ -24,8 +24,8 @@
|
|
|
00c0d4 |
/* Add an action to FILE-ACTIONS which tells the implementation to call
|
|
|
00c0d4 |
`dup2' for the given file descriptors during the `spawn' call. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
- int fd, int newfd)
|
|
|
00c0d4 |
+__posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
+ int fd, int newfd)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
struct __spawn_action *rec;
|
|
|
00c0d4 |
|
|
|
00c0d4 |
@@ -49,3 +49,5 @@ posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawn_file_actions_adddup2,
|
|
|
00c0d4 |
+ posix_spawn_file_actions_adddup2)
|
|
|
00c0d4 |
diff --git a/posix/spawn_faction_destroy.c b/posix/spawn_faction_destroy.c
|
|
|
00c0d4 |
index 46061ee3473d4475..2a2de4e41d6bd6d0 100644
|
|
|
00c0d4 |
--- a/posix/spawn_faction_destroy.c
|
|
|
00c0d4 |
+++ b/posix/spawn_faction_destroy.c
|
|
|
00c0d4 |
@@ -22,7 +22,7 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Deallocate the file actions. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
+__posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Free the paths in the open actions. */
|
|
|
00c0d4 |
for (int i = 0; i < file_actions->__used; ++i)
|
|
|
00c0d4 |
@@ -44,3 +44,5 @@ posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
free (file_actions->__actions);
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawn_file_actions_destroy,
|
|
|
00c0d4 |
+ posix_spawn_file_actions_destroy)
|
|
|
00c0d4 |
diff --git a/posix/spawn_faction_init.c b/posix/spawn_faction_init.c
|
|
|
00c0d4 |
index ddb42e6a77ba41ec..98432067c645021e 100644
|
|
|
00c0d4 |
--- a/posix/spawn_faction_init.c
|
|
|
00c0d4 |
+++ b/posix/spawn_faction_init.c
|
|
|
00c0d4 |
@@ -45,9 +45,10 @@ __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Initialize data structure for file attribute for `spawn' call. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
+__posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Simply clear all the elements. */
|
|
|
00c0d4 |
memset (file_actions, '\0', sizeof (*file_actions));
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawn_file_actions_init, posix_spawn_file_actions_init)
|
|
|
00c0d4 |
diff --git a/posix/spawnattr_destroy.c b/posix/spawnattr_destroy.c
|
|
|
00c0d4 |
index 603e00fffefae2bf..043386778588913a 100644
|
|
|
00c0d4 |
--- a/posix/spawnattr_destroy.c
|
|
|
00c0d4 |
+++ b/posix/spawnattr_destroy.c
|
|
|
00c0d4 |
@@ -19,8 +19,9 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Initialize data structure for file attribute for `spawn' call. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawnattr_destroy (posix_spawnattr_t *attr)
|
|
|
00c0d4 |
+__posix_spawnattr_destroy (posix_spawnattr_t *attr)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Nothing to do in the moment. */
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawnattr_destroy, posix_spawnattr_destroy)
|
|
|
00c0d4 |
diff --git a/posix/spawnattr_init.c b/posix/spawnattr_init.c
|
|
|
00c0d4 |
index bab464e62bdf7889..4e1218ab44e3f779 100644
|
|
|
00c0d4 |
--- a/posix/spawnattr_init.c
|
|
|
00c0d4 |
+++ b/posix/spawnattr_init.c
|
|
|
00c0d4 |
@@ -20,7 +20,7 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Initialize data structure for file attribute for `spawn' call. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawnattr_init (posix_spawnattr_t *attr)
|
|
|
00c0d4 |
+__posix_spawnattr_init (posix_spawnattr_t *attr)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* All elements have to be initialized to the default values which
|
|
|
00c0d4 |
is generally zero. */
|
|
|
00c0d4 |
@@ -28,3 +28,4 @@ posix_spawnattr_init (posix_spawnattr_t *attr)
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawnattr_init, posix_spawnattr_init)
|
|
|
00c0d4 |
diff --git a/posix/spawnattr_setdefault.c b/posix/spawnattr_setdefault.c
|
|
|
00c0d4 |
index c77cda59be3dda20..174bcfa423dc5666 100644
|
|
|
00c0d4 |
--- a/posix/spawnattr_setdefault.c
|
|
|
00c0d4 |
+++ b/posix/spawnattr_setdefault.c
|
|
|
00c0d4 |
@@ -20,11 +20,12 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawnattr_setsigdefault (posix_spawnattr_t *attr,
|
|
|
00c0d4 |
- const sigset_t *sigdefault)
|
|
|
00c0d4 |
+__posix_spawnattr_setsigdefault (posix_spawnattr_t *attr,
|
|
|
00c0d4 |
+ const sigset_t *sigdefault)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Copy the sigset_t data to the user buffer. */
|
|
|
00c0d4 |
memcpy (&attr->__sd, sigdefault, sizeof (sigset_t));
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawnattr_setsigdefault, posix_spawnattr_setsigdefault)
|
|
|
00c0d4 |
diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c
|
|
|
00c0d4 |
index cf9a60181dc91ccd..0a42e94770224a94 100644
|
|
|
00c0d4 |
--- a/posix/spawnattr_setflags.c
|
|
|
00c0d4 |
+++ b/posix/spawnattr_setflags.c
|
|
|
00c0d4 |
@@ -30,7 +30,7 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Store flags in the attribute structure. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
|
|
|
00c0d4 |
+__posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Check no invalid bits are set. */
|
|
|
00c0d4 |
if (flags & ~ALL_FLAGS)
|
|
|
00c0d4 |
@@ -41,3 +41,4 @@ posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawnattr_setflags, posix_spawnattr_setflags)
|
|
|
00c0d4 |
diff --git a/posix/spawnattr_setsigmask.c b/posix/spawnattr_setsigmask.c
|
|
|
00c0d4 |
index 7ae81ad47025db6f..12c0111af441dd13 100644
|
|
|
00c0d4 |
--- a/posix/spawnattr_setsigmask.c
|
|
|
00c0d4 |
+++ b/posix/spawnattr_setsigmask.c
|
|
|
00c0d4 |
@@ -20,7 +20,7 @@
|
|
|
00c0d4 |
|
|
|
00c0d4 |
/* Set signal mask for the new process in ATTR to SIGMASK. */
|
|
|
00c0d4 |
int
|
|
|
00c0d4 |
-posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
|
|
|
00c0d4 |
+__posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
|
|
|
00c0d4 |
const sigset_t *sigmask)
|
|
|
00c0d4 |
{
|
|
|
00c0d4 |
/* Copy the sigset_t data to the user buffer. */
|
|
|
00c0d4 |
@@ -28,3 +28,4 @@ posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
|
|
|
00c0d4 |
|
|
|
00c0d4 |
return 0;
|
|
|
00c0d4 |
}
|
|
|
00c0d4 |
+weak_alias (__posix_spawnattr_setsigmask, posix_spawnattr_setsigmask)
|