[10/10] RFC: remove gdb_wait.h

Tom Tromey
2012-11-15T20:32:54Z

This replaces gdb_wait.h with the corresponding gnulib module.

Tom

* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add sys_wait.
* common/gdb_wait.h: Remove.
* configure.ac: Don't check for sys/wait.h, wait.h.
* config.in: Rebuild.
* configure: Rebuild.
* gnulib/aclocal.m4: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/sys_wait_h.m4: Update.
* gnulib/import/sys_wait.in.h: Update.
* charset.c: Update.
* cli/cli-cmds.c: Update.
* fork-child.c: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-child.c: Update.
* inf-ptrace.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* ppc-linux-nat.c: Update.
* proc-api.c: Update.
* procfs.c: Update.
* remote-fileio.c: Update.
* sparc-nat.c: Update.
* spu-linux-nat.c: Update.
* utils.c: Update.
* xtensa-linux-nat.c: Update.
* common/linux-ptrace.c: Update.

* configure.ac: Don't check for sys/wait.h.
* config.in: Rebuild.
* configure: Rebuild.
* server.c: Update.
* linux-low.c: Update.
---
gdb/charset.c | 2 +-
gdb/cli/cli-cmds.c | 2 +-
gdb/common/gdb_wait.h | 113 ---------------------------
gdb/common/linux-ptrace.c | 2 +-
gdb/config.in | 6 --
gdb/configure | 2 +-
gdb/configure.ac | 2 +-
gdb/fork-child.c | 2 +-
gdb/gdbserver/config.in | 6 --
gdb/gdbserver/configure | 2 +-
gdb/gdbserver/configure.ac | 2 +-
gdb/gdbserver/linux-low.c | 2 +-
gdb/gdbserver/server.c | 2 +-
gdb/gnu-nat.c | 2 +-
gdb/gnulib/aclocal.m4 | 1 +
gdb/gnulib/configure | 141 ++++++++++++++++++++++++++++++++++
gdb/gnulib/import/Makefile.am | 30 +++++++-
gdb/gnulib/import/Makefile.in | 33 +++++++-
gdb/gnulib/import/m4/gnulib-cache.m4 | 3 +-
gdb/gnulib/import/m4/gnulib-comp.m4 | 5 +
gdb/gnulib/import/m4/sys_wait_h.m4 | 36 +++++++++
gdb/gnulib/import/sys_wait.in.h | 129 +++++++++++++++++++++++++++++++
gdb/gnulib/update-gnulib.sh | 2 +-
gdb/go32-nat.c | 2 +-
gdb/ia64-linux-nat.c | 2 +-
gdb/inf-child.c | 2 +-
gdb/inf-ptrace.c | 2 +-
gdb/infrun.c | 2 +-
gdb/linux-fork.c | 2 +-
gdb/linux-nat.c | 2 +-
gdb/ppc-linux-nat.c | 2 +-
gdb/proc-api.c | 2 +-
gdb/procfs.c | 2 +-
gdb/remote-fileio.c | 2 +-
gdb/sparc-nat.c | 2 +-
gdb/spu-linux-nat.c | 2 +-
gdb/utils.c | 2 +-
gdb/xtensa-linux-nat.c | 2 +-
38 files changed, 398 insertions(+), 159 deletions(-)
delete mode 100644 gdb/common/gdb_wait.h
create mode 100644 gdb/gnulib/import/m4/sys_wait_h.m4
create mode 100644 gdb/gnulib/import/sys_wait.in.h

