aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2011-12-24 22:58:52 +0000
committerUlrich Müller <ulm@gentoo.org>2011-12-24 22:58:52 +0000
commit3835451c50055c2db627703bd96d48c7edb58fbd (patch)
tree7295c688f80fde8b17063a2a5dc07e7eedd78f1c
parentRespect LDFLAGS when building programs in etc. (diff)
downloademacs-patches-3835451c50055c2db627703bd96d48c7edb58fbd.tar.gz
emacs-patches-3835451c50055c2db627703bd96d48c7edb58fbd.tar.bz2
emacs-patches-3835451c50055c2db627703bd96d48c7edb58fbd.zip
Include sys/wait.h if available. Backported from Emacs 21.4.emacs-18.59-patches-7
-rw-r--r--emacs/18.59/09_all_syswait.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/emacs/18.59/09_all_syswait.patch b/emacs/18.59/09_all_syswait.patch
new file mode 100644
index 0000000..0f55500
--- /dev/null
+++ b/emacs/18.59/09_all_syswait.patch
@@ -0,0 +1,96 @@
+Include sys/wait.h if available.
+Backported from Emacs 21.4.
+
+--- emacs-18.59-orig/src/process.c
++++ emacs-18.59/src/process.c
+@@ -138,55 +138,37 @@
+ On many systems, there is a structure defined for this.
+ But on vanilla-ish USG systems there is not. */
+
+-#ifndef WAITTYPE
+-#if !defined (BSD) && !defined (UNIPLUS) && !defined (STRIDE) && !(defined (HPUX) && !defined (NOMULTIPLEJOBS)) && !defined (HAVE_WAIT_HEADER)
+-#define WAITTYPE int
+-#define WIFSTOPPED(w) ((w&0377) == 0177)
+-#define WIFSIGNALED(w) ((w&0377) != 0177 && (w&~0377) == 0)
+-#define WIFEXITED(w) ((w&0377) == 0)
+-#define WRETCODE(w) (w >> 8)
+-#define WSTOPSIG(w) (w >> 8)
+-#define WTERMSIG(w) (w & 0377)
+-#ifndef WCOREDUMP
+-#define WCOREDUMP(w) ((w&0200) != 0)
+-#endif
+-#else
+-#ifdef BSD4_1
+-#include <wait.h>
+-#else
++#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
+ #include <sys/wait.h>
+-#endif /* not BSD 4.1 */
++#ifndef WCOREDUMP /* not POSIX */
++#define WCOREDUMP(w) ((w) & 0x80)
++#endif
+
+-#define WAITTYPE union wait
+-#define WRETCODE(w) w.w_retcode
+-#define WCOREDUMP(w) w.w_coredump
++#else /* !HAVE_SYS_WAIT_H */
+
+-#ifdef HPUX
+-/* HPUX version 7 has broken definitions of these. */
+-#undef WTERMSIG
+-#undef WSTOPSIG
++/* Note that sys/wait.h may still be included by stdlib.h or something
++ according to XPG. */
++
++#undef WEXITSTATUS
++#define WEXITSTATUS(w) (((w) & 0xff00) >> 8)
++#undef WIFEXITED
++#define WIFEXITED(w) (WTERMSIG(w) == 0)
+ #undef WIFSTOPPED
++#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
+ #undef WIFSIGNALED
+-#undef WIFEXITED
+-#endif
++#define WIFSIGNALED(w) (!WIFSTOPPED(w) && !WIFEXITED(w))
++#undef WSTOPSIG
++#define WSTOPSIG(w) WEXITSTATUS(w)
++#undef WTERMSIG
++#define WTERMSIG(w) ((w) & 0x7f)
++#undef WCOREDUMP
++#define WCOREDUMP(w) ((w) & 0x80)
++#endif /* HAVE_SYS_WAIT_H */
+
+-#ifndef WTERMSIG
+-#define WTERMSIG(w) w.w_termsig
+-#endif
+-#ifndef WSTOPSIG
+-#define WSTOPSIG(w) w.w_stopsig
+-#endif
+-#ifndef WIFSTOPPED
+-#define WIFSTOPPED(w) (WTERMSIG (w) == 0177)
+-#endif
+-#ifndef WIFSIGNALED
+-#define WIFSIGNALED(w) (WTERMSIG (w) != 0177 && (WSTOPSIG (w)) == 0)
+-#endif
+-#ifndef WIFEXITED
+-#define WIFEXITED(w) (WTERMSIG (w) == 0)
+-#endif
+-#endif /* BSD or UNIPLUS or STRIDE */
+-#endif /* no WAITTYPE */
++#undef WAITTYPE
++#define WAITTYPE int
++#undef WRETCODE
++#define WRETCODE(w) WEXITSTATUS (w)
+
+ extern errno;
+ extern sys_nerr;
+--- emacs-18.59-orig/src/s-linux.h
++++ emacs-18.59/src/s-linux.h
+@@ -166,6 +166,7 @@
+ #define NO_SIOCTL_H /* don't have sioctl.h */
+ #define SYSV_SYSTEM_DIR /* use dirent.h */
+ #define USG_SYS_TIME /* use sys/time.h, not time.h */
++#define HAVE_SYS_WAIT_H /* we have sys/wait.h */
+
+ #define POSIX /* affects only getpagesize.h */
+ #define POSIX_SIGNALS /* uses sigaction from sys_signal */