The BeOS waitpid() seems to be broken,
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 11 Dec 2001 15:27:06 +0000 (15:27 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 11 Dec 2001 15:27:06 +0000 (15:27 +0000)
have a wrapper for it.

p4raw-id: //depot/perl@13624

MANIFEST
beos/beos.c [new file with mode: 0644]
beos/beosish.h [new file with mode: 0644]
hints/beos.sh
perl.h

index 5501dbf..843d2f5 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,6 +3,8 @@ Artistic                The "Artistic License"
 AUTHORS                        Contact info for contributors
 av.c                   Array value code
 av.h                   Array value header
+beos/beosish.h         BeOS port
+beos/beos.c            BeOS port
 beos/nm.c              BeOS port
 bytecode.pl            Produces ext/ByteLoader/byterun.h, ext/ByteLoader/byterun.c and ext/B/Asmdata.pm
 cc_runtime.h           Macros need by runtime of compiler-generated code
diff --git a/beos/beos.c b/beos/beos.c
new file mode 100644 (file)
index 0000000..f0e8147
--- /dev/null
@@ -0,0 +1,16 @@
+#undef waitpid
+
+#include <sys/wait.h>
+
+/* In BeOS 5.0 the waitpid() seems to misbehave in that the status
+ * is _not_ shifted left by eight (multiplied by 256), as it is in
+ * POSIX/UNIX.  To undo the surpise effect to the rest of Perl we
+ * need this wrapper.  (The rest of BeOS might be surprised because
+ * of this, though.) */
+
+pid_t beos_waitpid(pid_t process_id, int *status_location, int options) {
+    pid_t got = waitpid(procedd_is, status_location, options);
+    if (status_localtion)
+        *status_location <<= 8;
+    return got;
+}
diff --git a/beos/beosish.h b/beos/beosish.h
new file mode 100644 (file)
index 0000000..4c999da
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef PERL_BEOS_BEOSISH_H
+#define PERL_BEOS_BEOSISH_H
+
+#include "unixish.h"
+
+#undef  waitpid
+#define waitpid beos_waitpid
+
+/* This seems to be protoless. */
+char *gcvt(double value, int num_digits, char *buffer);
+
+#endif
+
index c106775..bfe2ee8 100644 (file)
@@ -55,3 +55,5 @@ case "$ldlibpthname" in
 '') ldlibpthname=LIBRARY_PATH ;;
 esac
 
+# the waitpid() wrapper
+archobjs="beos/beos.o"
diff --git a/perl.h b/perl.h
index ace2aac..dbfadc8 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1800,6 +1800,11 @@ typedef struct clone_params CLONE_PARAMS;
 #   define ISHISH "macos classic"
 #endif
 
+#if defined(__BEOS__)
+#   include "beos/beosish.h"
+#   define ISHISH "beos"
+#endif
+
 #ifndef ISHISH
 #   include "unixish.h"
 #   define ISHISH "unix"