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

Side by Side Diff: src/pkg/debug/proc/proc_linux.go

Issue 163085: code review 163085: move ReadFile, WriteFile, and ReadDir into a separate i... (Closed)
Patch Set: code review 163085: move ReadFile, WriteFile, and ReadDir into a separate i... Created 15 years, 4 months 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/compress/zlib/writer_test.go ('k') | src/pkg/ebnf/ebnf_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package proc 5 package proc
6 6
7 // TODO(rsc): Imports here after to be in proc.go too in order 7 // TODO(rsc): Imports here after to be in proc.go too in order
8 // for deps.bash to get the right answer. 8 // for deps.bash to get the right answer.
9 import ( 9 import (
10 "container/vector"; 10 "container/vector";
11 "fmt"; 11 "fmt";
12 » "io"; 12 » "io/ioutil";
13 "os"; 13 "os";
14 "runtime"; 14 "runtime";
15 "strconv"; 15 "strconv";
16 "strings"; 16 "strings";
17 "sync"; 17 "sync";
18 "syscall"; 18 "syscall";
19 ) 19 )
20 20
21 // This is an implementation of the process tracing interface using 21 // This is an implementation of the process tracing interface using
22 // Linux's ptrace(2) interface. The implementation is multi-threaded. 22 // Linux's ptrace(2) interface. The implementation is multi-threaded.
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 return err 1208 return err
1209 } 1209 }
1210 if _, ok := p.threads[tid]; ok { 1210 if _, ok := p.threads[tid]; ok {
1211 continue 1211 continue
1212 } 1212 }
1213 1213
1214 _, err = p.attachThread(tid); 1214 _, err = p.attachThread(tid);
1215 if err != nil { 1215 if err != nil {
1216 // There could have been a race, or 1216 // There could have been a race, or
1217 // this process could be a zobmie. 1217 // this process could be a zobmie.
1218 » » » » statFile, err2 := io.ReadFile(taskPath + "/" + t idStr + "/stat"); 1218 » » » » statFile, err2 := ioutil.ReadFile(taskPath + "/" + tidStr + "/stat");
1219 if err2 != nil { 1219 if err2 != nil {
1220 switch err2 := err2.(type) { 1220 switch err2 := err2.(type) {
1221 case *os.PathError: 1221 case *os.PathError:
1222 if err2.Error == os.ENOENT { 1222 if err2.Error == os.ENOENT {
1223 // Raced with thread exi t 1223 // Raced with thread exi t
1224 p.logTrace("raced with t hread %d exit", tid); 1224 p.logTrace("raced with t hread %d exit", tid);
1225 continue; 1225 continue;
1226 } 1226 }
1227 } 1227 }
1228 // Return the original error 1228 // Return the original error
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 _, err := p.newThread(pid, syscall.SIGTRAP, false); 1308 _, err := p.newThread(pid, syscall.SIGTRAP, false);
1309 return err; 1309 return err;
1310 }); 1310 });
1311 if err != nil { 1311 if err != nil {
1312 p.stopMonitor(err); 1312 p.stopMonitor(err);
1313 return nil, err; 1313 return nil, err;
1314 } 1314 }
1315 1315
1316 return p, nil; 1316 return p, nil;
1317 } 1317 }
OLDNEW
« no previous file with comments | « src/pkg/compress/zlib/writer_test.go ('k') | src/pkg/ebnf/ebnf_test.go » ('j') | no next file with comments »

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