[v2,1/3] posix: Add internal symbols for posix_spawn interface
Commit Message
This patch adds internal hidden definition for mostly of the posix_spawn
function so it can be used internally on both popen and system
implementations.
Checked on x86_64-linux-gnu.
* include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose,
__posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy,
__posix_spawn_file_actions_init, __posix_spawnattr_init,
__posix_spawnattr_destroy, __posix_spawnattr_setflags,
__posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New
prototype.
* posix/spawn.c (__posix_spawn): Add libc_hidden_def.
* posix/spawn_faction_addclose.c
(__posix_spawn_file_actions_addclose): Add hidden definition.
* posix/spawn_faction_adddup2.c
(__posix_spawn_file_actions_adddup2): Likewise.
* posix/spawn_faction_destroy.c
(__posix_spawn_file_actions_destroy): Likewise.
* posix/spawn_faction_init.c (__posix_spawn_file_actions_init):
Likewise.
* posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise.
* posix/spawnattr_init.c (__posix_spawnattr_init): Likewise.
* posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault):
Likewise.
* posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise.
* posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask):
Likewise.
---
ChangeLog | 25 ++++++++++++++++++++++++
include/spawn.h | 35 ++++++++++++++++++++++++++++++++++
posix/spawn.c | 1 +
posix/spawn_faction_addclose.c | 6 ++++--
posix/spawn_faction_adddup2.c | 6 ++++--
posix/spawn_faction_destroy.c | 4 +++-
posix/spawn_faction_init.c | 3 ++-
posix/spawnattr_destroy.c | 3 ++-
posix/spawnattr_init.c | 3 ++-
posix/spawnattr_setdefault.c | 5 +++--
posix/spawnattr_setflags.c | 3 ++-
posix/spawnattr_setsigmask.c | 3 ++-
12 files changed, 85 insertions(+), 12 deletions(-)
Comments
* Adhemerval Zanella:
> This patch adds internal hidden definition for mostly of the posix_spawn
> function so it can be used internally on both popen and system
> implementations.
>
> Checked on x86_64-linux-gnu.
>
> * include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose,
> __posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy,
> __posix_spawn_file_actions_init, __posix_spawnattr_init,
> __posix_spawnattr_destroy, __posix_spawnattr_setflags,
> __posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New
> prototype.
> * posix/spawn.c (__posix_spawn): Add libc_hidden_def.
> * posix/spawn_faction_addclose.c
> (__posix_spawn_file_actions_addclose): Add hidden definition.
> * posix/spawn_faction_adddup2.c
> (__posix_spawn_file_actions_adddup2): Likewise.
> * posix/spawn_faction_destroy.c
> (__posix_spawn_file_actions_destroy): Likewise.
> * posix/spawn_faction_init.c (__posix_spawn_file_actions_init):
> Likewise.
> * posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise.
> * posix/spawnattr_init.c (__posix_spawnattr_init): Likewise.
> * posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault):
> Likewise.
> * posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise.
> * posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask):
> Likewise.
Looks okay to me.
Thanks,
Florian
Hi,
Le Wed, 24 Oct 2018 11:52:41 +0200, Florian Weimer <fweimer@redhat.com>
a écrit :
> * Adhemerval Zanella:
>
> > This patch adds internal hidden definition for mostly of the posix_spawn
> > function so it can be used internally on both popen and system
> > implementations.
> >
> > Checked on x86_64-linux-gnu.
> >
> > * include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose,
> > __posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy,
> > __posix_spawn_file_actions_init, __posix_spawnattr_init,
> > __posix_spawnattr_destroy, __posix_spawnattr_setflags,
> > __posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New
> > prototype.
> > * posix/spawn.c (__posix_spawn): Add libc_hidden_def.
> > * posix/spawn_faction_addclose.c
> > (__posix_spawn_file_actions_addclose): Add hidden definition.
> > * posix/spawn_faction_adddup2.c
> > (__posix_spawn_file_actions_adddup2): Likewise.
> > * posix/spawn_faction_destroy.c
> > (__posix_spawn_file_actions_destroy): Likewise.
> > * posix/spawn_faction_init.c (__posix_spawn_file_actions_init):
> > Likewise.
> > * posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise.
> > * posix/spawnattr_init.c (__posix_spawnattr_init): Likewise.
> > * posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault):
> > Likewise.
> > * posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise.
> > * posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask):
> > Likewise.
>
> Looks okay to me.
>
> Thanks,
> Florian
The ChangeLog date on the master branch for this patch is off by one
month (2018-09-24 instead of 2018-10-24).
Cordialement,
Albert ARIBAUD
3ADEV
* Albert ARIBAUD:
> The ChangeLog date on the master branch for this patch is off by one
> month (2018-09-24 instead of 2018-10-24).
Oops. Please fix it in a new commit. Thanks.
Florian
Hi Florian,
On Wed, 24 Oct 2018 21:40:40 +0200, Florian Weimer <fweimer@redhat.com>
wrote :
> * Albert ARIBAUD:
>
> > The ChangeLog date on the master branch for this patch is off by one
> > month (2018-09-24 instead of 2018-10-24).
>
> Oops. Please fix it in a new commit. Thanks.
You mean in a separate commit just for this, or along one already
planned commit? Because I have "[v13 1/2] Y2038: Add 64-bit
time for all architectures" ready to commit right now, and I could slip
the fix in it.
> Florian
Cordialement,
Albert ARIBAUD
3ADEV
* Albert ARIBAUD:
> Hi Florian,
>
> On Wed, 24 Oct 2018 21:40:40 +0200, Florian Weimer <fweimer@redhat.com>
> wrote :
>
>> * Albert ARIBAUD:
>>
>> > The ChangeLog date on the master branch for this patch is off by one
>> > month (2018-09-24 instead of 2018-10-24).
>>
>> Oops. Please fix it in a new commit. Thanks.
>
> You mean in a separate commit just for this, or along one already
> planned commit?
No, please use a separate commit. Commits are cheap.
Thanks,
Florian
On Wed, 24 Oct 2018 21:45:21 +0200, Albert ARIBAUD
<albert.aribaud@3adev.fr> wrote :
> Hi Florian,
>
> On Wed, 24 Oct 2018 21:40:40 +0200, Florian Weimer <fweimer@redhat.com>
> wrote :
>
> > * Albert ARIBAUD:
> >
> > > The ChangeLog date on the master branch for this patch is off by one
> > > month (2018-09-24 instead of 2018-10-24).
> >
> > Oops. Please fix it in a new commit. Thanks.
>
> You mean in a separate commit just for this, or along one already
> planned commit? Because I have "[v13 1/2] Y2038: Add 64-bit
> time for all architectures" ready to commit right now, and I could slip
> the fix in it.
Also: should I mention the typo fix in my commit message?
Cordialement,
Albert ARIBAUD
3ADEV
Hi Florian,
Le Wed, 24 Oct 2018 21:47:05 +0200, Florian Weimer <fweimer@redhat.com>
a écrit :
> * Albert ARIBAUD:
>
> > Hi Florian,
> >
> > On Wed, 24 Oct 2018 21:40:40 +0200, Florian Weimer <fweimer@redhat.com>
> > wrote :
> >
> >> * Albert ARIBAUD:
> >>
> [...]
> >>
> >> Oops. Please fix it in a new commit. Thanks.
> >
> > You mean in a separate commit just for this, or along one already
> > planned commit?
>
> No, please use a separate commit. Commits are cheap.
Ok (and disregard my 'also...')
Cordialement,
Albert ARIBAUD
3ADEV
@@ -1,3 +1,28 @@
+2018-09-17 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ * include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose,
+ __posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy,
+ __posix_spawn_file_actions_init, __posix_spawnattr_init,
+ __posix_spawnattr_destroy, __posix_spawnattr_setflags,
+ __posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New
+ prototype.
+ * posix/spawn.c (__posix_spawn): Add libc_hidden_def.
+ * posix/spawn_faction_addclose.c
+ (__posix_spawn_file_actions_addclose): Add hidden definition.
+ * posix/spawn_faction_adddup2.c
+ (__posix_spawn_file_actions_adddup2): Likewise.
+ * posix/spawn_faction_destroy.c
+ (__posix_spawn_file_actions_destroy): Likewise.
+ * posix/spawn_faction_init.c (__posix_spawn_file_actions_init):
+ Likewise.
+ * posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise.
+ * posix/spawnattr_init.c (__posix_spawnattr_init): Likewise.
+ * posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault):
+ Likewise.
+ * posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise.
+ * posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask):
+ Likewise.
+
2018-10-17 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
@@ -1 +1,36 @@
+#ifndef _SPAWN_H
#include <posix/spawn.h>
+
+# ifndef _ISOMAC
+__typeof (posix_spawn) __posix_spawn;
+libc_hidden_proto (__posix_spawn)
+
+__typeof (posix_spawn_file_actions_addclose)
+ __posix_spawn_file_actions_addclose attribute_hidden;
+
+__typeof (posix_spawn_file_actions_adddup2)
+ __posix_spawn_file_actions_adddup2 attribute_hidden;
+
+__typeof (posix_spawn_file_actions_destroy)
+ __posix_spawn_file_actions_destroy attribute_hidden;
+
+__typeof (posix_spawn_file_actions_init) __posix_spawn_file_actions_init
+ attribute_hidden;
+
+__typeof (posix_spawnattr_init) __posix_spawnattr_init
+ attribute_hidden;
+
+__typeof (posix_spawnattr_destroy) __posix_spawnattr_destroy
+ attribute_hidden;
+
+__typeof (posix_spawnattr_setflags) __posix_spawnattr_setflags
+ attribute_hidden;
+
+__typeof (posix_spawnattr_setsigdefault) __posix_spawnattr_setsigdefault
+ attribute_hidden;
+
+__typeof (posix_spawnattr_setsigmask) __posix_spawnattr_setsigmask
+ attribute_hidden;
+
+# endif /* !_ISOMAC */
+#endif /* spawn.h */
@@ -30,6 +30,7 @@ __posix_spawn (pid_t *pid, const char *path,
return __spawni (pid, path, file_actions, attrp, argv, envp, 0);
}
versioned_symbol (libc, __posix_spawn, posix_spawn, GLIBC_2_15);
+libc_hidden_def (__posix_spawn)
#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15)
@@ -24,8 +24,8 @@
/* Add an action to FILE-ACTIONS which tells the implementation to call
`close' for the given file descriptor during the `spawn' call. */
int
-posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
- int fd)
+__posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
+ int fd)
{
struct __spawn_action *rec;
@@ -48,3 +48,5 @@ posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
return 0;
}
+weak_alias (__posix_spawn_file_actions_addclose,
+ posix_spawn_file_actions_addclose)
@@ -24,8 +24,8 @@
/* Add an action to FILE-ACTIONS which tells the implementation to call
`dup2' for the given file descriptors during the `spawn' call. */
int
-posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
- int fd, int newfd)
+__posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
+ int fd, int newfd)
{
struct __spawn_action *rec;
@@ -49,3 +49,5 @@ posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
return 0;
}
+weak_alias (__posix_spawn_file_actions_adddup2,
+ posix_spawn_file_actions_adddup2)
@@ -22,7 +22,7 @@
/* Deallocate the file actions. */
int
-posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
+__posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
{
/* Free the paths in the open actions. */
for (int i = 0; i < file_actions->__used; ++i)
@@ -44,3 +44,5 @@ posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
free (file_actions->__actions);
return 0;
}
+weak_alias (__posix_spawn_file_actions_destroy,
+ posix_spawn_file_actions_destroy)
@@ -45,9 +45,10 @@ __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions)
/* Initialize data structure for file attribute for `spawn' call. */
int
-posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
+__posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
{
/* Simply clear all the elements. */
memset (file_actions, '\0', sizeof (*file_actions));
return 0;
}
+weak_alias (__posix_spawn_file_actions_init, posix_spawn_file_actions_init)
@@ -19,8 +19,9 @@
/* Initialize data structure for file attribute for `spawn' call. */
int
-posix_spawnattr_destroy (posix_spawnattr_t *attr)
+__posix_spawnattr_destroy (posix_spawnattr_t *attr)
{
/* Nothing to do in the moment. */
return 0;
}
+weak_alias (__posix_spawnattr_destroy, posix_spawnattr_destroy)
@@ -20,7 +20,7 @@
/* Initialize data structure for file attribute for `spawn' call. */
int
-posix_spawnattr_init (posix_spawnattr_t *attr)
+__posix_spawnattr_init (posix_spawnattr_t *attr)
{
/* All elements have to be initialized to the default values which
is generally zero. */
@@ -28,3 +28,4 @@ posix_spawnattr_init (posix_spawnattr_t *attr)
return 0;
}
+weak_alias (__posix_spawnattr_init, posix_spawnattr_init)
@@ -20,11 +20,12 @@
/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
int
-posix_spawnattr_setsigdefault (posix_spawnattr_t *attr,
- const sigset_t *sigdefault)
+__posix_spawnattr_setsigdefault (posix_spawnattr_t *attr,
+ const sigset_t *sigdefault)
{
/* Copy the sigset_t data to the user buffer. */
memcpy (&attr->__sd, sigdefault, sizeof (sigset_t));
return 0;
}
+weak_alias (__posix_spawnattr_setsigdefault, posix_spawnattr_setsigdefault)
@@ -30,7 +30,7 @@
/* Store flags in the attribute structure. */
int
-posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
+__posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
{
/* Check no invalid bits are set. */
if (flags & ~ALL_FLAGS)
@@ -41,3 +41,4 @@ posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
return 0;
}
+weak_alias (__posix_spawnattr_setflags, posix_spawnattr_setflags)
@@ -20,7 +20,7 @@
/* Set signal mask for the new process in ATTR to SIGMASK. */
int
-posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
+__posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
const sigset_t *sigmask)
{
/* Copy the sigset_t data to the user buffer. */
@@ -28,3 +28,4 @@ posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
return 0;
}
+weak_alias (__posix_spawnattr_setsigmask, posix_spawnattr_setsigmask)