summaryrefslogtreecommitdiff
path: root/lib/sys_wait.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-09-29 13:17:43 +0200
committerBruno Haible <bruno@clisp.org>2010-09-29 13:17:43 +0200
commit3215ba10fd6dcff44bb0f6748b161f56dcd28d01 (patch)
treee27b6bac1e910cb82f1794359744589dae261ff7 /lib/sys_wait.in.h
parent89c936487278c4567c724b3ec826873f46f72c5a (diff)
downloadgnulib-3215ba10fd6dcff44bb0f6748b161f56dcd28d01.tar.gz
New module 'waitpid'.
* lib/waitpid.c: New file, extracted from lib/sys_wait.in.h. * lib/sys_wait.in.h: Include <sys/types.h>, c++defs.h, warn-on-use.h. Don't include <process.h>. (waitpid): Declare only, using modern idiom. * m4/waitpid.m4: New file. * m4/sys_wait_h.m4 (gl_SYS_WAIT_H): Check whether waitpid is declared. * modules/waitpid: New file. * modules/sys_wait (Depends-on): Add c++defs, warn-on-use, waitpid. (Makefile.am): Update. Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>.
Diffstat (limited to 'lib/sys_wait.in.h')
-rw-r--r--lib/sys_wait.in.h46
1 files changed, 33 insertions, 13 deletions
diff --git a/lib/sys_wait.in.h b/lib/sys_wait.in.h
index 0006112ead..6f0ef3687d 100644
--- a/lib/sys_wait.in.h
+++ b/lib/sys_wait.in.h
@@ -30,6 +30,15 @@
#ifndef _GL_SYS_WAIT_H
#define _GL_SYS_WAIT_H
+/* Get pid_t. */
+#include <sys/types.h>
+
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
+
#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
/* Unix API. */
@@ -71,24 +80,11 @@
# define WCOREDUMP(x) ((x) & 0x80)
# endif
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* Declarations of functions. */
-
-# ifdef __cplusplus
-}
-# endif
-
#else
/* Native Windows API. */
-# include <process.h> /* for _cwait, WAIT_CHILD */
# include <signal.h> /* for SIGTERM */
-# define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD)
-
/* The following macros apply to an argument x, that is a status of a process,
as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess().
This value is simply an 'int', not composed of bit fields. */
@@ -111,5 +107,29 @@ extern "C" {
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Declarations of functions. */
+
+#if 1 /* @GNULIB_WAITPID@ */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+# endif
+_GL_CXXALIAS_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+_GL_CXXALIASWARN (waitpid);
+#elif defined GNULIB_POSIXCHECK
+# undef waitpid
+# if HAVE_RAW_DECL_WAITPID
+_GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
+ "use gnulib module sys_wait for portability");
+# endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _GL_SYS_WAIT_H */
#endif /* _GL_SYS_WAIT_H */