From 3835451c50055c2db627703bd96d48c7edb58fbd Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Sat, 24 Dec 2011 22:58:52 +0000 Subject: Include sys/wait.h if available. Backported from Emacs 21.4. --- emacs/18.59/09_all_syswait.patch | 96 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 emacs/18.59/09_all_syswait.patch (limited to 'emacs/18.59/09_all_syswait.patch') 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 +-#else ++#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */ + #include +-#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 */ -- cgit v1.2.3-65-gdbad