diff --git a/gdb/charset.c b/gdb/charset.c
index d032908..9c25f76 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -22,7 +22,7 @@
#include "gdbcmd.h"
#include "gdb_assert.h"
#include "gdb_obstack.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "charset-list.h"
#include "vec.h"
#include "environ.h"
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 991ad00..cc3df66 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -25,7 +25,7 @@
#include "readline/tilde.h"
#include "completer.h"
#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
-#include "gdb_wait.h" /* For shell escape implementation. */
+#include <sys/wait.h> /* For shell escape implementation. */
#include "gdb_regex.h" /* Used by apropos_command. */
#include <string.h>
#include "gdb_vfork.h"
diff --git a/gdb/common/gdb_wait.h b/gdb/common/gdb_wait.h
deleted file mode 100644
index 1d02f37..0000000
--- a/gdb/common/gdb_wait.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Standard wait macros.
- Copyright (C) 2000, 2007-2012 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GDB_WAIT_H
-#define GDB_WAIT_H
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h> /* POSIX */
-#else
-#ifdef HAVE_WAIT_H
-#include <wait.h> /* legacy */
-#endif
-#endif
-
-/* Define how to access the int that the wait system call stores.
- This has been compatible in all Unix systems since time immemorial,
- but various well-meaning people have defined various different
- words for the same old bits in the same old int (sometimes claimed
- to be a struct). We just know it's an int and we use these macros
- to access the bits. */
-
-/* The following macros are defined equivalently to their definitions
- in POSIX.1. We fail to define WNOHANG and WUNTRACED, which POSIX.1
- <sys/wait.h> defines, since our code does not use waitpid() (but
- NOTE exception for GNU/Linux below). We also fail to declare
- wait() and waitpid(). */
-
-#ifndef WIFEXITED
-#define WIFEXITED(w) (((w)&0377) == 0)
-#endif
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
-#endif
-
-#ifndef WIFSTOPPED
-#ifdef IBM6000
-
-/* Unfortunately, the above comment (about being compatible in all Unix
- systems) is not quite correct for AIX, sigh. And AIX 3.2 can generate
- status words like 0x57c (sigtrap received after load), and gdb would
- choke on it. */
-
-#define WIFSTOPPED(w) ((w)&0x40)
-
-#else
-#define WIFSTOPPED(w) (((w)&0377) == 0177)
-#endif
-#endif
-
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */
-#endif
-
-#ifndef WTERMSIG
-#define WTERMSIG(w) ((w) & 0177)
-#endif
-
-#ifndef WSTOPSIG
-#define WSTOPSIG WEXITSTATUS
-#endif
-
-/* These are not defined in POSIX, but are used by our programs. */
-
-#ifndef WSETEXIT
-# ifdef W_EXITCODE
-#define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
-# else
-#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
-# endif
-#endif
-
-#ifndef WSETSTOP
-# ifdef W_STOPCODE
-#define WSETSTOP(w,sig) ((w) = W_STOPCODE(sig))
-# else
-#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
-# endif
-#endif
-
-/* For native GNU/Linux we may use waitpid and the __WCLONE option.
- <GRIPE> It is of course dangerous not to use the REAL header file...
- </GRIPE>. */
-
-/* Bits in the third argument to `waitpid'. */
-#ifndef WNOHANG
-#define WNOHANG 1 /* Don't block waiting. */
-#endif
-
-#ifndef WUNTRACED
-#define WUNTRACED 2 /* Report status of stopped children. */
-#endif
-
-#ifndef __WCLONE
-#define __WCLONE 0x80000000 /* Wait for cloned process. */
-#endif
-
-#endif
diff --git a/gdb/common/linux-ptrace.c b/gdb/common/linux-ptrace.c
index 22cc204..eb1d366 100644
--- a/gdb/common/linux-ptrace.c
+++ b/gdb/common/linux-ptrace.c
@@ -27,7 +27,7 @@
#include "linux-procfs.h"
#include "buffer.h"
#include "gdb_assert.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>

