On MSVC 9, the type pid_t is nowhere defined. But POSIX wants it defined in
<fcntl.h> <sched.h> <signal.h> <spawn.h> <sys/msg.h> <sys/sem.h> <sys/shm.h> <sys/types.h> <sys/wait.h> <termios.h> <time.h> <trace.h> <unistd.h> <utmpx.h> This fixes it for those headers for which we have a gnulib module. I'm not sure we should create a module for <sys/types.h>? 2011-09-11 Bruno Haible <br...@clisp.org> Ensure pid_t gets defined. * m4/fcntl_h.m4 (gl_FCNTL_H): Require AC_TYPE_PID_T. * m4/sched_h.m4 (gl_SCHED_H): Likewise. * m4/signal_h.m4 (gl_SIGNAL_H): Likewise. * m4/spawn_h.m4 (gl_SPAWN_H): Likewise. * m4/sys_wait_h.m4 (gl_SYS_WAIT_H): Likewise. * m4/termios_h.m4 (gl_TERMIOS_H): Likewise. * m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. * tests/test-fcntl-h.c: Check that pid_t is defined. * tests/test-sched.c: Likewise. * tests/test-termios.c: Likewise. * tests/test-time.c: Likewise. * doc/posix-headers/fcntl.texi: Mention lack of pid_t on MSVC platform. * doc/posix-headers/signal.texi: Likewise. * doc/posix-headers/sys_types.texi: Likewise. * doc/posix-headers/time.texi: Likewise. --- doc/posix-headers/fcntl.texi.orig Sun Sep 11 14:06:44 2011 +++ doc/posix-headers/fcntl.texi Sun Sep 11 13:57:56 2011 @@ -8,6 +8,10 @@ Portability problems fixed by Gnulib: @itemize @item +The type @code{pid_t} is not defined on some platforms: +MSVC 9. + +@item @samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY}, @samp{O_NOFOLLOW}, @samp{O_RSYNC}, @samp{O_SYNC}, and @samp{O_TTY_INIT} are not defined on some platforms. Gnulib defines --- doc/posix-headers/signal.texi.orig Sun Sep 11 14:06:44 2011 +++ doc/posix-headers/signal.texi Sun Sep 11 13:57:57 2011 @@ -23,6 +23,9 @@ platforms: Irix 5.3, Interix 3.5. @item +The type @code{pid_t} is not defined on some platforms: +MSVC 9. +@item The signal @code{SIGPIPE} is not defined on some platforms: mingw. @item --- doc/posix-headers/sys_types.texi.orig Sun Sep 11 14:06:44 2011 +++ doc/posix-headers/sys_types.texi Sun Sep 11 13:57:57 2011 @@ -11,4 +11,8 @@ Portability problems not fixed by Gnulib: @itemize +@item +The type @code{pid_t} is not defined on some platforms: +MSVC 9. +You can use the macro @code{AC_TYPE_PID_T} to fix this. @end itemize --- doc/posix-headers/time.texi.orig Sun Sep 11 14:06:45 2011 +++ doc/posix-headers/time.texi Sun Sep 11 13:57:57 2011 @@ -11,6 +11,10 @@ @samp{struct timespec} is not defined on some platforms. @item +The type @code{pid_t} is not defined on some platforms: +MSVC 9. + +@item Some platforms provide a @code{NULL} macro that cannot be used in arbitrary expressions: NetBSD 5.0 --- m4/fcntl_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/fcntl_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# serial 13 +# serial 14 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -13,6 +13,9 @@ AC_REQUIRE([gl_FCNTL_O_FLAGS]) gl_NEXT_HEADERS([fcntl.h]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. --- m4/sched_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/sched_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# sched_h.m4 serial 4 +# sched_h.m4 serial 5 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -30,6 +30,9 @@ [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], [#include <sched.h>]) AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) ]) AC_SUBST([SCHED_H]) AM_CONDITIONAL([GL_GENERATE_SCHED_H], [test -n "$SCHED_H"]) --- m4/signal_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/signal_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 16 +# signal_h.m4 serial 17 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,6 +17,9 @@ #include <signal.h> ]]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + AC_REQUIRE([AC_TYPE_UID_T]) dnl Persuade glibc <signal.h> to define sighandler_t. --- m4/spawn_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/spawn_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# spawn_h.m4 serial 13 +# spawn_h.m4 serial 14 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,6 +31,9 @@ fi AC_SUBST([HAVE_SPAWN_H]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + AC_REQUIRE([gl_HAVE_POSIX_SPAWN]) AC_REQUIRE([AC_C_RESTRICT]) --- m4/sys_wait_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/sys_wait_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# sys_wait_h.m4 serial 5 +# sys_wait_h.m4 serial 6 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,9 @@ dnl <sys/wait.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/wait.h]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <sys/wait.h>]], --- m4/termios_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/termios_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# termios_h.m4 serial 3 +# termios_h.m4 serial 4 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,6 +15,9 @@ HAVE_TERMIOS_H=0 fi + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. --- m4/time_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/time_h.m4 Sun Sep 11 14:04:12 2011 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. -# serial 4 +# serial 5 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -23,6 +23,9 @@ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) ]) dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared --- m4/unistd_h.m4.orig Sun Sep 11 14:06:45 2011 +++ m4/unistd_h.m4 Sun Sep 11 14:04:12 2011 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 56 +# unistd_h.m4 serial 57 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,6 +21,9 @@ fi AC_SUBST([HAVE_UNISTD_H]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <unistd.h> --- tests/test-fcntl-h.c.orig Sun Sep 11 14:06:45 2011 +++ tests/test-fcntl-h.c Sun Sep 11 14:06:17 2011 @@ -31,6 +31,9 @@ /* Check that the FD_* macros are defined. */ int i = FD_CLOEXEC; +/* Check that the types are all defined. */ +pid_t t1; + int main (void) { --- tests/test-sched.c.orig Sun Sep 11 14:06:45 2011 +++ tests/test-sched.c Sun Sep 11 14:06:17 2011 @@ -26,6 +26,9 @@ /* Check that the SCHED_* macros are defined and compile-time constants. */ int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER }; +/* Check that the types are all defined. */ +pid_t t1; + static int f1; int --- tests/test-termios.c.orig Sun Sep 11 14:06:45 2011 +++ tests/test-termios.c Sun Sep 11 14:06:17 2011 @@ -20,6 +20,9 @@ #include <termios.h> +/* Check that the types are all defined. */ +pid_t t1; + int main (void) { --- tests/test-time.c.orig Sun Sep 11 14:06:45 2011 +++ tests/test-time.c Sun Sep 11 14:06:17 2011 @@ -22,7 +22,9 @@ #include "verify.h" -struct timespec a; +/* Check that the types are all defined. */ +struct timespec t1; +pid_t t2; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ -- In memoriam Georgi Markov <http://en.wikipedia.org/wiki/Georgi_Markov>