1 #include "beos/beosish.h"
16 /* In BeOS 5.0 the waitpid() seems to misbehave in that the status
17 * has the upper and lower bytes swapped compared with the usual
18 * POSIX/UNIX implementations. To undo the surpise effect to the
19 * rest of Perl we need this wrapper. (The rest of BeOS might be
20 * surprised because of this, though.) */
22 pid_t beos_waitpid(pid_t process_id, int *status_location, int options) {
23 pid_t got = waitpid(process_id, status_location, options);
26 (*status_location & 0x00FF) << 8 |
27 (*status_location & 0xFF00) >> 8;
32 /* BeOS kill() doesn't like the combination of the pseudo-signal 0 and
33 * specifying a process group (i.e. pid < -1 || pid == 0). We work around
34 * by changing pid to the respective process group leader. That should work
35 * well enough in most cases. */
37 int beos_kill(pid_t pid, int sig)
41 /* it's our process group */
43 } else if (pid < -1) {
44 /* just address the process group leader */
49 return kill(pid, sig);
52 /* sigaction() should fail, if trying to ignore or install a signal handler
53 * for a signal that cannot be caught or ignored. The BeOS R5 sigaction()
54 * doesn't return an error, though. */
55 int beos_sigaction(int sig, const struct sigaction *act,
56 struct sigaction *oact)
58 int result = sigaction(sig, act, oact);
60 if (result == 0 && act && act->sa_handler != SIG_DFL
61 && act->sa_handler != SIG_ERR && (sig == SIGKILL || sig == SIGSTOP)) {