Bruno Haible
2018-05-13 22:28:09 UTC
When compiling for Android 4.3, the Android headers define the types
posix_spawnattr_t and posix_spawn_file_actions_t. But the corresponding
functions are not declared and not available at link time. Therefore gnulib
attempts to build its replacements, which fails because the types don't
contain the expected members:
spawn_faction_addclose.c: In function 'posix_spawn_file_actions_addclose':
spawn_faction_addclose.c:50:19: error: request for member '_used' in something not a structure or union
if (file_actions->_used == file_actions->_allocated
^
spawn_faction_addclose.c:50:42: error: request for member '_allocated' in something not a structure or union
if (file_actions->_used == file_actions->_allocated
^
spawn_faction_addclose.c:59:24: error: request for member '_actions' in something not a structure or union
rec = &file_actions->_actions[file_actions->_used];
^
This patch fixes it.
2018-05-13 Bruno Haible <***@clisp.org>
posix_spawn: Fix compilation error on Android.
* lib/spawn.in.h (posix_spawnattr_t): Consider also the case
HAVE_POSIX_SPAWNATTR_T = 1 && HAVE_POSIX_SPAWN = 0.
(posix_spawn_file_actions_t): Consider also the case
HAVE_POSIX_SPAWN_FILE_ACTIONS_T = 1 && HAVE_POSIX_SPAWN = 0.
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index b0dfcb5..a606176 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -79,10 +79,10 @@
/* Data structure to contain attributes for thread creation. */
-#if @REPLACE_POSIX_SPAWN@
+#if @REPLACE_POSIX_SPAWN@ || (@HAVE_POSIX_SPAWNATTR_T@ && !@HAVE_POSIX_SPAWN@)
# define posix_spawnattr_t rpl_posix_spawnattr_t
#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@ || !@HAVE_POSIX_SPAWN@
# if !GNULIB_defined_posix_spawnattr_t
typedef struct
{
@@ -101,10 +101,10 @@ typedef struct
/* Data structure to contain information about the actions to be
performed in the new process with respect to file descriptors. */
-#if @REPLACE_POSIX_SPAWN@
+#if @REPLACE_POSIX_SPAWN@ || (@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@ && !@HAVE_POSIX_SPAWN@)
# define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@ || !@HAVE_POSIX_SPAWN@
# if !GNULIB_defined_posix_spawn_file_actions_t
typedef struct
{
posix_spawnattr_t and posix_spawn_file_actions_t. But the corresponding
functions are not declared and not available at link time. Therefore gnulib
attempts to build its replacements, which fails because the types don't
contain the expected members:
spawn_faction_addclose.c: In function 'posix_spawn_file_actions_addclose':
spawn_faction_addclose.c:50:19: error: request for member '_used' in something not a structure or union
if (file_actions->_used == file_actions->_allocated
^
spawn_faction_addclose.c:50:42: error: request for member '_allocated' in something not a structure or union
if (file_actions->_used == file_actions->_allocated
^
spawn_faction_addclose.c:59:24: error: request for member '_actions' in something not a structure or union
rec = &file_actions->_actions[file_actions->_used];
^
This patch fixes it.
2018-05-13 Bruno Haible <***@clisp.org>
posix_spawn: Fix compilation error on Android.
* lib/spawn.in.h (posix_spawnattr_t): Consider also the case
HAVE_POSIX_SPAWNATTR_T = 1 && HAVE_POSIX_SPAWN = 0.
(posix_spawn_file_actions_t): Consider also the case
HAVE_POSIX_SPAWN_FILE_ACTIONS_T = 1 && HAVE_POSIX_SPAWN = 0.
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index b0dfcb5..a606176 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -79,10 +79,10 @@
/* Data structure to contain attributes for thread creation. */
-#if @REPLACE_POSIX_SPAWN@
+#if @REPLACE_POSIX_SPAWN@ || (@HAVE_POSIX_SPAWNATTR_T@ && !@HAVE_POSIX_SPAWN@)
# define posix_spawnattr_t rpl_posix_spawnattr_t
#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@ || !@HAVE_POSIX_SPAWN@
# if !GNULIB_defined_posix_spawnattr_t
typedef struct
{
@@ -101,10 +101,10 @@ typedef struct
/* Data structure to contain information about the actions to be
performed in the new process with respect to file descriptors. */
-#if @REPLACE_POSIX_SPAWN@
+#if @REPLACE_POSIX_SPAWN@ || (@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@ && !@HAVE_POSIX_SPAWN@)
# define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@ || !@HAVE_POSIX_SPAWN@
# if !GNULIB_defined_posix_spawn_file_actions_t
typedef struct
{