Integrate:
[p5sagit/p5-mst-13.2.git] / beos / beos.c
CommitLineData
d1c9dd79 1#include "beos/beosish.h"
30410c71 2
efca5cc6 3#undef waitpid
4
5#include <sys/wait.h>
6
7/* In BeOS 5.0 the waitpid() seems to misbehave in that the status
dff18f87 8 * has the upper and lower bytes swapped compared with the usual
9 * POSIX/UNIX implementations. To undo the surpise effect to the
10 * rest of Perl we need this wrapper. (The rest of BeOS might be
11 * surprised because of this, though.) */
efca5cc6 12
13pid_t beos_waitpid(pid_t process_id, int *status_location, int options) {
30410c71 14 pid_t got = waitpid(process_id, status_location, options);
7b9cd8f0 15 if (status_location)
dff18f87 16 *status_location =
17 (*status_location & 0x00FF) << 8 |
18 (*status_location & 0xFF00) >> 8;
efca5cc6 19 return got;
20}