1 |
ulm 11/12/24 22:58:52 |
2 |
|
3 |
Added: 09_all_syswait.patch |
4 |
Log: |
5 |
Include sys/wait.h if available. Backported from Emacs 21.4. |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 src/patchsets/emacs/18.59/09_all_syswait.patch |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/emacs/18.59/09_all_syswait.patch?rev=1.1&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/emacs/18.59/09_all_syswait.patch?rev=1.1&content-type=text/plain |
12 |
|
13 |
Index: 09_all_syswait.patch |
14 |
=================================================================== |
15 |
Include sys/wait.h if available. |
16 |
Backported from Emacs 21.4. |
17 |
|
18 |
--- emacs-18.59-orig/src/process.c |
19 |
+++ emacs-18.59/src/process.c |
20 |
@@ -138,55 +138,37 @@ |
21 |
On many systems, there is a structure defined for this. |
22 |
But on vanilla-ish USG systems there is not. */ |
23 |
|
24 |
-#ifndef WAITTYPE |
25 |
-#if !defined (BSD) && !defined (UNIPLUS) && !defined (STRIDE) && !(defined (HPUX) && !defined (NOMULTIPLEJOBS)) && !defined (HAVE_WAIT_HEADER) |
26 |
-#define WAITTYPE int |
27 |
-#define WIFSTOPPED(w) ((w&0377) == 0177) |
28 |
-#define WIFSIGNALED(w) ((w&0377) != 0177 && (w&~0377) == 0) |
29 |
-#define WIFEXITED(w) ((w&0377) == 0) |
30 |
-#define WRETCODE(w) (w >> 8) |
31 |
-#define WSTOPSIG(w) (w >> 8) |
32 |
-#define WTERMSIG(w) (w & 0377) |
33 |
-#ifndef WCOREDUMP |
34 |
-#define WCOREDUMP(w) ((w&0200) != 0) |
35 |
-#endif |
36 |
-#else |
37 |
-#ifdef BSD4_1 |
38 |
-#include <wait.h> |
39 |
-#else |
40 |
+#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */ |
41 |
#include <sys/wait.h> |
42 |
-#endif /* not BSD 4.1 */ |
43 |
+#ifndef WCOREDUMP /* not POSIX */ |
44 |
+#define WCOREDUMP(w) ((w) & 0x80) |
45 |
+#endif |
46 |
|
47 |
-#define WAITTYPE union wait |
48 |
-#define WRETCODE(w) w.w_retcode |
49 |
-#define WCOREDUMP(w) w.w_coredump |
50 |
+#else /* !HAVE_SYS_WAIT_H */ |
51 |
|
52 |
-#ifdef HPUX |
53 |
-/* HPUX version 7 has broken definitions of these. */ |
54 |
-#undef WTERMSIG |
55 |
-#undef WSTOPSIG |
56 |
+/* Note that sys/wait.h may still be included by stdlib.h or something |
57 |
+ according to XPG. */ |
58 |
+ |
59 |
+#undef WEXITSTATUS |
60 |
+#define WEXITSTATUS(w) (((w) & 0xff00) >> 8) |
61 |
+#undef WIFEXITED |
62 |
+#define WIFEXITED(w) (WTERMSIG(w) == 0) |
63 |
#undef WIFSTOPPED |
64 |
+#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) |
65 |
#undef WIFSIGNALED |
66 |
-#undef WIFEXITED |
67 |
-#endif |
68 |
+#define WIFSIGNALED(w) (!WIFSTOPPED(w) && !WIFEXITED(w)) |
69 |
+#undef WSTOPSIG |
70 |
+#define WSTOPSIG(w) WEXITSTATUS(w) |
71 |
+#undef WTERMSIG |
72 |
+#define WTERMSIG(w) ((w) & 0x7f) |
73 |
+#undef WCOREDUMP |
74 |
+#define WCOREDUMP(w) ((w) & 0x80) |
75 |
+#endif /* HAVE_SYS_WAIT_H */ |
76 |
|
77 |
-#ifndef WTERMSIG |
78 |
-#define WTERMSIG(w) w.w_termsig |
79 |
-#endif |
80 |
-#ifndef WSTOPSIG |
81 |
-#define WSTOPSIG(w) w.w_stopsig |
82 |
-#endif |
83 |
-#ifndef WIFSTOPPED |
84 |
-#define WIFSTOPPED(w) (WTERMSIG (w) == 0177) |
85 |
-#endif |
86 |
-#ifndef WIFSIGNALED |
87 |
-#define WIFSIGNALED(w) (WTERMSIG (w) != 0177 && (WSTOPSIG (w)) == 0) |
88 |
-#endif |
89 |
-#ifndef WIFEXITED |
90 |
-#define WIFEXITED(w) (WTERMSIG (w) == 0) |
91 |
-#endif |
92 |
-#endif /* BSD or UNIPLUS or STRIDE */ |
93 |
-#endif /* no WAITTYPE */ |
94 |
+#undef WAITTYPE |
95 |
+#define WAITTYPE int |
96 |
+#undef WRETCODE |
97 |
+#define WRETCODE(w) WEXITSTATUS (w) |
98 |
|
99 |
extern errno; |
100 |
extern sys_nerr; |
101 |
--- emacs-18.59-orig/src/s-linux.h |
102 |
+++ emacs-18.59/src/s-linux.h |
103 |
@@ -166,6 +166,7 @@ |
104 |
#define NO_SIOCTL_H /* don't have sioctl.h */ |
105 |
#define SYSV_SYSTEM_DIR /* use dirent.h */ |
106 |
#define USG_SYS_TIME /* use sys/time.h, not time.h */ |
107 |
+#define HAVE_SYS_WAIT_H /* we have sys/wait.h */ |
108 |
|
109 |
#define POSIX /* affects only getpagesize.h */ |
110 |
#define POSIX_SIGNALS /* uses sigaction from sys_signal */ |