main/libc0.9.32: backport posix_spawn fix

This should fix the following error when compiling posix-spawn ruby gem:

In file included from posix-spawn.c:9:0:
/usr/include/spawn.h:80:34: error: expected ';', ',' or ')' before 'pid'
 int posix_spawn(pid_t * restrict pid, const char * restrict path,
                                  ^
/usr/include/spawn.h:248:10: error: expected ';', ',' or ')' before 'file_actions'
          file_actions, int fd,
          ^
This commit is contained in:
Natanael Copa 2014-03-07 13:41:38 +00:00
parent a83974aaa0
commit 5a835d7baa
2 changed files with 404 additions and 1 deletions

View File

@ -4,7 +4,7 @@ pkgname=libc$_abiver
_gitver=
pkgver=0.9.33.2
_ver=${pkgver/_/-}
pkgrel=26
pkgrel=27
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@ -72,6 +72,7 @@ librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
970-add___kernel_long_and___kernel_ulong.patch
spawn-use-glibc-style-to-keep-differences-down.patch
uclibcconfig.x86
uclibcconfig.x86_64
@ -220,6 +221,7 @@ bfe02411af06545da375f177cfaf7efe avoid-forced-unwind.patch
5320bafb053938dda439cdf06095d172 0001-libc-stdlib-add-mkostemp-helpers.patch
d1dd50e417383d46acdd5976813c9862 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
ae818855a1460fb46bcb1de31c46fe95 970-add___kernel_long_and___kernel_ulong.patch
ef3188af11a702ef06586939e58e4416 spawn-use-glibc-style-to-keep-differences-down.patch
05dba6fb46e8d1cb2e38cbd5b93c1d95 uclibcconfig.x86
2b1755754cd72cd06a23ef1db26d8c59 uclibcconfig.x86_64
05dba6fb46e8d1cb2e38cbd5b93c1d95 uclibcconfig.i486
@ -265,6 +267,7 @@ cf0ce515c8d98e68cec01e805cb568371dd6f4aa21c14ea8bf841a0a0c26b358 uClibc-0.9.33.
013f33861790a75d3ec1c28861d57a86e990a06f47120d992f40a36985132550 0001-libc-stdlib-add-mkostemp-helpers.patch
646dc019fd010c16d9c2cbea251be816ce44ad780eac8aad58108923d2b473bd 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
2f77d8572a03385c35de75b5f8cd2982f2e18316637231f22f8a62c0af742bb4 970-add___kernel_long_and___kernel_ulong.patch
ca983d49d7df5989c4272b6e07db05a5223f08bd7968404f4cc5320f31e74556 spawn-use-glibc-style-to-keep-differences-down.patch
ede1827b14e310a2b048d12431fada583560bcfe3a6164004f38568617cc74ef uclibcconfig.x86
d793fa91cb758eb482c9f795632972b2c1559d4ce76a855db0fd2d05c01492c3 uclibcconfig.x86_64
ede1827b14e310a2b048d12431fada583560bcfe3a6164004f38568617cc74ef uclibcconfig.i486
@ -310,6 +313,7 @@ be0bc446a030b1e59ccd8fa564b773cf12f6aac1ecb645ceeeb54958ebd8dd8619431bc395aeb640
c95a1e96308c761dbe4d11fc7d84aee04a5abc8d8da191cc5aae407eba4fec9b7c62f9c7f8294004d7a160fc7051c3d9de64368e4c85c633609ee3dfb5d97e3c 0001-libc-stdlib-add-mkostemp-helpers.patch
1867ca0de857afc43e430cb18bbdd279e795c73062184c18c82c8d5970fad88cd60aee8c24a1ab16595dfb5df002be19eb46f24017d5a0432358107a213f43d6 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
71bcca7ca61f055f5496bbd9c11495e6c9d6d6598fd6ff34bd259f4eac6a4b46c852450123011215e8950fb6aa86e11a4d7767cca6a16bf8f2d5882432e1d6a7 970-add___kernel_long_and___kernel_ulong.patch
ab08ac546c890244866a2120e18bdc1b550a9bce9668d2fe3b9534e4c4d5ecddcec4042c2a51dae55573ed7c389330c14753977a96dcdaeefa8b307b1db615cd spawn-use-glibc-style-to-keep-differences-down.patch
ef8e7225e8dc82cf16f428359b117ac643179e5bab96a8613915ad34a3b0df945bf650216516502ffed6254c023e0ef000892875ce813e7532016abf54b57758 uclibcconfig.x86
bd8ff2c359e221607943f8c55508b4e5ac0dcd344ccbe0e4579bc16e34694a27f27b0aea141ecb6f4fc42c44dc85aa5a2bbf282cbee592550f45af01276caefd uclibcconfig.x86_64
ef8e7225e8dc82cf16f428359b117ac643179e5bab96a8613915ad34a3b0df945bf650216516502ffed6254c023e0ef000892875ce813e7532016abf54b57758 uclibcconfig.i486

View File

@ -0,0 +1,399 @@
From 54935c23e92c7f948ea3c561b3fac7cd4deac22a Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 27 Mar 2012 03:34:37 +0000
Subject: spawn: use glibc style to keep differences down
There's no point in reformatting the code style when we're sourcing
most of it from glibc. Further, the changed style breaks with older
compilers, and pollutes the namespace with non-double leading under-
scores.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
(limited to 'include/spawn.h')
diff --git a/include/spawn.h b/include/spawn.h
index 8b07bb8..95fff35 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -19,36 +19,39 @@
#ifndef _SPAWN_H
#define _SPAWN_H 1
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
#include <features.h>
#include <sched.h>
#define __need_sigset_t
#include <signal.h>
#include <sys/types.h>
+/* For the tiny inlines (errno/free/memset). */
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
/* Data structure to contain attributes for thread creation. */
-typedef struct {
- short int __flags;
- pid_t __pgrp;
- sigset_t __sd;
- sigset_t __ss;
- struct sched_param __sp;
- int __policy;
- int __pad[16];
+typedef struct
+{
+ short int __flags;
+ pid_t __pgrp;
+ sigset_t __sd;
+ sigset_t __ss;
+ struct sched_param __sp;
+ int __policy;
+ int __pad[16];
} posix_spawnattr_t;
/* Data structure to contain information about the actions to be
performed in the new process with respect to file descriptors. */
-typedef struct {
- int __allocated;
- int __used;
- struct __spawn_action *__actions;
- int __pad[16];
+typedef struct
+{
+ int __allocated;
+ int __used;
+ struct __spawn_action *__actions;
+ int __pad[16];
} posix_spawn_file_actions_t;
@@ -59,7 +62,9 @@ typedef struct {
#define POSIX_SPAWN_SETSIGMASK 0x08
#define POSIX_SPAWN_SETSCHEDPARAM 0x10
#define POSIX_SPAWN_SETSCHEDULER 0x20
-#define POSIX_SPAWN_USEVFORK 0x40 /* GNU extension */
+#ifdef __USE_GNU
+# define POSIX_SPAWN_USEVFORK 0x40
+#endif
#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
@@ -77,189 +82,207 @@ __BEGIN_DECLS
This function is a possible cancellation point and therefore not
marked with __THROW. */
-int posix_spawn(pid_t * restrict pid, const char * restrict path,
- const posix_spawn_file_actions_t * restrict file_actions,
- const posix_spawnattr_t * restrict attrp,
- char * const argv[restrict],
- char * const envp[restrict]);
+extern int posix_spawn (pid_t *__restrict __pid,
+ const char *__restrict __path,
+ const posix_spawn_file_actions_t *__restrict
+ __file_actions,
+ const posix_spawnattr_t *__restrict __attrp,
+ char *const __argv[__restrict_arr],
+ char *const __envp[__restrict_arr]);
/* Similar to `posix_spawn' but search for FILE in the PATH.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-int posix_spawnp(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[]);
-
-/* Initialize data structure with attributes for `spawn' to default values. */
-inline static int
-posix_spawnattr_init(posix_spawnattr_t *attr)
+extern int posix_spawnp (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[]);
+
+
+/* Initialize data structure with attributes for `spawn' to default values. */
+static inline
+int posix_spawnattr_init (posix_spawnattr_t *__attr)
{
- memset(attr, 0, sizeof(*attr));
- return 0;
+ memset (__attr, 0, sizeof (*__attr));
+ return 0;
}
/* Free resources associated with ATTR. */
-inline static int
-posix_spawnattr_destroy(posix_spawnattr_t *attr)
+static inline
+int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
{
- return 0;
+ return 0;
}
/* Store signal mask for signals with default handling from ATTR in
SIGDEFAULT. */
-inline static int
-posix_spawnattr_getsigdefault(const posix_spawnattr_t *attr,
- sigset_t *sigdefault)
+static inline
+int posix_spawnattr_getsigdefault (const posix_spawnattr_t *
+ __restrict __attr,
+ sigset_t *__restrict __sigdefault)
{
- memcpy(sigdefault, &attr->__sd, sizeof(sigset_t));
- return 0;
+ memcpy (__sigdefault, &__attr->__sd, sizeof (sigset_t));
+ return 0;
}
-
/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
-inline static int
-posix_spawnattr_setsigdefault(posix_spawnattr_t *attr,
- const sigset_t *sigdefault)
+static inline
+int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr,
+ const sigset_t *__restrict
+ __sigdefault)
{
- memcpy(&attr->__sd, sigdefault, sizeof(sigset_t));
- return 0;
+ memcpy (&__attr->__sd, __sigdefault, sizeof (sigset_t));
+ return 0;
}
/* Store signal mask for the new process from ATTR in SIGMASK. */
-inline static int
-posix_spawnattr_getsigmask(const posix_spawnattr_t *attr,
- sigset_t *sigmask)
+static inline
+int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict
+ __attr,
+ sigset_t *__restrict __sigmask)
{
- memcpy(sigmask, &attr->__ss, sizeof(sigset_t));
- return 0;
+ memcpy (__sigmask, &__attr->__ss, sizeof (sigset_t));
+ return 0;
}
-
/* Set signal mask for the new process in ATTR to SIGMASK. */
-inline static int
-posix_spawnattr_setsigmask(posix_spawnattr_t *attr,
- const sigset_t *sigmask)
+static inline
+int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr,
+ const sigset_t *__restrict __sigmask)
{
- memcpy(&attr->__ss, sigmask, sizeof(sigset_t));
- return 0;
+ memcpy (&__attr->__ss, __sigmask, sizeof (sigset_t));
+ return 0;
}
/* Get flag word from the attribute structure. */
-inline static int
-posix_spawnattr_getflags(const posix_spawnattr_t *attr, short int *flags)
+static inline
+int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict
+ __attr,
+ short int *__restrict __flags)
{
- *flags = attr->__flags;
- return 0;
+ *__flags = __attr->__flags;
+ return 0;
}
/* Store flags in the attribute structure. */
-inline static int
-posix_spawnattr_setflags(posix_spawnattr_t *attr, short int flags)
+static inline
+int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
+ short int __flags)
{
- /* Check no invalid bits are set. */
- if (flags & ~__POSIX_SPAWN_MASK)
- return EINVAL;
+ /* Check no invalid bits are set. */
+ if (__flags & ~__POSIX_SPAWN_MASK)
+ return EINVAL;
- attr->__flags = flags;
- return 0;
+ _attr->__flags = __flags;
+ return 0;
}
/* Get process group ID from the attribute structure. */
-inline static int
-posix_spawnattr_getpgroup(const posix_spawnattr_t *attr, pid_t *pgroup)
+static inline
+int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict
+ __attr, pid_t *__restrict __pgroup)
{
- *pgroup = attr->__pgrp;
- return 0;
+ *__pgroup = __attr->__pgrp;
+ return 0;
}
/* Store process group ID in the attribute structure. */
-inline static int
-posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup)
+static inline
+int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
+ pid_t __pgroup)
{
- attr->__pgrp = pgroup;
- return 0;
+ __attr->__pgrp = __pgroup;
+ return 0;
}
/* Get scheduling policy from the attribute structure. */
-inline static int
-posix_spawnattr_getschedpolicy(const posix_spawnattr_t *attr,
- int *schedpolicy)
+static inline
+int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *
+ __restrict __attr,
+ int *__restrict __schedpolicy)
{
- *schedpolicy = attr->__policy;
- return 0;
+ *__schedpolicy = __attr->__policy;
+ return 0;
}
/* Store scheduling policy in the attribute structure. */
-inline static int
-posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy)
+static inline
+int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
+ int __schedpolicy)
{
- switch (schedpolicy) {
- case SCHED_OTHER:
- case SCHED_FIFO:
- case SCHED_RR:
- break;
- default:
- return EINVAL;
- }
-
- attr->__policy = schedpolicy;
- return 0;
+ switch (__schedpolicy) {
+ case SCHED_OTHER:
+ case SCHED_FIFO:
+ case SCHED_RR:
+ break;
+ default:
+ return EINVAL;
+ }
+
+ __attr->__policy = __schedpolicy;
+ return 0;
}
/* Get scheduling parameters from the attribute structure. */
-static inline int
-posix_spawnattr_getschedparam(const posix_spawnattr_t *attr,
- struct sched_param *schedparam)
+static inline
+int posix_spawnattr_getschedparam (const posix_spawnattr_t *
+ __restrict __attr,
+ struct sched_param *__restrict
+ __schedparam)
{
- memcpy(schedparam, &attr->__sp, sizeof(attr->__sp));
- return 0;
+ memcpy (__schedparam, &__attr->__sp, sizeof (__attr->__sp));
+ return 0;
}
/* Store scheduling parameters in the attribute structure. */
-static inline int
-posix_spawnattr_setschedparam(posix_spawnattr_t *attr,
- const struct sched_param *schedparam)
+static inline
+int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
+ const struct sched_param *
+ __restrict __schedparam)
{
- attr->__sp = *schedparam;
- return 0;
+ __attr->__sp = *__schedparam;
+ return 0;
}
/* Initialize data structure for file attribute for `spawn' call. */
-inline static int
-posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions)
+static inline
+int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
+ __file_actions)
{
- memset(file_actions, 0, sizeof(*file_actions));
- return 0;
+ memset (__file_actions, 0, sizeof (*__file_actions));
+ return 0;
}
/* Free resources associated with FILE-ACTIONS. */
-inline static int
-posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions)
+static inline
+int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
+ __file_actions)
{
- free(file_actions->__actions);
- return 0;
+ free (__file_actions->__actions);
+ return 0;
}
/* Add an action to FILE-ACTIONS which tells the implementation to call
`open' for the given file during the `spawn' call. */
-int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * restrict
- file_actions, int fd,
- const char * restrict path,
- int oflag, mode_t mode)
+extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
+ __restrict __file_actions,
+ int __fd,
+ const char *__restrict __path,
+ int __oflag, mode_t __mode)
__THROW;
/* 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)
+extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
+ __file_actions, int __fd)
__THROW;
/* 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) __THROW;
+extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
+ __file_actions,
+ int __fd, int __newfd) __THROW;
__END_DECLS
--
cgit v0.9.1