From 5c1463104d59237000263dc6f682715f0b2abe3e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 7 Aug 2014 20:01:29 -0700 Subject: No getppid on MinGW. * configure: Add test for getppid. * eval.c (getppid_wrap, eval_init): use HAVE_GETPPID --- ChangeLog | 8 ++++++++ configure | 21 +++++++++++++++++++++ eval.c | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1b477aea..16cf47fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-08-07 Kaz Kylheku + + No getppid on MinGW. + + * configure: Add test for getppid. + + * eval.c (getppid_wrap, eval_init): use HAVE_GETPPID + 2014-08-07 Kaz Kylheku * parser.l (yyerr): Function removed; it is not used in the lexer, diff --git a/configure b/configure index 97a05671..047fe1a2 100755 --- a/configure +++ b/configure @@ -1406,6 +1406,27 @@ else printf "no\n" fi +printf "Checking for POSIX getppid ... " + +cat > conftest.c < +#include + +int main(int argc, char **argv) +{ + pid_t p = getppid(); + return 0; +} +! + +if conftest ; then + printf "yes\n" + printf "#define HAVE_GETPPID 1\n" >> config.h + have_unistd=y +else + printf "no\n" +fi + # # fcntl # diff --git a/eval.c b/eval.c index 06963cc3..c66ddbef 100644 --- a/eval.c +++ b/eval.c @@ -3295,17 +3295,21 @@ static val usleep_wrap(val usec) } #if HAVE_UNISTD_H + static val getpid_wrap(void) { return num(getpid()); } +#if HAVE_GETPPID static val getppid_wrap(void) { return num(getppid()); } #endif +#endif + static val env_hash(void) { val env_strings = env(); @@ -4011,7 +4015,9 @@ void eval_init(void) reg_fun(intern(lit("usleep"), user_package), func_n1(usleep_wrap)); #if HAVE_UNISTD_H reg_fun(intern(lit("getpid"), user_package), func_n0(getpid_wrap)); +#if HAVE_GETPPID reg_fun(intern(lit("getppid"), user_package), func_n0(getppid_wrap)); +#endif #endif reg_fun(intern(lit("env"), user_package), func_n0(env)); -- cgit v1.2.3