]> Cypherpunks repositories - gostls13.git/commitdiff
close TODO
authorRuss Cox <rsc@golang.org>
Fri, 15 May 2009 22:51:41 +0000 (15:51 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 15 May 2009 22:51:41 +0000 (15:51 -0700)
R=r
DELTA=42  (0 added, 26 deleted, 16 changed)
OCL=28940
CL=28942

src/lib/syscall/types_amd64_darwin.go
src/lib/syscall/types_amd64_linux.go

index 36ced7ab6177ac3302e2e5b410381137b94435c4..69a9a85f0de0762c6ab2b9bd8d21c241d51c61b9 100644 (file)
@@ -258,11 +258,6 @@ const (
 
 type WaitStatus uint32;
 
-// TODO(rsc): should be method on WaitStatus,
-// not *WaitStatus, but causes problems when
-// embedding in a *Waitmsg in package os.
-// Need to find the 6g bug.
-
 // Wait status is 7 bits at bottom, either 0 (exited),
 // 0x7F (stopped), or a signal number that caused an exit.
 // The 0x80 bit is whether there was a core dump.
@@ -278,26 +273,22 @@ const (
        stopped = 0x7F;
 )
 
-func (wp *WaitStatus) Exited() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Exited() bool {
        return w&mask == exited;
 }
 
-func (wp *WaitStatus) ExitStatus() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) ExitStatus() int {
        if w&mask != exited {
                return -1;
        }
        return int(w >> shift);
 }
 
-func (wp *WaitStatus) Signaled() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Signaled() bool {
        return w&mask != stopped && w&mask != 0;
 }
 
-func (wp *WaitStatus) Signal() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Signal() int {
        sig := int(w & mask);
        if sig == stopped || sig == 0 {
                return -1;
@@ -305,23 +296,19 @@ func (wp *WaitStatus) Signal() int {
        return sig;
 }
 
-func (wp *WaitStatus) CoreDump() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) CoreDump() bool {
        return w.Signaled() && w&core != 0;
 }
 
-func (wp *WaitStatus) Stopped() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Stopped() bool {
        return w&mask == stopped && w>>shift != SIGSTOP;
 }
 
-func (wp *WaitStatus) Continued() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Continued() bool {
        return w&mask == stopped && w>>shift == SIGSTOP;
 }
 
-func (wp *WaitStatus) StopSignal() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) StopSignal() int {
        if !w.Stopped() {
                return -1;
        }
index 58ffec00f8acd4eab230834df36078261d6242e7..b15f0cbcc03c1a10d41ce26f14524194c140cb0a 100644 (file)
@@ -242,11 +242,6 @@ const (
 
 type WaitStatus uint32;
 
-// TODO(rsc): should be method on WaitStatus,
-// not *WaitStatus, but causes problems when
-// embedding in a *Waitmsg in package os.
-// Need to find the 6g bug.
-
 // Wait status is 7 bits at bottom, either 0 (exited),
 // 0x7F (stopped), or a signal number that caused an exit.
 // The 0x80 bit is whether there was a core dump.
@@ -269,49 +264,41 @@ const (
        __unused = SIGSTOP;
 )
 
-func (wp *WaitStatus) Exited() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Exited() bool {
        return w&mask == exited;
 }
 
-func (wp *WaitStatus) Signaled() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Signaled() bool {
        return w&mask != stopped && w&mask != exited;
 }
 
-func (wp *WaitStatus) Stopped() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Stopped() bool {
        return w&0xFF == stopped;
 }
 
-func (wp *WaitStatus) Continued() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Continued() bool {
        return w == 0xFFFF;
 }
 
-func (wp *WaitStatus) CoreDump() bool {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) CoreDump() bool {
        return w.Signaled() && w&core != 0;
 }
 
-func (wp *WaitStatus) ExitStatus() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) ExitStatus() int {
        if !w.Exited() {
                return -1;
        }
        return int(w >> shift) & 0xFF;
 }
 
-func (wp *WaitStatus) Signal() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) Signal() int {
        if !w.Signaled() {
                return -1;
        }
        return int(w & mask);
 }
 
-func (wp *WaitStatus) StopSignal() int {
-       w := *wp;  // TODO(rsc): no pointer
+func (w WaitStatus) StopSignal() int {
        if !w.Stopped() {
                return -1;
        }