Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Delta Between Two Patch Sets: src/pkg/os/exec_posix.go

Issue 5688046: code review 5688046: os: drop the Wait function and the options to Process.Wait (Closed)
Left Patch Set: diff -r c76997f376a5 https://code.google.com/p/go Created 13 years ago
Right Patch Set: diff -r 8ce97b044cfa https://code.google.com/p/go Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/os/exec_plan9.go ('k') | src/pkg/os/exec_unix.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin freebsd linux netbsd openbsd windows 5 // +build darwin freebsd linux netbsd openbsd windows
6 6
7 package os 7 package os
8 8
9 import ( 9 import (
10 "syscall" 10 "syscall"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // since syscall one might have different field types across 49 // since syscall one might have different field types across
50 // different OS. 50 // different OS.
51 51
52 // Waitmsg stores the information about an exited process as reported by Wait. 52 // Waitmsg stores the information about an exited process as reported by Wait.
53 type Waitmsg struct { 53 type Waitmsg struct {
54 Pid int // The process's id. 54 Pid int // The process's id.
55 syscall.WaitStatus // System-dependent status info. 55 syscall.WaitStatus // System-dependent status info.
56 Rusage *syscall.Rusage // System-dependent resource usage in fo. 56 Rusage *syscall.Rusage // System-dependent resource usage in fo.
57 } 57 }
58 58
59 // Wait waits for process pid to exit or stop, and then returns a
60 // Waitmsg describing its status and an error, if any.
61 // Wait is equivalent to calling FindProcess and then Wait
62 // and Release on the result.
63 func Wait(pid int) (w *Waitmsg, err error) {
64 p, e := FindProcess(pid)
65 if e != nil {
66 return nil, e
67 }
68 defer p.Release()
69 return p.Wait()
70 }
71
72 // Convert i to decimal string. 59 // Convert i to decimal string.
73 func itod(i int) string { 60 func itod(i int) string {
74 if i == 0 { 61 if i == 0 {
75 return "0" 62 return "0"
76 } 63 }
77 64
78 u := uint64(i) 65 u := uint64(i)
79 if i < 0 { 66 if i < 0 {
80 u = -u 67 u = -u
81 } 68 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 res += " (trap " + itod(w.TrapCause()) + ")" 100 res += " (trap " + itod(w.TrapCause()) + ")"
114 } 101 }
115 case w.Continued(): 102 case w.Continued():
116 res = "continued" 103 res = "continued"
117 } 104 }
118 if w.CoreDump() { 105 if w.CoreDump() {
119 res += " (core dumped)" 106 res += " (core dumped)"
120 } 107 }
121 return res 108 return res
122 } 109 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b