* Re: [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory.
[not found] <7358.97838972068$1352968938@news.gmane.org>
@ 2012-11-15 16:02 ` Tom Tromey
2012-11-15 16:13 ` Pedro Alves
2012-11-15 17:46 ` Joel Brobecker
0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2012-11-15 16:02 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> I know that Joel and Tom talked about using
Pierre> gnulib instead of our own headers, but this is out of
Pierre> my competence, thus I send a patch that is really
Pierre> a quick way to remove Critical entries from ARI web page.
FWIW, yesterday I experimented with this.
I updated gnulib to latest, added some modules, and removed some
now-useless things from gdb and gdbserver.
In particular, I was able to get rid of gdb_dirent.h, gdb_string.h, and
gdb_stat.h; plus a bunch of more minor things.
I'll send this patch series soon. The biggest problem is testing it. I
don't really have access to hosts that would require most of this
configury.
If people want to test it out rather than just seeing the patches, I'm
happy to push a branch to archer.git.
gdb_wait.h also looks pretty easy to drop.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory.
2012-11-15 16:02 ` [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory Tom Tromey
@ 2012-11-15 16:13 ` Pedro Alves
2012-11-15 17:46 ` Joel Brobecker
1 sibling, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2012-11-15 16:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pierre Muller, gdb-patches
On 15-11-2012 16:02, Tom Tromey wrote:
>>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
>
> Pierre> I know that Joel and Tom talked about using
> Pierre> gnulib instead of our own headers, but this is out of
> Pierre> my competence, thus I send a patch that is really
> Pierre> a quick way to remove Critical entries from ARI web page.
>
> FWIW, yesterday I experimented with this.
>
> I updated gnulib to latest, added some modules, and removed some
> now-useless things from gdb and gdbserver.
>
> In particular, I was able to get rid of gdb_dirent.h, gdb_string.h, and
> gdb_stat.h; plus a bunch of more minor things.
Excellent. FAOD, even though I approved Pierre's patches, I'm all for this.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory.
2012-11-15 16:02 ` [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory Tom Tromey
2012-11-15 16:13 ` Pedro Alves
@ 2012-11-15 17:46 ` Joel Brobecker
1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2012-11-15 17:46 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pierre Muller, gdb-patches
> I'll send this patch series soon. The biggest problem is testing it. I
> don't really have access to hosts that would require most of this
> configury.
I'd say, let's just commit and see if we have any problem. If there
is any breakage, we can fix it then.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory.
[not found] <50a4aadb.c54c420a.715f.5d53SMTPIN_ADDED@mx.google.com>
@ 2012-11-15 10:15 ` Pedro Alves
0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2012-11-15 10:15 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
On 15-11-2012 08:41, Pierre Muller wrote:
> 2012-11-14 Pierre Muller <muller@sourceware.org>
>
> ARI fixes: move gdb_wait and gdb_stat headers to common
> subdirectory.
> * gdb_stat.h: Delete. Moved to common directory.
> * common/gdb_stat.h: New file.
> * gdb_wait.h: Delete. Moved to common directory.
> * common/gdb_wait.h: New file.
> * Makefile.in (H_FILES_NO_SRC): Adapt to new header
> location.
> * contrib/ari/gdb_ari.sh (wait.h rule): Adapt to new gdb_wait.h
> location.
> (stat.h rule): Adapt to new gdb_stat.h location.
> * common/linux-osdata.c: Include "gdb_stat.h" header instead of
> <sys/stat.h> header.
> * common/linux-ptrace.c: Include "gdb_wait.h" header instead of
> <sys/wait.h> header.
Note tabs vs spaces.
When moving headers to common/, we need to ensure that whatever config.h
HAVE_FOO symbols they are using are also produced by gdbserver's configure
too.
gdb_wait.h seems to depend on AC_CHECK_HEADERS checks for sys/wait.h and
wait.h. gdbserver's configure only checks the former.
gdb_stat.h seems to depend on AC_HEADER_STAT for STAT_MACROS_BROKEN.
gdbserver's configure doesn't call that macro. But, according to autoconf's
manual:
> Macro: AC_HEADER_STAT
>
> If the macros S_ISDIR, S_ISREG, etc. defined in sys/stat.h do not work properly
> (returning false positives), define STAT_MACROS_BROKEN. This is
> the case on Tektronix UTekV, Amdahl UTS and Motorola System V/88.
>
> This macro is obsolescent, as no current systems have the bug. New
> programs need not use this macro.
These old hosts are not relevant for GDB anymore (I found references to
Motorola 88000 but support was removed on 6.0). So we can just remove
the AC_HEADER_STAT call from gdb's configure.ac, and remove the whole
STAT_MACROS_BROKEN block from gdb_stat.h. That would be done as a separate
patch (in a separate email thread). I'd prefer that be done before the
move, thus avoiding adding AC_HEADER_STAT to gdbserver.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory.
@ 2012-11-15 8:41 Pierre Muller
0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2012-11-15 8:41 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]
The following entry removes two more critical
entries at top of
http://sourceware.org/gdb/current/ari/test/
I know that Joel and Tom talked about using
gnulib instead of our own headers, but this is out of
my competence, thus I send a patch that is really
a quick way to remove Critical entries from ARI web page.
I hope that this patch can be checked in
despite the idea of going towards a more intensive use of gnulib.
Comments welcome,
Pierre Muller
as ARI maintainer.
ChangeLog entry:
2012-11-14 Pierre Muller <muller@sourceware.org>
ARI fixes: move gdb_wait and gdb_stat headers to common
subdirectory.
* gdb_stat.h: Delete. Moved to common directory.
* common/gdb_stat.h: New file.
* gdb_wait.h: Delete. Moved to common directory.
* common/gdb_wait.h: New file.
* Makefile.in (H_FILES_NO_SRC): Adapt to new header
location.
* contrib/ari/gdb_ari.sh (wait.h rule): Adapt to new gdb_wait.h
location.
(stat.h rule): Adapt to new gdb_stat.h location.
* common/linux-osdata.c: Include "gdb_stat.h" header instead of
<sys/stat.h> header.
* common/linux-ptrace.c: Include "gdb_wait.h" header instead of
<sys/wait.h> header.
[-- Attachment #2: ARI-stat-wait.patch --]
[-- Type: application/octet-stream, Size: 17461 bytes --]
projecttype:gdb
revision:HEAD
email:muller@ics.u-strasbg.fr
2012-11-14 Pierre Muller <muller@sourceware.org>
ARI fixes: move gdb_wait and gdb_stat headers to common subdirectory.
* gdb_stat.h: Delete. Moved to common directory.
* common/gdb_stat.h: New file.
* gdb_wait.h: Delete. Moved to common directory.
* common/gdb_wait.h: New file.
* Makefile.in (H_FILES_NO_SRC): Adapt to new header
location.
* contrib/ari/gdb_ari.sh (wait.h rule): Adapt to new gdb_wait.h
location.
(stat.h rule): Adapt to new gdb_stat.h location.
* common/linux-osdata.c: Include "gdb_stat.h" header instead of
<sys/stat.h> header.
* common/linux-ptrace.c: Include "gdb_wait.h" header instead of
<sys/wait.h> header.
Index: src/gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1216
diff -u -p -r1.1216 Makefile.in
--- src/gdb/Makefile.in 13 Sep 2012 14:35:16 -0000 1.1216
+++ src/gdb/Makefile.in 14 Nov 2012 08:57:21 -0000
@@ -781,7 +781,7 @@ gnulib/import/string.in.h gnulib/import/
gnulib/import/stdint.in.h remote.h gdb.h sparc-nat.h \
gdbthread.h dwarf2-frame.h dwarf2-frame-tailcall.h nbsd-nat.h dcache.h \
amd64-nat.h s390-tdep.h arm-linux-tdep.h exceptions.h macroscope.h \
-gdbarch.h bsd-uthread.h gdb_stat.h memory-map.h memrange.h \
+gdbarch.h bsd-uthread.h common/gdb_stat.h memory-map.h memrange.h \
mdebugread.h m88k-tdep.h stabsread.h hppa-linux-offsets.h linux-fork.h \
ser-unix.h inf-ptrace.h terminal.h ui-out.h frame-base.h \
f-lang.h dwarf2loc.h value.h sparc-tdep.h defs.h target-descriptions.h \
@@ -799,7 +799,7 @@ expression.h score-tdep.h gdb_select.h s
call-cmds.h typeprint.h mi/mi-getopt.h mi/mi-parse.h mi/mi-console.h \
mi/mi-out.h mi/mi-main.h mi/mi-common.h mi/mi-cmds.h linux-nat.h \
complaints.h gdb_proc_service.h gdb_regex.h xtensa-tdep.h inf-loop.h \
-gdb_wait.h common/gdb_assert.h solib.h ppc-tdep.h cp-support.h glibc-tdep.h \
+common/gdb_wait.h common/gdb_assert.h solib.h ppc-tdep.h cp-support.h glibc-tdep.h \
interps.h auxv.h gdbcmd.h tramp-frame.h mipsnbsd-tdep.h \
amd64-linux-tdep.h linespec.h i387-tdep.h mn10300-tdep.h \
sparc64-tdep.h monitor.h ppcobsd-tdep.h srec.h solib-pa64.h \
Index: src/gdb/gdb_stat.h
===================================================================
RCS file: gdb_stat.h
diff -N gdb_stat.h
--- src/gdb/gdb_stat.h 4 Jan 2012 08:17:02 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/* Portable <sys/stat.h>
- Copyright (C) 1995, 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/>. */
-
-#if !defined(GDB_STAT_H)
-#define GDB_STAT_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISREG
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISSOCK
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#endif
-
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-
-/* Microsoft C's stat.h doesn't define all the POSIX file modes. */
-#ifndef S_IROTH
-#define S_IROTH S_IREAD
-#endif
-
-#endif /* !defined(GDB_STAT_H) */
Index: src/gdb/gdb_wait.h
===================================================================
RCS file: gdb_wait.h
diff -N gdb_wait.h
--- src/gdb/gdb_wait.h 4 Jan 2012 08:17:02 -0000 1.14
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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
Index: src/gdb/contrib/ari/gdb_ari.sh
===================================================================
RCS file: /cvs/src/src/gdb/contrib/ari/gdb_ari.sh,v
retrieving revision 1.4
diff -u -p -r1.4 gdb_ari.sh
--- src/gdb/contrib/ari/gdb_ari.sh 8 Nov 2012 09:04:27 -0000 1.4
+++ src/gdb/contrib/ari/gdb_ari.sh 14 Nov 2012 08:57:22 -0000
@@ -358,7 +358,7 @@ Do not include gnu-regex.h, instead incl
BEGIN { doc["stat.h"] = "\
Do not include stat.h or sys/stat.h, instead include gdb_stat.h"
category["stat.h"] = ari_regression
- fix("stat.h", "gdb/gdb_stat.h", 1)
+ fix("stat.h", "common/gdb_stat.h", 1)
}
/^#[[:space:]]*include[[:space:]]*.stat\.h./ \
|| /^#[[:space:]]*include[[:space:]]*.sys\/stat\.h./ {
@@ -367,7 +367,7 @@ Do not include stat.h or sys/stat.h, ins
BEGIN { doc["wait.h"] = "\
Do not include wait.h or sys/wait.h, instead include gdb_wait.h"
- fix("wait.h", "gdb/gdb_wait.h", 2);
+ fix("wait.h", "common/gdb_wait.h", 2);
category["wait.h"] = ari_regression
}
/^#[[:space:]]*include[[:space:]]*.wait\.h./ \
Index: src/gdb/common/gdb_stat.h
===================================================================
RCS file: common/gdb_stat.h
diff -N common/gdb_stat.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/gdb/common/gdb_stat.h 14 Nov 2012 08:57:22 -0000
@@ -0,0 +1,72 @@
+/* Portable <sys/stat.h>
+ Copyright (C) 1995, 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/>. */
+
+#if !defined(GDB_STAT_H)
+#define GDB_STAT_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef STAT_MACROS_BROKEN
+#undef S_ISBLK
+#undef S_ISCHR
+#undef S_ISDIR
+#undef S_ISREG
+#undef S_ISFIFO
+#undef S_ISLNK
+#undef S_ISSOCK
+#undef S_ISMPB
+#undef S_ISMPC
+#undef S_ISNWK
+#endif
+
+#if !defined(S_ISBLK) && defined(S_IFBLK)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#endif
+#if !defined(S_ISCHR) && defined(S_IFCHR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#endif
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+#if !defined(S_ISREG) && defined(S_IFREG)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+#if !defined(S_ISFIFO) && defined(S_IFIFO)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#endif
+#if !defined(S_ISLNK) && defined(S_IFLNK)
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif
+#if !defined(S_ISSOCK) && defined(S_IFSOCK)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+#endif
+#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
+#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+#endif
+#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
+#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+#endif
+
+/* Microsoft C's stat.h doesn't define all the POSIX file modes. */
+#ifndef S_IROTH
+#define S_IROTH S_IREAD
+#endif
+
+#endif /* !defined(GDB_STAT_H) */
Index: src/gdb/common/gdb_wait.h
===================================================================
RCS file: common/gdb_wait.h
diff -N common/gdb_wait.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/gdb/common/gdb_wait.h 14 Nov 2012 08:57:22 -0000
@@ -0,0 +1,113 @@
+/* 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
Index: src/gdb/common/linux-osdata.c
===================================================================
RCS file: /cvs/src/src/gdb/common/linux-osdata.c,v
retrieving revision 1.7
diff -u -p -r1.7 linux-osdata.c
--- src/gdb/common/linux-osdata.c 7 Nov 2012 12:35:04 -0000 1.7
+++ src/gdb/common/linux-osdata.c 14 Nov 2012 08:57:22 -0000
@@ -26,7 +26,6 @@
#include "linux-osdata.h"
#include <sys/types.h>
-#include <sys/stat.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -43,6 +42,7 @@
#include "buffer.h"
#include "gdb_assert.h"
#include "gdb_dirent.h"
+#include "gdb_stat.h"
/* Define PID_T to be a fixed size that is at least as large as pid_t,
so that reading pid values embedded in /proc works
Index: src/gdb/common/linux-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/common/linux-ptrace.c,v
retrieving revision 1.4
diff -u -p -r1.4 linux-ptrace.c
--- src/gdb/common/linux-ptrace.c 17 Sep 2012 18:27:58 -0000 1.4
+++ src/gdb/common/linux-ptrace.c 14 Nov 2012 08:57:22 -0000
@@ -27,6 +27,7 @@
#include "linux-procfs.h"
#include "buffer.h"
#include "gdb_assert.h"
+#include "gdb_wait.h"
/* Find all possible reasons we could fail to attach PID and append these
newline terminated reason strings to initialized BUFFER. '\0' termination
@@ -57,7 +58,6 @@ extern void (linux_ptrace_test_ret_to_nx
#include <sys/reg.h>
#include <sys/mman.h>
#include <signal.h>
-#include <sys/wait.h>
#include <stdint.h>
#endif /* defined __i386__ || defined __x86_64__ */
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-15 17:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <7358.97838972068$1352968938@news.gmane.org>
2012-11-15 16:02 ` [RFA] ARI fixes: move gdb_stat.h and gdb_wait.h to common subdirectory Tom Tromey
2012-11-15 16:13 ` Pedro Alves
2012-11-15 17:46 ` Joel Brobecker
[not found] <50a4aadb.c54c420a.715f.5d53SMTPIN_ADDED@mx.google.com>
2012-11-15 10:15 ` Pedro Alves
2012-11-15 8:41 Pierre Muller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox