diff mbox series

AT&T Unix PC : 14-broken-wait-h (amended)

Message ID acdd690e-77fb-4a90-9471-4f165d5a0ad6@knaff.lu (mailing list archive)
State Under Review
Delegated to: Herbert Xu
Headers show
Series AT&T Unix PC : 14-broken-wait-h (amended) | expand

Commit Message

Alain Knaff Nov. 17, 2024, 6:50 p.m. UTC
Hi,

UnixPC ships with a wait.h for the wrong endianness.

This patch provides a local replacement (triggered by absence
WEXITSTATUS flag)

After having applied the patches until and including this one, it should
compile for UnixPC, but not yet work. The next couple of patches address
issues that only become apparent at runtime or optional features.

Edit: but there is an amendment *here*. The "bad" sys/wait.h problem is 
apparently more general than just AT&T Unix PC, and autoconf has a 
specific test for this condition (and simply ignores sys/wait.h if it is 
bad). This new version of the patch follows the approach given in 
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html

Regards,

Alain
diff mbox series

Patch

diff -X ../exclude.txt -urN dash-0.5.12+13-wait3-replacement/configure.ac dash-0.5.12+14-broken-wait-h/configure.ac
--- dash-0.5.12+13-wait3-replacement/configure.ac	2024-11-10 20:26:19.105474215 +0000
+++ dash-0.5.12+14-broken-wait-h/configure.ac	2024-11-17 18:36:24.270333145 +0000
@@ -46,6 +46,7 @@ 
 dnl Checks for header files.
 AC_CHECK_HEADERS(alloca.h paths.h pwd.h stdbool.h dirent.h \
 		getopt.h sys/resource.h termios.h sys/time.h)
+AC_HEADER_SYS_WAIT
 
 dnl Check for declarations
 AC_CHECK_DECL([_PATH_BSHELL],,AC_DEFINE_UNQUOTED([_PATH_BSHELL], "/bin/sh", [Define to system shell path]),[
diff -X ../exclude.txt -urN dash-0.5.12+13-wait3-replacement/src/jobs.c dash-0.5.12+14-broken-wait-h/src/jobs.c
--- dash-0.5.12+13-wait3-replacement/src/jobs.c	2024-11-10 21:51:55.911519696 +0000
+++ dash-0.5.12+14-broken-wait-h/src/jobs.c	2024-11-17 18:36:24.270333145 +0000
@@ -43,8 +43,12 @@ 
 #endif
 #include <sys/types.h>
 #include <sys/param.h>
+
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
 #ifdef BSD
-#include <sys/wait.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
diff -X ../exclude.txt -urN dash-0.5.12+13-wait3-replacement/src/system.h dash-0.5.12+14-broken-wait-h/src/system.h
--- dash-0.5.12+13-wait3-replacement/src/system.h	2024-11-10 14:53:08.418618090 +0000
+++ dash-0.5.12+14-broken-wait-h/src/system.h	2024-11-17 18:36:24.274333237 +0000
@@ -220,3 +220,14 @@ 
 #ifndef HAVE_LSTAT
 #define lstat stat
 #endif
+
+/* As recommended by https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html */
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+#ifndef WTERMSIG
+#define	WTERMSIG(stat_val) ((stat_val) & 127)
+#endif