1
0
mirror of https://github.com/golang/go synced 2024-11-21 13:24:40 -07:00

syscall: correct WSTOPPED on OS X

Have to set #defines correctly to get correct value.
Otherwise get a mask for use in implementing WIFSTOPPED(status).

Changed WSTOPPED definition in os because on
OS X WSTOPPED and WUNTRACED have different values
even though they seem to mean the same thing.

Fixes #1374.

R=r, r2
CC=golang-dev
https://golang.org/cl/4063042
This commit is contained in:
Russ Cox 2011-01-18 14:02:41 -05:00
parent 166b444a93
commit acd858eee0
4 changed files with 78 additions and 7 deletions

View File

@ -67,10 +67,10 @@ type Waitmsg struct {
// Options for Wait.
const (
WNOHANG = syscall.WNOHANG // Don't wait if no process has exited.
WSTOPPED = syscall.WSTOPPED // If set, status of stopped subprocesses is also reported.
WUNTRACED = WSTOPPED
WRUSAGE = 1 << 20 // Record resource usage.
WNOHANG = syscall.WNOHANG // Don't wait if no process has exited.
WSTOPPED = syscall.WSTOPPED // If set, status of stopped subprocesses is also reported.
WUNTRACED = syscall.WUNTRACED // Usually an alias for WSTOPPED.
WRUSAGE = 1 << 20 // Record resource usage.
)
// WRUSAGE must not be too high a bit, to avoid clashing with Linux's

View File

@ -35,9 +35,10 @@ includes_Linux='
'
includes_Darwin='
#define __DARWIN_UNIX03 0
#define _DARWIN_C_SOURCE
#define KERNEL
#define _DARWIN_USE_64_BIT_INODE
#include <sys/cdefs.h>
#include <sys/wait.h>
#include <sys/event.h>
'

View File

@ -216,6 +216,22 @@ const (
F_VOLPOSMODE = 0x4
F_WRITEBOOTSTRAP = 0x2f
F_WRLCK = 0x3
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 0x18
IN_CLASSB_HOST = 0xffff
IN_CLASSB_MAX = 0x10000
IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 0x10
IN_CLASSC_HOST = 0xff
IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 0x8
IN_CLASSD_HOST = 0xfffffff
IN_CLASSD_NET = 0xf0000000
IN_CLASSD_NSHIFT = 0x1c
IN_LINKLOCALNETNUM = 0xa9fe0000
IN_LOOPBACKNET = 0x7f
IPPROTO_3PC = 0x22
IPPROTO_ADFS = 0x44
IPPROTO_AH = 0x33
@ -423,6 +439,22 @@ const (
IP_TOS = 0x3
IP_TRAFFIC_MGT_BACKGROUND = 0x41
IP_TTL = 0x4
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x80
MSG_EOF = 0x100
MSG_EOR = 0x8
MSG_FLUSH = 0x400
MSG_HAVEMORE = 0x2000
MSG_HOLD = 0x800
MSG_NEEDSA = 0x10000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_RCVMORE = 0x4000
MSG_SEND = 0x1000
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITSTREAM = 0x200
O_ACCMODE = 0x3
O_ALERT = 0x20000000
O_APPEND = 0x8
@ -446,6 +478,9 @@ const (
O_SYNC = 0x80
O_TRUNC = 0x400
O_WRONLY = 0x1
SCM_CREDS = 0x3
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x2
SHUT_RD = 0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -577,7 +612,7 @@ const (
WNOHANG = 0x1
WNOWAIT = 0x20
WORDSIZE = 0x20
WSTOPPED = 0x7f
WSTOPPED = 0x8
WUNTRACED = 0x2
)

View File

@ -216,6 +216,22 @@ const (
F_VOLPOSMODE = 0x4
F_WRITEBOOTSTRAP = 0x2f
F_WRLCK = 0x3
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 0x18
IN_CLASSB_HOST = 0xffff
IN_CLASSB_MAX = 0x10000
IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 0x10
IN_CLASSC_HOST = 0xff
IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 0x8
IN_CLASSD_HOST = 0xfffffff
IN_CLASSD_NET = 0xf0000000
IN_CLASSD_NSHIFT = 0x1c
IN_LINKLOCALNETNUM = 0xa9fe0000
IN_LOOPBACKNET = 0x7f
IPPROTO_3PC = 0x22
IPPROTO_ADFS = 0x44
IPPROTO_AH = 0x33
@ -423,6 +439,22 @@ const (
IP_TOS = 0x3
IP_TRAFFIC_MGT_BACKGROUND = 0x41
IP_TTL = 0x4
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x80
MSG_EOF = 0x100
MSG_EOR = 0x8
MSG_FLUSH = 0x400
MSG_HAVEMORE = 0x2000
MSG_HOLD = 0x800
MSG_NEEDSA = 0x10000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_RCVMORE = 0x4000
MSG_SEND = 0x1000
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITSTREAM = 0x200
O_ACCMODE = 0x3
O_ALERT = 0x20000000
O_APPEND = 0x8
@ -446,6 +478,9 @@ const (
O_SYNC = 0x80
O_TRUNC = 0x400
O_WRONLY = 0x1
SCM_CREDS = 0x3
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x2
SHUT_RD = 0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -577,7 +612,7 @@ const (
WNOHANG = 0x1
WNOWAIT = 0x20
WORDSIZE = 0x40
WSTOPPED = 0x7f
WSTOPPED = 0x8
WUNTRACED = 0x2
)