MDEV-27758: Errors when building Connect engine on os x 11.6.2

Added checking for support of vfork by a platform where
building being done. Set HAVE_VFORK macros in case vfork()
system call is supported. Use vfork() system call if the
macros HAVE_VFORK is set, else use fork().
This commit is contained in:
Dmitry Shulga 2022-04-22 18:47:19 +07:00
parent 3c209bfc04
commit bc7ba7afee
3 changed files with 23 additions and 1 deletions

View file

@ -577,3 +577,5 @@
#endif // !defined(__STDC_FORMAT_MACROS)
#endif
#cmakedefine HAVE_VFORK 1

View file

@ -1033,3 +1033,19 @@ IF(NOT MSVC)
HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
)
ENDIF()
MY_CHECK_C_COMPILER_FLAG("-Werror")
IF(have_C__Werror)
SET(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
CHECK_C_SOURCE_COMPILES("
#include <unistd.h>
int main()
{
pid_t pid=vfork();
return (int)pid;
}"
HAVE_VFORK
)
SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
ENDIF()

View file

@ -112,7 +112,11 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // endif f
pID = vfork();
#ifdef HAVE_VFORK
pID = vfork();
#else
pID = fork();
#endif
sprintf(fn, "-o%s", filename);
if (pID == 0) {