bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

posix_spawn: Fix compilation error on Android


From: Bruno Haible
Subject: posix_spawn: Fix compilation error on Android
Date: Mon, 14 May 2018 00:28:09 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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@ && address@hidden@)
 # define posix_spawnattr_t rpl_posix_spawnattr_t
 #endif
-#if @REPLACE_POSIX_SPAWN@ || address@hidden@
+#if @REPLACE_POSIX_SPAWN@ || address@hidden@ || address@hidden@
 # 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@ && 
address@hidden@)
 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
 #endif
-#if @REPLACE_POSIX_SPAWN@ || address@hidden@
+#if @REPLACE_POSIX_SPAWN@ || address@hidden@ || address@hidden@
 # if !GNULIB_defined_posix_spawn_file_actions_t
 typedef struct
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]