aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-01-18 14:02:41 -0500
committerRuss Cox <rsc@golang.org>2011-01-18 14:02:41 -0500
commitacd858eee024469103bce2b9a669e2e96ccbf189 (patch)
treec687dc004a336f6c92e67077db92d3a5d60ac494
parent166b444a9320a6c99f3b6f1f5d2c353c02c5182f (diff)
downloadgo-acd858eee024469103bce2b9a669e2e96ccbf189.tar.gz
go-acd858eee024469103bce2b9a669e2e96ccbf189.zip
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
-rw-r--r--src/pkg/os/exec.go8
-rwxr-xr-xsrc/pkg/syscall/mkerrors.sh3
-rw-r--r--src/pkg/syscall/zerrors_darwin_386.go37
-rw-r--r--src/pkg/syscall/zerrors_darwin_amd64.go37
4 files changed, 78 insertions, 7 deletions
diff --git a/src/pkg/os/exec.go b/src/pkg/os/exec.go
index 501ebc270f..100d984d17 100644
--- a/src/pkg/os/exec.go
+++ b/src/pkg/os/exec.go
@@ -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
diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh
index 3605b57b2c..9ddd4bc252 100755
--- a/src/pkg/syscall/mkerrors.sh
+++ b/src/pkg/syscall/mkerrors.sh
@@ -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>
'
diff --git a/src/pkg/syscall/zerrors_darwin_386.go b/src/pkg/syscall/zerrors_darwin_386.go
index 16a24924d2..b12c661f86 100644
--- a/src/pkg/syscall/zerrors_darwin_386.go
+++ b/src/pkg/syscall/zerrors_darwin_386.go
@@ -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
)
diff --git a/src/pkg/syscall/zerrors_darwin_amd64.go b/src/pkg/syscall/zerrors_darwin_amd64.go
index 869c002d78..3215694eb3 100644
--- a/src/pkg/syscall/zerrors_darwin_amd64.go
+++ b/src/pkg/syscall/zerrors_darwin_amd64.go
@@ -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
)