--- emacs-18.59-orig/src/ChangeLog +++ emacs-18.59/src/ChangeLog @@ -1,3 +1,9 @@ +2011-12-24 Ulrich Mueller + + * process.c: Include sys/wait.h if available. + Backported from Emacs 21.4. + * s-linux.h (HAVE_SYS_WAIT_H): Define. + 2010-03-11 Ulrich Mueller * Makefile (xmakefile): Call C preprocessor with -P option, --- 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 */