/* Find all possible reasons we could fail to attach PID and append these
newline terminated reason strings to initialized BUFFER. '\0' termination
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 644d853..6517108 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1079,7 +1079,7 @@ AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
- sys/wait.h wait.h termios.h termio.h \
+ termios.h termio.h \
sgtty.h unistd.h elf_hp.h locale.h \
dlfcn.h sys/socket.h sys/un.h])
AC_CHECK_HEADERS(link.h, [], [],
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 1e136de..5c726ed 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -25,7 +25,7 @@
#include "inferior.h"
#include "terminal.h"
#include "target.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdb_vfork.h"
#include "gdbcore.h"
#include "terminal.h"
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 5e7545e..8d00948 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -53,7 +53,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h dnl
proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
errno.h fcntl.h sys/file.h malloc.h dnl
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
- netinet/tcp.h arpa/inet.h sys/wait.h wait.h sys/un.h)
+ netinet/tcp.h arpa/inet.h sys/un.h)
AC_CHECK_FUNCS(pread pwrite pread64 readlink)
AC_REPLACE_FUNCS(vasprintf vsnprintf)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index fa85413..a476031 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -21,7 +21,7 @@
#include "linux-osdata.h"
#include "agent.h"

-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/ptrace.h>
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 427f40d..b37398d 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -23,7 +23,7 @@

#include <unistd.h>
#include <signal.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>

/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of
`vCont'. Note the multi-process extensions made `vCont' a
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index fb042b1..95a984f 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -59,7 +59,7 @@
#include "value.h"
#include "language.h"
#include "target.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdbcmd.h"
#include "gdbcore.h"
#include "gdbthread.h"
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index e866c87..71162cc 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -29,7 +29,7 @@
# regenerate the various scripts and Makefiles are on the PATH.

# The list of gnulib modules we are importing in GDB.
-IMPORTED_GNULIB_MODULES="fnmatch-gnu inttypes memmem update-copyright string strerror strstr dirent sys_stat"
+IMPORTED_GNULIB_MODULES="fnmatch-gnu inttypes memmem update-copyright string strerror strstr dirent sys_stat sys_wait"

# The gnulib commit ID to use for the update.
GNULIB_COMMIT_SHA1="0dc43482065b697a7e64ac7cc7fba7c848924997"
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index bd8d25e..52053ba 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -89,7 +89,7 @@
#include "i386-nat.h"
#include "inferior.h"
#include "gdbthread.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdbcore.h"
#include "command.h"
#include "gdbcmd.h"
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index b3acb9e..d9b4f2d 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -29,7 +29,7 @@

#include <signal.h>
#include <sys/ptrace.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#endif
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index c42e08d..f90e4ac 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -30,7 +30,7 @@
#include "inf-child.h"
#include "gdb/fileio.h"
#include "agent.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> /* for MAXPATHLEN */
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index d645dab..ab4af04 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -29,7 +29,7 @@
#include "gdb_assert.h"
#include <string.h>
#include "gdb_ptrace.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <signal.h>

#include "inf-ptrace.h"
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7812123..9bd8938 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -26,7 +26,7 @@
#include "inferior.h"
#include "exceptions.h"
#include "breakpoint.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdbcore.h"
#include "gdbcmd.h"
#include "cli/cli-script.h"
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index d46fe84..53c6300 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -31,7 +31,7 @@
#include "gdbthread.h"

#include <sys/ptrace.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <sys/param.h>
#include <dirent.h>
#include <ctype.h>
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 67a6c43..89abca7 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -21,7 +21,7 @@
#include "inferior.h"
#include "target.h"
#include <string.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdb_assert.h"
#ifdef HAVE_TKILL_SYSCALL
#include <unistd.h>
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index d201aa8..453ea4c 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -36,7 +36,7 @@
#include <signal.h>
#include <sys/user.h>
#include <sys/ioctl.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <fcntl.h>
#include <sys/procfs.h>
#include <sys/ptrace.h>
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index 876d08c..0ef4e78 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -45,7 +45,7 @@
#include <sys/user.h> /* for struct user */
#endif
#include <fcntl.h> /* for O_RDWR etc. */
-#include "gdb_wait.h"
+#include <sys/wait.h>

#include "proc-utils.h"

diff --git a/gdb/procfs.c b/gdb/procfs.c
index d7d0d50..c43373d 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -42,7 +42,7 @@
#include <sys/syscall.h>
#endif
#include <sys/errno.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <signal.h>
#include <ctype.h>
#include "gdb_bfd.h"
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index ec981ee..2ffb392 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -24,7 +24,7 @@
#include "gdbcmd.h"
#include "remote.h"
#include "gdb/fileio.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <sys/stat.h>
#include "exceptions.h"
#include "remote-fileio.h"
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index e1d46e3..d5b6e63 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -26,7 +26,7 @@
#include <signal.h>
#include <string.h>
#include <sys/ptrace.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#ifdef HAVE_MACHINE_REG_H
#include <machine/reg.h>
#endif
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index bbab38d..b51ed8f 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -27,7 +27,7 @@
#include "inf-ptrace.h"
#include "regcache.h"
#include "symfile.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "gdbthread.h"
#include "gdb_bfd.h"

diff --git a/gdb/utils.c b/gdb/utils.c
index 316cbd6..6ed0c5b 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -22,7 +22,7 @@
#include "gdb_assert.h"
#include <ctype.h>
#include <string.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include "event-top.h"
#include "exceptions.h"
#include "gdbthread.h"
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index e287f18..a9eede0 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -33,7 +33,7 @@
#include <signal.h>
#include <sys/user.h>
#include <sys/ioctl.h>
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <fcntl.h>
#include <sys/procfs.h>
#include <sys/ptrace.h>
--
1.7.7.6