File: beos.c

package info (click to toggle)
perl 5.8.4-8sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 58,128 kB
  • ctags: 31,422
  • sloc: perl: 224,262; ansic: 155,398; sh: 32,253; pascal: 7,747; lisp: 6,121; makefile: 2,341; cpp: 2,035; yacc: 1,019; java: 23
file content (20 lines) | stat: -rw-r--r-- 649 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "beos/beosish.h"

#undef waitpid

#include <sys/wait.h>

/* In BeOS 5.0 the waitpid() seems to misbehave in that the status
 * has the upper and lower bytes swapped compared with the usual
 * POSIX/UNIX implementations.  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(process_id, status_location, options);
    if (status_location)
      *status_location =
	(*status_location & 0x00FF) << 8 |
	(*status_location & 0xFF00) >> 8;
    return got;
}